Coral

Coral is a (experimental) renderer for maritime robotics simulation in ROS 2. The goal is to replace the classical Gazebo or RViz GUI to render nice, realistic images when performing maritime robotics experiments or simulation.
It is based on osgOcean and is inspired from the well-known UWSim in ROS 1.

The module can be explored and downloaded from GitHub

Virtual Machine for C++ and ROS

Download link

For students willing to experiment in C++ and ROS, here is a prepared virtual machine where ROS, Qt Creator and other tools are already set up. It is an OVA file that can be imported in Virtual Box software.

Installation of VirtualBox can be done from here. On some computers, Virtual Box requires activation of virtualization in the BIOS settings.

  • Direct link to Virtual Machine file (4.4 Gb)
  • Login / password is automatic and is ecn / ecn
  • This VM uses Kubuntu 24.04 Noble, with ROS 2 Jazzy
  • The default keyboard layout is US but can be switched to French or any other layout in the options

Installing lab dependencies

In order to keep it light, the VM is not shipped with all dependencies for all labs. You can install them by running the update.sh that lies in your home directory. It takes either no argument, in this case a GUI will run, or the acronym of the module, in this case it will install the corresponding dependencies.

cd ~
./update.sh # to run the GUI
./update.sh -u # to update all installed modules
./update.sh -u arpro # to update only the ARPRO-related packages

Install VBox additions

It is very important to setup the shared folders in order to synchronize everything you do in the VM to some local folder on your computer. To do so, you need to install (in your host OS) the VirtualBox extension pack (see on the previous link, it depends on your OS). Then run the VM.

  • Inside the VM, click on "Devices...Insert Guess Additions CD Image
  • Open the corresponding virtual CD
  • Run a terminal inside this folder and run sudo ./VBoxLinuxAdditions.run
  • Reboot the VM
  • To allow shared folders, type 'sudo usermod ecn -a -G vboxsf' and logout / login again in the VM.
You will also benefit from full screen capabilities in the VM.

The log2plot module

This module allows logging data from C++ code (typically a robot control loop where you want to store the control inputs, error, robot command, etc.) in order to plot them with Python (matplotlib). The data files are in YAML and can also be generated from elsewhere as long as they follow the same syntax. The plotting script can also create videos and has many options to change the display.

The module can be explored and downloaded from Github:

git clone https://github.com/oKermorgant/log2plot.git

ROS 2 tools

This repository includes the ros_management.bash script that helps dealing with both ROS, when sourced in your .bashrc:

ros1_workspaces="/opt/ros/obsolete ~/code/legacy/ros"
ros2_workspaces="/opt/ros/jazzy ~/code/libs/ros2 ~/code/ros2"
source /path/to/ros_management.bash -k -p -ros2 # sourceROS 2 workspaces, keep configuration for next terminals
You then have a few additional commands:
ros2cd # tries to make it to the source directory of the package
colbuild # wrapper for colcon build

For ROS 2 users, the script provides colbuild, a wrapper for colcon build with overall better default behavior and options.

You will also find a ROS cheat sheet that motivates how and when using ROS tools versus standard ones (CMake / IDE) when working on packages.

A few utility scripts used at ECN can be found on this repository. They are tailored for the installation and maintenance of the ECN compter and virtual machines, but feel free to use any part of the scripts.

CMake, IDE's, and ROS

Why use an IDE

As we saw in class, I recommend the use of an IDE to develop in C++. There are a few reasons for this:

  • You can jump to the wrong lines when a compilation error is detected.
  • It allows an easy use of the debugger, which is the modern and efficient way to hunt for bugs.
  • It provides auto-completion and navigation between classes and files.

In particular the Qt Creator IDE has all its defaults good to work on CMake project, even with ROS. This may not be the case for other IDE's (VS Code, KDevelop, Eclipse, CLion...) where some plugins should be installed.

I recall below the properties of a CMake project, and how to load it in your favorite IDE. There are small differences depending on the project being a ROS package or not.

CMake and the build directory

A standard way to share C++ source files is to rely on the CMake tool. In this case, the project is composed of the source files and the CMakeLists.txt which is basically the recipe to build all of this.

The only info not available in the project itself is the compilation directory, which is classically some build folder not far from the source directory, and it specific to your computer.

Thus, any CMake-friendly IDE will ask for this information. When using a build folder inside the source, and pre-configuring with CMake, Qt Creator will usually detect the directory and propose it as a default value.

Loading ROS projects

ROS uses CMake but in its own fashion. The projects are called packages and the sources are located in the src folder of the ROS workspace. The compilation directory of a given ROS package is imposed by the ROS framework and is below the build folder of the workspace. This has a few consequences:

  • it is up to ROS to create the build folders
    → when working on a new package, compile it with catkin or colcon first
  • the generated build folder will probably not be detected by an IDE
    → it is better to pre-configure the IDE with the correct path
  • the IDE should know about the ROS environment
    → run the IDE from a terminal or a custom shortcut

Other than that, ROS packages are just plain CMake project and can be developped, compiled, run and debugged in any capable IDE. A tool is proposed in this repository to generate the relevant configuration file for Qt Creator and VS Code (+CMake / clang plugins) Just run the following line from the folder where CMakeLists.txt is:

ide_config.py
You may also define an alias in your .bashrc file. This is already done in the virtual machine and in the lab computers:
alias ideconf="path/to/ide_config.py"
The tool will detect if the CMake project is a plain one, or a ROS package, and will find the suitable compilation folder. Refer to the ROS cheat sheet to better understand when to compile from the IDE and when to rely on the ROS build tool (catkin / colcon).

Using QtCreator

When loading a CMakeLists.txt, QtCreator will read the content and display all sources (.h and .cpp) that are listed as useful to create executables or libraries. Here are the main tools from the GUI:

  • To create a new source file, go through File... New file or project then C++ source file.
  • Each time you modify the CMakeLists.txt file (to add a new source or new binary), right-click on the project and select Run CMake It may be done automatically by Qt Creator.
    • Note that calling CMake from Qt Creator may fail for ROS projects. It is best to call catkin or colcon and reopen the project.
  • You can select the executable that is run by clicking on the computer in the lower-left section
  • This executable is actually run by clicking on the green triangle. Sources are recompiled if needed.
  • This executable is run in Debug mode by clicking on the green triangle with a bug. The Debug display of Qt Creator will appear.
  • If your executable requires keyboard input, you have to tell QtCreator to run this one in a separate terminal:
    • Open the left Project panel
    • Go to the Run panel
    • Select your executable and tick the "Run in terminal" box

ROS (1/2) nodes can be run from Qt Creator (as soon as a ROS master is available, for ROS 1). Launch files cannot be used, so topics / parameters have to be set from the C++ code. This is very useful for initial debugging, before remapping everything with launch files.

Duels framework

Duels is a C++ framework to build AIs that play various 1 vs 1 games. It can be installed through Debian packages (available on Github) for Ubuntu Focal or Jammy.
The source can also be used to create new games with embedded AIs and let other people play against it.
All the mechanics (rules) and AI are in C++ while the UI uses Pygame. Communication is done through zero-MQ.

Clickshare for Linux

In the following link you can find a tar file containing the Clickshare tool for Linux computers. All libraries should be shipped in. The first run will ask for the admin password in order to update some USB rules, then it will run directly.

Just untar this file and run clickshare.sh