Class FixedPointingDynamics

Inheritance Relationships

Base Type

Class Documentation

class FixedPointingDynamics : public lupnt::AttitudeDynamics

Attitude dynamics that orients a body frame so two configured axes point at two configured target bodies (“two-vector” / fixed-pointing attitude).

Builds a body-to-world rotation whose primary_axis_ points toward primary_body_id_ and whose secondary_axis_ is constrained toward secondary_body_id_ (e.g. antenna boresight at the target body, solar panel normal at the Sun). The resulting quaternion and angular velocity (obtained by differentiating the rotation in time via autodiff) are returned as an Attitude state. Used by agents/ (e.g. constellation satellites, see Constellation construction in agents/constellation.cc) to drive pointing-dependent devices.

Public Functions

FixedPointingDynamics() = default
FixedPointingDynamics(Config &config)

Construct from a YAML configuration node specifying the primary and secondary pointing axes and target bodies.

Reads primary_axis, primary_body_id, secondary_axis, and secondary_body_id from config.

inline void SetPrimaryPointing(Axis axis, BodyId body_id)

Set the primary pointing axis and the body it should track.

Parameters:
  • axis – Body-frame axis (X/Y/Z) to align with the direction to body_id.

  • body_id – Target body whose direction defines the primary pointing axis.

inline void SetSecondaryPointing(Axis axis, BodyId body_id)

Set the secondary pointing axis and the body it should track.

Parameters:
  • axis – Body-frame axis (X/Y/Z) constrained toward the direction to body_id.

  • body_id – Target body whose direction defines the secondary pointing axis.

virtual State Propagate(const State &qw, Real t0, Real tf, const State &rv) override

Compute the two-vector pointing attitude at time tf from the object’s position.

Builds an orthonormal body-to-world rotation matrix R_b2w(t) whose columns align the primary/secondary body axes with the directions from the object’s position r = rv.head(3) to primary_body_id_/secondary_body_id_ at GetLupntEpoch() + t. The angular velocity is obtained from the analytic time-derivative of R_b2w (via autodiff) using RotToAngularVelocity.

Parameters:
  • qw – Initial attitude state at t0 (only its frame is used).

  • t0 – Initial epoch [s, TDB since J2000] (unused; attitude is computed directly at tf).

  • tf – Final epoch [s, TDB since J2000] at which to evaluate the pointing attitude.

  • rvObject’s Cartesian position/velocity state (Cart6); must share the same frame as qw and have position in rv.head(3).

Returns:

Attitude state (quaternion + body angular velocity) realizing the two-vector pointing law at time tf.

virtual State Propagate(const State &qw, Real t0, Real tf, const State *u) override

Unimplemented: fixed-pointing attitude requires the object’s position/velocity.

Always raises a LUPNT_CHECK

failure (“Position and velocity required for

fixed pointing dynamics”) and returns

qw unchanged. Callers must use the Propagate(qw, t0, tf, rv) overload instead.

inline virtual StateType GetStateType() const override

Return Attitude::TYPE.

virtual State Propagate(const State &x0, Real t0, Real tf, const State *u, MatXd *stm)

Propagate the state and compute the state transition matrix (STM) d(xf)/d(x0) via automatic differentiation.

Default implementation: if stm == nullptr, forwards to the no-STM Propagate overload; otherwise wraps Propagate(x0, t0, tf, u) in an autodiff Jacobian (jacobian(...)) with respect to x0. Used by filters (filters/) that need the linearized state transition for covariance propagation (e.g. EKF/UKF time updates).

Parameters:
  • x0 – Initial state at time t0.

  • t0 – Initial epoch [s, TDB since J2000].

  • tf – Final epoch [s, TDB since J2000].

  • u – Optional control/forcing input; nullptr if unused.

  • stm – Output: state transition matrix d(xf)/d(x0); left unmodified if nullptr.

Returns:

Propagated state at time tf.

virtual MatX Propagate(const State &x0, const VecX &tfs, const State *u = nullptr)

Propagate the state to a sequence of output epochs.

Repeatedly calls Propagate(x0, t0, tf, u) between consecutive entries of tfs, accumulating each result as a row of the returned matrix. Used by applications/ and analysis scripts to generate a full trajectory time history in one call, with optional progress-bar output (see SetPrintProgress).

Parameters:
  • x0 – Initial state at tfs(0).

  • tfs – Vector of output epochs [s, TDB since J2000], including the initial epoch as tfs(0).

  • u – Optional control/forcing input applied at every step; nullptr if unused.

Returns:

Matrix whose i-th row is the propagated state at tfs(i).