0
$\begingroup$

Rosanswers logo

I'm a noob. I've installed ROS on my beagle bone and just worked through the tutorials (I ran the tutorial on the ROS VM).

Now I want to use ROS to control my custom robot. The first thing I want to write is a driver/node/package to control the motor drivers. But, I'm not sure what kind of interface my driver should expose.

Firstly, do I just subscribe to a message type (topic?), or do I create a service? What messages do I use to make my robot move? The turtle tutorial used turtlesim/Velocity to move the robot. I've browsed the code of some other packages, art_servo for example, has throttle, brake and acceleration messages. It looks like these drivers can only work with nodes that specifically know what message to send, that is, there is no standard motion messages.

Is that correct? How reusable are packages written by others if they create their own messages each time?

Or am I missing something?


Originally posted by frank on ROS Answers with karma: 11 on 2013-07-23

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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:

  1. turtlesim/Velocity

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!)

  1. 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.


Originally posted by lindzey with karma: 1780 on 2013-07-23

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by ahendrix on 2013-07-23:
All of the real robots I've seen use geometry_msgs/Twist on the /cmd_vel topic

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.