ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I think the confusion is that in the publisher/subscriber tutorial, the message type just happens to be a string, whereas the message type you want to be publishing is not a string, but a geometry_msgs/Twist. At the top of your while loop, you should have something like
geometry_msgs::Twist msg;
then you need to fill in the message's data fields:
msg.linear.x = 10;
msg.angular.z = 5;
The syntax you're using is only for the command line tool rostopic pub.
2 | No.2 Revision |
I think the confusion is that in the publisher/subscriber tutorial, the message type just happens to be a string, whereas the message type you want to be publishing is not a string, but a geometry_msgs/Twist. At the top of your while loop, you should have something like
geometry_msgs::Twist msg;
then you need to fill in the message's data fields:
msg.linear.x = 10;
msg.angular.z = 5;
The syntax you're using is only for the command line tool rostopic pub.
To visualize a laser scan, you should check out rviz.