ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

response of a server in python

asked 2011-07-10 09:34:14 -0600

Gauss Lee gravatar image

updated 2012-02-27 07:37:31 -0600

kwc gravatar image

Hi, everybody,

I have a simple question. If I have more than 2 responses in the srv file. How Can I use them in python code. How to use the servicenameResponse() function?

Cheers,

Gauss

edit retag flag offensive close merge delete

Comments

Can you give an example what you mean with "more than 2 responses". A service consists of 1 request and 1 response per srv file.
dornhege gravatar image dornhege  ( 2011-07-10 12:12:21 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
6

answered 2011-07-10 16:25:12 -0600

fergs gravatar image

Posting your actual .srv file would help, but I think you just have a bit of terminology issues. If you have two lines in your response section of the service definition, you would have two fields in the response message. For instance, if servicename.srv is:

int8 someRequestStuff
---
int8 firstThingToReturn
int8 secondThingToReturn

In this case, you could:

resp = servicenameResponse()
resp.firstThingToReturn = 1
resp.secondThingToReturn = 2
return resp
edit flag offensive delete link more
0

answered 2012-06-03 16:00:35 -0600

malong gravatar image

i have edit this problem ,all the clod are here http://answers.ros.org/question/35502/i-want-to-send-multiple-requst-and-multiple/ may it help you

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-07-10 09:34:14 -0600

Seen: 3,551 times

Last updated: Jun 03 '12