0
$\begingroup$

Rosanswers logo

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

http://wiki.ros.org/turtlesim/Tutorials/Moving%20in%20a%20Straight%20Line

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)

Originally posted by Zhoulai Fu on ROS Answers with karma: 186 on 2018-11-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Delb with karma: 3907 on 2018-11-26

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.