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

In the turtlesim tutorial "Moving in a straightline", which instructions actually move the turtle?

asked 2018-11-26 01:43:49 -0500

updated 2018-11-26 01:59:19 -0500

I am reading the turtlesim tutorial "Moving in a straightline".

http://wiki.ros.org/turtlesim/Tutoria...

I do not understand how the software moves the simulated turtle. The only relevant program segment in the tutorial seems to be in lines 8 and 37-38 (see below). But those lines are about publishing a message, vel_msg, to a channel turtle1/cmd_vel . So, I would like to know which instructions actually make the turtle move (since publishing a message does not do the job). Any clarification?

 8     velocity_publisher = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10)
...
37             #Publish the velocity
38             velocity_publisher.publish(vel_msg)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-11-26 02:04:14 -0500

Delb gravatar image

Publishing on the topic /turtleX/cmd_vel allows you to send a velocity command (linear and angular). The node turtlesim subscribes to this topic and set the position of the turtlebot according to the command (code here).

(since publishing a message does not do the job)

It doesn't actually do the job but that's how you can send easy instructions instead of manually calculate the new pose of the turtle for each command.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-11-26 01:43:49 -0500

Seen: 1,141 times

Last updated: Nov 26 '18