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

Missing Ros Message while Running pointcloud to pcd

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

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
1

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

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

Comments

@PapaG thank you, I faced the same problem and increasing the queue size solved the problem. Now I am able to save all cloud msgs into pcd.

Mathanraj_Sharma gravatar image Mathanraj_Sharma  ( 2021-01-09 13:35:39 -0500 )edit
0

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

gvdhoorn gravatar image

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

@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 image PapaG  ( 2019-08-28 07:00:56 -0500 )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 image gvdhoorn  ( 2019-08-28 07:10:30 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 392 times

Last updated: Aug 28 '19