1.1. Setting up Linux for the RSP course#

This course is designed to familiarize you with using Linux, C++ and ROS2. Working through the manuals therefore requires that students have access to a Linux-based operating system (Ubuntu in this course) available on their personal laptops/desktops, and also that they have the required C++ and ROS2 tools installed.

However, we realise it could be too daunting for a student to install Ubuntu natively on their laptops and install a bunch of software, without expecting them to even know the basics of Linux yet. Besides, the course instructors and teaching assistants are not able to act as tech support in case something goes wrong. Hopefully such students will become sufficiently familiar and experienced through this course that they can take on installing Linux later. Another problem is that everybody might use a different version of (Ubuntu) Linux, C++, and ROS2, making it difficult to provide support and help consistent instructions.

To simplify the process of teaching large student cohorts, and ensure everybody has a mostly similar experience which is relatively simple to setup, we have decided on the following setup:

  • If you do not have Linux already installed on your laptop, we provide a Virtual Machine[1] for Ubuntu Linux. The VM allows us to distribute a pre-configured software configuration in an easy to distribute format, which acts as-if you have access to a complete and separate computer running Ubuntu Linux. Using a VM also has the benefit that no invasive changes to your laptops or desktop computer is needed. You should use the provided VM to get support, see Section 1.1.1 for more information.

  • If you do already have a modern version of Linux installed, e.g. via a “dual-boot”[2], you can keep using your Linux version without the VM. A big benefit of this setup is that it will give you the best performance, especially when working on the more complex ROS2 assignments. Your Linux version does not necessarily have to be Ubuntu, though we will assume you are working with Ubuntu throughout the manual. Again, we provide no instructions or support for setting up dual-boot.

  • We ask you to not install ROS2 on your Linux system, and it is also not installed in the VM we provide. Instead, we will use a different method to provide you with a pre-configured ROS2 setup using a tool called Pixi that you can use within any modern Linux installation (either via our VM or dual-boot). This will be explained in more detailed in Section 1.1.2.

1.1.1. Use the provided VM (if you don’t have Linux/dual-boot)#

If you have not done so already, be sure to read the Robot Software Practicals - RO47003: Installation and Setup manual and follow the instructions given there.

A separate document is provided which discusses how to install and configure the virtual machine software we use. Refer to the Robot Software Practicals - RO47003: Installation and Setup manual for more information. Please carefully read it and follow the instructions given in it before starting with the exercises and assignments in this manual.

In terms of hardware, you will need a reasonably recent laptop with an x86-64 CPU (i.e. a “normal” Intel or AMD CPU; but NOT a MacBook with an Apple Silicon (M-series, e.g. M1/M2/M3/M4) chip, NOT a Chromebook, etc. These use a different CPU architecture which means that the software we provide will not run! A MacBook with an Intel x86 CPU is fine). A laptop with an Nvidia GPU would make the robot simulations towards the end of this course run even smoother.

Note

If you don’t have Linux/dual-boot installed, you should use this same VM for the Linux, C++ and ROS labs and the final assignment.

1.1.2. Using ROS with Pixi#

For the ROS exercises, you should not install ROS directly yourself! There are two reasons for this:

  • All exercises in this course require that you are working with ROS version “Humble”. We have provided a Virtual Machine with the correct version of Ubuntu, but on your own laptop you may also have a native Ubuntu installation that may not be that specific version, as this course attracts many students who may already be using different Ubuntu versions on their personal computers.

  • There are special installation requirements for the required Gazebo simulator, which will be used for the final lab assignment of this course.

Instead, we use a tool called Pixi which allows us to share a whole Linux development environment using a simple directory with some configuration files, which can then be used on any Linux system with Pixi installed. The directory containing the packaged environment is called a Pixi environment, which you can activate in any terminal you want to gain access to the development tools. We shall provide you with a Pixi environment which contains an installation of all the required ROS and simulator tools needed for the assignment (and future lab sessions in the course). This way, we can provide a unified development environment for all students, independent of how they setup Linux on their laptop. The Pixi environment enables you to do the exercises as if the correct Ubuntu version with all the required ROS packages was installed on your computer. Therefore, the first step to getting started is to install the Pixi tool, if needed, and test how to use it.

This chapter of the manual will help you setup (if still needed) and verify your Pixi installation, and show you how to use it to start a Pixi shell from the provided Pixi environment.

Important

