Space ROS Demos Quickstart

If you're competing in the NASA Space ROS Sim Summer Sprint Challenge, this guide is here to help you quickly set up and run Space ROS demos, like the Curiosity Mars Rover and Canadarm, using Docker on Ubuntu 22.04. We've carefully compiled a comprehensive, easy-to-follow set of instructions to address gaps in the official documentation, ensuring that no one is left out of the competition—something that many participants mentioned as a concern during the webinar.
Prerequisites
- Ubuntu 22.04: Ensure you are running Ubuntu 22.04.
- Docker: Install Docker and grant Docker sudo permissions.
- Earthly: Install Earthly for building Docker images.
- ROS 2 Humble and Gazebo Fortress: Install the correct binaries with apt.
- Space ROS and Demo Repositories: Clone and build the Space ROS and demo repositories.
Page Index
- Step 1: Install Docker
- Step 2: Install Earthly
- Step 3: Install ROS 2 Humble and Gazebo
- Step 4: Clone and Build Space ROS
- Step 5: Clone and Build Demo Docker Images
- Step 6: Run the Demo Docker
- Step 7: Running the Demos
Step-by-Step Instructions
Step 1: Install Docker
First, install Docker:
Follow the instructions in this link Docker Installation Guide
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Grant Docker sudo permissions:
sudo usermod -aG docker $USER
Log out and log back in to apply the new group membership.
Step 2: Install Earthly
Follow the steps here: Earthly Installation Guide
or
Install Earthly for building Docker images:
sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'
Step 3: Install ROS 2 Humble and Gazebo
Follow the steps here: ROS 2 Humble Installation Guide
or TLDR:
Add the ROS 2 repository and install the required packages:
sudo apt update && sudo apt install -y locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
sudo apt install -y software-properties-common
sudo add-apt-repository universe
sudo apt update && sudo apt install -y curl gnupg2 lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt upgrade
sudo apt install -y ros-humble-desktop
sudo apt install -y ros-humble-gazebo-ros-pkgs
Step 4: Clone and Build Space ROS
Follow the steps here: Space ROS Main Repository
or TLDR:
Clone and build the Space ROS image:
git clone https://github.com/space-ros/space-ros.git
cd space-ros
git checkout -b humble-2024.07.0
earthly build +repos-file
Step 5: Clone and Build Demo Docker Images
You can find this information at Space ROS Docker Repository
Clone the space-ros/docker repository to build the space_robots and moveit2 images:
git clone https://github.com/space-ros/docker.git
cd docker
cd moveit2
./build.sh
cd ..
cd space_robots
./build.sh
This will take a while to build—probably around 1 hour—so grab a coffee, sit back, and relax. You might take this time to read about NASA's Moon to Mars initiatives and Artemis missions to get ideas for new features or demos.
- NASA Moon to Mars Architecture Definition Document: Read the document
- NASA Artemis Missions: Learn more about Artemis
Step 6: Run the Demo Docker
Allow GUI passthrough for Docker:
xhost +local:docker
Run the Docker container:
./run.sh
If you encounter issues with GPU support, you might need to remove the --gpus all flag from run.sh.
Step 7: Running the Demos
Curiosity Mars Rover Demo
Launch the demo:
ros2 launch mars_rover mars_rover.launch.py
To view the camera feed, click the refresh button on the top left corner.
Perform Tasks
Setup
Open a new terminal and attach to the currently running container:
docker exec -it <container-name> bash
Make sure packages are sourced:
source ~/spaceros/install/setup.bash
source ~/demos_ws/install/setup.bash
Available Commands
Drive the rover forward
ros2 service call /move_forward std_srvs/srv/Empty
Stop the rover
ros2 service call /move_stop std_srvs/srv/Empty
Turn left
ros2 service call /turn_left std_srvs/srv/Empty
Turn right
ros2 service call /turn_right std_srvs/srv/Empty
Open the tool arm:
ros2 service call /open_arm std_srvs/srv/Empty
Close the tool arm:
ros2 service call /close_arm std_srvs/srv/Empty
Open the mast (camera arm)
ros2 service call /mast_open std_srvs/srv/Empty
Close the mast (camera arm)
ros2 service call /mast_close std_srvs/srv/Empty
Canadarm demo
ros2 launch canadarm canadarm.launch.py
Available Commands
Open the arm
ros2 service call /open_arm std_srvs/srv/Empty
Close the arm
ros2 service call /close_arm std_srvs/srv/Empty
Moves the arm ramdonly
ros2 service call /random_arm std_srvs/srv/Empty
Credits
- Space ROS Main Repository: README.md
- Space ROS Docker Repository: space_robots/README.md
- Image Source: Freelancer Contest - NASA Space ROS Sim Summer Sprint Challenge
- Docker Documentation: Docker Docs
- Earthly Documentation: Earthly Docs
- ROS 2 Documentation: ROS 2 Docs