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

Method TrackWithMotionModel

src/Tracking.cc:2854–2947  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2852}
2853
2854bool Tracking::TrackWithMotionModel()
2855{
2856 ORBmatcher matcher(0.9,true);
2857
2858 // Update last frame pose according to its reference keyframe
2859 // Create "visual odometry" points if in Localization Mode
2860 UpdateLastFrame();
2861
2862 if (mpAtlas->isImuInitialized() && (mCurrentFrame.mnId>mnLastRelocFrameId+mnFramesToResetIMU))
2863 {
2864 // Predict state with IMU if it is initialized and it doesnt need reset
2865 PredictStateIMU();
2866 return true;
2867 }
2868 else
2869 {
2870 mCurrentFrame.SetPose(mVelocity * mLastFrame.GetPose());
2871 }
2872
2873
2874
2875
2876 fill(mCurrentFrame.mvpMapPoints.begin(),mCurrentFrame.mvpMapPoints.end(),static_cast<MapPoint*>(NULL));
2877
2878 // Project points seen in previous frame
2879 int th;
2880
2881 if(mSensor==System::STEREO)
2882 th=7;
2883 else
2884 th=15;
2885
2886 int nmatches = matcher.SearchByProjection(mCurrentFrame,mLastFrame,th,mSensor==System::MONOCULAR || mSensor==System::IMU_MONOCULAR);
2887
2888 // If few matches, uses a wider window search
2889 if(nmatches<20)
2890 {
2891 Verbose::PrintMess("Not enough matches, wider window search!!", Verbose::VERBOSITY_NORMAL);
2892 fill(mCurrentFrame.mvpMapPoints.begin(),mCurrentFrame.mvpMapPoints.end(),static_cast<MapPoint*>(NULL));
2893
2894 nmatches = matcher.SearchByProjection(mCurrentFrame,mLastFrame,2*th,mSensor==System::MONOCULAR || mSensor==System::IMU_MONOCULAR);
2895 Verbose::PrintMess("Matches with wider search: " + to_string(nmatches), Verbose::VERBOSITY_NORMAL);
2896
2897 }
2898
2899 if(nmatches<20)
2900 {
2901 Verbose::PrintMess("Not enough matches!!", Verbose::VERBOSITY_NORMAL);
2902 if (mSensor == System::IMU_MONOCULAR || mSensor == System::IMU_STEREO || mSensor == System::IMU_RGBD)
2903 return true;
2904 else
2905 return false;
2906 }
2907
2908 // Optimize frame pose with all matches
2909 Optimizer::PoseOptimization(&mCurrentFrame);
2910
2911 // Discard outliers

Callers

nothing calls this directly

Calls 5

SearchByProjectionMethod · 0.80
ObservationsMethod · 0.80
isImuInitializedMethod · 0.45
SetPoseMethod · 0.45
GetPoseMethod · 0.45

Tested by

no test coverage detected