Doing a Docker installation is a great method for setting up the repository on any operating system that isn't Ubuntu 22.04. It is a faster and more lightweight alternative to a traditional Virtual Machine. In addition, you can still run GUI applications like Gazebo using the NoVNC desktop environment.
- If you are on Linux, add yourself to the
docker
group. Being a member of thedocker
group allows you to rundocker
withoutsudo
.
sudo groupadd docker
sudo usermod -aG docker $USER
After you complete the installation, restart your computer!
To check that everything installed OK, you should be able to open the command line and type:
docker
You do not have to use VS Code. However, VS Code has very nice extensions for using Docker containers.
Search for and install the following extensions in VS Code
- Docker
- ROS
- C/C++
- CMake
Install Git using the instructions here
You can either pull the image from Dockerhub or build the image manually using a Dockerfile. Pulling from Dockerhub is faster, easier, and less error-prone. However, if you want to edit the Dockerfile for some reason, do the manual build instructions.
docker pull robojackets/urc-gui-baseimage
The docker container is essentially a self-contained instance of Ubuntu 22.04, but can access some files on your system in a limited way. We use this so the container can see the repositories you clone locally, that way both local development and containerized testing can be done without any delays.
You can place this directory wherever you want, I recommend /home
for Mac/Linux and C:\Users\[Username]\
for Windows
mkdir urc_container
Our installation script will
- Clone all necessary repos
- Automatically setup your desktop NoVNC environment
If on Windows, you will need to use Git Bash to run the following commands!
Run this command only if you are on Mac/Linux
chmod +x setup.sh
./setup.sh
For beginners to Docker:
- Go to
localhost:6060
in your web browser of choice
Recommended way:
- Open up VS Code
- Click on the whale Docker icon on your left
- Right click the currently running container (Should be called tiryoh/ros2)
- Select open in browser
Open terminator in the desktop (this is the recommended terminal for commands in your container)
In terminator, run
cd urc_container
First, it's always a good idea to check for updates. Nothing will happen if you just created the image. However, if you decide to re-create the container a while after you made the initial image, you will need to update those packages.
sudo apt update
sudo apt upgrade
cd /rover_ws
rosdep update && rosdep install --from-paths src --ignore-src -r -y
Now, it's time for the moment of truth!
colcon build
- Work on your code in
urc_container
locally to avoid input lag - When ready to test, you can build and run your code in the container just like on native Ubuntu!
Once you are done with the conatiner, be sure to close the Docker container. Otherwise, the Docker container will take up a big chunk of memory on your computer.