fix(ros2): correct PointField descriptors in DVS camera publisher#9649
fix(ros2): correct PointField descriptors in DVS camera publisher#9649youtalk wants to merge 1 commit intocarla-simulator:ue5-devfrom
Conversation
Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>
|
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update our CHANGELOG.md based on your changes. |
There was a problem hiding this comment.
Pull request overview
This PR fixes the ROS 2 DVS camera PointCloud2 field descriptors so the published message has correct metadata for downstream consumers.
Changes:
- Fixes a copy/paste error so the
polPointField descriptor is configured ondescriptor4(instead of overwritingdescriptor3). - Ensures the
polfield descriptor is no longer left uninitialized.
Comments suppressed due to low confidence (1)
LibCarla/source/carla/ros2/publishers/CarlaDVSCameraPublisher.cpp:499
- PointCloud2 dimensional fields and steps appear internally inconsistent: the function copies
height * widthbytes intodata, setspoint_steptosizeof(DVSEvent), but then setswidthdirectly on the message and computesrow_stepaswidth * point_size. With the current call site passingwidth = elements * sizeof(DVSEvent), this makesrow_stepequal toelements * sizeof(DVSEvent)^2, which won’t match the actualdatabuffer size. Please setpc.widthto the number of points (likelyelementswithheight = 1), computerow_step = pc.width * point_step, and size/copy the data buffer aselements * point_stepbytes.
descriptor4.count(1);
const size_t point_size = sizeof(carla::sensor::data::DVSEvent);
_point_cloud->_pc.width(width);
_point_cloud->_pc.height(height);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JesusAnaya
left a comment
There was a problem hiding this comment.
Reviewed. The descriptor block is correct: all four fields (x, y, t, pol) are now independently initialized and the offsets/datatypes match the DVSEvent memory layout. Clean fix.
|
@Blyron @LuisPovedaCano This is a bug fix. Please review it. |
Description
Fix a copy-paste bug in
CarlaDVSCameraPublisher::SetPointCloudDatawheredescriptor4(for thepolfield) was incorrectly assigned usingdescriptor3, causing:descriptor3(tfield) to be overwritten withpolfield valuesdescriptor4to remain uninitializedThe PointCloud2 message published by the DVS camera sensor had incorrect field metadata, making it unusable by downstream ROS 2 consumers. I found it in the #9638 (comment).
Where has this been tested?
Possible Drawbacks
None. This is a straightforward bug fix with no behavioral change beyond correcting the PointField metadata.
This change is