/cpp-example-ros2-bridge

An example implementation of a ROS 2 to Rerun bridge

Primary LanguageC++Apache License 2.0Apache-2.0

C++ Example: ROS 2 Bridge

This is an example that shows how to use Rerun's C++ API to log and visualize ROS 2 messages (for the ROS 1 version, see here).

It works by subscribing to all topics with supported types, converting the messages, and logging the data to Rerun. It further allows to remap topic names to specific entity paths, specify additional timeless transforms, and pinhole parameters via an external config file. See the launch directory for usage examples.

CARLA Go2
carla go2

This example is built for ROS 2. For more ROS examples, also check out the ROS 2 example, the URDF data-loader, and the ROS 1 bridge.

NOTE: Currently only some of the most common messages are supported (see #4 for an overview). However, extending to other messages should be straightforward.

Compile and run using pixi

The easiest way to get started is to install pixi.

The pixi environment described in pixi.toml contains all required dependencies, including the example data, and the Rerun viewer. To run the CARLA example use

pixi run carla_example

and to run the Go2 example use

pixi run go2_example

Compile and run using existing ROS environment

If you have an existing ROS workspace and would like to add the Rerun node to it, clone this repository into the workspace's src directory and build the workspace.

To manually run the CARLA example, first download the CARLA bag or Go2 bag and extract it to the share directory of the rerun_bridge package (typically located in {workspace_dir}/install/rerun_bridge/share/rerun_bridge). Then, run the corresponding launch file:

ros2 launch rerun_bridge {carla,go2}_example.launch

Development

Prior to opening a pull request, run pixi run lint-typos && pixi run cpp-fmt to check for typos and format the C++ code.

You can update this repository with the latest changes from the template by running:

  • scripts/template_update.py update --languages cpp

Acknowledgements

This code uses the turbo colormap lookup table by Anton Mikhailov.