[ros-users] Passing arguments into service function

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: User discussions
Subject: [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