Skip to content

rerun-io/cpp-example-ros2-bridge

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.mp4

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 geometry_msgs/{PoseStamped,TransformStamped}, nav_msgs/Odometry, tf2_msgs/TFMessage, and sensor_msgs/{Image,CameraInfo,Imu} are supported. 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

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 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 following command:

ros2 launch rerun_bridge carla_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

About

An example implementation of a ROS 2 to Rerun bridge

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published