Ask Your Question

How to control Turtle using C++ example?

asked 2013-04-15 21:15:08 -0500

Hi, I'm running ROS Fuerte and Ubuntu 12.04 and consider myself a newbie and would like to modify the tutorial 'Writing a Publisher and Subscriber' to control TurtleSim. I'm not clear on how to send the data to the turtle or the format it should be in, I can control the velocity from the command line, but how is this structured in C++? Are there any snippets of code that show this? Many thanks for reading, Sam

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-04-15 22:58:44 -0500

davinci gravatar image

Unfortunately is down again. But you should write a publisher to the command velocity topic. Using rostopic info on that topic you can see what the input data type to the topic should be. That should be published to the topic like in the publisher subscriber example.

edit flag offensive delete link more


Ok, I can publish text, but how to publish float32 linear and float32 angular? How do I modify the example:

ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000); std_msgs::String msg; std::stringstream ss; = ss.str(); chatter_pub.publish(msg);

Sam Wane gravatar image Sam Wane  ( 2013-04-16 21:40:28 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-04-15 21:15:08 -0500

Seen: 206 times

Last updated: Apr 15 '13