How can I access data from a service
Hi. How can I get the data from a service in real-time in my main python script? I found a service called "get_joint_properties" which returns the position of a revolute joint. From that service, I want to get the "Position" field value and work with it in "real-time" in my main python script. Is that possible? If yes, how?
Image : https://imgur.com/a/pT9dNHs
This sounds to me like normal use of service. Is it not? If you haven't seen it, can you review the python service client tutorial and further explain if you actually want something else?
Thank for your answer! I did it and I get a response on my main program. The response looks like this. My question now, is, can I get the only value which is stored in "position" field? Sorry if my questions seems stupid, but I'm new to ros.
Image : https://imgur.com/a/j8JBhX6
Yes, a service response is a python object generated to match the fields in the text description you show in your screenshot. The
position
field is a list of floating point values, so you would access that first value with something likeresp.position[0]