Ask Your Question
0

Missing Ros Message while Running pointcloud to pcd

asked 2019-08-27 15:47:28 -0600

Dina gravatar image

Hi,

Can anyone please tell me why I am getting less pcd file compared to the number of my point cloud message in my rosbag while running the

"rosrun pcl_ros pointcloud_to_pcd input:=/velodyne/pointcloud2" command

In other case when I am running the bag to pcd command using the "rosrun pcl_ros bag_to_pcd data.bag /laser_tilt_cloud ./pointclouds" command. I am getting the exact number of pcd files comparing to my point cloud message in my Ros bag.

Any guide will be very helpful.

Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-08-28 02:27:53 -0600

gvdhoorn gravatar image

updated 2019-08-28 02:29:20 -0600

@PapaG is not wrong, but I feel that answer misses an important point: the fact that bag_to_pcd uses a fundamentally different way of processing the .bag file.

Pub-sub is typically implemented such that it makes no guarantees about whether you receive a message (there are implementations that do, but ROS 1's is not one of those).

bag_to_pcd does not use pub-sub, it iterates over the messages in the .bag file directly (using the rosbag API, examples here). That is implemented as a blocking operation, and that is why no messages are "lost": there is simply no way to advance to the next message before the current one has been processed.

edit flag offensive delete link more

Comments

Kind of feel like you just expanded the final sentence of my answer into something irrelevant to the actual question being asked...

PapaG gravatar imagePapaG ( 2019-08-28 07:00:56 -0600 )edit

I disagree. OP specifically asked:

Can anyone please tell me why I am getting less pcd file compared to the number of my point cloud message in my rosbag while running the

"rosrun pcl_ros pointcloud_to_pcd input:=/velodyne/pointcloud2" command

In other case when I am running the bag to pcd command using the "rosrun pcl_ros bag_to_pcd data.bag /laser_tilt_cloud ./pointclouds" command.

Unless I misunderstood this, this asks for the reason why the nr of msgs is different between bag_to_pcd and pointcloud_to_pcd.

The queue size in pointcloud_to_pcd is almost irrelevant, as even with a queue of a 1000 (or some other large nr), it would still not be possible to guarantee that all messages in a .bag would be processed.

The fundamental difference is the use of pub-sub vs loading the .bag directly.

gvdhoorn gravatar imagegvdhoorn ( 2019-08-28 07:10:30 -0600 )edit
0

answered 2019-08-27 23:54:46 -0600

PapaG gravatar image

After taking a look at the source code my guess is because the pointcloud_to_pcd has a queue of 1. This means that if it is processing some message n, it is perhaps that by the time the callback is finished running n+1 is no longer the most recent message and thus is ignored.

  sub_ = nh_.subscribe (cloud_topic_, 1,  &PointCloudToPCD::cloud_cb, this);

Whereas bag_to_pcd will just iteratively inspect the messages in the bag.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-08-27 15:47:28 -0600

Seen: 18 times

Last updated: Aug 28