2#include <NDEVR/Buffer.h>
3#include <NDEVR/Vertex.h>
7#include <Eigen/Geometry>
9#include <OrbSLAM/Thirdparty/Sophus/sophus/se3.hpp>
19 static constexpr g_type GRAVITY_VALUE = 9.81f;
29 Point(
const Ray<3, fltp04>& acc,
const Ray<3, fltp04>& gyro, fltp08 timestamp)
30 : acc(
cast<g_type>(acc[X]),
cast<g_type>(acc[Y]),
cast<g_type>(acc[Z]))
31 , w(
cast<g_type>(gyro[X]),
cast<g_type>(gyro[Y]),
cast<g_type>(gyro[Z]))
34 Point(
const Ray<3, fltp08>& acc,
const Ray<3, fltp08>& gyro, fltp08 timestamp)
35 : acc(
cast<g_type>(acc[X]),
cast<g_type>(acc[Y]),
cast<g_type>(acc[Z]))
36 , w(
cast<g_type>(gyro[X]),
cast<g_type>(gyro[Y]),
cast<g_type>(gyro[Z]))
40 Point(g_type acc_x, g_type acc_y, g_type acc_z,
41 g_type ang_vel_x, g_type ang_vel_y, g_type ang_vel_z,
43 : acc(acc_x, acc_y, acc_z)
44 , w(ang_vel_x, ang_vel_y, ang_vel_z)
47 template<
class t_xyz_type>
48 Point(
const t_xyz_type Acc,
const t_xyz_type Gyro,
const double& timestamp)
49 : acc(Acc.x, Acc.y, Acc.z)
50 , w(Gyro.x, Gyro.y, Gyro.z)
54 Eigen::Vector3<g_type> acc;
55 Eigen::Vector3<g_type> w;
57 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
66 Bias() :bax(0), bay(0), baz(0), bwx(0), bwy(0), bwz(0) {}
67 Bias(
const fltp04& b_acc_x,
const fltp04& b_acc_y,
const fltp04& b_acc_z,
68 const fltp04& b_ang_vel_x,
const fltp04& b_ang_vel_y,
const fltp04& b_ang_vel_z)
69 : bax(
cast<g_type>(b_acc_x))
70 , bay(
cast<g_type>(b_acc_y))
71 , baz(
cast<g_type>(b_acc_z))
72 , bwx(
cast<g_type>(b_ang_vel_x))
73 , bwy(
cast<g_type>(b_ang_vel_y))
74 , bwz(
cast<g_type>(b_ang_vel_z))
76 Bias(
const fltp08& b_acc_x,
const fltp08& b_acc_y,
const fltp08& b_acc_z,
77 const fltp08& b_ang_vel_x,
const fltp08& b_ang_vel_y,
const fltp08& b_ang_vel_z)
78 : bax(
cast<g_type>(b_acc_x))
79 , bay(
cast<g_type>(b_acc_y))
80 , baz(
cast<g_type>(b_acc_z))
81 , bwx(
cast<g_type>(b_ang_vel_x))
82 , bwy(
cast<g_type>(b_ang_vel_y))
83 , bwz(
cast<g_type>(b_ang_vel_z))
87 void CopyFrom(
const Bias& b);
92 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
102 Calib(
const Sophus::SE3<g_type>& Tbc,
const g_type& ng,
const g_type& na,
const g_type& ngw,
const g_type& naw)
104 Set(Tbc, ng, na, ngw, naw);
107 Calib(
const Calib& calib);
108 Calib() { mbIsSet =
false; }
116 void Set(
const Sophus::SE3<g_type>& sophTbc,
const g_type& ng,
const g_type& na,
const g_type& ngw,
const g_type& naw);
119 Sophus::SE3<g_type> mTcb;
120 Sophus::SE3<g_type> mTbc;
121 Eigen::DiagonalMatrix<g_type, 6> Cov, CovWalk;
122 g_type gyro_random_walk = 0.0f;
123 g_type acc_random_walk = 0.0f;
124 bool mbIsSet =
false;
130 class IntegratedRotation
133 IntegratedRotation() {}
138 IntegratedRotation(
const Eigen::Vector3<g_type>& angVel,
const Bias& imuBias,
const g_type& time);
141 g_type deltaT = 0.0f;
143 Eigen::Matrix3f rightJ;
144 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
154 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
158 Preintegrated(
const Bias& b_,
const Calib& calib);
161 Preintegrated(
const Preintegrated& pImuPre);
166 void CopyFrom(
const Preintegrated& pImuPre);
169 void Initialize(
const Bias& b_);
174 void IntegrateNewMeasurement(
const Eigen::Vector3<g_type>& acceleration,
const Eigen::Vector3<g_type>& angVel,
const g_type dt);
179 void MergePrevious(Preintegrated* pPrev);
182 void SetNewBias(
const Bias& bu_);
186 IMU::Bias GetDeltaBias(
const Bias& b_);
189 Eigen::Matrix3<g_type> GetDeltaRotation(
const Bias& b_);
192 Eigen::Vector3<g_type> GetDeltaVelocity(
const Bias& b_);
195 Eigen::Vector3<g_type> GetDeltaPosition(
const Bias& b_);
197 Eigen::Matrix3<g_type> GetUpdatedDeltaRotation();
199 Eigen::Vector3<g_type> GetUpdatedDeltaVelocity();
201 Eigen::Vector3<g_type> GetUpdatedDeltaPosition();
203 Eigen::Matrix3<g_type> GetOriginalDeltaRotation();
205 Eigen::Vector3<g_type> GetOriginalDeltaVelocity();
207 Eigen::Vector3<g_type> GetOriginalDeltaPosition();
209 Eigen::Matrix<g_type, 6, 1> GetDeltaBias();
211 Bias GetOriginalBias();
213 Bias GetUpdatedBias();
216 Eigen::Matrix<g_type, 15, 15> calc;
217 Eigen::Matrix<g_type, 15, 15> Info;
218 Eigen::DiagonalMatrix<g_type, 6> Nga, NgaWalk;
221 Eigen::Matrix3<g_type> dR;
222 Eigen::Vector3<g_type> dV, dP;
223 Eigen::Matrix3<g_type> JRg, JVg, JVa, JPg, JPa;
224 Eigen::Vector3<g_type> avgA, avgW;
229 Eigen::Matrix<g_type, 6, 1> db;
234 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
236 integrable(
const Eigen::Vector3<g_type>& a_,
const Eigen::Vector3<g_type>& w_,
const g_type& t_) :a(a_), w(w_), t(t_) {}
237 Eigen::Vector3<g_type> a, w;
241 Buffer<integrable> mvMeasurements;
251 static Eigen::Matrix3<g_type>
RightJacobianSO3(
const g_type& x,
const g_type& y,
const g_type& z);
255 static Eigen::Matrix3<g_type>
RightJacobianSO3(
const Eigen::Vector3<g_type>& v);
269 extern Eigen::Matrix3<g_type>
NormalizeRotation(
const Eigen::Matrix3<g_type>& R);
The primary namespace for the NDEVR SDK.
Eigen::Matrix< T, 3, 3 > NormalizeRotation(const Eigen::Matrix< T, 3, 3 > &R)
Normalizes a rotation matrix using SVD decomposition.
double fltp08
Defines an alias representing an 8 byte floating-point number.
Vector3< g_type > deltaR(const Matrix3< g_type > &R)
Extracts the rotation vector from a rotation matrix using the Rodrigues formula.
Eigen::Matrix3< g_type > InverseRightJacobianSO3(const Eigen::Vector3< g_type > &v)
Computes the inverse right Jacobian of SO3.
Eigen::Matrix3< g_type > RightJacobianSO3(const Eigen::Vector3< g_type > &v)
Computes the right Jacobian of SO3.
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.