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

Revision history [back]

click to hide/show revision 1
initial version

Move your

  ros::Subscriber odom_sub = n.subscribe("p3dx/odom", 1000, velsubcallback);

outside the while loop. the subscriber only needs to be created once! And be sure to call ros::spinOnce() in your loop. This is the point code code where your callback are actually called!