Skip to content

Commit

Permalink
FIX: issue with XYZIRT to ROS conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jan 9, 2024
1 parent 4167fd5 commit 0c35071
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/source/doxygen-docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- mrpt::obs::CObservation::load() is now protected with a std::mutex for safe multi-threading usage.
- BUG FIXES:
- Fix wrong filenames in `rawlog-edit --externalize` when sensor labels contain the `/` character (e.g. mimicking ROS topic names).
- Fix crash in mrpt::ros2bridge::toROS() for XYZIRT point clouds.

# Version 2.11.5: Released Dec 21st, 2023
- Changes in libraries:
Expand Down
9 changes: 6 additions & 3 deletions libs/ros2bridge/src/point_cloud2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,21 @@ bool mrpt::ros2bridge::toROS(

if (obj.hasIntensityField())
{
ASSERT_EQUAL_(obj.getPointsBufferRef_intensity()->size(), obj.size());
names.push_back("intensity");
offsets.push_back(msg.point_step);
msg.point_step += sizeof(float);
}
if (obj.hasTimeField())
{
ASSERT_EQUAL_(obj.getPointsBufferRef_timestamp()->size(), obj.size());
names.push_back("time");
offsets.push_back(msg.point_step);
msg.point_step += sizeof(float);
}
if (obj.hasRingField())
{
ASSERT_EQUAL_(obj.getPointsBufferRef_ring()->size(), obj.size());
names.push_back("ring");
offsets.push_back(msg.point_step);
msg.point_step += sizeof(uint16_t);
Expand Down Expand Up @@ -402,9 +405,9 @@ bool mrpt::ros2bridge::toROS(
const auto& xs = obj.getPointsBufferRef_x();
const auto& ys = obj.getPointsBufferRef_y();
const auto& zs = obj.getPointsBufferRef_z();
const auto& Is = obj.getPointsBufferRef_intensity();
const auto& Rs = obj.getPointsBufferRef_ring();
const auto& Ts = obj.getPointsBufferRef_timestamp();
const auto& Is = *obj.getPointsBufferRef_intensity();
const auto& Rs = *obj.getPointsBufferRef_ring();
const auto& Ts = *obj.getPointsBufferRef_timestamp();

uint8_t* pointDest = msg.data.data();
for (size_t i = 0; i < xs.size(); i++)
Expand Down

0 comments on commit 0c35071

Please sign in to comment.