Subscribe from service example
Hi,
lets say that I have a service that needs some additional resources which is available via topic. Is there some example how this can be implemented?
Thanks
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Hi,
lets say that I have a service that needs some additional resources which is available via topic. Is there some example how this can be implemented?
Thanks
The recommended way to do this is to have a subscription to the topic which stores the latest value in a persistent location. Then you can use that value in your service callback.
I'm not sure what the best practice is, but I've always used ros::topic::waitForMessage. It gets one message on the topic you specify.
Asked: 2013-01-10 21:44:23 -0600
Seen: 560 times
Last updated: Jan 11 '13
Reasons for slow response to actions, services, messages?
Having confusion over nodes’ communication methods: by topics and by service.
What is the preferable way to share states among multiple nodes in ROS?
Latching more than one message
How to create subscriber in a publisher
ROS topic does not unbind/close when app closes
ros2 topic /initialpose doesn't echo