ROS2 on your own machine - RobotTeaching/COMP4034 GitHub Wiki

Using the Docker image on your own machine

We have supplied a Docker image for this module that contains everything you need to get going. There are comprehensive installation instructions on the GitHub page, as well as the download for the image itself. Your work will be checked in the B85 lab environment, so test your code there before each checkpoint.

Installing ROS2 on your own machine (alternative)

If you would prefer to run ROS directly on Ubuntu instead of in a Docker container, you can follow the instructions below.

Important: these instructions are a guide only! The install process will depend on how you plan to run Ubuntu, and what OS/hardware are on your host machine. Therefore, we cannot offer detailed installation support for your own machine.

Step 1: Install Ubuntu 22.04

The version of ROS2 we use requires you to run Ubuntu 22.04 as your operating system. You can do this by dual-booting your machine, or by using a virtual machine software (such as VirtualBox). You can download an Ubuntu image here, then install it using your preferred method. Note that Gazebo can run slowly inside a virtual machine.

Step 2: Installing ROS2 Humble

You should follow the installation instructions for Humble, found here. We recommend using the deb packages for this module, rather than the pre-built binary, and installing the desktop version (ros-humble-desktop) so you get RViz and RQT.

Step 3: Installing TurtleBot3 packages

The TurtleBot3 install pages cover the installation you need on your "remote PC" and on your physical TurtleBot. The "remote PC" in this case is your install of Ubuntu. Since you will be using simulation only, you only need to follow the instructions below. The ROBOTIS pages cover several ROS 2 versions, so make sure you select Humble.

Follow the PC setup steps from the Quick Start Guide.

Follow all steps in the Gazebo Simulation and SLAM Simulation.

If you can run the simulation, you have successfully installed everything!

(Optional) Step 4: Updating the Bash File

  1. Open a terminal, and type nano ~/.bashrc
  2. Use your arrow keys to move to the end of the file
  3. Add the following lines to the end of the file:
    • source /opt/ros/humble/setup.bash
    • source ~/ros2_ws/install/setup.bash (this file only exists after your first colcon build, so you will see an error in new terminals until then)
    • export ROS_DOMAIN_ID=30 #TURTLEBOT3
    • export TURTLEBOT3_MODEL=waffle
    • source /usr/share/gazebo/setup.bash
  4. Press ctrl + x on your keyboard, then Y, then Enter
  5. In your terminal, type source ~/.bashrc

This will make sure everything you need for ROS2 will be initialised whenever you open a new terminal.