ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Hi,
i am not sure why you want two different services that perform the same function. Other than that i would do as you mentioned and include this data in the service definition (.srv file).
2 | No.2 Revision |
Hi,
i am not sure why you want two different services that perform the same function. Other than that i would do as you mentioned and include this data in the service definition (.srv file).
Edit:
When you look at the definition of the rospy services you can clearly see that there are no callback arguments expected. You can always use your Service definition in the .srv you are using to add a field like an string or int for the robot ID to be passed to the service call. For example you could take the AddTwoInts.srv
int64 a
int64 b
---
int64 sum
and modify it to look like this
int64 a
int64 b
int64 robotid
---
int64 sum
In your service callback you can than access this value and change the response message accordingly. For this you should rename the file, add it to the CMakeLists.txt in the package the .srv file is in and make a catkin_make to generate the needed include files.