[ros-users] Passing arguments into service function

joao bimbo joaommsb at gmail.com
Mon Oct 25 17:36:08 UTC 2010


Hello everybody

I've been trying to learn the basics on ROS and i've come across this issue:

when I want to get an argument into a callback function in a normal
subscriber i do this:
 ros::Subscriber sub = n.subscribe<std_msgs::String>("control", 1000,
boost::bind(controlCallback,_1,&z));

but if I want to make a similar thing into a service-called function i tried
this (I want to pass the argument 500 into function troca):
 ros::ServiceServer service =
n.advertiseService<std_msgs::String>("switcher",boost::bind(troca,_1,_2,500));

And it doesn't work.

Can somebody help?
Thanks in advance
João
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20101025/f1bac5aa/attachment-0002.html>


More information about the ros-users mailing list