How to publish a pointcloud of ros msgs in a topic from a pcd file?

Two methods

1. modified source

2. pcd_to_pointcloud

  • run ros node pcl_ros in a terminal

    usage:
$ rosrun pcl_ros pcd_to_pointcloud <file.pcd> [ <interval> ]
// <interval> is the (optional) number of seconds to sleep between messages.
// If <interval> is zero or not specified the message is published once.
  • in my condition, I use
// can add _frame_id:=/camera_link
$ rosrun pcl_ros pcd_to_pointcloud /home/william/Documents/demos/cylinders/preprocessing/data/realSense02.pcd 10 _frame_id:=/map
  • run rviz:

    $ rosrun rviz rviz

References:

  1. pcl_ros
05-15 02:25