ljl16

last publisher

Nov 23rd, 2011
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ros/ros.h"
  2. //#include "geometry_msgs/Twist.h"
  3. #include "std_msgs/String.h"
  4.  
  5. #include <sstream>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9. ros::init(argc, argv, "talker");
  10. ros::NodeHandle n;
  11. ros::Publisher chatter_pub = n.advertise<geometry_msgs::Twist>("cmd_vel", 1000);
  12. ros::Rate loop_rate(10);
  13.  
  14. int count = 0;
  15. while (ros::ok())
  16. {
  17. geometry_msgs::Twist msg;
  18. msg.linear.x = 10;
  19. msg.angular.z = 5;
  20. chatter_pub.publish(msg);
  21. ros::spinOnce();
  22. loop_rate.sleep();
  23. ++count;
  24. }
  25. return 0;
  26. }
  27.  
RAW Paste Data