Search
To successfully use ROS, you need to be able to perform basic tasks in Linux. Refer e.g. to MRS Cheatsheet to get a quick reference guide.
Singularity is a virtualization technology somewhat similar to Docker. But there are some key differences:
sudo
/tmp
-B <dir>
We choose Singularity over Docker because it is friendlier with GUI applications and it is the framework used in HPC (High-performance Computing) clusters such as the RCI cluster running at CTU, or Metacentrum. Also, running Singularity containers doesn't require administrator privileges. We also used Singularity with success for running local multi-robot simulation tests for DARPA SubT Challenge.
Singularity CE == Apptainer (the latter is just a newer name). You can find both terms when googling.
Apptainer is the newer one, but it installs the backwards-compatible singularity command to the system.
singularity
We use exclusively singularity everywhere to make it possible to use both newer and older versions.
At labs (e.g., E130, E132) and the Turtlebot robots, Robot Operating System (ROS) is available through pre-downloaded Singularity containers. The computers and robots automatically handle updating the images so you can be sure you're always using the latest image.
A general guide for connecting to the desktops/robots in the lab is here: TurtleBot Lab Guide. You need a special password to login to these machines. Set the password here.
To start using ROS in Singularity, clone the deploy repository somewhere to your home directory. Once you have the deploy repository, you can run singularity image with Ubuntu 20.04 + ROS Noetic using: scripts/start_singularity_aro .
scripts/start_singularity_aro
First-time run:
git clone https://gitlab.fel.cvut.cz/robolab/deploy.git deploy/scripts/start_singularity_aro # console prompt should start with AROSingularity now
Following runs:
deploy/scripts/start_singularity_aro # console prompt should start with AROSingularity now
The script will create (or update) a ROS workspace in folder workspace next to deploy. The codes you need to edit for homeworks are all in workspace/src/student-packages.
workspace
deploy
workspace/src/student-packages
You can make use of the fact that the home directory in labs is a shared network mount, so changes you do on the desktop computer are almost instantly available also on the turtlebots.
You will get the smoothest and easiest experience on Ubuntu 20.04. Newer Ubuntus still offer a smooth experience. Other Linux distros can be used, but may require a few manual setup steps. Singularity only runs on Linux. If you need to use a different operating system, there are alternatives, which are, however, not officially supported by the teaching team. We think it is good for you to get an Ubuntu installation and familiarize yourself with it during the study of Cybernetics.
First time, choose a folder on your computer that has enough disk space (at least 3 GB) and is preferably on an SSD. cd to the folder and run the following commands that will download the deploy repository, install Singularity, download the image and finally start a container.
cd
The install_singularity script works on Ubuntu 20.04+. If you have a different Linux flavor, you will need to install Singularity manually. The install_singularity script will point you to the relevant documentation.
install_singularity
git clone https://gitlab.fel.cvut.cz/robolab/deploy.git deploy/scripts/install_singularity deploy/scripts/download_singularity_image deploy/scripts/start_singularity_aro # console prompt should start with AROSingularity now
The script will create (or update) a ROS workspace in folder workspace next to deploy. The codes you need to edit for homeworks are all in workspace/src/student-packages/aro_exploration.
workspace/src/student-packages/aro_exploration
Once you have the initial installation done, running the singularity with ROS is as easy as:
The script will automatically check for new releases of the Singularity ARO image and download them if necessary.
By default, Singularity makes your normal home directory accessible inside the container, so you can edit files using any editor you like. However, to get a fully-featured IDE experience, it is better to start an IDE from within the container, as then it has access to all the ROS programs that are needed to test your code. The provided Singularity image comes with several IDEs preinstalled:
code . # Start VSCode inside the Singularity container pycharm # Start Pycharm inside the Singularity container subl # Start Sublime editor inside the Singularity container
The start_singularity_aro script will also auto-update the copy of student-packages repository where you work on your homeworks. We expect the updates of this repository should not be frequent, but we reserve the right to push updates during the semester. The automatic update works by calling git fetch origin && git merge origin/master in the repository. If you only edit the parts of files you are supposed to, the update should be seamless. If your local changes are not compatible with the update, you will be informed by the script and it will guide you through the next possible steps.
start_singularity_aro
git fetch origin && git merge origin/master
For the curious, here's a short summary what all the provided scripts do for you:
singularity exec robolab_noetic.simg initialize_workspace_aro
initialize_workspace_aro
catkin init && catkin config --extend /opt/ros/aro
catkin build
source ~/workspace/devel/setup.bash
.bashrc
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
if [ -z "$SINGULARITY_NAME" ]; then ORIGINAL_CONDA_ACTIVATION_CODE; fi
pip3 install --user --upgrade numpy
pip3 uninstall numpy
sudo apt install --reinstall python3-numpy
aro_exploration
roslaunch
~/.bashrc
if [ -z "$SINGULARITY_NAME" ]; then YOUR_ROS_SOURCING_COMMANDS; fi
~/.profile
if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi
<Tab>
[ -n "$SINGULARITY_NAME" ] && [ -n "$TMUX" ] && source /path/to/your/workspace/devel/setup.bash