0
$\begingroup$

Rosanswers logo

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


Originally posted by Sam Wane on ROS Answers with karma: 11 on 2013-04-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Unfortunately ros.org 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.


Originally posted by davinci with karma: 2573 on 2013-04-15

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Sam Wane on 2013-04-16:
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; msg.data = ss.str(); chatter_pub.publish(msg);

$\endgroup$

Your Answer

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