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

# 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