| 1736 | |
| 1737 | |
| 1738 | bool 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 | |
| 1788 | void Tracking::ResetFrameIMU() |
| 1789 | { |
nothing calls this directly
no test coverage detected