ov_core namespace
Core algorithms for OpenVINS.
This has the core algorithms that all projects within the OpenVINS ecosystem leverage. The purpose is to allow for the reuse of code that could be shared between different localization systems (i.e. msckf-based, batch-based, etc.). These algorithms are the foundation which is necessary before we can even write an estimator that can perform localization. The key components of the ov_
- 3d feature initialization (see ov_core::
FeatureInitializer) - SE(3) b-spline (see ov_core::
BsplineSE3) - KLT, descriptor, aruco, and simulation feature trackers
- Groundtruth dataset reader (see ov_core::
DatasetReader) - Quaternion and other manifold math operations
- Generic type system and their implementations (see ov_
type namespace) - Closed-form preintegration [13]
Please take a look at classes that we offer for the user to leverage as each has its own documentation. If you are looking for the estimator please take a look at the ov_
Classes
- class BsplineSE3
- B-Spline which performs interpolation over SE(3) manifold.
- class CamBase
- Base pinhole camera model class.
- class CamEqui
- Fisheye / equadistant model pinhole camera model class.
- struct CameraData
- Struct for a collection of camera measurements.
- class CamRadtan
- Radial-tangential / Brown–Conrady model pinhole camera model class.
- class CpiBase
- Base class for continuous preintegration integrators.
- class CpiV1
- Model 1 of continuous preintegration.
- class CpiV2
- Model 2 of continuous preintegration.
- class DatasetReader
- Helper functions to read in dataset files.
- class Feature
- Sparse feature class used to collect measurements.
- class FeatureDatabase
- Database containing features we are currently tracking.
- class FeatureHelper
- Contains some nice helper functions for features.
- class FeatureInitializer
- Class that triangulates feature.
- struct FeatureInitializerOptions
- Struct which stores all our feature initializer options.
- class Grider_FAST
- Extracts FAST features in a grid pattern.
- class Grider_GRID
- Extracts FAST features in a grid pattern.
- struct ImuData
- Struct for a single imu measurement (time, wm, am)
- class Printer
- Printer for open_vins that allows for various levels of printing to be done.
- class TrackAruco
- Tracking of OpenCV Aruoc tags.
- class TrackBase
- Visual feature tracking base class.
- class TrackDescriptor
- Descriptor-based visual tracking.
- class TrackKLT
- KLT tracking of features.
- class TrackSIM
- Simulated tracker for when we already have uv measurements!
- class YamlParser
- Helper class to do OpenCV yaml parsing from both file and ROS.
Functions
- auto rot_2_quat(const Eigen::Matrix<double, 3, 3>& rot) -> Eigen::Matrix<double, 4, 1>
- Returns a JPL quaternion from a rotation matrix.
- auto skew_x(const Eigen::Matrix<double, 3, 1>& w) -> Eigen::Matrix<double, 3, 3>
- Skew-symmetric matrix from a given 3x1 vector.
- auto quat_2_Rot(const Eigen::Matrix<double, 4, 1>& q) -> Eigen::Matrix<double, 3, 3>
- Converts JPL quaterion to SO(3) rotation matrix.
- auto quat_multiply(const Eigen::Matrix<double, 4, 1>& q, const Eigen::Matrix<double, 4, 1>& p) -> Eigen::Matrix<double, 4, 1>
- Multiply two JPL quaternions.
- auto vee(const Eigen::Matrix<double, 3, 3>& w_x) -> Eigen::Matrix<double, 3, 1>
- Returns vector portion of skew-symmetric.
- auto exp_so3(const Eigen::Matrix<double, 3, 1>& w) -> Eigen::Matrix<double, 3, 3>
- SO(3) matrix exponential.
- auto log_so3(const Eigen::Matrix<double, 3, 3>& R) -> Eigen::Matrix<double, 3, 1>
- SO(3) matrix logarithm.
- auto exp_se3(Eigen::Matrix<double, 6, 1> vec) -> Eigen::Matrix4d
- SE(3) matrix exponential function.
- auto log_se3(Eigen::Matrix4d mat) -> Eigen::Matrix<double, 6, 1>
- SE(3) matrix logarithm.
- auto hat_se3(const Eigen::Matrix<double, 6, 1>& vec) -> Eigen::Matrix4d
- Hat operator for R^6 -> Lie Algebra se(3)
- auto Inv_se3(const Eigen::Matrix4d& T) -> Eigen::Matrix4d
- SE(3) matrix analytical inverse.
- auto Inv(Eigen::Matrix<double, 4, 1> q) -> Eigen::Matrix<double, 4, 1>
- JPL Quaternion inverse.
- auto Omega(Eigen::Matrix<double, 3, 1> w) -> Eigen::Matrix<double, 4, 4>
- Integrated quaternion from angular velocity.
- auto quatnorm(Eigen::Matrix<double, 4, 1> q_t) -> Eigen::Matrix<double, 4, 1>
- Normalizes a quaternion to make sure it is unit norm.
- auto Jl_so3(const Eigen::Matrix<double, 3, 1>& w) -> Eigen::Matrix<double, 3, 3>
- Computes left Jacobian of SO(3)
- auto Jr_so3(const Eigen::Matrix<double, 3, 1>& w) -> Eigen::Matrix<double, 3, 3>
- Computes right Jacobian of SO(3)
- auto rot2rpy(const Eigen::Matrix<double, 3, 3>& rot) -> Eigen::Matrix<double, 3, 1>
- Gets roll, pitch, yaw of argument rotation (in that order).
- auto rot_x(double t) -> Eigen::Matrix<double, 3, 3>
- Construct rotation matrix from given roll.
- auto rot_y(double t) -> Eigen::Matrix<double, 3, 3>
- Construct rotation matrix from given pitch.
- auto rot_z(double t) -> Eigen::Matrix<double, 3, 3>
- Construct rotation matrix from given yaw.
Function documentation
Eigen::Matrix<double, 4, 1> ov_ core:: rot_2_quat(const Eigen::Matrix<double, 3, 3>& rot)
Returns a JPL quaternion from a rotation matrix.
Parameters | |
---|---|
rot in | 3x3 rotation matrix |
Returns | 4x1 quaternion |
This is based on the equation 74 in Indirect Kalman Filter for 3D Attitude Estimation. In the implementation, we have 4 statements so that we avoid a division by zero and instead always divide by the largest diagonal element. This all comes from the definition of a rotation matrix, using the diagonal elements and an off-diagonal.
Eigen::Matrix<double, 3, 3> ov_ core:: skew_x(const Eigen::Matrix<double, 3, 1>& w)
Skew-symmetric matrix from a given 3x1 vector.
Parameters | |
---|---|
w in | 3x1 vector to be made a skew-symmetric |
Returns | 3x3 skew-symmetric matrix |
This is based on equation 6 in Indirect Kalman Filter for 3D Attitude Estimation:
Eigen::Matrix<double, 3, 3> ov_ core:: quat_2_Rot(const Eigen::Matrix<double, 4, 1>& q)
Converts JPL quaterion to SO(3) rotation matrix.
Parameters | |
---|---|
q in | JPL quaternion |
Returns | 3x3 SO(3) rotation matrix |
This is based on equation 62 in Indirect Kalman Filter for 3D Attitude Estimation:
Eigen::Matrix<double, 4, 1> ov_ core:: quat_multiply(const Eigen::Matrix<double, 4, 1>& q,
const Eigen::Matrix<double, 4, 1>& p)
Multiply two JPL quaternions.
Parameters | |
---|---|
q in | First JPL quaternion |
p in | Second JPL quaternion |
Returns | 4x1 resulting q*p quaternion |
This is based on equation 9 in Indirect Kalman Filter for 3D Attitude Estimation. We also enforce that the quaternion is unique by having q_4 be greater than zero.
Eigen::Matrix<double, 3, 3> ov_ core:: exp_so3(const Eigen::Matrix<double, 3, 1>& w)
SO(3) matrix exponential.
Parameters | |
---|---|
w in | 3x1 vector in R(3) we will take the exponential of |
Returns | SO(3) rotation matrix |
SO(3) matrix exponential mapping from the vector to SO(3) lie group. This formula ends up being the Rodrigues formula. This definition was taken from "Lie Groups for 2D and 3D Transformations" by Ethan Eade equation 15. http:/
Eigen::Matrix<double, 3, 1> ov_ core:: log_so3(const Eigen::Matrix<double, 3, 3>& R)
SO(3) matrix logarithm.
Parameters | |
---|---|
R in | 3x3 SO(3) rotation matrix |
Returns | 3x1 in the R(3) space [omegax, omegay, omegaz] |
This definition was taken from "Lie Groups for 2D and 3D Transformations" by Ethan Eade equation 17 & 18. http:/
This function is based on the GTSAM one as the original implementation was a bit unstable. See the following:
Eigen::Matrix4d ov_ core:: exp_se3(Eigen::Matrix<double, 6, 1> vec)
SE(3) matrix exponential function.
Parameters | |
---|---|
vec | 6x1 in the R(6) space [omega, u] |
Returns | 4x4 SE(3) matrix |
Equation is from Ethan Eade's reference: http:/
where we have the following definitions
Eigen::Matrix<double, 6, 1> ov_ core:: log_se3(Eigen::Matrix4d mat)
SE(3) matrix logarithm.
Parameters | |
---|---|
mat | 4x4 SE(3) matrix |
Returns | 6x1 in the R(6) space [omega, u] |
Equation is from Ethan Eade's reference: http:/
where we have the following definitions
This function is based on the GTSAM one as the original implementation was a bit unstable. See the following:
Eigen::Matrix4d ov_ core:: hat_se3(const Eigen::Matrix<double, 6, 1>& vec)
Hat operator for R^6 -> Lie Algebra se(3)
Parameters | |
---|---|
vec | 6x1 in the R(6) space [omega, u] |
Returns | Lie algebra se(3) 4x4 matrix |
Eigen::Matrix4d ov_ core:: Inv_se3(const Eigen::Matrix4d& T)
SE(3) matrix analytical inverse.
Parameters | |
---|---|
T in | SE(3) matrix |
Returns | inversed SE(3) matrix |
It seems that using the .inverse() function is not a good way. This should be used in all cases we need the inverse instead of numerical inverse. https://github.com/rpng/open_
Eigen::Matrix<double, 4, 1> ov_ core:: Inv(Eigen::Matrix<double, 4, 1> q)
JPL Quaternion inverse.
Parameters | |
---|---|
q in | quaternion we want to change |
Returns | inversed quaternion |
See equation 21 in Indirect Kalman Filter for 3D Attitude Estimation.
Eigen::Matrix<double, 4, 4> ov_ core:: Omega(Eigen::Matrix<double, 3, 1> w)
Integrated quaternion from angular velocity.
Parameters | |
---|---|
w | Angular velocity |
Returns | The matrix |
See equation (48) of trawny tech report Indirect Kalman Filter for 3D Attitude Estimation. This matrix is derived in Section 1.5 of the report by finding the Quaterion Time Derivative.
Eigen::Matrix<double, 4, 1> ov_ core:: quatnorm(Eigen::Matrix<double, 4, 1> q_t)
Normalizes a quaternion to make sure it is unit norm.
Parameters | |
---|---|
q_t | Quaternion to normalized |
Returns | Normalized quaterion |
Eigen::Matrix<double, 3, 3> ov_ core:: Jl_so3(const Eigen::Matrix<double, 3, 1>& w)
Computes left Jacobian of SO(3)
Parameters | |
---|---|
w | axis-angle |
Returns | The left Jacobian of SO(3) |
The left Jacobian of SO(3) is defined equation (7.77b) in State Estimation for Robotics by Timothy D. Barfoot [3]. Specifically it is the following (with and ):
Eigen::Matrix<double, 3, 3> ov_ core:: Jr_so3(const Eigen::Matrix<double, 3, 1>& w)
Computes right Jacobian of SO(3)
Parameters | |
---|---|
w | axis-angle |
Returns | The right Jacobian of SO(3) |
The right Jacobian of SO(3) is related to the left by Jl(-w)=Jr(w). See equation (7.87) in State Estimation for Robotics by Timothy D. Barfoot [3]. See Jl_
Eigen::Matrix<double, 3, 1> ov_ core:: rot2rpy(const Eigen::Matrix<double, 3, 3>& rot)
Gets roll, pitch, yaw of argument rotation (in that order).
Parameters | |
---|---|
rot | SO(3) rotation matrix |
Returns | roll, pitch, yaw values (in that order) |
To recover the matrix: R_input = R_z(yaw)*R_y(pitch)*R_x(roll) If you are interested in how to compute Jacobians checkout this report: http:/
Eigen::Matrix<double, 3, 3> ov_ core:: rot_x(double t)
Construct rotation matrix from given roll.
Parameters | |
---|---|
t | roll angle |
Returns | SO(3) rotation matrix |
Eigen::Matrix<double, 3, 3> ov_ core:: rot_y(double t)
Construct rotation matrix from given pitch.
Parameters | |
---|---|
t | pitch angle |
Returns | SO(3) rotation matrix |
Eigen::Matrix<double, 3, 3> ov_ core:: rot_z(double t)
Construct rotation matrix from given yaw.
Parameters | |
---|---|
t | yaw angle |
Returns | SO(3) rotation matrix |