MCPcopy Create free account
hub / github.com/UZ-SLAMLab/ORB_SLAM3 / PredictStateIMU

Method PredictStateIMU

src/Tracking.cc:1738–1786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1736
1737
1738bool Tracking::PredictStateIMU()
1739{
1740 if(!mCurrentFrame.mpPrevFrame)
1741 {
1742 Verbose::PrintMess("No last frame", Verbose::VERBOSITY_NORMAL);
1743 return false;
1744 }
1745
1746 if(mbMapUpdated && mpLastKeyFrame)
1747 {
1748 const Eigen::Vector3f twb1 = mpLastKeyFrame->GetImuPosition();
1749 const Eigen::Matrix3f Rwb1 = mpLastKeyFrame->GetImuRotation();
1750 const Eigen::Vector3f Vwb1 = mpLastKeyFrame->GetVelocity();
1751
1752 const Eigen::Vector3f Gz(0, 0, -IMU::GRAVITY_VALUE);
1753 const float t12 = mpImuPreintegratedFromLastKF->dT;
1754
1755 Eigen::Matrix3f Rwb2 = IMU::NormalizeRotation(Rwb1 * mpImuPreintegratedFromLastKF->GetDeltaRotation(mpLastKeyFrame->GetImuBias()));
1756 Eigen::Vector3f twb2 = twb1 + Vwb1*t12 + 0.5f*t12*t12*Gz+ Rwb1*mpImuPreintegratedFromLastKF->GetDeltaPosition(mpLastKeyFrame->GetImuBias());
1757 Eigen::Vector3f Vwb2 = Vwb1 + t12*Gz + Rwb1 * mpImuPreintegratedFromLastKF->GetDeltaVelocity(mpLastKeyFrame->GetImuBias());
1758 mCurrentFrame.SetImuPoseVelocity(Rwb2,twb2,Vwb2);
1759
1760 mCurrentFrame.mImuBias = mpLastKeyFrame->GetImuBias();
1761 mCurrentFrame.mPredBias = mCurrentFrame.mImuBias;
1762 return true;
1763 }
1764 else if(!mbMapUpdated)
1765 {
1766 const Eigen::Vector3f twb1 = mLastFrame.GetImuPosition();
1767 const Eigen::Matrix3f Rwb1 = mLastFrame.GetImuRotation();
1768 const Eigen::Vector3f Vwb1 = mLastFrame.GetVelocity();
1769 const Eigen::Vector3f Gz(0, 0, -IMU::GRAVITY_VALUE);
1770 const float t12 = mCurrentFrame.mpImuPreintegratedFrame->dT;
1771
1772 Eigen::Matrix3f Rwb2 = IMU::NormalizeRotation(Rwb1 * mCurrentFrame.mpImuPreintegratedFrame->GetDeltaRotation(mLastFrame.mImuBias));
1773 Eigen::Vector3f twb2 = twb1 + Vwb1*t12 + 0.5f*t12*t12*Gz+ Rwb1 * mCurrentFrame.mpImuPreintegratedFrame->GetDeltaPosition(mLastFrame.mImuBias);
1774 Eigen::Vector3f Vwb2 = Vwb1 + t12*Gz + Rwb1 * mCurrentFrame.mpImuPreintegratedFrame->GetDeltaVelocity(mLastFrame.mImuBias);
1775
1776 mCurrentFrame.SetImuPoseVelocity(Rwb2,twb2,Vwb2);
1777
1778 mCurrentFrame.mImuBias = mLastFrame.mImuBias;
1779 mCurrentFrame.mPredBias = mCurrentFrame.mImuBias;
1780 return true;
1781 }
1782 else
1783 cout << "not IMU prediction!!" << endl;
1784
1785 return false;
1786}
1787
1788void Tracking::ResetFrameIMU()
1789{

Callers

nothing calls this directly

Calls 9

GetDeltaRotationMethod · 0.80
GetImuBiasMethod · 0.80
GetDeltaPositionMethod · 0.80
GetDeltaVelocityMethod · 0.80
SetImuPoseVelocityMethod · 0.80
NormalizeRotationFunction · 0.70
GetImuPositionMethod · 0.45
GetImuRotationMethod · 0.45
GetVelocityMethod · 0.45

Tested by

no test coverage detected