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

Converting twist into direction and a distance

asked 2013-09-21 08:50:51 -0500

Massbuilder gravatar image

updated 2013-11-18 07:18:18 -0500

tfoote gravatar image

My robot is design around a tank style control system which takes an angle of rotation and distance for commands, however the cmd_vel sends it data in a twist message, how do I covert the angular and linear velocities into a distance and an angle?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-09-21 09:07:25 -0500

dornhege gravatar image

updated 2013-09-21 09:25:15 -0500

You can't. Twist describes translational and rotational velocities. To get a distance/angle from that, you'd need a time frame that this should be set. You could assume some (short) time frame, or use the controller frequency that sends out those messages. This might work somehow.

If you want to receive twist commands from the default navigation stack, you'll need to modify your command interface (that probably already has some level of control). Alternatively you could write a local planner for the navigation stack that sends out local pose deltas.

If you want to use something else, just use another message to represent the command that you need and send that.

edit flag offensive delete link more


Any suggestions what topic I should use given that I can't use cmd_vel?

Massbuilder gravatar image Massbuilder  ( 2013-09-23 05:52:33 -0500 )edit

If you move to an actual position in your controller, you could just send a geometry_msgs/PoseStamped and set the frame_id to base_link.

dornhege gravatar image dornhege  ( 2013-09-23 06:04:01 -0500 )edit

Or change your controller to accept velocities (it will probably have that internally anyways) if you plan to use move_base at some point in time.

dornhege gravatar image dornhege  ( 2013-09-23 06:04:32 -0500 )edit

my robot is a complete custom job. At the moment it is a mobile base with a propellor microcontroller and some bump sensor

Massbuilder gravatar image Massbuilder  ( 2013-09-23 06:06:22 -0500 )edit

In that case isn't it easiest to just use velocities? That should make your controller easier too.

dornhege gravatar image dornhege  ( 2013-09-23 06:53:45 -0500 )edit

answered 2013-09-23 07:08:34 -0500

Massbuilder gravatar image

Being a beginner I will need some help figuring out how to do that, please direct me to the relevant tutorial or post. Also note at this moment I do not have speed control on my robot.

edit flag offensive delete link more


Please do not create answers for discussion or comments. Instead, either edit and append to your original post or use the comment functionality.

dornhege gravatar image dornhege  ( 2013-09-23 23:58:40 -0500 )edit

I was thinking that speed control would be what you have as that's usually easier than position. I don't know how the interface to your robot is on the lowest level that you have access to.

dornhege gravatar image dornhege  ( 2013-09-23 23:59:23 -0500 )edit

I think I have an idea on how to use position to navigate but it will require the current position of the robot, which topic or service do I use to find that

Massbuilder gravatar image Massbuilder  ( 2013-09-25 04:11:12 -0500 )edit

Question Tools

1 follower


Asked: 2013-09-21 08:50:51 -0500

Seen: 436 times

Last updated: Sep 21 '13