[ros-users] Passing arguments into service function

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
+ (text/html)
このメッセージを削除
このメッセージに返信
著者: User discussions
日付:  
To: User discussions
題目: [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