ADCS.controller.plan_and_track.build_csat module

ADCS.controller.plan_and_track.build_csat.build_cpp_satellite(est_sat, planner_settings)[source]

Construct a C++ planner-compatible satellite model from a Python estimated satellite.

This function converts an instance of EstimatedSatellite into a Satellite object used by the C++ trajectory planner. The conversion includes:

  • Inertia tensor assignment

  • Actuator definitions

  • Environmental disturbance torques

  • Operational constraints

The resulting satellite model is dynamically equivalent to the Python-side representation and suitable for optimization-based planning.

Parameters:
  • est_sat (EstimatedSatellite) – Estimated satellite containing inertia and actuator definitions.

  • planner_settings (PlannerSettings) – Planner configuration including weights, limits, and disturbance flags.

Returns:

Satellite object compatible with the C++ trajectory planner.

Return type:

Satellite

ADCS.controller.plan_and_track.build_csat.get_cpp_to_python_control_permutation(actuators)[source]

Compute the permutation between C++ planner control ordering and Python actuator ordering.

The C++ trajectory planner outputs control vectors in a fixed, type-based order:

\[\begin{split}\mathbf{u}_{\text{C++}} = \begin{bmatrix} \mathbf{u}_{\text{MTQ}} \\ \mathbf{u}_{\text{RW}} \end{bmatrix}\end{split}\]

where all magnetorquers (MTQs) are listed first, followed by all reaction wheels (RWs). In contrast, the Python-side actuator list stored in EstimatedSatellite may have an arbitrary ordering.

This function computes permutation indices that allow reordering control vectors and matrices between these two conventions.

Let \(\pi\) be a permutation such that

\[\mathbf{u}_{\text{Python}} = \mathbf{u}_{\text{C++}}[\pi]\]

and \(\pi^{-1}\) its inverse.

Parameters:

actuators (List[Actuator]) – List of Python actuator objects in the order they appear in actuators.

Returns:

A tuple (cpp_to_py, py_to_cpp) where cpp_to_py maps C++ control indices to Python indices, and py_to_cpp is the inverse permutation.

Return type:

Tuple[numpy.ndarray, numpy.ndarray]

ADCS.controller.plan_and_track.build_csat.reorder_controls_cpp_to_python(Uset, actuators)[source]

Reorder a control matrix from C++ planner ordering to Python actuator ordering.

The C++ planner outputs control trajectories using the ordering described in get_cpp_to_python_control_permutation(). This function applies the appropriate permutation to match the actuator order expected by the Python simulation and control stack.

Two matrix layouts are supported:

  • Column-major controls:

    \[\mathbf{U} \in \mathbb{R}^{n_u \times N}\]

    where each row corresponds to one control input over time.

  • Row-major controls:

    \[\mathbf{U} \in \mathbb{R}^{N \times n_u}\]

    where each column corresponds to one control input.

The output matrix preserves the original layout and dimensions.

Parameters:
  • Uset (numpy.ndarray) – Control matrix produced by the C++ planner.

  • actuators (List[Actuator]) – Python actuator list defining the desired control ordering.

Returns:

Control matrix reordered to match Python actuator ordering.

Return type:

numpy.ndarray