Sleep 1 ms when publish imu in ros

This commit is contained in:
John Zhao 2018-04-16 17:18:27 +08:00
parent 3c65958c10
commit 03d6043c08

View File

@ -252,6 +252,8 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
<< ", gyro_y: " << data.imu->gyro[1] << ", gyro_y: " << data.imu->gyro[1]
<< ", gyro_z: " << data.imu->gyro[2] << ", gyro_z: " << data.imu->gyro[2]
<< ", temperature: " << data.imu->temperature); << ", temperature: " << data.imu->temperature);
// Sleep 1ms, otherwise publish may drop some datas.
ros::Duration(0.001).sleep();
}); });
time_beg_ = ros::Time::now().toSec(); time_beg_ = ros::Time::now().toSec();