0.3.0
Loading...
Searching...
No Matches
InertialIntegrator.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
13
14#pragma once
15
16#include <functional>
17#include <optional>
18#include <memory>
19
22
29
31#include "util/Eigen.hpp"
32#include "util/Json.hpp"
33#include "util/Logger.hpp"
34
35namespace NAV
36{
37
40{
41 public:
55
57 enum class IntegrationFrame : uint8_t
58 {
61 };
62
65 {
66 bool averagedMeasurement = false;
67 double dt = 0.0;
68 Eigen::Vector3d p_acceleration;
69 Eigen::Vector3d p_angularRate;
70 };
71
73 template<typename T>
75 {
77
78 Eigen::Vector3<T> position;
79 Eigen::Vector3<T> velocity;
80 Eigen::Quaternion<T> attitude;
81
83
84 Eigen::Vector3<T> p_biasAcceleration = Eigen::Vector3<T>::Zero();
85 Eigen::Vector3<T> p_biasAngularRate = Eigen::Vector3<T>::Zero();
86
87 Eigen::Vector3<T> scaleFactorAccel = Eigen::Vector3<T>::Ones();
88 Eigen::Vector3<T> scaleFactorGyro = Eigen::Vector3<T>::Ones();
89
90 Eigen::Quaternion<T> misalignmentAccel = Eigen::Quaternion<T>::Identity();
91 Eigen::Quaternion<T> misalignmentGyro = Eigen::Quaternion<T>::Identity();
92 };
93
96
98 InertialIntegrator() = default;
99
102 explicit InertialIntegrator(IntegrationFrame integrationFrame);
103
105 void reset();
106
108 [[nodiscard]] bool hasInitialPosition() const;
109
113 void setInitialState(const PosVelAtt& state, const char* nameId);
114
118 void addState(const PosVelAtt& state, const char* nameId);
119
123 void setTotalSensorBiases(const Eigen::Vector3d& p_biasAcceleration, const Eigen::Vector3d& p_biasAngularRate);
124
128 void applySensorBiasesIncrements(const Eigen::Vector3d& p_deltaBiasAcceleration, const Eigen::Vector3d& p_deltaBiasAngularRate);
129
134 void applyStateErrors_n(const Eigen::Vector3d& lla_positionError, const Eigen::Vector3d& n_velocityError, const Eigen::Vector3d& n_attitudeError_b);
135
140 void applyStateErrors_e(const Eigen::Vector3d& e_positionError, const Eigen::Vector3d& e_velocityError, const Eigen::Vector3d& e_attitudeError_b);
141
143 [[nodiscard]] std::optional<std::reference_wrapper<const State>> getLatestState() const;
144
146 [[nodiscard]] const Eigen::Vector3d& p_getLastAccelerationBias() const;
147
149 [[nodiscard]] const Eigen::Vector3d& p_getLastAngularRateBias() const;
150
153
155 [[nodiscard]] const PosVelAttDerivativeConstants& getConstants() const;
156
158 [[nodiscard]] bool areAccelerationsAveragedMeasurements() const;
159
161 [[nodiscard]] std::optional<Eigen::Vector3d> p_calcCurrentAcceleration() const;
162
164 [[nodiscard]] std::optional<Eigen::Vector3d> p_calcCurrentAngularRate() const;
165
173 std::shared_ptr<PosVelAtt> calcInertialSolution(const InsTime& obsTime,
174 const Eigen::Vector3d& p_acceleration, const Eigen::Vector3d& p_angularRate,
175 const ImuPos& imuPos, const char* nameId);
176
185 std::shared_ptr<PosVelAtt> calcInertialSolutionDelta(const InsTime& obsTime, double deltaTime,
186 const Eigen::Vector3d& p_deltaVelocity, const Eigen::Vector3d& p_deltaTheta,
187 const ImuPos& imuPos, const char* nameId);
188
189 // Forward declaring external function
192
199 template<typename T>
200 [[nodiscard]] Eigen::Vector<T, 10> calcInertialSolution(const ImuPos& imuPos,
201 const GenericState<T>& state__t0,
202 const GenericState<T>& state__t1,
203 [[maybe_unused]] const char* nameId) const
204 {
205 // #if LOG_LEVEL <= LOG_LEVEL_DATA
206 // auto printState = [](const GenericState<T>& state, const char* t, const char* nameId) {
207 // LOG_DATA("{} [{}]:\n"
208 // " - {}:\n"
209 // " Position [{}, {}, {}], Velocity [{}, {}, {}], Attitude [{}x, {}y, {}z, {}w]\n"
210 // " dt = {:.5f}, p_accel [{}, {}, {}], p_angRate [{}, {}, {}]\n"
211 // " p_biasAccel [{}, {}, {}], p_biasAngRate [{}, {}, {}]\n"
212 // " p_scaleFacAccel [{}, {}, {}], p_scaleFacAngRate [{}, {}, {}]\n"
213 // " p_misAlignAccel [{}x, {}y, {}z, {}w], p_misAlignAngRate [{}x, {}y, {}z, {}w]",
214 // nameId, t, state.epoch.toYMDHMS(GPST),
215 // state.position(0), state.position(1), state.position(2),
216 // state.velocity(0), state.velocity(1), state.velocity(2),
217 // state.attitude.x(), state.attitude.y(), state.attitude.z(), state.attitude.w(),
218 // state.m.dt, state.m.p_acceleration(0), state.m.p_acceleration(1), state.m.p_acceleration(2),
219 // state.m.p_angularRate(0), state.m.p_angularRate(1), state.m.p_angularRate(2),
220 // state.p_biasAcceleration(0), state.p_biasAcceleration(1), state.p_biasAcceleration(2),
221 // state.p_biasAngularRate(0), state.p_biasAngularRate(1), state.p_biasAngularRate(2),
222 // state.scaleFactorAccel(0), state.scaleFactorAccel(1), state.scaleFactorAccel(2),
223 // state.scaleFactorGyro(0), state.scaleFactorGyro(1), state.scaleFactorGyro(2),
224 // state.misalignmentAccel.x(), state.misalignmentAccel.y(), state.misalignmentAccel.z(), state.misalignmentAccel.w(),
225 // state.misalignmentGyro.x(), state.misalignmentGyro.y(), state.misalignmentGyro.z(), state.misalignmentGyro.w());
226 // };
227 // LOG_DATA("{}: Frame {}, Algorithm {}", nameId, to_string(_integrationFrame), to_string(_integrationAlgorithm));
228 // printState(state__t0, "t0", nameId);
229 // printState(state__t1, "t1", nameId);
230 // #endif
231
232 Eigen::Vector<T, 10> y;
233 // 0 1 2 3 4 5 6 7 8 9
234 // NED [ 𝜙, λ, h, v_N, v_E, v_D, n_q_bx, n_q_by, n_q_bz, n_q_bw]^T
235 // ECEF [ x, y, z, v_x, v_y, v_z, e_q_bx, e_q_by, e_q_bz, e_q_bw]^T
236 y.template segment<3>(0) = state__t1.position;
237 y.template segment<3>(3) = state__t1.velocity;
238 y.template segment<4>(6) = state__t1.attitude.coeffs();
239
240 auto p_accel = [](const GenericState<T>& state) -> Eigen::Vector3<T> {
241 return (state.misalignmentAccel * state.m.p_acceleration.template cast<T>()).cwiseProduct(state.scaleFactorAccel) + state.p_biasAcceleration;
242 };
243 auto p_gyro = [](const GenericState<T>& state) -> Eigen::Vector3<T> {
244 return (state.misalignmentGyro * state.m.p_angularRate.template cast<T>()).cwiseProduct(state.scaleFactorGyro) + state.p_biasAngularRate;
245 };
246
247 // LOG_DATA("{}: imuPos.b_quat_p() [{}]", nameId, imuPos.b_quat_p());
248 Eigen::Vector3<T> b_accel__t0 = imuPos.b_quat_p().cast<T>() * p_accel(state__t0);
249 Eigen::Vector3<T> b_accel__t1 = imuPos.b_quat_p().cast<T>() * p_accel(state__t1);
250 Eigen::Vector3<T> b_gyro__t0 = imuPos.b_quat_p().cast<T>() * p_gyro(state__t0);
251 Eigen::Vector3<T> b_gyro__t1 = imuPos.b_quat_p().cast<T>() * p_gyro(state__t1);
252 // LOG_DATA("{}: b_accel__t0 [{}, {}, {}], b_accel__t1 [{}, {}, {}]", nameId, b_accel__t0(0), b_accel__t0(1), b_accel__t0(2), b_accel__t1(0), b_accel__t1(1), b_accel__t1(2));
253 // LOG_DATA("{}: b_gyro__t0 [{}, {}, {}], b_gyro__t1 [{}, {}, {}]", nameId, b_gyro__t0(0), b_gyro__t0(1), b_gyro__t0(2), b_gyro__t1(0), b_gyro__t1(1), b_gyro__t1(2));
254
255 // LOG_DATA("{}: integrationAlgorithm = {}", nameId, to_string(_integrationAlgorithm));
256 switch (_integrationAlgorithm)
257 {
259 {
260 std::array<Eigen::Vector<T, 6>, 1> z;
261 if (state__t0.m.averagedMeasurement) { z[0] << b_accel__t0, b_gyro__t0; }
262 else { z[0] << b_accel__t1, b_gyro__t1; }
263 // LOG_DATA("{}: z[0] = {}, {}, {}, {}, {}, {}", nameId, z[0](0), z[0](1), z[0](2), z[0](3), z[0](4), z[0](5));
264
265 switch (_integrationFrame)
266 {
269 break;
272 break;
273 }
274 break;
275 }
277 {
278 std::array<Eigen::Vector<T, 6>, 2> z;
279 if (state__t0.m.averagedMeasurement)
280 {
281 z[0] << b_accel__t0, b_gyro__t0;
282 z[1] << b_accel__t0, b_gyro__t0;
283 }
284 else
285 {
286 z[0] << b_accel__t1, b_gyro__t1;
287 z[1] << math::lerp(b_accel__t1, b_accel__t0, 0.5), math::lerp(b_gyro__t1, b_gyro__t0, 0.5);
288 }
289 // LOG_DATA("{}: z[0] = {}, {}, {}, {}, {}, {}", nameId, z[0](0), z[0](1), z[0](2), z[0](3), z[0](4), z[0](5));
290 // LOG_DATA("{}: z[1] = {}, {}, {}, {}, {}, {}", nameId, z[1](0), z[1](1), z[1](2), z[1](3), z[1](4), z[1](5));
291 switch (_integrationFrame)
292 {
295 break;
298 break;
299 }
300 break;
301 }
303 {
304 std::array<Eigen::Vector<T, 6>, 2> z;
305 if (state__t0.m.averagedMeasurement)
306 {
307 z[0] << b_accel__t0, b_gyro__t0;
308 z[1] << b_accel__t0, b_gyro__t0;
309 }
310 else
311 {
312 z[0] << b_accel__t1, b_gyro__t1;
313 z[1] << b_accel__t0, b_gyro__t0;
314 }
315 // LOG_DATA("{}: z[0] = {}, {}, {}, {}, {}, {}", nameId, z[0](0), z[0](1), z[0](2), z[0](3), z[0](4), z[0](5));
316 // LOG_DATA("{}: z[1] = {}, {}, {}, {}, {}, {}", nameId, z[1](0), z[1](1), z[1](2), z[1](3), z[1](4), z[1](5));
317 switch (_integrationFrame)
318 {
321 break;
324 break;
325 }
326 break;
327 }
329 {
330 std::array<Eigen::Vector<T, 6>, 3> z;
331 if (state__t0.m.averagedMeasurement)
332 {
333 z[0] << b_accel__t0, b_gyro__t0;
334 z[1] << b_accel__t0, b_gyro__t0;
335 z[2] << b_accel__t0, b_gyro__t0;
336 }
337 else
338 {
339 z[0] << b_accel__t1, b_gyro__t1;
340 z[1] << math::lerp(b_accel__t1, b_accel__t0, 0.5), math::lerp(b_gyro__t1, b_gyro__t0, 0.5);
341 z[2] << b_accel__t0, b_gyro__t0;
342 }
343 // LOG_DATA("{}: z[0] = {}, {}, {}, {}, {}, {}", nameId, z[0](0), z[0](1), z[0](2), z[0](3), z[0](4), z[0](5));
344 // LOG_DATA("{}: z[1] = {}, {}, {}, {}, {}, {}", nameId, z[1](0), z[1](1), z[1](2), z[1](3), z[1](4), z[1](5));
345 // LOG_DATA("{}: z[2] = {}, {}, {}, {}, {}, {}", nameId, z[2](0), z[2](1), z[2](2), z[2](3), z[2](4), z[2](5));
346 switch (_integrationFrame)
347 {
350 break;
353 break;
354 }
355 break;
356 }
358 {
359 std::array<Eigen::Vector<T, 6>, 3> z;
360 if (state__t0.m.averagedMeasurement)
361 {
362 z[0] << b_accel__t0, b_gyro__t0;
363 z[1] << b_accel__t0, b_gyro__t0;
364 z[2] << b_accel__t0, b_gyro__t0;
365 }
366 else
367 {
368 z[0] << b_accel__t1, b_gyro__t1;
369 z[1] << math::lerp(b_accel__t1, b_accel__t0, 1.0 / 3.0), math::lerp(b_gyro__t1, b_gyro__t0, 1.0 / 3.0);
370 z[2] << math::lerp(b_accel__t1, b_accel__t0, 2.0 / 3.0), math::lerp(b_gyro__t1, b_gyro__t0, 2.0 / 3.0);
371 }
372 // LOG_DATA("{}: z[0] = {}, {}, {}, {}, {}, {}", nameId, z[0](0), z[0](1), z[0](2), z[0](3), z[0](4), z[0](5));
373 // LOG_DATA("{}: z[1] = {}, {}, {}, {}, {}, {}", nameId, z[1](0), z[1](1), z[1](2), z[1](3), z[1](4), z[1](5));
374 // LOG_DATA("{}: z[2] = {}, {}, {}, {}, {}, {}", nameId, z[2](0), z[2](1), z[2](2), z[2](3), z[2](4), z[2](5));
375 switch (_integrationFrame)
376 {
379 break;
382 break;
383 }
384 break;
385 }
387 {
388 std::array<Eigen::Vector<T, 6>, 4> z;
389 if (state__t0.m.averagedMeasurement)
390 {
391 z[0] << b_accel__t0, b_gyro__t0;
392 z[1] << b_accel__t0, b_gyro__t0;
393 z[2] << b_accel__t0, b_gyro__t0;
394 z[3] << b_accel__t0, b_gyro__t0;
395 }
396 else
397 {
398 z[0] << b_accel__t1, b_gyro__t1;
399 z[1] << math::lerp(b_accel__t1, b_accel__t0, 0.5), math::lerp(b_gyro__t1, b_gyro__t0, 0.5);
400 z[2] << math::lerp(b_accel__t1, b_accel__t0, 0.5), math::lerp(b_gyro__t1, b_gyro__t0, 0.5);
401 z[3] << b_accel__t0, b_gyro__t0;
402 }
403 // LOG_DATA("{}: z[0] = {}, {}, {}, {}, {}, {}", nameId, z[0](0), z[0](1), z[0](2), z[0](3), z[0](4), z[0](5));
404 // LOG_DATA("{}: z[1] = {}, {}, {}, {}, {}, {}", nameId, z[1](0), z[1](1), z[1](2), z[1](3), z[1](4), z[1](5));
405 // LOG_DATA("{}: z[2] = {}, {}, {}, {}, {}, {}", nameId, z[2](0), z[2](1), z[2](2), z[2](3), z[2](4), z[2](5));
406 // LOG_DATA("{}: z[3] = {}, {}, {}, {}, {}, {}", nameId, z[3](0), z[3](1), z[3](2), z[3](3), z[3](4), z[3](5));
407 switch (_integrationFrame)
408 {
411 break;
414 break;
415 }
416 break;
417 }
419 {
420 LOG_CRITICAL("Not implemented yet");
421 break;
422 }
424 {
425 LOG_CRITICAL("Not implemented yet");
426 break;
427 }
429 {
430 LOG_CRITICAL("Unreachable");
431 break;
432 }
433 }
434
435 y.template segment<4>(6) = Eigen::Quaternion<T>(y.template segment<4>(6)).normalized().coeffs();
436
437 return y;
438 }
439
440 private:
447 void addMeasurement(const InsTime& epoch, double dt,
448 const Eigen::Vector3d& p_acceleration, const Eigen::Vector3d& p_angularRate, const char* nameId);
449
457 void addDeltaMeasurement(const InsTime& epoch, double dt, double deltaTime,
458 const Eigen::Vector3d& p_deltaVelocity, const Eigen::Vector3d& p_deltaTheta, const char* nameId);
459
461 [[nodiscard]] std::shared_ptr<PosVelAtt> lastStateAsPosVelAtt() const;
462
467 std::shared_ptr<PosVelAtt> calcInertialSolutionFromMeasurementBuffer(const ImuPos& imuPos, const char* nameId);
468
471
474
475 Eigen::Vector3d _p_lastBiasAcceleration = Eigen::Vector3d::Zero();
476 Eigen::Vector3d _p_lastBiasAngularRate = Eigen::Vector3d::Zero();
477
478 // #########################################################################################################################################
479
482
485
488
491
492 // #########################################################################################################################################
493
496
497 friend bool InertialIntegratorGui(const char* label, InertialIntegrator& integrator, bool& preferAccelerationOverDeltaMeasurements, float width);
498 friend void to_json(json& j, const InertialIntegrator& data);
499 friend void from_json(const json& j, InertialIntegrator& data);
500};
501
507bool InertialIntegratorGui(const char* label, InertialIntegrator& integrator, bool& preferAccelerationOverDeltaMeasurements, float width = 250.0F);
508
512void to_json(json& j, const InertialIntegrator& data);
516void from_json(const json& j, InertialIntegrator& data);
517
522
527
528} // namespace NAV
Inertial Navigation Mechanization Functions in ECEF frame.
Eigen::Vector< T, 10 > e_calcPosVelAttDerivative(const Eigen::Vector< T, 10 > &y, const Eigen::Vector< T, 6 > &z, const PosVelAttDerivativeConstants &c, double=0.0)
Calculates the derivative of the quaternion, velocity and position in ECEF coordinates.
Definition Mechanization.hpp:121
Vector space operations.
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Different Gravity Models.
Imu Position Data.
bool InertialIntegratorGui(const char *label, InertialIntegrator &integrator, bool &preferAccelerationOverDeltaMeasurements, float width=250.0F)
Shows a GUI for advanced configuration of the InertialIntegrator.
The class is responsible for all time-related tasks.
Defines how to save certain datatypes to json.
Inertial Navigation Mechanization Functions in local navigation frame.
Eigen::Vector< T, 10 > n_calcPosVelAttDerivative(const Eigen::Vector< T, 10 > &y, const Eigen::Vector< T, 6 > &z, const PosVelAttDerivativeConstants &c, double=0.0)
Calculates the derivative of the quaternion, velocity and curvilinear position.
Definition Mechanization.hpp:141
Utility class for logging to console and file.
#define LOG_CRITICAL(...)
Critical Event, which causes the program to work entirely and throws an exception.
Definition Logger.hpp:75
Derived::PlainObject lerp(const Eigen::MatrixBase< Derived > &a, const Eigen::MatrixBase< Derived > &b, auto t)
Linear interpolation between vectors.
Definition Math.hpp:351
Inertial Navigation Mechanization Functions.
void to_json(json &j, const Node &node)
Converts the provided node into a json object.
void from_json(const json &j, Node &node)
Converts the provided json object into a node object.
Provides Numerical integration methods.
Y RungeKutta3(const Y &y_n, const std::array< Z, 3 > &z, const Scalar &h, const auto &f, const auto &constParam, const Scalar &t_n=0)
Runge-Kutta 3rd order (explicit) / Simpson's rule .
Definition NumericalIntegration.hpp:264
Y RungeKutta1(const Y &y_n, const std::array< Z, 1 > &z, const Scalar &h, const auto &f, const auto &constParam, const Scalar &t_n=0)
Runge-Kutta 1st order (explicit) / (Forward) Euler method .
Definition NumericalIntegration.hpp:175
Y RungeKutta4(const Y &y_n, const std::array< Z, 4 > &z, const Scalar &h, const auto &f, const auto &constParam, const Scalar &t_n=0)
Runge-Kutta 4th order (explicit) .
Definition NumericalIntegration.hpp:328
Y RungeKutta2(const Y &y_n, const std::array< Z, 2 > &z, const Scalar &h, const auto &f, const auto &constParam, const Scalar &t_n=0)
Runge-Kutta 2nd order (explicit) / Explicit midpoint method .
Definition NumericalIntegration.hpp:204
Y Heun2(const Y &y_n, const std::array< Z, 2 > &z, const Scalar &h, const auto &f, const auto &constParam, const Scalar &t_n=0)
Heun's method (2nd order) (explicit) .
Definition NumericalIntegration.hpp:233
Position, Velocity and Attitude Storage Class.
const char * to_string(gui::widgets::PositionWithFrame::ReferenceFrame refFrame)
Converts the enum to a string.
A buffer which is overwriting itself from the start when full.
IMU Position.
Definition ImuPos.hpp:26
const Eigen::Quaterniond & b_quat_p() const
Quaternion from IMU platform frame to body frame.
Definition ImuPos.hpp:35
Inertial Measurement Integrator.
Definition InertialIntegrator.hpp:40
IntegrationAlgorithm _integrationAlgorithm
Integration algorithm used for the update.
Definition InertialIntegrator.hpp:487
void applyStateErrors_e(const Eigen::Vector3d &e_positionError, const Eigen::Vector3d &e_velocityError, const Eigen::Vector3d &e_attitudeError_b)
Apply the errors to the latest state.
std::optional< Eigen::Vector3d > p_calcCurrentAcceleration() const
Calculate the current acceleration, if measurements area available.
friend const char * to_string(InertialIntegrator::IntegrationAlgorithm algorithm)
Converts the enum to a string.
bool hasInitialPosition() const
Checks if an initial position is set.
Eigen::Vector< T, 10 > calcInertialSolution(const ImuPos &imuPos, const GenericState< T > &state__t0, const GenericState< T > &state__t1, const char *nameId) const
Calculates the inertial solution going from state__t1 to state__t0 given that measurements are availa...
Definition InertialIntegrator.hpp:200
Eigen::Vector3d _p_lastBiasAcceleration
Initial values for the acceleration bias [m/s^2].
Definition InertialIntegrator.hpp:475
friend bool InertialIntegratorGui(const char *label, InertialIntegrator &integrator, bool &preferAccelerationOverDeltaMeasurements, float width)
Shows a GUI for advanced configuration of the InertialIntegrator.
InertialIntegrator(IntegrationFrame integrationFrame)
Constructor.
IntegrationFrame getIntegrationFrame() const
Returns the selected integration frame.
std::shared_ptr< PosVelAtt > calcInertialSolution(const InsTime &obsTime, const Eigen::Vector3d &p_acceleration, const Eigen::Vector3d &p_angularRate, const ImuPos &imuPos, const char *nameId)
Calculates the inertial navigation solution.
std::optional< Eigen::Vector3d > p_calcCurrentAngularRate() const
Calculate the current angular rate, if measurements area available.
void addState(const PosVelAtt &state, const char *nameId)
Pushes the state to the list of states.
friend void to_json(json &j, const InertialIntegrator &data)
Write info to a json object.
void applyStateErrors_n(const Eigen::Vector3d &lla_positionError, const Eigen::Vector3d &n_velocityError, const Eigen::Vector3d &n_attitudeError_b)
Apply the errors to the latest state.
IntegrationAlgorithm
Available Integration Algorithms.
Definition InertialIntegrator.hpp:44
@ SingleStepRungeKutta4
Runge-Kutta 4th order (explicit)
Definition InertialIntegrator.hpp:50
@ MultiStepRK4
Multistep Runge-Kutta 4th order (explicit) (taking 2 old epochs into account)
Definition InertialIntegrator.hpp:52
@ SingleStepHeun2
Heun's method (2nd order) (explicit)
Definition InertialIntegrator.hpp:47
@ COUNT
Amount of available integration algorithms.
Definition InertialIntegrator.hpp:53
@ MultiStepRK3
Multistep Runge-Kutta 3rd order (explicit) / Simpson's rule (taking 2 old epochs into account)
Definition InertialIntegrator.hpp:51
@ SingleStepRungeKutta3
Runge-Kutta 3rd order (explicit) / Simpson's rule.
Definition InertialIntegrator.hpp:48
@ SingleStepRungeKutta2
Runge-Kutta 2nd order (explicit) / Explicit midpoint method.
Definition InertialIntegrator.hpp:46
@ SingleStepHeun3
Heun's method (3nd order) (explicit)
Definition InertialIntegrator.hpp:49
@ SingleStepRungeKutta1
Runge-Kutta 1st order (explicit) / (Forward) Euler method.
Definition InertialIntegrator.hpp:45
bool _accelerationsAreAveragedMeasurements
If true, then the measurements are accumulated values over the last epoch. (always true when using de...
Definition InertialIntegrator.hpp:490
void setTotalSensorBiases(const Eigen::Vector3d &p_biasAcceleration, const Eigen::Vector3d &p_biasAngularRate)
Sets the sensor biases total values.
const Eigen::Vector3d & p_getLastAccelerationBias() const
Return the last acceleration bias in platform frame coordinates in [m/s^2].
friend const char * to_string(InertialIntegrator::IntegrationFrame frame)
Converts the enum to a string.
void setBufferSizes()
Resizes the measurement and state buffers depending on the integration algorithm.
std::optional< std::reference_wrapper< const State > > getLatestState() const
Get the latest state if it exists.
friend void from_json(const json &j, InertialIntegrator &data)
Read info from a json object.
std::shared_ptr< PosVelAtt > calcInertialSolutionFromMeasurementBuffer(const ImuPos &imuPos, const char *nameId)
Calculates the inertial navigation solution.
void addMeasurement(const InsTime &epoch, double dt, const Eigen::Vector3d &p_acceleration, const Eigen::Vector3d &p_angularRate, const char *nameId)
Adds the measurement to the tracking buffer.
InertialIntegrator()=default
Default Constructor.
std::shared_ptr< PosVelAtt > calcInertialSolutionDelta(const InsTime &obsTime, double deltaTime, const Eigen::Vector3d &p_deltaVelocity, const Eigen::Vector3d &p_deltaTheta, const ImuPos &imuPos, const char *nameId)
Calculates the inertial navigation solution.
bool areAccelerationsAveragedMeasurements() const
Wether the measurements are accumulated values over the last epoch. (always true when using delta mea...
void addDeltaMeasurement(const InsTime &epoch, double dt, double deltaTime, const Eigen::Vector3d &p_deltaVelocity, const Eigen::Vector3d &p_deltaTheta, const char *nameId)
Adds the measurement to the tracking buffer.
IntegrationFrame
Available Integration Frames.
Definition InertialIntegrator.hpp:58
@ NED
Local North-East-Down frame.
Definition InertialIntegrator.hpp:60
@ ECEF
Earth-Centered Earth-Fixed frame.
Definition InertialIntegrator.hpp:59
void setInitialState(const PosVelAtt &state, const char *nameId)
Sets the initial state.
void reset()
Clears all internal data.
IntegrationFrame _integrationFrame
Frame to integrate the observations in.
Definition InertialIntegrator.hpp:481
PosVelAttDerivativeConstants _posVelAttDerivativeConstants
Settings for the models to use.
Definition InertialIntegrator.hpp:495
Eigen::Vector3d _p_lastBiasAngularRate
Initial values for the angular rate bias [rad/s].
Definition InertialIntegrator.hpp:476
ScrollingBuffer< State > _states
List of states. Length depends on algorithm used.
Definition InertialIntegrator.hpp:473
bool _lockIntegrationFrame
Wether to lock the integration frame.
Definition InertialIntegrator.hpp:484
std::shared_ptr< PosVelAtt > lastStateAsPosVelAtt() const
Returns the last state as PosVelAtt.
const Eigen::Vector3d & p_getLastAngularRateBias() const
Return the last angular rate bias in platform frame coordinates in [rad/s].
void applySensorBiasesIncrements(const Eigen::Vector3d &p_deltaBiasAcceleration, const Eigen::Vector3d &p_deltaBiasAngularRate)
Sets the sensor biases increment.
GenericState< double > State
Inertial state and measurements.
Definition InertialIntegrator.hpp:95
const PosVelAttDerivativeConstants & getConstants() const
Returns the selected compensation models.
The class is responsible for all time-related tasks.
Definition InsTime.hpp:710
Position, Velocity and Attitude Storage Class.
Definition PosVelAtt.hpp:25
A buffer which is overwriting itself from the start when full.
Definition ScrollingBuffer.hpp:29
Inertial state and measurements.
Definition InertialIntegrator.hpp:75
Eigen::Quaternion< double > misalignmentAccel
Definition InertialIntegrator.hpp:90
InsTime epoch
Definition InertialIntegrator.hpp:76
Eigen::Vector3< double > p_biasAngularRate
Definition InertialIntegrator.hpp:85
Measurement m
Definition InertialIntegrator.hpp:82
Eigen::Vector3< double > scaleFactorGyro
Definition InertialIntegrator.hpp:88
Eigen::Quaternion< double > misalignmentGyro
Definition InertialIntegrator.hpp:91
Eigen::Vector3< double > p_biasAcceleration
Definition InertialIntegrator.hpp:84
Eigen::Quaternion< double > attitude
Definition InertialIntegrator.hpp:80
Eigen::Vector3< double > velocity
Definition InertialIntegrator.hpp:79
Eigen::Vector3< double > scaleFactorAccel
Definition InertialIntegrator.hpp:87
Eigen::Vector3< double > position
Definition InertialIntegrator.hpp:78
Inertial Measurement.
Definition InertialIntegrator.hpp:65
bool averagedMeasurement
Wether the acceleration is averaged over the last epoch.
Definition InertialIntegrator.hpp:66
Eigen::Vector3d p_angularRate
Angular rate in platform frame coordinates in [rad/s].
Definition InertialIntegrator.hpp:69
Eigen::Vector3d p_acceleration
Acceleration in platform frame coordinates in [m/s^2].
Definition InertialIntegrator.hpp:68
double dt
Time since previous observation in [s].
Definition InertialIntegrator.hpp:67
Values needed to calculate the PosVelAttDerivative for the local-navigation frame.
Definition Mechanization.hpp:26