NDEVR
API Documentation
LocalMapping.h
1#pragma once
2#include "OrbSLAM/Headers/KeyFrame.h"
3#include "OrbSLAM/Headers/Atlas.h"
4#include "OrbSLAM/Headers/LoopClosing.h"
5#include "OrbSLAM/Headers/Tracking.h"
6#include "OrbSLAM/Headers/KeyFrameDatabase.h"
7
8#include <mutex>
9namespace NDEVR
10{
11
12 class OrbSLAM;
13 class Tracking;
14 class LoopClosing;
15 class Atlas;
16 class InfoPipe;
17
24 {
25 public:
33 LocalMapping(OrbSLAM* pSys, Atlas* pAtlas, bool bMonocular, bool bInertial, LogPtr log);
34
39 void setCameraSettings(bool bMonocular, bool bInertial);
43 void SetLoopCloser(LoopClosing* pLoopCloser);
44
48 void SetTracker(Tracking* pTracker);
54 void Run();
55
61 void EmptyQueue();
62
72 bool Stop();
74 void Release();
78 bool isStopped();
90 void SetAcceptKeyFrames(bool flag);
95 bool SetNotStop(bool flag);
104
111
112 uint04 KeyframesInQueue()
113 {
114 std::unique_lock<std::mutex> lock(mMutexNewKFs);
115 return cast<uint04>(mlNewKeyFrames.size());
116 }
117
118 bool IsInitializing();
119 double GetCurrKFTime();
120 KeyFrame* currentKeyFrame();
121
122 std::mutex mMutexImuInit;
123
124 Eigen::MatrixX<g_type> mcovInertial;
125 Eigen::Matrix3<g_type> m_gyro_rotation;
126 Eigen::Vector3<g_type> m_gyro_bias;
127 Eigen::Vector3<g_type> mba;
128 fltp04 m_scale = 1.0f;
129
130 unsigned int mInitSect;
131 unsigned int mIdxInit;
132 fltp08 m_initial_timestamp;
133
134 // For debugging (erase in normal mode)
135
136 bool mbNotBA1 = true;
137 bool mbNotBA2 = true;
138 bool mbBadImu = false;
139
140 // not consider far points (clouds)
141 bool mbFarPoints;
142 float mThFarPoints;
143 protected:
144 void processIMUKeyFrame();
145 bool CheckNewKeyFrames();
146 void processNextKeyFrame();
147 void CreateNewMapPoints();
148 void handleNewKeyFrame();
149 void MapPointCulling();
150 void SearchInNeighbors();
151 void KeyFrameCulling();
152
153 Optimizer m_optimizer;
154 OrbSLAM* mpSystem;
155 ORBmatcher m_matcher;
156 bool mbMonocular = false;
157 bool mbInertial = false;
158
159 void ResetIfRequested();
160
161 bool CheckFinish();
162 void SetFinish();
163
164 private:
165 Buffer<Vector<2, uint04>> m_matched_indices;
166 Atlas* mpAtlas = nullptr;
167
168 LoopClosing* mpLoopCloser = nullptr;
169 Tracking* mpTracker = nullptr;
170
171 Buffer<KeyFrame*> mlNewKeyFrames;
172
173 KeyFrame* m_current_keyframe = nullptr;
174
175 Buffer<MapPoint*> mlpRecentAddedMapPoints;
176
177 std::mutex mMutexNewKFs;
178
179
180
181 bool mbAcceptKeyFrames = true;
182
183 void InitializeIMU(float priorG = 1e2, float priorA = 1e6, bool bFirst = false);
184 void ScaleRefinement();
185
186
187
188 fltp08 mTinit;
189 LogPtr m_log;
190
191 bool bInitializing = false;
192 bool mbAbortBA = false;
193 bool mbStopped = false;
194 bool mbStopRequested = false;
195 bool mbNotStop = false;
196 bool mbResetRequested = false;
197 bool mbResetRequestedActiveMap = false;
198 bool mbFinishRequested = false;
199 bool mbFinished = true;
200
201 };
202
203}
Manages a collection of maps for the ORB-SLAM system.
Definition Atlas.h:29
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A light-weight base class for Log that allows processes to update, without the need for additional in...
A keyframe in the SLAM map, derived from Frame.
Definition KeyFrame.h:31
void RequestReset()
Requests a full reset of the local mapper.
void InterruptBA()
Interrupts any running bundle adjustment.
void RequestFinish()
Requests the local mapper to finish.
void InsertKeyFrame(KeyFrame *pKF)
Inserts a new keyframe into the processing queue.
void Release()
Releases the local mapper from a stopped state.
void SetAcceptKeyFrames(bool flag)
Sets whether the local mapper accepts keyframes.
bool stopRequested()
Checks whether a stop has been requested.
void RequestResetActiveMap()
Requests a reset of the active map only.
fltp04 inertialPercent() const
Returns the IMU initialization progress as a percentage.
void EmptyQueue()
Processes all queued keyframes without blocking.
bool SetNotStop(bool flag)
Sets whether the local mapper can be stopped.
Buffer< std::pair< Eigen::Vector3f, Vector< 2, uint04 > > > FindSharedPoints(KeyFrame *a, KeyFrame *b)
Finds shared 3D points between two keyframes.
void SetTracker(Tracking *pTracker)
Sets the tracker reference.
void SetLoopCloser(LoopClosing *pLoopCloser)
Sets the loop closer reference.
bool isFinished()
Checks whether the local mapper has finished.
void RequestStop()
Requests the local mapper to stop.
LocalMapping(OrbSLAM *pSys, Atlas *pAtlas, bool bMonocular, bool bInertial, LogPtr log)
Constructs the local mapper.
bool AcceptKeyFrames()
Checks whether the local mapper is accepting keyframes.
void setCameraSettings(bool bMonocular, bool bInertial)
Updates the camera mode settings.
bool Stop()
Attempts to stop the local mapper.
bool isStopped()
Checks whether the local mapper is stopped.
void Run()
Main local mapping loop.
A light-weight wrapper that will be a no-op if there is not a valid log reference,...
Detects and corrects loop closures and map merges.
Definition LoopClosing.h:29
Matches ORB features between frames, keyframes, and map points.
Definition ORBmatcher.h:26
Provides graph optimization routines for the ORB-SLAM system.
Definition Optimizer.h:34
Main entry point for the ORB-SLAM3 system.
Definition System.h:37
Main tracking thread that processes each frame and estimates camera pose.
Definition Tracking.h:33
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Definition Angle.h:408