diff --git a/ros-tutorials/brew-ros-configuration.sh b/ros-tutorials/brew-ros-configuration.sh new file mode 100644 index 0000000..40d5a21 --- /dev/null +++ b/ros-tutorials/brew-ros-configuration.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Set to exit if error occurs +set -e + +echo "Beginning Duke Robotics Software Install..." + +# if homebrew is not installed, install homebrew +if ! command -v brew &> /dev/null; then + echo "Homebrew is not installed, installing homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +fi + +brew install docker +brew install docker-compose +brew install git +brew install --cask github +brew install --cask slack +brew install python@3.11 +brew install --cask xquartz + +# if user wants to install vscode, install vscode +read -p "Do you want to install vscode? (y/n): " install_vscode +if [ "$install_vscode" = "y" ]; then + brew install --cask visual-studio-code +fi diff --git a/ros-tutorials/lesson-0-introduction.md b/ros-tutorials/lesson-0-introduction.md index 4844cc3..37c486d 100644 --- a/ros-tutorials/lesson-0-introduction.md +++ b/ros-tutorials/lesson-0-introduction.md @@ -4,42 +4,60 @@ This introduction will set up your system for the rest of the tutorials. It will ## System Requirements -The primary requirement for installing these programs is computer disc space. Ensure before proceeding that you have sufficient space on your computer hard drive. We reccomend **at least 32 Gb**. +The primary requirement for installing these programs is computer disc space. Ensure before proceeding that you have sufficient space on your computer hard drive. We reccomend **at least 25 Gb**. The install script will require you to free this much disk space. Some of our software, such as Docker or simulation software, may run slowly on a lower power machine (or an Apple Silicon chip). Please reach out to a leadership member if you are having techincal difficulties of any kind (or email [Drew Council](apc41@duke.edu)). -## For Windows 10 and 11 +## Install + +### For Windows 10 and 11 To simplify the installation steps for Windows 10 and 11 users, we have created an installation script that automates the installation of several applications. -- Before running this script, **install `winget` on your computer**. Open Windows Store and search for *"App Installer"*. Install the first result. `winget` is a package manager made by Microsoft to manage applications for Windows. -- Once `winget` is installed, right-click on **[this link]**(https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/winget-ros-configuration.ps1) and select *"Save link as"*. Save the file somewhere with the default name and extension. Open the file location in File Explorer, right-click on the file and select *"Run with Powershell"*. - - You may be prompted to ask if you trust this file to run. Please permit the file to execute. If you are unsure, you may look at the source code yourself and see what it does! You have succeeded when a blue terminal window displays a loading bar. -- Now allow the script to execute! **Be sure to watch your computer, as you may be prompted to accept license agreements or give administrator access.** The script will install the following programs: - - Docker Desktop - - Git - - GitHub Desktop - - Windows Terminal - - Slack - - Python3 -- Once it has installed these programs, you will be prompted asking if you would like to install VS Code, our recommended code editor. If you prefer another editor or already have VS Code installed, you should reject here. -- Once the script has completed, you may delete the script file. To update your programs in the future, simply run -```powershell -winget upgrade --all + +Open the Start Menu and search for Powershell. Right click on Powershell and select *Run as Administrator*. + +Run the following command: +```ps1 +Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/winget-ros-configuration.ps1')) ``` -## Command Line +> If your antivirus is giving you trouble with the above, right-click on **[this link](https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/winget-ros-configuration.ps1)** and select *"Save link as"*. Save the file somewhere with the default name and extension. Open the file location in File Explorer, right-click on the file and select *"Run with Powershell"*. +You may be prompted to ask if you trust this file to run. Please permit the file to execute. If you are unsure, you may look at the source code yourself and see what it does! + +Now allow the script to execute! **Be sure to watch your computer, as you may be prompted to accept license agreements or give administrator access. When prompted, please select "Y" and allow the installations to proceed** The script will install the following programs: +- Docker Desktop +- Git +- GitHub Desktop +- Slack +- Python3 +- MobaXTerm + +Once it has installed these programs, you will be prompted asking if you would like to install VS Code, our recommended code editor. If you prefer another editor or already have VS Code installed, you should reject here. +> To update your programs in the future, simply run `winget upgrade --all` + +### For MacOS + +Open terminal and run the following command: +```sh +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/DukeRobotics/documentation/master/ros-tutorials/brew-ros-configuration.sh)" +``` -Before continuing, if you have never used the Unix command line (or Terminal in Mac or Command Prompt in Windows), complete [this short tutorial](https://www.vikingcodeschool.com/web-development-basics/a-command-line-crash-course). +Now allow the script to execute! **Be sure to watch your computer, as you may be prompted to accept license agreements or give superuser permissions. When prompted, please select "Y" and allow the installations to proceed** The script will install the following programs: +- Docker Desktop +- Git +- GitHub Desktop +- Slack +- Python3.11 +- XQuartz + +Once it has installed these programs, you will be prompted asking if you would like to install VS Code, our recommended code editor. If you prefer another editor or already have VS Code installed, you should reject here. +> To update your programs in the future, simply run `brew update && brew upgrade && brew upgrade --cask && brew cleanup` ## Starter Code and Git To share and manage versions of our source code, we use [Git](https://git-scm.com/). When you have a folder of code files for your project, Git calls it a repository. We're going to use Git now to get some starter code for these tutorials. -### For those not using `winget` script -Install Git [from their website](https://git-scm.com/) now if you have not already. - -Open up Terminal in Mac or Command Prompt in Windows. Type `git --version` and press Enter. If the command is not found, close the window and install Git from [here](https://git-scm.com/downloads). Then re-open Terminal or Command Prompt. -Now, run the following command: +Run the following command in a location you would like to use for these tutorials: ```bash git clone https://github.com/DukeRobotics/documentation.git @@ -49,15 +67,9 @@ This clones, or makes a copy of, our documentation repository (the one you're re ## Docker Setup -To run ROS, we will be using Docker. This is a software that allows you to run programs inside an isolated environment called a container. So, you only need to download Docker Desktop and then run our image. Our image includes all of the little pieces of software we need, rather than installing them individually. If you're curious, learn more [here](https://www.docker.com/resources/what-container) or [here](https://docs.docker.com/get-started/) or ask a software team member. - -Download and install the appropriate Docker client: +To run ROS, we will be using Docker. This is a software that allows you to run programs inside an isolated environment called a container. So, you only need to open Docker Desktop and then run our image. Our image includes all of the little pieces of software we need, rather than installing them individually. If you're curious, learn more [here](https://www.docker.com/resources/what-container) or [here](https://docs.docker.com/get-started/) or ask a software team member. -* [Windows (10 and 11)](#for-windows-10-and-11) see above -* [Windows (Other, no `winget`)](https://docs.docker.com/desktop/install/windows-install/) -* [Mac](https://docs.docker.com/desktop/install/mac-install/) - -Once Docker Desktop is installed, run it like you would any other app on your computer. +Search for the program Docker Desktop and run it. ## Run Docker @@ -70,16 +82,18 @@ cd documentation/ros-tutorials Then run this (it may take a few minutes to download the image and run the container): ```bash -docker compose up -d +docker-compose up -d ``` ## Connect to Docker via SSH Now that the container is up and running, let's get into that isolated environment so that we can use it. We'll do that by connecting to the command line that is _inside_ of that container using Secure Shell (SSH). -Install and run one of the following: -* [Mac: XQuartz](https://www.xquartz.org/) -* [Windows: MobaXterm](https://mobaxterm.mobatek.net/)
+- If on MacOS, Run the program called **XQuartz** + - As long as this program is running in the background, you can just use the normal MacOS terminal to run your commands. +- If on Windows, Run the program called **MobaXTerm** + - Be sure to run all commands in this terminal and *not* anywhere else. + :warning: Open MobaXterm > click on Settings > go the X11 tab > uncheck RANDR. This will help with some graphics display later. After opening that program, SSH into the container by running: @@ -87,12 +101,17 @@ After opening that program, SSH into the container by running: ssh -XY -p 2201 root@localhost ``` -The password is `robotics`. +> The password is `robotics`. Now you're inside the container, isolated from the rest of your computer. This environment has ROS installed for you. :information_source: **Whenever you're running ROS, you should be in this environment.** + +## Command Line + +Before continuing, if you have never used the Unix/Bash command line (Terminal in MacOS or Linux), [this page](https://cs.colby.edu/maxwell/courses/tutorials/terminal/) provides a good reference. + *** Excellent! Now proceed to [Lesson 1 - Basics](lesson-1-basics.md). diff --git a/ros-tutorials/lesson-4-smach.md b/ros-tutorials/lesson-4-smach.md deleted file mode 100644 index 44e1454..0000000 --- a/ros-tutorials/lesson-4-smach.md +++ /dev/null @@ -1,19 +0,0 @@ -# Lesson 4 - SMACH - -## Summary -The Task Planning portion of our codebase uses a package called SMACH to organize and coordinate our tasks. SMACH allows us to create state machines and represent different actions as states. - -In this lesson, you will use SMACH to control a turtle. - -## Vocab -- **State Machine**: A concept consisting of states and transitions connecting those states. Depending on the outcome of each state, a different transition will taken, switching the state machine to the next state. - -## Goals -1. Use SMACH to have the turtle move in some direction. Then, based on a random choice, the turtle should turn either left or right and move in that direction. - - Your state machine should contain at least 3 different states. - -## Resources -- [SMACH: Getting Started](http://wiki.ros.org/smach/Tutorials/Getting%20Started) - -## Notes -- This lesson will be easiest if you adapt the code from the previous lession, rather than starting from scratch. It is recommended that you make a copy of your move_square.py file and work in that. diff --git a/ros-tutorials/winget-ros-configuration.ps1 b/ros-tutorials/winget-ros-configuration.ps1 index 7d7828a..9bfe48c 100644 --- a/ros-tutorials/winget-ros-configuration.ps1 +++ b/ros-tutorials/winget-ros-configuration.ps1 @@ -2,13 +2,44 @@ # - Docker Desktop # - Git # - GitHub Desktop -# - Windows Terminal # - Slack # - Python3 # The script also gives the option to install VS Code. -# winget MUST BE INSTALLED BEFORE RUNNING THIS SCRIPT -winget install -e --id Docker.DockerDesktop;winget install -e --id Git.Git;winget install -e --id GitHub.GitHubDesktop;winget install -e --id Microsoft.WindowsTerminal;winget install -e --id SlackTechnologies.Slack;winget install -e --id Python.Python.3 +# Set to exit if error occurs +$ErrorActionPreference = "Stop" + +Write-Host "Beginning Duke Robotics Software Install..." -ForegroundColor Yellow + +# install winget if not already installed +if (-not(Get-Command winget -ErrorAction SilentlyContinue)){ + # print message + Write-Host "WinGet is not installed. Installing WinGet..." -ForegroundColor Yellow + # $progressPreference = 'silentlyContinue' + # Write-Information "Downloading WinGet and its dependencies..." + # Invoke-WebRequest -Uri https://aka.ms/getwinget -OutFile Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle + # Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx + # Invoke-WebRequest -Uri https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx -OutFile Microsoft.UI.Xaml.2.7.x64.appx + # Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx + # Add-AppxPackage Microsoft.UI.Xaml.2.7.x64.appx + # Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle + Install-Script winget-install -Force +} + +$Disk = Get-WmiObject -Class Win32_LogicalDisk +$Freespace = $Disk.FreeSpace/1GB +# if freespace is less than 25GB, exit the script with an error message +if ($Freespace -lt 25){ + Write-Host "Not enough disk space to install all packages. Please free up some space and try again." -ForegroundColor Red + exit +} + +winget install -e --id Docker.DockerDesktop +winget install -e --id Git.Git +winget install -e --id GitHub.GitHubDesktop +winget install -e --id SlackTechnologies.Slack +winget install -e --id Python.Python.3 +winget install -e --id=Mobatek.MobaXterm # Ask user if they want to install the optional packages $response = Read-Host -Prompt "Do you want to install VS Code? (y/N)" # If $respose is y, install the optional packages