mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-04 16:57:46 +08:00
refactored time jump detection
This commit is contained in:
@@ -1202,7 +1202,6 @@ void OdometryROS::reset(const Transform & pose)
|
|||||||
imus_.clear();
|
imus_.clear();
|
||||||
imuMutex_.unlock();
|
imuMutex_.unlock();
|
||||||
this->flushCallbacks();
|
this->flushCallbacks();
|
||||||
this->tfListener().clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OdometryROS::pause(std_srvs::Empty::Request&, std_srvs::Empty::Response&)
|
bool OdometryROS::pause(std_srvs::Empty::Request&, std_srvs::Empty::Response&)
|
||||||
|
|||||||
@@ -1023,15 +1023,6 @@ bool CoreWrapper::odomUpdate(const nav_msgs::OdometryConstPtr & odomMsg, ros::Ti
|
|||||||
{
|
{
|
||||||
if(!paused_)
|
if(!paused_)
|
||||||
{
|
{
|
||||||
// Check time jump in the past
|
|
||||||
if(stamp < previousStamp_) {
|
|
||||||
ROS_WARN("Detected time jump in the past of %f sec (previous stamp=%f, current stamp=%f). Resetting internal stamps and abort!",
|
|
||||||
previousStamp_.toSec() - stamp.toSec(), previousStamp_.toSec(), stamp.toSec());
|
|
||||||
previousStamp_ = ros::Time();
|
|
||||||
tfListener_.clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Transform odom = rtabmap_conversions::transformFromPoseMsg(odomMsg->pose.pose);
|
Transform odom = rtabmap_conversions::transformFromPoseMsg(odomMsg->pose.pose);
|
||||||
if(!odom.isNull())
|
if(!odom.isNull())
|
||||||
{
|
{
|
||||||
@@ -1143,15 +1134,6 @@ bool CoreWrapper::odomTFUpdate(const ros::Time & stamp)
|
|||||||
{
|
{
|
||||||
if(!paused_)
|
if(!paused_)
|
||||||
{
|
{
|
||||||
// Check time jump in the past
|
|
||||||
if(stamp < previousStamp_) {
|
|
||||||
ROS_WARN("Detected time jump in the past of %f sec (previous stamp=%f, current stamp=%f). Resetting internal stamps and abort!",
|
|
||||||
previousStamp_.toSec() - stamp.toSec(), previousStamp_.toSec(), stamp.toSec());
|
|
||||||
previousStamp_ = ros::Time();
|
|
||||||
tfListener_.clear();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Odom TF ready?
|
// Odom TF ready?
|
||||||
Transform odom = rtabmap_conversions::getTransform(odomFrameId_, frameId_, stamp, tfListener_, waitForTransform_?waitForTransformDuration_:0.0);
|
Transform odom = rtabmap_conversions::getTransform(odomFrameId_, frameId_, stamp, tfListener_, waitForTransform_?waitForTransformDuration_:0.0);
|
||||||
if(odom.isNull())
|
if(odom.isNull())
|
||||||
|
|||||||
Reference in New Issue
Block a user