ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to publish data in PointCloud2

asked 2021-08-27 12:29:17 -0500

pr_db gravatar image

I have ROS noetic installed on my pc and I am working on vrx repository.

I am using ros gpu ray sensor type="gpu_ray" with libgazebo_ros_gpu_laser.so plugin. The default type of data published is sensor_msgs/LaserScan.

I tried adding <output_type> tag inside the <plugin> tag in the urdf file like ROS2 but it didn't seem to work.

I want to publish the data in PointCloud2 format. How can I achieve that?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-08-28 09:52:17 -0500

updated 2021-08-28 09:52:54 -0500

There are a couple of ways of getting a PointCloud2 msg:

  1. You can use the laser_geometry as laid out in this answer. This is the easier of the two approaches.
  2. You will have to manually convert the data into a PointCloud2 msg. You basically know the data format and layout of both the LaserScan msg and PointCloud2 msg from their definitions. You will have to manually build up the pointcloud2 msg using data used in the laserscan msg. This is not necessarily harder, just a bit more involved.
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-08-27 12:29:17 -0500

Seen: 308 times

Last updated: Aug 28 '21