37 typedef std::map<KeyFrame*, Sim3, std::less<KeyFrame*>,
40 void globalBundleAdjustment(
Map* pMap,
int nIterations=5,
bool *pbStopFlag=
nullptr,
const uint04 nLoopKF = 0,
const bool bRobust =
true);
41 void fullInertialBA(
Map *pMap,
int its,
const bool bFixLocal=
false,
const uint04 nLoopKF = 0,
bool* pbStopFlag =
nullptr,
bool bInit=
false,
float priorG = 1e2,
float priorA=1e6);
43 void localBundleAdjustment(
KeyFrame* pKF,
bool *pbStopFlag,
Map *pMap);
46 uint04 poseInertialOptimizationLastFrame(
Frame& pFrame,
Frame* reference_frame,
bool locked_frame,
bool bRecInit =
false);
47 template<
class t_solver_type>
49 , std::function<
bool(
KeyFrame* pKFi,
MapPoint* pMP)> filter,
bool use_kernels);
50 template<
class t_solver_type>
52 , std::function<
bool(
KeyFrame* pKFi,
MapPoint* pMP)> filter,
bool use_kernels);
58 const bool &bFixScale);
71 Sim3 &ParkeS12,
const float th2,
const bool bFixScale,
const bool bAllPoints=
false);
75 void localInertialBA(
KeyFrame* pKF,
bool *pbStopFlag,
bool bLarge =
false,
bool bRecInit =
false);
83 static Eigen::MatrixX<g_type> Marginalize(
const Eigen::MatrixX<g_type>& H,
int start,
int end);
86 void inertialOptimization(
Map *pMap, Eigen::Matrix3<g_type>& Rwg,
fltp04& scale, Eigen::Vector3<g_type>& bg, Eigen::Vector3<g_type>& ba,
bool bMono,
bool bFixedVel=
false,
float priorG = 1e2,
float priorA = 1e6);
87 void inertialOptimization(
Map *pMap, Eigen::Vector3<g_type>& bg, Eigen::Vector3<g_type>& ba,
float priorG = 1e2,
float priorA = 1e6);
88 void inertialOptimization(
Map *pMap, Eigen::Matrix3<g_type>& Rwg,
fltp04& scale);
91 EIGEN_MAKE_ALIGNED_OPERATOR_NEW;
92 template<
class t_edge>
93 struct MP :
public t_edge
95 MP(t_edge&& e = t_edge())
96 : t_edge(
std::forward<t_edge>(e))
98 void eraseIfNeeded(g_type chi)
102 if (t_edge::chi2() <= chi && t_edge::isDepthPositive())
109 WLock lock(point->featureLockPtr());
110 point->eraseObservation(frame);
116 template<
class t_edge>
117 struct MI :
public t_edge
119 MI(t_edge&& e = t_edge())
120 : t_edge(std::forward<t_edge>(e))
125 IndexScratch m_scratch_pad;
126 Buffer<MapPoint*> m_local_map_points;
127 Buffer<VertexSE3Expmap> m_se3_exp_map;
128 Buffer<MP<EdgeSE3ProjectXYZ>> m_edges_mono;
129 Buffer<MP<EdgeSE3ProjectXYZToBody>> m_edges_body;
130 Buffer<MP<EdgeStereoSE3ProjectXYZ>> m_edges_stereo;
131 Buffer<VertexSim3Expmap> m_exp_map;
132 Buffer<EdgeSim3> m_sim_3_edge;
133 Buffer<VertexSBAPointXYZ> m_sba_points;
134 Buffer<RobustKernelHuber> m_robust_kernels;
136 Buffer<MI<EdgeMonoOnlyPose>> m_inertial_mono;
137 Buffer<MI<EdgeStereoOnlyPose>> m_inertial_stereo;
138 Buffer<MI<EdgeSE3ProjectXYZOnlyPose>> m_edges_pose_mono;
139 Buffer<MI<EdgeSE3ProjectXYZOnlyPose>> m_edges_pose_mono_last;
140 Buffer<MI<EdgeSE3ProjectXYZOnlyPoseToBody>> m_edges_pose_body;
141 Buffer<MI<EdgeStereoSE3ProjectXYZOnlyPose>> m_edges_pose_stereo;
143 Buffer<VertexPose> m_vertex_pose;
144 Buffer<VertexVelocity> m_vertex_velocity;
145 Buffer<VertexGyroBias> m_gyro_biases;
146 Buffer<VertexAccBias> m_acc_biases;
147 Buffer<EdgeInertialGS> m_edge_inertial_gs;
148 Buffer<EdgeInertial> m_vei;
149 Buffer<EdgeGyroRW> m_vegr;
150 Buffer<EdgeAccRW> m_vear;
151 Buffer<MP<EdgeMono>> m_inertial_edges_mono;
152 Buffer<MP<EdgeStereo>> m_inertial_edges_stereo;