For all exercises after this section, we will assume that any new terminal that you open, you would first use it to open a Pixi shell as explained below. Only if you work in the Pixi shell will you be able to access the ROS tools.

Note

For a real ROS project where you want to setup ROS on a new computer, you would pick an Ubuntu installation and a corresponding supported ROS version, e.g. Ubuntu 22.04 LTS and ROS Humble. You would then use the Ubuntu package manager to install the required ROS packages.

In case you ever need to install ROS 2 Humble Hawksbill on a new system yourself, you can check its installation instructions in the online documentation. Again, this is not needed for this course.

1.1.2.1. Setup Pixi#

All the instructions on how to setup the software required for the course were explained in Week 0 of the course. If you completed those instructions, you should have everything correctly setup and one of the two following situations applies to you:

  • You are doing these assignments on your own computer in the Virtual Machine provided to you at the beginning of this course, as was discussed in Section 1.1.1. The provided VM already contains an installation of the correct version of Pixi.

  • You have a native Ubuntu (or other Linux) installation. Then you should have installed Pixi yourself, as explained in the Week 0 Setup manual.

In both cases please make sure you have downloaded and tested the required Pixi environment.

1.1.2.2. Verify Pixi installation#

To verify the Pixi installation, we can check Pixi’s version with the following command:

$ pixi --version

For our course we have pinned Pixi to version 0.78.0, so this command should output the following:

pixi 0.78.0

1.1.2.3. Activating the Pixi environment#

Now that the Pixi tool is available and that you have installed the provided Pixi environment, we can practice how to use it. To activate a Pixi environment, open a new terminal window and type the following command:

$ pixi shell -m ~/ro47003_pixi_ws

If the Pixi shell correctly started, you will see that the bash prompt now contains the text (ro47003_pixi_ws).

Now in the Pixi shell, enter the following command:

$ gazebo --version

You should see the following output:

Gazebo multi-robot simulator, version 11.15.1
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

Exercise 1.1

Start a Pixi bash shell by opening a terminal and running:

$ pixi shell -m ~/ro47003_pixi_ws

Note that you should not run this command with sudo. If the Pixi shell correctly started, you will see that the bash prompt changed, indicating the workspace. You can now execute commands that are installed in this workspace. Terminate the Pixi bash shell by either typing exit, or pressing Ctrl+D. You should now be back in your normal Bash shell, and the prompt should have returned to normal.

Exercise 1.2

Open a new terminal, but before activating the Pixi shell in that new terminal, try to execute gazebo:

$ gazebo --version

You should see a message in your terminal that the command gazebo is not found or recognised, which makes sense because gazebo isn’t installed on your regular Ubuntu installation. However, it will be available once you activate the Pixi environment.

As before, now activate the Pixi environment in the same terminal, and verify that the gazebo command is now available again:

$ pixi shell -m ~/ro47003_pixi_ws
$ gazebo --version

Finally, exit the Pixi environment (see previous exercise), such that your terminal returns to the regular prompt, and one more time try to run the gazebo command. Does the system recognize the command now?

1.1.2.4. Reinstall the Pixi environment (only do this if you accidentally deleted it!)#

By following the Week 0 Setup manual, you should already have setup the Pixi environment for this course. This section is only intended as a reference if you accidentally deleted the directory containing the Pixi environment, so if the Pixi environment is working correctly, you can skip this section!

Warning

You should not delete the directory containing the Pixi environment, (if you followed the setup instructions, this would be the ro47003_pixi_ws directory in your home directory). If you delete this directory, you will not be able to activate that environment anymore.

When you install (or the first time activate) a Pixi environment, the pixi tool will setup all the necessary software inside a hidden directory in that environment’s directory.

However, if you accidentally do delete the Pixi environment directory, it should be easy to reinstall it again, as you can see in this section.

If you ever need to re-install your Pixi environment later in the course, for example because you have to change laptop or accidentally deleted the Pixi environment directory, then simply git clone our course’s Pixi environment into your home directory again (you should have learned how to use git early in the course):

cd $HOME
git clone https://gitlab.ro47003.me.tudelft.nl/students-2627/ro47003_pixi_ws.git

Afterwards, “install” the Pixi environment, which may download the necessary software from the internet (if not already cached on your computer), and set up the environment.

cd $HOME/ro47003_pixi_ws
pixi install

Once you have installed the Pixi environment, you can immediately continue to Section 1.1.2.2.