quaternionStateData

class QuaternionStateData : public StateData
#include <quaternionStateData.h>

A StateData whose value is a unit quaternion advanced from a body angular velocity.

state is a 4x1 unit quaternion in (w, x, y, z) order. stateDeriv is a 3x1 body angular velocity in rad/s. Each stateDiffusion entry, when present, must be a 3x1 rotational increment vector that is composed into the quaternion with the matching pseudo-step.

Sizes intentionally differ — the standard Euler step state += deriv * dt is not valid on SO(3). propagateState instead applies the exact exponential-map integrator and renormalizes so |q| = 1 after each step.

Public Functions

QuaternionStateData(std::string inName, const Eigen::MatrixXd &newState)

Constructs a 4x1 quaternion state with a 3x1 derivative.

A zero or empty initial state defaults to the identity quaternion. A nonzero 4x1 initial quaternion is normalized and used as the initial state.

virtual std::unique_ptr<StateData> clone() const override

Returns a deep copy of this state.

virtual void propagateState(double dt, std::vector<double> pseudoStep = {}) override

Integrates state over dt using the body angular velocity in stateDeriv. Composes the current quaternion with exp(0.5 * dt * omega), applies any stochastic rotational diffusion, and renormalizes so |q| = 1 after each step.