mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 16:57:46 +08:00
DbPlayer: fixed tf delay when rate=-1
This commit is contained in:
@@ -136,7 +136,9 @@ int main(int argc, char** argv)
|
|||||||
ros::Publisher scanPub;
|
ros::Publisher scanPub;
|
||||||
tf2_ros::TransformBroadcaster tfBroadcaster;
|
tf2_ros::TransformBroadcaster tfBroadcaster;
|
||||||
|
|
||||||
|
UTimer timer;
|
||||||
rtabmap::OdometryEvent odom = reader.getNextData();
|
rtabmap::OdometryEvent odom = reader.getNextData();
|
||||||
|
double acquisitionTime = timer.ticks();
|
||||||
while(ros::ok() && odom.data().id())
|
while(ros::ok() && odom.data().id())
|
||||||
{
|
{
|
||||||
ROS_INFO("Reading sensor data %d...", odom.data().id());
|
ROS_INFO("Reading sensor data %d...", odom.data().id());
|
||||||
@@ -238,7 +240,7 @@ int main(int argc, char** argv)
|
|||||||
// publish transforms first
|
// publish transforms first
|
||||||
if(publishTf)
|
if(publishTf)
|
||||||
{
|
{
|
||||||
ros::Time tfExpiration = time + ros::Duration(1.0/rate);
|
ros::Time tfExpiration = time + ros::Duration(rate>0?1.0/rate:acquisitionTime);
|
||||||
|
|
||||||
rtabmap::Transform localTransform;
|
rtabmap::Transform localTransform;
|
||||||
if(odom.data().cameraModels().size() == 1)
|
if(odom.data().cameraModels().size() == 1)
|
||||||
@@ -391,6 +393,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
odom = reader.getNextData();
|
odom = reader.getNextData();
|
||||||
|
acquisitionTime = timer.ticks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user