ADCS.controller.plan_and_track_lqr module¶
- class ADCS.controller.plan_and_track_lqr.Plan_and_Track_LQR(est_sat, planner_settings)[source]¶
Bases:
PlanAndTrackBasePlan-and-Track controller using ALTRO planning with TVLQR feedback tracking.
This controller plans an optimal attitude trajectory using the ALTRO (Augmented Lagrangian TRajectory Optimizer) and executes it in closed loop using a time-varying linear quadratic regulator (TVLQR). The TVLQR gains are computed along the nominal trajectory returned by the planner and are used to stabilize the spacecraft about that trajectory.
Relationship to the Plan-and-Track framework¶
This class derives from
PlanAndTrackBase, which provides:Construction and configuration of the C++ ALTRO planner.
Orbit and environment propagation into planner-compatible arrays.
A shared trajectory-optimization pipeline.
Mathematical formulation¶
Let the nonlinear spacecraft attitude dynamics be linearized about the nominal planned trajectory, yielding a discrete-time linear time-varying system:
\[\mathbf{x}_{k+1} = A_k \mathbf{x}_k + B_k \mathbf{u}_k,\]where \(\mathbf{x}_k\) is the attitude state deviation and \(\mathbf{u}_k\) is the control input deviation at time step \(k\).
The planner computes a nominal state-control sequence \((\mathbf{x}_k^\ast, \mathbf{u}_k^\ast)\) and associated TVLQR gains \(K_k\). The tracking control law applied by this controller is:
\[\mathbf{u}_k = \mathbf{u}_k^\ast - K_k \left( \mathbf{x}_k - \mathbf{x}_k^\ast \right).\]This feedback stabilizes the system about the planned trajectory while compensating for moderate disturbances and modeling errors.
Intended use¶
This controller is the standard closed-loop Plan-and-Track variant and is appropriate for nominal mission operations where feedback tracking is required but explicit disturbance estimation is not needed.
- param est_sat:
Estimated satellite model with actuators and sensors.
- type est_sat:
- param planner_settings:
ALTRO trajectory planner configuration bundle.
- type planner_settings:
PlannerSettings- return:
None.
- rtype:
None
- calculate_trajectory(t_start, duration, x_0, os_0, goals, verbose=False)[source]¶
Plan an optimal trajectory using ALTRO and prepare it for TVLQR tracking.
This method invokes the shared planning routine provided by
_calculate_trajectory_common()to compute a nominal trajectory and associated TVLQR gains. The results are packaged into aTrajectoryobject suitable for closed-loop tracking.Planner outputs¶
The returned trajectory contains:
A discrete time grid for planning and tracking.
The nominal state sequence \(\mathbf{x}_k^\ast\).
The nominal control sequence \(\mathbf{u}_k^\ast\).
The time-varying LQR gain sequence \(K_k\).
Auxiliary solver data required for tracking.
These data are subsequently used by
find_u()to compute feedback control commands.- param t_start:
Planning start time in J2000 centuries.
- type t_start:
float
- param duration:
Planning horizon length in seconds.
- type duration:
float
- param x_0:
Initial state vector used to seed the optimizer.
- type x_0:
numpy.ndarray
- param os_0:
Initial orbital state used to seed environment propagation.
- type os_0:
- param goals:
Goal list defining the pointing objectives.
- type goals:
GoalList- param verbose:
If true, enable planner verbosity and diagnostic output.
- type verbose:
bool
- return:
Planned trajectory with nominal states, controls, and TVLQR gains.
- rtype:
Trajectory
- Parameters:
t_start (float)
duration (float)
x_0 (ndarray)
os_0 (Orbital_State)
goals (GoalList)
verbose (bool)
- Return type:
- find_u(x_hat, sens, est_sat, os_hat, goal=None)[source]¶
Compute the TVLQR tracking control input at the current time.
This method evaluates the time-varying LQR feedback law associated with the active trajectory. The current time is obtained from the orbital state estimate and used to interpolate the nominal trajectory and TVLQR gains.
Control evaluation¶
Let \(t\) be the current time extracted from
os_hat.J2000. If the active trajectory is valid at \(t\), the controller computes:\[\]mathbf{u}(t) = mathbf{u}^ast(t) - K(t) left(mathbf{x}(t) - mathbf{x}^ast(t)right),
where:
\(\mathbf{x}(t)\) is the estimated state
x_hat,\(\mathbf{x}^\ast(t)\) is the nominal state from the trajectory,
\(\mathbf{u}^\ast(t)\) is the nominal control,
\(K(t)\) is the time-varying LQR gain.
Validity checks¶
A runtime error is raised if:
No active trajectory has been set using
set_active_trajectory().The current time lies outside the valid time interval of the trajectory, as determined by
is_valid_time().
Parameter usage¶
The parameters
sens,est_sat,goal_vector_eci, andw_refare included to satisfy theControllerinterface but are not used directly in the control computation, since all references are taken from the active trajectory.- param x_hat:
Estimated state vector.
- type x_hat:
numpy.typing.NDArray[numpy.float64]
- param sens:
Sensor measurement vector. Not directly used.
- type sens:
numpy.typing.NDArray[numpy.float64]
- param est_sat:
Estimated satellite model. Not directly used.
- type est_sat:
- param os_hat:
Estimated orbital state providing the current time.
- type os_hat:
- param goal_vector_eci:
Goal vector in ECI frame. Not directly used.
- type goal_vector_eci:
typing.Optional[numpy.typing.NDArray[numpy.float64]]
- param w_ref:
Reference angular velocity. Not directly used.
- type w_ref:
typing.Optional[numpy.typing.NDArray[numpy.float64]]
- return:
Control vector computed by TVLQR tracking.
- rtype:
numpy.typing.NDArray[numpy.float64]
- Parameters:
x_hat (ndarray[tuple[int, ...], dtype[float64]])
sens (ndarray[tuple[int, ...], dtype[float64]])
est_sat (EstimatedSatellite)
os_hat (Orbital_State)
goal (Goal | None)
- Return type:
ndarray[tuple[int, …], dtype[float64]]
- Parameters:
est_sat (EstimatedSatellite)
planner_settings (PlannerSettings)