ROS node

A minimal example of creating a ROS node that subscribes to topics and converts the messages to rerun log calls.

The solution here is mostly a toy example to show how ROS concepts can be mapped to Rerun.

Used Rerun types

Image, Pinhole, Transform3D, Boxes3D, Points3D, LineStrips3D, Scalar

Background

The Robot Operating System (ROS) helps build robot applications through software libraries and tools. Although Rerun doesn't have native ROS support, you can easily create a basic ROS 2 Python node to subscribe to common ROS topics and log them to Rerun. In this example, Rerun visualizes simulation data, including robot pose, images, camera position, laser scans, point clouds, and velocities, as the Turtlebot navigates the environment.

Logging and visualizing with Rerun

Find the detailed code walkthrough and explanation for visualizing this example here: Using Rerun with ROS 2.

For more information on future improved ROS support, see tracking issue: #1527

Run the code

Dependencies

NOTE: Unlike many of the other examples, this example requires a system installation of ROS in addition to the packages from requirements.txt.

This example was developed and tested on top of ROS2 Humble Hawksbill and the turtlebot3 navigation example.

Installing ROS is outside the scope of this example, but you will need the equivalent of the following packages:

sudo apt install ros-humble-desktop gazebo ros-humble-navigation2 ros-humble-turtlebot3 ros-humble-turtlebot3-gazebo

Make sure you have the Rerun repository checked out and the latest SDK installed:

# Setup pip install --upgrade rerun-sdk # install the latest Rerun SDK git clone git@github.com:rerun-io/rerun.git # Clone the repository cd rerun git checkout latest # Check out the commit matching the latest SDK release

Install the necessary libraries specified in the requirements file:

pip install -r examples/python/ros_node/requirements.txt

In addition to installing the dependencies from requirements.txt into a venv you will also need to source the ROS setup script:

source venv/bin/active source /opt/ros/humble/setup.bash

Run the code

First, in one terminal launch the nav2 turtlebot demo:

source /opt/ros/humble/setup.bash export TURTLEBOT3_MODEL=waffle export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/opt/ros/humble/share/turtlebot3_gazebo/models ros2 launch nav2_bringup tb3_simulation_launch.py headless:=False

As described in the nav demo, use the rviz window to initialize the pose estimate and set a navigation goal.

You can now connect to the running ROS system by running:

python examples/python/ros_node/main.py # run the example

If you wish to customize it, or explore additional features, use the CLI with the --help option for guidance:

python examples/python/ros_node/main.py --help