MSCEqF 1.0
Multi State Constraint Equivariant Filter for visual inertial navigation
Loading...
Searching...
No Matches
system.hpp
1// Copyright (C) 2023 Alessandro Fornasier.
2// Control of Networked Systems, University of Klagenfurt, Austria.
3//
4// All rights reserved.
5//
6// This software is licensed under the terms of the BSD-2-Clause-License with
7// no commercial use allowed, the full terms of which are made available
8// in the LICENSE file. No license in patents is granted.
9//
10// You can contact the authors at <alessandro.fornasier@ieee.org>
11
12#ifndef SYSTEM_HPP
13#define SYSTEM_HPP
14
15#include <variant>
16
17#include "msceqf/system/system_elements.hpp"
18#include "msceqf/options/msceqf_options.hpp"
19
20namespace msceqf
21{
29{
30 public:
31 using SystemStateKey = std::variant<SystemStateElementName, uint>;
32 using SystemStateMap = std::unordered_map<SystemStateKey, SystemStateElementSharedPtr>;
33 using SystemStateAlgebraMap = std::unordered_map<SystemStateKey, VectorX>;
34
38 SystemState() = delete;
39
48 SystemState(const StateOptions& opts, const SE23& T0 = SE23(), const Vector6& b0 = Vector6::Zero());
49
67 template <typename... Args>
68 SystemState(const StateOptions& opts, Args&&... pairs_of_key_ptr) : opts_(opts), state_()
69 {
70 preallocate();
71
72 insertSystemStateElement(std::make_pair(
73 SystemStateElementName::S,
74 createSystemStateElement<CameraExtrinsicState>(std::make_tuple(opts.initial_camera_extrinsics_))));
75
77 {
78 insertSystemStateElement(std::make_pair(
79 SystemStateElementName::K,
80 createSystemStateElement<CameraIntrinsicState>(std::make_tuple(opts.initial_camera_intrinsics_))));
81 }
82
83 (insertSystemStateElement(std::forward<decltype(pairs_of_key_ptr)>(pairs_of_key_ptr)), ...);
84 }
85
87 SystemState(const SystemState& other);
88 SystemState(SystemState&& other) noexcept;
89 SystemState& operator=(const SystemState& other);
90 SystemState& operator=(SystemState&& other) noexcept;
92
98 [[nodiscard]] const SE23& T() const;
99
105 [[nodiscard]] const SE3 P() const;
106
112 [[nodiscard]] const SE3 V() const;
113
119 [[nodiscard]] const Vector6& b() const;
120
128 [[nodiscard]] const SE3& S() const;
129
137 [[nodiscard]] const In& K() const;
138
146 [[nodiscard]] const Vector4 k() const;
147
155 [[nodiscard]] const Vector3& f(const uint& feat_id) const;
156
162 [[nodiscard]] const Vector3 ge3() const;
163
169 [[nodiscard]] inline const StateOptions& opts() const { return opts_; }
170
177 static std::string toString(const SystemStateKey& key);
178
179 private:
184 void preallocate();
185
192 void insertSystemStateElement(std::pair<SystemStateKey, SystemStateElementUniquePtr>&& key_ptr);
193
200 void insertSystemStateElement(std::vector<std::pair<SystemStateKey, SystemStateElementUniquePtr>>& keys_ptrs);
201
202 friend class Symmetry;
203
204 StateOptions opts_;
205
206 SystemStateMap state_;
207};
208
209} // namespace msceqf
210
211#endif // SYSTEM_HPP
212
213// [COMMENT] I can use unorderd map as soon as i check for out of order images when getting a image...
Definition symmetry.hpp:23
The SystemState class represent the state of the system posed on the Homogenous space.
Definition system.hpp:29
std::variant< SystemStateElementName, uint > SystemStateKey
Key to access the system state map.
Definition system.hpp:31
const SE23 & T() const
return a constant reference to the extended pose element (R,v,p) of the system state as a SE23-torsor
std::unordered_map< SystemStateKey, VectorX > SystemStateAlgebraMap
System state algebra map.
Definition system.hpp:33
const StateOptions & opts() const
Get the state options.
Definition system.hpp:169
std::unordered_map< SystemStateKey, SystemStateElementSharedPtr > SystemStateMap
System state map.
Definition system.hpp:32
static std::string toString(const SystemStateKey &key)
Get a string describing the given SystemStateKey.
SystemState(const StateOptions &opts, const SE23 &T0=SE23(), const Vector6 &b0=Vector6::Zero())
Initialize a system state with given extended pose and bias (Identity and zero by default)....
SystemState(const SystemState &other)
Rule of Five.
const SE3 V() const
return a copy of the pose element (R,v) of the system state as a SE3-torsor
const Vector6 & b() const
return a constant reference to the bias element of the system state as a vector
const Vector3 & f(const uint &feat_id) const
return a constant reference to a persistent feature element of the system state as a vector,...
const In & K() const
return a constant reference to the camera intrinsics element of the system state as a In-torsor If th...
SystemState()=delete
Deleted default constructor.
const Vector4 k() const
return a copy of the camera intrinsics element of the system state as a 4-vector If the camera intrin...
SystemState(const StateOptions &opts, Args &&... pairs_of_key_ptr)
Construct system state given a multiple pairs of key-pointer of states element. This methods prealloc...
Definition system.hpp:68
const Vector3 ge3() const
return a copy of g*e3 as a vector
const SE3 & S() const
return a constant reference to the camera extrinsics element of the system state as a SE3-torsor....
const SE3 P() const
return a copy of the pose element (R,p) of the system state as a SE3-torsor
Definition msceqf_options.hpp:98
bool enable_camera_intrinsics_calibration_
Boolean to enable intinsic camera calibration.
Definition msceqf_options.hpp:105
In initial_camera_intrinsics_
Initial camera intrinsics.
Definition msceqf_options.hpp:104
SE3 initial_camera_extrinsics_
Initial camera extrinsics.
Definition msceqf_options.hpp:103