First Simulation

This guide walks you through setting up your first simulation in the CPM Lab. It assumes you installed the CPM Lab using Install from Debian Packages and want to use an integrated motion planner.

Note

Prerequisites: have ROS2 sourced (source /opt/ros/jazzy/setup.bash, see Supported Platforms), and the CPM Lab packages installed.

1. Launch the CPM Lab

Launch the control flow together with RViz and the Control Center. The control flow starts all components you select in the Control Center, see Running the Lab.

source /opt/ros/jazzy/setup.bash
export ROS_DOMAIN_ID=21
ros2 launch cpm_lab cpm_lab_rviz.launch.xml

Tip

You can use Lichtblick instead of RViz, see Visualization with Lichtblick. The CPM control dashboard panel offers the same steps as the Control Center.

2. Configure the Control Center

When you start the Control Center you may be presented with a few configuration screens.

FastDDS Warning Screen

FastDDS Warning Screen

Note

The warning about FastDDS is expected if you have not switched to an alternative RMW implementation. You can choose to ignore the warning and continue with FastDDS, but we recommend switching to CycloneDDS or Zenoh for a more stable experience. If you switch to an alternative RMW implementation you will not see this warning.

Indoor Positioning System Setup Screen

Indoor Positioning System Setup Screen

Note

If you installed the indoor positioning package the Control Center may prompt to start it. For simulations this is optional and can be skipped.

Next, select the map to use for the simulation (maps starting with “Lab” are provided). In this guide we chose “Lab Reduced”. Click Start to launch the map server.

Map Selection Screen

Map Selection Screen

Warning

If you run FastDDS as the RMW implementation the map might not appear in RViz due to known QoS incompatibilities. The simulation and planners still work; the missing map is a display issue.

Map not displayed in RViz with FastDDS

Map not displayed in RViz with FastDDS

If you are using CycloneDDS or Zenoh you should see the map in RViz immediately.

Map displayed in RViz with CycloneDDS

Map displayed in RViz with CycloneDDS

After the map server is running, start one or more vehicle simulations. Select the vehicle(s) in the Control Center selection screen and click Start.

Vehicle Selection Screen

Vehicle Selection Screen

Start a motion planner next. Choose from the available planners (the example below uses the default central routing motion planner).

Motion Planner Selection Screen

Motion Planner Selection Screen

In the experiment setup screen you can set the motion planner update rate (ms) and start the bridge by clicking “Deploy”. The bridge will query each component (vehicles and planner) for readiness; once all components report ready the Control Center enables the “Start” button. If you use FastDDS you may then also see the map in RViz.

Experiment Setup Screen

Experiment Setup Screen

Click “Start” to begin the simulation. Vehicles should move in RViz according to the motion planner commands.

Simulation Running in RViz

Simulation Running in RViz

Click “Stop” to stop the simulation. The map server and the simulated vehicles keep running, so you can deploy the next experiment right away. Press Ctrl+C in the terminal of the launch file to stop the CPM Lab and all components started by the control flow.

Simulation Stopped

Simulation Stopped

Middleware

This guide works with CycloneDDS or Zenoh. For experiments with real vehicles, Zenoh is required; see Middleware for how to install it and start its router.