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

read cmd_vel commands from a text file

asked 2013-02-18 20:29:00 -0500

Evis gravatar image

Hello all,

Please, note that I'm a beginner in ROS. I'm using the turtlebot robot in gazebo. I know how to send a velocity command from the terminal, e.g., move forward 1m/s. But, What I would like is to send a sequence of consecutive commands. Would it be possible to read them from a text file, for example?

I hope my questions makes sense, Thanks in advance

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2013-02-18 21:16:10 -0500

Tadhg Fitzgerald gravatar image

updated 2013-02-18 21:17:19 -0500

I haven't worked with turtlebot or gazebo but the answer is almost certainly yes. The basic idea is that you want to read your text file line by line as you normally would in python/c++. Split each line into different values you want then publish these programmatically as Twist messages as explained in this tutorial http://pharos.ece.utexas.edu/wiki/index.php/Writing_A_Simple_Node_that_Moves_the_iRobot_Create_Robot#Create_the_Program. You should do all of this work inside a node which you start after your robot has started. Hope this helps.

edit flag offensive delete link more

Comments

Thanks. I got the idea. That should do it.

Evis gravatar image Evis  ( 2013-02-18 23:29:37 -0500 )edit
3

answered 2013-02-18 23:47:12 -0500

dornhege gravatar image

You can just use the rostopic tools for that. Create a yaml text file with contents in the same format that rostopic echo cmd_vel would give you (or in general for any other message) and pipe that file into rostopic, e.g.:

cat my_cmds.txt | rostopic echo /cmd_vel geometry_msgs/Twist
edit flag offensive delete link more
1

answered 2013-03-21 14:45:36 -0500

Chik gravatar image
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-18 20:29:00 -0500

Seen: 1,899 times

Last updated: Mar 21 '13