[ros-users] Passing arguments into service function

Forside
Vedhæftede filer:
Indlæg som e-mail
+ (text/plain)
+ (text/html)
Slet denne besked
Besvar denne besked
Skribent: User discussions
Dato:  
Til: User discussions
Emne: [ros-users] Passing arguments into service function
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