# turtlesim velocity units?

Can anyone tell me how to correlate a velocity message to turtlesim with its actual motion? In particular, I'm currently trying to get a specific rotation. I had assumed that sending a velocity message with angular=1 meant 1 radian per second for one second = 1 radian of rotation. Instead, I get something less than significantly less than this.

Using electric with ubuntu 10.4.

Thanks, Paul.

edit retag close merge delete

Sort by » oldest newest most voted

You are correct. The turtle moves in radians per second. So if you command your turtle to move at 6.28 rad/sec it will make one full revolution in 1 second. You can test this out by using this command since the turtle executes commands for 1 second it will make 1 revolution.

pub -1 /turtle1/command_velocity turtlesim/Velocity  0.0  6.28


EDIT: To command the turtle propgramatically in C++ you will need to repeatedly publish the command velocity until you achieve the desired angle because the turtle times out the velocity commands after 1 second if it does not receive a new command within that time window.

A good example of commanding the turtle in C++ is the turtle_actionlib package (http://ros.org/wiki/turtle_actionlib). The action server drives the turtle in a polygonal shape.

The turtle_actionlib draws regular polygons, the goal shown below takes in the number of sides and the radius of the circumscribed circle. When a goal is received, the goalCB() function computes the interior angles and apothem which are returned in the result in the action msg. Once a goal is received and the angles computed the controlCB() function publishes the velocity commands to draw the shape. Look in the shape_client.cpp file for how to send a goal to the shape_server.

#goal definition
int32 edges
---
#result definition
float32 interior_angle
float32 apothem
---
#feedback


You should not need to change the command duration. The point of having a timeout is so that the turtle behaves more like robots in the real world where you need to publish msgs at a steady rate to continue moving.

more

Thanks mwise_wg. I'm trying to do it programmatically. Is there any timer built into the command that I might need to implement in a C++ program?
( 2012-01-04 04:39:10 -0500 )edit
Again, thanks. Is it possible to use the turtle_actionlib to generate shapes besides the pentagon example? I'm not seeing how the actionlib actually takes a shape input. Also, is it possible to change the command duration? I tried altering the WallDuration(1.0) in turtle.cpp... but no luck.
( 2012-01-05 08:51:52 -0500 )edit

## Stats

Seen: 1,742 times

Last updated: Jan 05 '12