CogniPilot

MODELICA LIBRARY · ENGINEERING REFERENCE

function

Estimation.StrapdownINS.ESKF.correctZeroVelocity

Fuse a synthetic measurement that the vehicle is not moving

Public declarations

Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.

RoleNameTypeDimensions / attributes / defaultDescription
inputpredictedState
inputvariance_m2_s2Real(unit = "m2/s2")Per-axis measurement variance of the zero-velocity observation
inputinnovationGateReal= 0.0
inputuseSemiDirectBiasBoolean= false
outputcorrectedState
outputacceptedBoolean
outputrejectionReasonInteger
outputnormalizedInnovationSquaredReal

Modelica declarations and implementation

Show parameters, interfaces and source

Parameters, inputs, outputs, defaults and equations from the source file.

function correctZeroVelocity
  "Fuse a synthetic measurement that the vehicle is not moving"
  input State predicted;
  input Real variance_m2_s2(unit = "m2/s2")
    "Per-axis measurement variance of the zero-velocity observation";
  input Real innovationGate = 0.0;
  input Boolean useSemiDirectBias = false;
  output State corrected;
  output Boolean accepted;
  output Integer rejectionReason;
  output Real normalizedInnovationSquared;
protected
  Real rotationWorldBody[3, 3];
  Real residual[3];
  Real H[3, TangentLength];
  Real measurementCovariance[3, 3];
algorithm
  // Same body-frame velocity residual convention as correctGpsVelocity.
  // Through the velocity-attitude cross covariance this is the update that
  // makes a tilt error observable on a vehicle at rest with no aiding.
  rotationWorldBody := LieGroups.SO3.Quat.to_DCM(
    predicted.quaternionWorldBody);
  residual := -(transpose(rotationWorldBody) * predicted.velocityWorldEnu_m_s);
  H := cat(2, zeros(3, 3), identity(3), zeros(3, TangentLength - 6));
  measurementCovariance := identity(3) * variance_m2_s2;
  (corrected, accepted, rejectionReason, normalizedInnovationSquared) :=
    correctLinear(predicted, residual, H, measurementCovariance,
      innovationGate, zeros(3), zeros(TangentLength, size(residual, 1)),
      false, useSemiDirectBias);
end correctZeroVelocity;