Command Reference

This page collects the commands needed for the daily use of the CPM Lab. Unless stated otherwise, source your ROS2 installation first:

# Debian installation
source /opt/ros/jazzy/setup.bash

# Source build
source <path-to-ros2-workspace>/install/setup.bash

The lab runs in ROS_DOMAIN_ID=21 and the motion planners in ROS_DOMAIN_ID=1, see Understanding the Domain IDs.

Starting the Lab

Run in ROS_DOMAIN_ID=21. See Running the Lab for details.

# Control flow with RViz and the Control Center
ros2 launch cpm_lab cpm_lab_rviz.launch.xml

# Control flow with the Foxglove bridge for Lichtblick
ros2 launch cpm_lab cpm_lab_foxglove.launch.xml

# Control flow only, optionally with another recording directory
ros2 launch cpm_lab cpm_lab_headless.launch.xml recording_root:=/data/experiments

# Lichtblick web visualization (in the cloned lichtblick repository)
docker compose up -d

The control flow can also be operated with ros2 service call, see Controlling the Lab from the Command Line.

Motion Planners

The motion planners are usually started by the control flow. To run one yourself as an external motion planner, start it in ROS_DOMAIN_ID=1, before or after deploying, with the same period as in the deploy step:

export ROS_DOMAIN_ID=1

# Central routing, multi-vehicle planner for arbitrary maps
ros2 launch cpm_lab_central_routing default.launch.xml vehicle_ids:="[1,2,3]" period:=400

# Path tracking on the outer loop
ros2 launch cpm_lab_path_tracking default.launch.xml vehicle_ids:="[1]"

# Manual control with a gamepad (C++ or Python)
ros2 launch cpm_lab_manual_control_cpp default.launch.xml vehicle_ids:="[1]"
ros2 launch cpm_lab_manual_control_py default.launch.xml vehicle_ids:="[1]"

# SFB route and speed planner
ros2 launch cpm_lab_sfb_py default.launch.xml vehicle_ids:="[1,2,3]" period:=400

# SigmaRL planner, requires a trained model
ros2 launch cpm_lab_sigmarl_control default.launch.xml vehicle_ids:="[1,2,3,4]" period:=100 model_path:=<model-dir>

All planners accept use_sim_time:=true for replaying recordings.

Vehicles

Simulated vehicles are usually started by the control flow. To start one manually in ROS_DOMAIN_ID=21:

ros2 launch cpm_lab_mid_level_controller default.launch.xml vehicle_id:=1 simulated:=true

# With a start pose x,y,yaw
ros2 launch cpm_lab_mid_level_controller default.launch.xml vehicle_id:=1 simulated:=true pose:=3.15,3.88,0.0

On a muCar, start.bash of the controller package starts the controller node directly, with the vehicle ID derived from the IP address of the car, see muCar.

Map Server

Started by the control flow. To publish a map manually in ROS_DOMAIN_ID=21:

ros2 run cpm_lab_map_server cpm_lab_map_server_node --ros-args -p map_path:="maps/Lab Full.osm" -r __ns:=/lab

Relative map paths are resolved in the cpm_lab_maps package.

Prepare and check your own map, see Lanelet2 Maps:

# Replace the negative IDs created by JOSM with positive IDs
ros2 run lanelet2_python make_ids_positive.py my_map.osm --inplace

# Check the map for mapping errors, with the latitude and longitude of the origin node
ros2 run lanelet2_validation lanelet2_validate my_map.osm --lat <origin-lat> --lon <origin-lon>

Indoor Positioning System

Started by the control flow. To run the IPS manually in ROS_DOMAIN_ID=21 with a configuration file:

ros2 launch cpm_lab_indoor_positioning_system default.launch.xml config_file:=<absolute-path-to-config.yaml>

Calibrate the IPS camera from checkerboard images, see IPS Camera Calibration:

cpm_calibrate <images-or-directory> [--checkerboard 39 44] [--square-size 0.10] [--quick]

Lane Control Lights

# Display the lane control lights on the image server
ros2 launch cpm_lab_lane_control_light light.launch.xml

# Select light presets with the keyboard (a-g: presets 1-7, 0: reset, r: reload presets)
ros2 run cpm_lab_lane_control_light lane_control_node

Recording and Evaluation

See Recording and Evaluating Experiments.

# List the recorded runs
cpm_eval list

# Quick summary of run 1 without writing files
cpm_eval evaluate 1 --quick

# Full HTML report of run 1
cpm_eval evaluate 1

Building from Source

Run in the workspace root, see Building from Source:

Command

Description

make dependencies

Install all dependencies with rosdep.

make build

Build the workspace (Release).

make simulation

Build without the indoor positioning system, for computers without the Basler pylon library.

make debug

Debug build of the indoor positioning system and its dependencies.

make clean

Remove build/, install/ and log/.

Docker

The simulation and desktop images are started with the scripts in their repositories, see Docker Images:

# Build the image and open a terminal in it, in the cloned simulation or desktop repository
./make-image.bash
./run-terminal.bash

# Update an image
git pull && ./make-image.bash

For developing the CPM Lab itself, the workspace builds and runs the CPM Lab in Docker (compose.yaml, docker/Dockerfile). The VS Code dev container of the workspace uses the same image. Run the targets in the workspace root:

Command

Description

make control-center

Start the Zenoh router, build the workspace if anything changed, and start the lab with RViz and the Control Center.

make control-center-foxglove

The same with the Foxglove bridge instead of RViz.

make terminal

Open a terminal in the image with ROS and the workspace sourced.

make rqt

Start rqt.

make docker-build

Build the workspace inside the image.

make router

Start only the Zenoh router.

make image

Rebuild the cpm-lab-runtime and cpm-lab-dev images.

make down

Stop and remove all containers.

muCars

Run in the root of the vehicle workspace ros2-workspace-vehicle on the central workstation, see muCar:

Command

Description

make (./docker/build.bash)

Cross compile the controller against the car OS: dist/package.tar.gz.

make deploy (./docker/deploy.bash)

Publish the package on the web server; the cars load it on their next start.

make shell (./docker/shell.bash)

Open the cross-compile shell.

make -C image os sysroot image

Build the car OS, its sysroot and the SD-card image.

image/provision.bash --car <id> --device /dev/sdX

Write the SD card of car <id>.

image/fleet.bash status

OS version, kernel and package version of every car.

image/fleet.bash update

Install the current package set (image/packages.txt) on the running cars.

On a car (ssh ubuntu@192.168.1.<20 + id>):

sudo systemctl restart vehicle-controller          # download and start the newest controller package
sudo journalctl -u vehicle-controller.service      # its log

Middleware

# Use CycloneDDS
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

# Use Zenoh and start the router once (keep it running)
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
ros2 run rmw_zenoh_cpp rmw_zenohd

Inspecting the Lab

# Running nodes and topics of the current domain
ros2 node list
ros2 topic list

# State of a vehicle
ros2 topic echo /lab/vehicle_1/vehicleState

# Events of the control flow
ros2 topic echo --qos-durability transient_local /lab/control_flow/status

# Diagnostics of all components
ros2 topic echo /diagnostics

For network and time synchronization commands, see Troubleshooting Guide.