ROS 2 package providing a C++ bridge between MRPT (Mobile Robot Programming Toolkit) and the ROS 2 ecosystem. It enables seamless conversion between MRPT and ROS message types for maps, sensor data, poses, images, and more. Since version v4.0.0 this package requires MRPT>=v3.0.0.
| Distro | Build dev | Stable sync |
|---|---|---|
| ROS 2 Humble (u22.04) | ||
| ROS 2 Jazzy (u24.04) | ||
| ROS 2 Kilted (u24.04) | ||
| ROS 2 Lyrical (u26.04) | ||
| ROS 2 Rolling (u26.04) |
| Package | ROS 2 Humble BinBuild |
ROS 2 Jazzy BinBuild |
ROS 2 Kilted BinBuild |
ROS 2 Rolling BinBuild |
ROS 2 Lyrical BinBuild |
|---|---|---|---|---|---|
mrpt_libros_bridge |
|||||
rosbag2rawlog |
The mrpt_libros_bridge library provides bidirectional converters between MRPT data structures and ROS 2 message types.
It simplifies integrating MRPT-based algorithms (e.g. SLAM, perception, mapping) with ROS 2 nodes.
| Package | Description |
|---|---|
mrpt_libros_bridge |
Core C++ library bridging MRPT data types with ROS 2 messages (poses, maps, sensor data, etc.). |
rosbag2rawlog |
Command-line tool to convert ROS 2 .bag files into MRPT .rawlog datasets. |
rawlog2rosbag |
Command-line tool to convert MRPT .rawlog datasets into ROS 2 bags (.mcap, .db3). |
- Convert between MRPT and ROS 2 types:
geometry_msgs::Pose⇄mrpt::poses::CPose3Dsensor_msgs::LaserScan⇄mrpt::obs::CObservation2DRangeScansensor_msgs::Image⇄mrpt::img::CImagesensor_msgs::Imu,NavSatFix,PointCloud2, etc.
- Compatible with ROS 2 distros: Humble, Jazzy, Kilted, and Rolling.
- Written in C++17, using ament_cmake.
- Includes unit tests for conversions and message integrity.
Install from ROS build servers with:
sudo apt install ros-${ROS_DISTRO}-rosbag2rawlog ros-${ROS_DISTRO}-rawlog2rosbag ros-${ROS_DISTRO}-mrpt-ros-bridgeIf needed to build from source code, do this:
# Source your ROS 2 environment
source /opt/ros/jazzy/setup.bash
# Clone dependencies
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/MRPT/mrpt_ros_bridge.git
# Install dependencies
rosdep install --from-paths . --ignore-src -r -y
# Build
cd ~/ros2_ws
colcon build --symlink-install#include <mrpt_libros_bridge/pose.h>
#include <geometry_msgs/msg/pose.hpp>
#include <mrpt/poses/CPose3D.h>
geometry_msgs::msg::Pose ros_pose;
mrpt::poses::CPose3D mrpt_pose(1.0, 2.0, 0.0, 0.0, 0.0, 1.57);
mrpt::ros2bridge::toROS(mrpt_pose, ros_pose);Refer to the dataset conversions page on the MOLA project website.
rawlog2rosbag -i dataset.rawlog -o dataset_bag/Each sensor label becomes a topic namespace and a /tf_static frame (lower case, e.g. LMS_SICK_LEFT is
written to /lms_sick_left/scan in frame lms_sick_left):
| MRPT observation | ROS 2 topic(s) |
|---|---|
CObservation2DRangeScan |
<ns>/scan (sensor_msgs/LaserScan; invalid rays are +inf) |
CObservationIMU |
<ns>/imu (sensor_msgs/Imu) |
CObservationGPS |
<ns>/fix (sensor_msgs/NavSatFix) |
CObservationImage |
<ns>/image_raw/compressed + <ns>/camera_info (--image-mode raw for <ns>/image_raw) |
CObservationStereoImages |
the same, under <ns>/left and <ns>/right |
CObservationPointCloud |
<ns>/points (sensor_msgs/PointCloud2) |
CObservationOdometry |
<ns>/odom (nav_msgs/Odometry) + /tf (odom -> base_link) |
CObservationRobotPose |
<ns>/pose (geometry_msgs/PoseWithCovarianceStamped) |
CObservationComment |
/rawlog_comment (std_msgs/String) |
Other 3D sensors (CObservation3DRangeScan, CObservationRotatingScan,...) |
<ns>/points, in the base_link frame |
In SensoryFrame-based rawlogs, the odometry actions are integrated into /odom + /tf.
Externally stored JPEG/PNG images are copied into the bag byte by byte, without re-encoding them.
Main options (see rawlog2rosbag --help):
-c topics.yaml: per-sensor overrides of the topic namespace and frame, orskip: true:sensors: CAMERA_LEFT: ns: /camera_left frame_id: camera_left_optical_frame
--gt-tum gt.txt: also writes a ground-truth trajectory (TUM format) to/ground_truth(nav_msgs/Odometry).--storage-id mcap|sqlite3,--storage-preset zstd_fast|zstd_small|....--no-latched-qos: do not store thetransient_localQoS of/tf_static. Bags written with QoS profiles by ROS 2 Jazzy or newer cannot be read by ROS 2 Humble.
Run unit tests with:
colcon test --packages-select mrpt_libros_bridge rawlog2rosbag
colcon test-result --verboseAuto-generated API docs (Doxygen):
cd mrpt_ros_bridge
doxygen doc/rosdoc.yamlFurther information about MRPT: 👉 https://www.mrpt.org
This package is distributed under the BSD License.
José-Luis Blanco-Claraco 📧 joseluisblancoc@gmail.com 🔗 https://github.com/MRPT