design question: topic vs service?
topics seem like the best way for storing "states" of the robot (stateful). so that we can monitor all states/components of the robots like position, temperature, voltage, etc. that makes sense to me.
however, i also see a lot of people using topics as a way to send instructions/commands to the robots (like the topic /head_pan_joint/command for sending commands to servos, like /cmd_vel for sending movement instructions to mobile base, etc). in this case, it doesn't make sense to me.
it seems to me that this should be designed as a service (stateless). if you want to send a command to servo, create a service at the servo level that can be called upon. if you want to send a command to mobile base, create a service at the mobile base that can be called upon.
what are the advantages of designing things like /cmd_vel and /head_pan_joint/command as topics? what are the disadvantages of desigining them as services?
thanks.
Why are topics supposed to be stateful and services stateless?
that's just how i see they could work. topics seem to be best used for storing "robot states" (like temperature, position, etc). so that's what i meant by 'stateful'. services seem to be best for handling actions and don't need to store any states. would love to hear your thoughts.
and, i guess actionlib was created as something in between to feed "states" on "service" calls? i'm new to ros... so i would love to understand how/why these fundametal ros concepts were designed and intended to be used. would love to hear your thoughts.
This question: http://answers.ros.org/question/11834/when-should-i-use-topics-vs-services-vs-actionlib-actions-vs-dynamic_reconfigure/ the use cases of topics/services/actions
thanks. that design pattern doc is really helpful!