123 void setTotalSensorBiases(
const Eigen::Vector3d& p_biasAcceleration,
const Eigen::Vector3d& p_biasAngularRate);
134 void applyStateErrors_n(
const Eigen::Vector3d& lla_positionError,
const Eigen::Vector3d& n_velocityError,
const Eigen::Vector3d& n_attitudeError_b);
140 void applyStateErrors_e(
const Eigen::Vector3d& e_positionError,
const Eigen::Vector3d& e_velocityError,
const Eigen::Vector3d& e_attitudeError_b);
143 [[nodiscard]] std::optional<std::reference_wrapper<const State>>
getLatestState()
const;
174 const Eigen::Vector3d& p_acceleration,
const Eigen::Vector3d& p_angularRate,
175 const ImuPos& imuPos,
const char* nameId);
186 const Eigen::Vector3d& p_deltaVelocity,
const Eigen::Vector3d& p_deltaTheta,
187 const ImuPos& imuPos,
const char* nameId);
203 [[maybe_unused]]
const char* nameId)
const
232 Eigen::Vector<T, 10> y;
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();
241 return (state.misalignmentAccel * state.m.p_acceleration.template cast<T>()).cwiseProduct(state.scaleFactorAccel) + state.p_biasAcceleration;
244 return (state.misalignmentGyro * state.m.p_angularRate.template cast<T>()).cwiseProduct(state.scaleFactorGyro) + state.p_biasAngularRate;
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);
260 std::array<Eigen::Vector<T, 6>, 1> z;
262 else { z[0] << b_accel__t1, b_gyro__t1; }
278 std::array<Eigen::Vector<T, 6>, 2> z;
281 z[0] << b_accel__t0, b_gyro__t0;
282 z[1] << b_accel__t0, b_gyro__t0;
286 z[0] << b_accel__t1, b_gyro__t1;
304 std::array<Eigen::Vector<T, 6>, 2> z;
307 z[0] << b_accel__t0, b_gyro__t0;
308 z[1] << b_accel__t0, b_gyro__t0;
312 z[0] << b_accel__t1, b_gyro__t1;
313 z[1] << b_accel__t0, b_gyro__t0;
330 std::array<Eigen::Vector<T, 6>, 3> z;
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;
339 z[0] << b_accel__t1, b_gyro__t1;
341 z[2] << b_accel__t0, b_gyro__t0;
359 std::array<Eigen::Vector<T, 6>, 3> z;
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;
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);
388 std::array<Eigen::Vector<T, 6>, 4> z;
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;
398 z[0] << b_accel__t1, b_gyro__t1;
401 z[3] << b_accel__t0, b_gyro__t0;
435 y.template segment<4>(6) = Eigen::Quaternion<T>(y.template segment<4>(6)).normalized().coeffs();
448 const Eigen::Vector3d& p_acceleration,
const Eigen::Vector3d& p_angularRate,
const char* nameId);
458 const Eigen::Vector3d& p_deltaVelocity,
const Eigen::Vector3d& p_deltaTheta,
const char* nameId);
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
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
Different Gravity Models.
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.
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
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