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

writing a subscriber with 2 arguments

asked 2016-05-10 17:30:34 -0500

BBB gravatar image

Hi, im new to ROS and PCL and i want to process the data provided by a xtion pro live using openni. my goal is to estimate a groundplane using a function

void groundplane (CloudT::ConstPtr cloud_in, CloudT::Ptr cloud_out) { ...code... }

So the function needs 2 arguments, a pointcloud cloud_in from the xtion and a pointcloud cloud_out that should be empty at the beginning. searching the web i think i need to use boost::bind, but i cant figure out how. help would be very much appreciated

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-05-10 20:51:53 -0500

ahendrix gravatar image

It looks like you're trying to use cloud_out as an output parameter. This isn't a good idea.

All of the parameters to your callback function should be inputs. They can be messages or static inputs, but since the arguments (other than the message) are passed in once when you create the publisher, you shouldn't pass in something that the callback will attempt to modify.

Depending on what you're trying to do, you could write your callback to modify a global variable or a class member, or it could publish the output cloud on a new topic.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-05-10 17:30:34 -0500

Seen: 117 times

Last updated: May 10 '16