ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

standard messages?

asked 2013-07-23 18:40:35 -0500

frank gravatar image

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?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-07-23 19:45:03 -0500

lindzey gravatar image

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

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.

edit flag offensive delete link more

Comments

2

All of the real robots I've seen use geometry_msgs/Twist on the /cmd_vel topic

ahendrix gravatar image ahendrix  ( 2013-07-23 20:04:47 -0500 )edit
0

answered 2013-07-24 10:25:22 -0500

frank gravatar image

updated 2013-07-24 10:25:49 -0500

Thanks, that will get me moving in the right direction. (pun intended)

What happens when my robot driver doesn't support a particular message. Do I need to add support for that message to my driver, or do I write a message conversion node?

edit flag offensive delete link more

Comments

Just FYI - this type of info should be added as a comment to the answer (for "that worked"/follow up questions on answer details), or as an update to the question (if it's more information about requirements/refining the question).

lindzey gravatar image lindzey  ( 2013-07-24 10:32:18 -0500 )edit

I'm afraid I don't understand what you're getting at here - are you worried about other message types for specifying motion, or for additional functionality that your robot has?

lindzey gravatar image lindzey  ( 2013-07-24 10:33:49 -0500 )edit

Yes, both. For example, if my driver subscribes to the the turtlesim/Velocity message, and later I want to add the navigation stack, which uses geometery_msg/Twist, should I add support for Twist to my driver, or should I create a node that subscribes to Twist and publishes Velocity?

frank gravatar image frank  ( 2013-07-24 11:08:25 -0500 )edit

I'm really just looking for "best practices" at the moment.

frank gravatar image frank  ( 2013-07-24 11:09:27 -0500 )edit

In this particular case, I'd say just use geometry_msgs/Twist, because that's the interface that pretty much all robots use. =) (I'd only use the turtlesim/Velocity if I had compelling reasons to match the tutorials)

lindzey gravatar image lindzey  ( 2013-07-24 11:35:08 -0500 )edit

I'm not enough of an expert to want to make a proclamation for the general case - I've seen both approaches used.

lindzey gravatar image lindzey  ( 2013-07-24 11:35:57 -0500 )edit

Question Tools

Stats

Asked: 2013-07-23 18:40:35 -0500

Seen: 375 times

Last updated: Jul 24 '13