20#ifndef SYSTEM_ELEMENTS_HPP
21#define SYSTEM_ELEMENTS_HPP
25#include "types/fptypes.hpp"
36enum class SystemStateElementName
58 virtual std::unique_ptr<SystemStateElement>
clone()
const = 0;
75 ExtendedPoseState() :
T_(){};
76 ExtendedPoseState(
const SE23& T) :
T_(T){};
83 std::unique_ptr<SystemStateElement>
clone()
const override {
return std::make_unique<ExtendedPoseState>(*
this); }
94 BiasState() :
b_(Vector6::Zero()){};
95 BiasState(
const Vector6& b) :
b_(b){};
102 std::unique_ptr<SystemStateElement>
clone()
const override {
return std::make_unique<BiasState>(*
this); }
113 CameraExtrinsicState() :
S_(){};
114 CameraExtrinsicState(
const Quaternion& q,
const Vector3& t) :
S_(q, {t}){};
115 CameraExtrinsicState(
const Matrix3& R,
const Vector3& t) :
S_(R, {t}){};
116 CameraExtrinsicState(
const Matrix4& S) :
S_(S){};
117 CameraExtrinsicState(
const SE3& S) :
S_(S){};
124 std::unique_ptr<SystemStateElement>
clone()
const override {
return std::make_unique<CameraExtrinsicState>(*
this); }
135 CameraIntrinsicState() :
K_(){};
136 CameraIntrinsicState(
const fp& fx,
const fp& fy,
const fp& cx,
const fp& cy) :
K_(fx, fy, cx, cy){};
137 CameraIntrinsicState(
const Vector4& intr) :
K_(intr){};
138 CameraIntrinsicState(
const Matrix3& K) :
K_(K){};
139 CameraIntrinsicState(
const In& K) :
K_(K){};
146 std::unique_ptr<SystemStateElement>
clone()
const override {
return std::make_unique<CameraIntrinsicState>(*
this); }
158 FeatureState() :
f_(Vector3::Zero()){};
159 FeatureState(
const Vector3& f) :
f_(f){};
160 FeatureState(
const fp& x,
const fp& y,
const fp& z) :
f_({x, y, z}){};
167 std::unique_ptr<SystemStateElement>
clone()
const override {
return std::make_unique<FeatureState>(*
this); }
172using SystemStateElementSharedPtr = std::shared_ptr<SystemStateElement>;
173using SystemStateElementUniquePtr = std::unique_ptr<SystemStateElement>;
174using ExtendedPoseStateSharedPtr = std::shared_ptr<ExtendedPoseState>;
175using ExtendedPoseUniquePtr = std::unique_ptr<ExtendedPoseState>;
176using BiasStateStateSharedPtr = std::shared_ptr<BiasState>;
177using BiasStateStateUniquePtr = std::unique_ptr<BiasState>;
178using CameraExtrinsicStateStateSharedPtr = std::shared_ptr<CameraExtrinsicState>;
179using CameraExtrinsicStateStateUniquePtr = std::unique_ptr<CameraExtrinsicState>;
180using CameraIntrinsicStateStateSharedPtr = std::shared_ptr<CameraIntrinsicState>;
181using CameraIntrinsicStateStateUniquePtr = std::unique_ptr<CameraIntrinsicState>;
182using FeatureStateStateStateSharedPtr = std::shared_ptr<FeatureState>;
183using FeatureStateStateStateUniquePtr = std::unique_ptr<FeatureState>;
197template <
typename T,
typename... Args>
198[[nodiscard]]
static SystemStateElementUniquePtr createSystemStateElement(
const std::tuple<Args...>& args)
201 [](
const auto&... args) {
202 if constexpr (std::is_base_of_v<SystemStateElement, T> && std::is_constructible_v<T,
decltype(args)...>)
204 return std::make_unique<T>(args...);
SystemStateElement()=default
Rule of Five.
virtual std::unique_ptr< SystemStateElement > clone() const =0
Clone.
Vector6 b_
The Inertial Measurement Unit (IMU) biases (bw, ba).
Definition system_elements.hpp:104
std::unique_ptr< SystemStateElement > clone() const override
Clone the bias state element of the system.
Definition system_elements.hpp:102
SE3 S_
The camera extrinsics calibration (SR, St).
Definition system_elements.hpp:126
std::unique_ptr< SystemStateElement > clone() const override
Clone the camera extrinsics state element of the system.
Definition system_elements.hpp:124
std::unique_ptr< SystemStateElement > clone() const override
Clone the camera instirnsic state element of the system.
Definition system_elements.hpp:146
In K_
The camera intrinsics calibration (K).
Definition system_elements.hpp:148
SE23 T_
The extended pose of the system (R, v, p).
Definition system_elements.hpp:85
std::unique_ptr< SystemStateElement > clone() const override
Clone the extended pose state element of the system.
Definition system_elements.hpp:83
Vector3 f_
The persistent feature (f).
Definition system_elements.hpp:169
std::unique_ptr< SystemStateElement > clone() const override
Clone the persistent feature state element of the system.
Definition system_elements.hpp:167