ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
![]() | 1 | initial version |
You should subscribe to a topic - services are mostly used when you want data infrequently, or care that the recipient is ready to process it. For this type of communication, it's OK if messages get dropped, and you always want to be executing the most recent command.
I think that there are two reasonable options for pre-defined messages to use:
This is the simplest possible message, designed for a robot that can either move forward or rotate in place. If your robot's motion is more complicated, then this isn't an option. The advantage of this is that it's compatible with the turtlesim tutorials, and you can use turtle_teleop to immediately drive your robot around. (But writing your own teleop node is really easy!)
2) geometry_msgs/Twist (traditionally published on the "/cmd_vel" topic)
This is what's used in the navigation stack, and can be used to describe more complicated motion. It's probably the most common message used for this purpose. Here's one example for a sphero, and a stupid-simple driver for an m3pi that I recently wrote.