ros-simulation / gazebo_ros_pkgs

Wrappers, tools and additional API's for using ROS with Gazebo
http://wiki.ros.org/gazebo_ros_pkgs
752 stars 771 forks source link

[ROS2] Publishing unorganized point cloud data from gazebo depth camera plugin #1267

Open Paul-Ajay opened 3 years ago

Paul-Ajay commented 3 years ago

Description

The pointcloud data generated by the depth camera in gazebo_ros_camera plugin is not organized pointcloud. The height value is always 1 and width is total size of pointcloud data

To Reproduce

Steps to reproduce the behavior:

  1. Install navigation2 package for foxy and launch ros2 launch nav2_bringup tb3_simulation_launch.py
  2. Check ros2 topic echo /intel_realsense_r200_depth/points width and height values. Height is 1

Expected behavior With the organized pointcloud data height should be 240 and width is 320 as per the camera_info

Environment (please complete the following information):

Additional context

This issue happens because of resize call from here https://github.com/ros-simulation/gazebo_ros_pkgs/blob/foxy/gazebo_plugins/src/gazebo_ros_camera.cpp#L712 . The rezise() function changes height to 1 https://github.com/ros2/common_interfaces/blob/foxy/sensor_msgs/include/sensor_msgs/impl/point_cloud2_iterator.hpp#L126. Replacing this line with this impl_->cloud_msg_.data.resize(_width * _height * impl_->cloud_msg_.point_step); publishes organized pointcloud without any issues.

roncapat commented 1 year ago

Any interest in a Pull Request? I can make it.