ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Your code looks reasonable; with the Rate object that you're using, it should be running at 10Hz.
Some virtual machines don't implement the high-precision timers correctly, and I think ROS uses the high-precision timers for rates and sleeps. As a first debugging step, it would be good to add a ROS_INFO message to each loop iteration, and print the ROS time, so that you can see if ROS is interpreting time correctly or not. Try something like
ROS_INFO_STREAM("Now: " << ros::Time::now());