From 541218e1d42a3e7727683757888cdfc713e99e2d Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Sun, 28 Jul 2024 10:50:49 +0200 Subject: [PATCH] ROS2 bridge: Fix detection of timestamps in PointCloud2 --- doc/source/doxygen-docs/changelog.md | 3 +++ libs/ros2bridge/src/point_cloud2.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/doc/source/doxygen-docs/changelog.md b/doc/source/doxygen-docs/changelog.md index 6d6c709547..0ac719745b 100644 --- a/doc/source/doxygen-docs/changelog.md +++ b/doc/source/doxygen-docs/changelog.md @@ -1,6 +1,9 @@ \page changelog Change Log # Version 2.13.5: UNRELEASED +- Changes in libraries: + - \ref mrpt_ros2bridge_grp: + - mrpt::ros2bridge::toROS() conversion from `PointCloud2` to mrpt::maps::CPointsMapXYZIRT: recognize timestamp field names `"t"` and `"timestamp"`, apart of `"time"`. - Build system: - This main MRPT repository is no longer directly built as a ROS package. Please, use the wrappers for better modularity: - https://github.com/MRPT/mrpt_ros diff --git a/libs/ros2bridge/src/point_cloud2.cpp b/libs/ros2bridge/src/point_cloud2.cpp index 02ce0eebf3..631719e803 100644 --- a/libs/ros2bridge/src/point_cloud2.cpp +++ b/libs/ros2bridge/src/point_cloud2.cpp @@ -179,7 +179,10 @@ bool mrpt::ros2bridge::fromROS(const sensor_msgs::msg::PointCloud2& msg, CPoints incompatible |= check_field(msg.fields[i], "z", &z_field); incompatible |= check_field(msg.fields[i], "intensity", &i_field); incompatible |= check_field(msg.fields[i], "ring", &r_field); + + incompatible |= check_field(msg.fields[i], "timestamp", &t_field); incompatible |= check_field(msg.fields[i], "time", &t_field); + incompatible |= check_field(msg.fields[i], "t", &t_field); } if (incompatible || (!x_field || !y_field || !z_field)) return false;