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

Revision history [back]

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

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

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.

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
float32 radius
---
#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.