ADCS.controller.plan_and_track_base module

class ADCS.controller.plan_and_track_base.PlanAndTrackBase(est_sat, **kwargs)[source]

Bases: Controller

Base class for Plan-and-Track trajectory controllers.

This class factors out the shared machinery needed by all Plan-and-Track controller variants (e.g. time-varying LQR tracking, tracking with disturbance estimation, and exact/quaternion formulations). It provides:

  • Construction of a C++ planner stack from a Python satellite model.

  • Propagation of orbital/environment vectors into the exact memory layout expected by the C++ planner.

  • A common trajectory-optimization call path and post-processing of the returned controls/gains into Python actuator ordering.

The class is a concrete Controller but remains abstract in the sense that subclasses must implement the controller’s control law and planning policy (e.g. find_u() and a public trajectory-generation entry point) on top of the helpers provided here.

Mathematical overview

The trajectory planner receives a time grid and a collection of environment vectors sampled along an orbit segment.

Let the planning horizon be \(T\) seconds with a planner time step \(\Delta t\). The number of knot points is

\[N = \left\lceil \frac{T}{\Delta t} \right\rceil + 1.\]

The start time is expressed in J2000 centuries, \(t_0\), and the end time passed to the planner is

\[t_1 = t_0 + T \cdot c_{\mathrm{sec}\rightarrow\mathrm{cent}},\]

where \(c_{\mathrm{sec}\rightarrow\mathrm{cent}}\) is the conversion factor from seconds to J2000 centuries (TimeConstants).

For each knot point \(k \in \{0,\dots,N-1\}\), the propagated orbit provides inertial position and velocity \(\mathbf{r}_k, \mathbf{v}_k\) along with environment vectors such as magnetic field and sun direction (symbolically \(\mathbf{b}_k, \mathbf{s}_k\)). The goal system provides a reference attitude/pointing direction \(\mathbf{e}_k\) via to_ref().

Implementation notes

The C++ side expects specific array shapes and memory layouts:

  • Time: (N,) contiguous float64.

  • Vectors: (3, N) float64 Fortran-contiguous (column-major), compatible with Armadillo-style matrix views.

  • Scalars: (N,) contiguous float64.

Returned controls and gains are converted from the planner’s internal actuator ordering (e.g. MTQ then RW) to the Python actuator ordering using reorder_controls_cpp_to_python() and reorder_gains_cpp_to_python().

set_active_trajectory(traj)[source]

Set the active trajectory used for tracking.

The active trajectory is the nominal plan that the tracking controller follows. Subclasses typically reference this trajectory inside their control computation (e.g. selecting the nearest knot point and applying the corresponding TVLQR feedback gains).

The trajectory type is the shared planning container Trajectory.

Parameters:

traj (Trajectory) – The trajectory to mark as active for subsequent tracking.

Returns:

None.

Return type:

None

active_trajectory: Trajectory | None
csat: pysat.Satellite
ctrl_dim: int
est_sat: EstimatedSatellite
planner: tplaunch.Planner
planner_settings: PlannerSettings
state_dim: int
Parameters:

est_sat (EstimatedSatellite)