Skip to content

Bug on PointCloud2Modifier::resize(uint32_t width, uint32_t height) #320

@Rektino

Description

@Rektino

Generated by Generative AI

No response

Operating System:

Ubuntu 24.04

ROS version or commit hash:

rolling

RMW implementation (if applicable):

No response

RMW Configuration (if applicable):

Client library (if applicable):

No response

'ros2 doctor --report' output

ros2 doctor --report
<COPY OUTPUT HERE>

Steps to reproduce issue

  • define a sensor_msgs::PointCloud2Modifier modifier(cloud_msg); where cloud_msg is sensor_msgs::msg::Pointcloud2
  • run modifier.resize(width , height) assuming an organized pointcloud.
  • print the cloud_msg.row_step, it should show the total size of the pointcloud instead of width * point_step

Expected behavior

cloud_msg.row_step = cloud_msg.width * cloud_msg.point_step;
should be added after manually assigning height, width in the resize(width, height) function overload.

Actual behavior

The function does a few simple things :

  • Call the resize(size_t size) overload which sets the pointcloud total size, its height to 1, its width to size, and row_step to size (!!)
  • Subsequently manually fixes the height and width to match the passed height,width params.
  • It does NOT fix the row_step, which should be :
    cloud_msg.row_step = cloud_msg.width * cloud_msg.point_step;

The row_step is wrongly equal to total points.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions