From cd4c58879e6e6b9624f49fb3e09a69a67d73dba8 Mon Sep 17 00:00:00 2001 From: Brokemia <37253216+Brokemia@users.noreply.github.com> Date: Sat, 9 Sep 2023 13:51:31 -0400 Subject: [PATCH 1/8] New brew install script and better winget script --- ros-tutorials/brew-ros-configuration.sh | 21 +++++++++++++++ ros-tutorials/winget-ros-configuration.ps1 | 30 ++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 ros-tutorials/brew-ros-configuration.sh diff --git a/ros-tutorials/brew-ros-configuration.sh b/ros-tutorials/brew-ros-configuration.sh new file mode 100644 index 0000000..cd07a64 --- /dev/null +++ b/ros-tutorials/brew-ros-configuration.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# if available disk space less than 25GB, exit and print error message +if [ $(df -H | grep -m1 -o '[0-9]\+G' | tr -d G) -lt 25 ]; then + echo "Error: Available disk space less than 25GB" + exit 1 +fi + +# 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 git +brew install --cask github +brew install --cask slack +brew install python@3.11 +brew install --cask xquartz + diff --git a/ros-tutorials/winget-ros-configuration.ps1 b/ros-tutorials/winget-ros-configuration.ps1 index 7d7828a..2fd623e 100644 --- a/ros-tutorials/winget-ros-configuration.ps1 +++ b/ros-tutorials/winget-ros-configuration.ps1 @@ -6,9 +6,35 @@ # - 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 +# install winget if not already installed +if (-not(Get-Command winget -ErrorAction SilentlyContinue)){ + # $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 Microsoft.WindowsTerminal +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 From 45b8cf9bbf4507a3cadb0484407b92826d48bb5a Mon Sep 17 00:00:00 2001 From: Brokemia <37253216+Brokemia@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:22:46 -0400 Subject: [PATCH 2/8] feature parity scripts and updated lesson 0 --- ros-tutorials/brew-ros-configuration.sh | 5 ++ ros-tutorials/lesson-0-introduction.md | 89 +++++++++++++--------- ros-tutorials/winget-ros-configuration.ps1 | 2 - 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/ros-tutorials/brew-ros-configuration.sh b/ros-tutorials/brew-ros-configuration.sh index cd07a64..429eb0e 100644 --- a/ros-tutorials/brew-ros-configuration.sh +++ b/ros-tutorials/brew-ros-configuration.sh @@ -19,3 +19,8 @@ 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..3b29ad8 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 @@ -77,9 +89,11 @@ docker compose up -d 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), complete [this short tutorial](https://www.vikingcodeschool.com/web-development-basics/a-command-line-crash-course). + *** Excellent! Now proceed to [Lesson 1 - Basics](lesson-1-basics.md). diff --git a/ros-tutorials/winget-ros-configuration.ps1 b/ros-tutorials/winget-ros-configuration.ps1 index 2fd623e..fd54d4d 100644 --- a/ros-tutorials/winget-ros-configuration.ps1 +++ b/ros-tutorials/winget-ros-configuration.ps1 @@ -2,7 +2,6 @@ # - Docker Desktop # - Git # - GitHub Desktop -# - Windows Terminal # - Slack # - Python3 # The script also gives the option to install VS Code. @@ -31,7 +30,6 @@ if ($Freespace -lt 25){ 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 winget install -e --id=Mobatek.MobaXterm From 5b30284a574ae9b7e392c714e353f2911342def2 Mon Sep 17 00:00:00 2001 From: Vedarsh Shah Date: Wed, 13 Sep 2023 19:56:15 -0400 Subject: [PATCH 3/8] Deleted smach tutorial --- ros-tutorials/lesson-4-smach.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 ros-tutorials/lesson-4-smach.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. From 6bd41aa077c4734e0bf7f14d7b61c87d29ea0a22 Mon Sep 17 00:00:00 2001 From: Vedarsh Shah Date: Wed, 13 Sep 2023 19:56:56 -0400 Subject: [PATCH 4/8] Updated terminal reference with working link --- ros-tutorials/lesson-0-introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ros-tutorials/lesson-0-introduction.md b/ros-tutorials/lesson-0-introduction.md index 3b29ad8..3f4b24a 100644 --- a/ros-tutorials/lesson-0-introduction.md +++ b/ros-tutorials/lesson-0-introduction.md @@ -110,7 +110,7 @@ Now you're inside the container, isolated from the rest of your computer. This e ## Command Line -Before continuing, if you have never used the Unix/Bash command line (Terminal in MacOS or Linux), complete [this short tutorial](https://www.vikingcodeschool.com/web-development-basics/a-command-line-crash-course). +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. *** From 6bf82f2dcc5a8ff2b66a8f8b3f2c91f79a3c1278 Mon Sep 17 00:00:00 2001 From: AndrewCouncil Date: Thu, 14 Sep 2023 17:27:47 -0400 Subject: [PATCH 5/8] nonfunctional disk space check --- ros-tutorials/brew-ros-configuration.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ros-tutorials/brew-ros-configuration.sh b/ros-tutorials/brew-ros-configuration.sh index 429eb0e..89247c6 100644 --- a/ros-tutorials/brew-ros-configuration.sh +++ b/ros-tutorials/brew-ros-configuration.sh @@ -1,11 +1,5 @@ #!/bin/bash -# if available disk space less than 25GB, exit and print error message -if [ $(df -H | grep -m1 -o '[0-9]\+G' | tr -d G) -lt 25 ]; then - echo "Error: Available disk space less than 25GB" - exit 1 -fi - # if homebrew is not installed, install homebrew if ! command -v brew &> /dev/null; then echo "Homebrew is not installed, installing homebrew..." From a2c46865533d1e3c7ac51c528f5f4917b6815823 Mon Sep 17 00:00:00 2001 From: AndrewCouncil Date: Thu, 14 Sep 2023 17:37:51 -0400 Subject: [PATCH 6/8] adding print messages --- ros-tutorials/brew-ros-configuration.sh | 2 ++ ros-tutorials/winget-ros-configuration.ps1 | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ros-tutorials/brew-ros-configuration.sh b/ros-tutorials/brew-ros-configuration.sh index 89247c6..e6614d8 100644 --- a/ros-tutorials/brew-ros-configuration.sh +++ b/ros-tutorials/brew-ros-configuration.sh @@ -1,5 +1,7 @@ #!/bin/bash +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..." diff --git a/ros-tutorials/winget-ros-configuration.ps1 b/ros-tutorials/winget-ros-configuration.ps1 index fd54d4d..6cc26c9 100644 --- a/ros-tutorials/winget-ros-configuration.ps1 +++ b/ros-tutorials/winget-ros-configuration.ps1 @@ -7,7 +7,12 @@ # The script also gives the option to install VS Code. # install winget if not already installed + +Write-Host "Beginning Duke Robotics Software Install..." -ForegroundColor Yellow + 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 From 856e6db457ba7ee57b2684538e47d17a1a9a7550 Mon Sep 17 00:00:00 2001 From: AndrewCouncil Date: Thu, 14 Sep 2023 17:41:53 -0400 Subject: [PATCH 7/8] set scripts to exit on error --- ros-tutorials/brew-ros-configuration.sh | 3 +++ ros-tutorials/winget-ros-configuration.ps1 | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ros-tutorials/brew-ros-configuration.sh b/ros-tutorials/brew-ros-configuration.sh index e6614d8..a908ac7 100644 --- a/ros-tutorials/brew-ros-configuration.sh +++ b/ros-tutorials/brew-ros-configuration.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Set to exit if error occurs +set -e + echo "Beginning Duke Robotics Software Install..." # if homebrew is not installed, install homebrew diff --git a/ros-tutorials/winget-ros-configuration.ps1 b/ros-tutorials/winget-ros-configuration.ps1 index 6cc26c9..9bfe48c 100644 --- a/ros-tutorials/winget-ros-configuration.ps1 +++ b/ros-tutorials/winget-ros-configuration.ps1 @@ -6,10 +6,12 @@ # - Python3 # The script also gives the option to install VS Code. -# install winget if not already installed +# 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 From 2fb244cd8c5ae92e9edd84edc0856166a70744e9 Mon Sep 17 00:00:00 2001 From: AndrewCouncil Date: Thu, 14 Sep 2023 19:01:31 -0400 Subject: [PATCH 8/8] fixing docker compose mac --- ros-tutorials/brew-ros-configuration.sh | 1 + ros-tutorials/lesson-0-introduction.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ros-tutorials/brew-ros-configuration.sh b/ros-tutorials/brew-ros-configuration.sh index a908ac7..40d5a21 100644 --- a/ros-tutorials/brew-ros-configuration.sh +++ b/ros-tutorials/brew-ros-configuration.sh @@ -12,6 +12,7 @@ if ! command -v brew &> /dev/null; then fi brew install docker +brew install docker-compose brew install git brew install --cask github brew install --cask slack diff --git a/ros-tutorials/lesson-0-introduction.md b/ros-tutorials/lesson-0-introduction.md index 3f4b24a..37c486d 100644 --- a/ros-tutorials/lesson-0-introduction.md +++ b/ros-tutorials/lesson-0-introduction.md @@ -82,7 +82,7 @@ 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