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

velodyne_points with timesync

asked 2016-07-06 03:38:47 -0600

b-sriram gravatar image

updated 2016-07-06 16:55:34 -0600

joq gravatar image

Hi, I have three point cloud topics and want to use time sync, i.e. message filter, to sync and read them.

But I get a huge error. This is the part where I define the subscriber.

 sub_HDL_1  = new message_filters::Subscriber<VPointCloud>(nh, "HDL_1/velodyne_points", 1);
 sub_HDL_2  = new message_filters::Subscriber<VPointCloud>(nh, "HDL_2/velodyne_points", 1);
 sub_VLP  = new message_filters::Subscriber<VPointCloud>(nh, "VLP/velodyne_points", 1);
 timesync = new message_filters::TimeSynchronizer<VPointCloud, VPointCloud, VPointCloud>(*sub_HDL_1, *sub_HDL_2, *sub_VLP, 50);
 timesync->registerCallback(boost::bind(&myclass::dataReceived, this, _1, _2, _3));

>  error: could not convert ‘m.pcl::PointCloud<velodyne_pointcloud::PointXYZIR>::header.pcl::PCLHeader::stamp’ from ‘const uint64_t {aka const long unsigned int}’ to ‘ros::Time’
 static ros::Time value(const M& m) { return m.header.stamp; }

Has someone done this before or have any idea how to solve it? Thanks in advance.

edit retag flag offensive close merge delete

Comments

The ROS message header has a ros::Time stamp, while PCL now has its own uint64_t stamp, a different type. The pcl_ros package provides some translation between the two. I don't see a message filter there, however.

joq gravatar image joq  ( 2016-07-06 17:11:53 -0600 )edit

Are you trying to combine complete rotational scans from all three devices? That probably won't work very well. Maybe it would help if you explain what you are trying to achieve.

joq gravatar image joq  ( 2016-07-06 17:13:44 -0600 )edit

hi thanks. I have a seperate visualisation app and i want to pass the topics to this program to see all the point clouds from the velodynes. So if i can have a message filter then I can sync them in time.

b-sriram gravatar image b-sriram  ( 2016-07-07 03:03:13 -0600 )edit

It would probably work better to display each scan message when it arrives (separately), showing it for some reasonable duration, depending on rotational rate (100ms, or maybe 200ms for the default 10Hz spin rate). I believe that is how rviz does it.

joq gravatar image joq  ( 2016-07-11 11:15:14 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2016-07-07 06:40:55 -0600

joq gravatar image

Try using sensor_msgs::PointCloud2 instead of VPointCloud.

edit flag offensive delete link more

Comments

ya i used the same to sync.. but I'm not able to read the unit8[] data i.ie the point cloud out of it.

That's y i switched to VpointCloud as you had suggested in a previous question. http://answers.ros.org/question/13281...

b-sriram gravatar image b-sriram  ( 2016-07-07 07:41:18 -0600 )edit

I suppose you could try the PointCloud2 iterator in the sensor_msgs package: http://docs.ros.org/kinetic/api/senso...

joq gravatar image joq  ( 2016-07-07 09:11:42 -0600 )edit

hi,

I tried what you suggested but there is a complication. The timesync call back uses a const Ptr and the Pointcloud2 Iterator doesn't

sensor_msgs::PointCloud2Iterator<float> iter_x(*points_msg, "x");
b-sriram gravatar image b-sriram  ( 2016-07-08 07:16:20 -0600 )edit

There is a const iterator, too: http://docs.ros.org/kinetic/api/senso...

joq gravatar image joq  ( 2016-07-08 16:52:05 -0600 )edit

thanks. So this is my subscriber here and when i run the node, theres nothing happening. The registered call back function doesn't get called at all (i see this as i cannot see any output 's')

b-sriram gravatar image b-sriram  ( 2016-07-11 02:00:41 -0600 )edit

void myclass::cloudReceived(const sensor_msgs::PointCloud2ConstPtr& points1, const sensor_msgs::PointCloud2ConstPtr& points2) { std::cout <<"s"; sensor_msgs::PointCloud2ConstIterator<float> iter_x1(*points1, "x"); sensor_msgs::PointCloud2ConstIterator<float> iter_x2(*points2, "x"); }

b-sriram gravatar image b-sriram  ( 2016-07-11 02:01:10 -0600 )edit

Maybe the time synchronizer is not working for such widely-space messages?

joq gravatar image joq  ( 2016-07-11 11:17:40 -0600 )edit

Are all of the devices definitely providing data?

joq gravatar image joq  ( 2016-07-11 11:18:09 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-07-06 03:38:47 -0600

Seen: 807 times

Last updated: Jul 06 '16