controller#

Abstract base class for satellite attitude control laws.

namespace saltro
namespace controller#
class Controller#
#include <controller.h>

Abstract base class for satellite attitude controllers.

Defines the interface for control laws that compute actuator commands given the current attitude state, magnetic field, goal orientation, and boresight constraints.

The controller computes a combined control vector:

\[ \mathbf{u} = [\mathbf{m}_{\text{mtq}}^T, \boldsymbol{\tau}_{\text{rw}}^T, \boldsymbol{\tau}_{\text{magic}}^T]^T \]
where:
  • \(\mathbf{m}_{\text{mtq}}\): magnetic dipole moments (A·m²) for each MTQ axis

  • \(\boldsymbol{\tau}_{\text{rw}}\): commanded torques (N·m) for each reaction wheel

  • \(\boldsymbol{\tau}_{\text{magic}}\): unconstrained “magic” torque (N·m) in body frame

Derived classes implement specific control laws such as B-dot detumbling, PD control, or excitation signals for system identification.

Subclassed by saltro::controller::ExcitationController, saltro::controller::IntegratedBdotController, saltro::controller::ZeroController

Public Functions

Controller(const Satellite &satellite)#

Construct a controller for the given satellite model.

Parameters:

satelliteSatellite model with actuator configuration and inertia properties

virtual ~Controller() = default#
virtual Satellite::VecX find_u(const Satellite::VecX &x, const Eigen::Vector3d &B_eci, const Eigen::Vector4d &q_goal, const Eigen::Vector3d &boresight_body) const = 0#

Compute control input for current state and environment.

Pure virtual method implemented by derived classes to define the control law. The controller maps the current state, magnetic field, goal orientation, and boresight constraint to an actuator command vector.

Parameters:
  • x – Attitude state vector (7+nRW × 1): [ω(3), q(4), h_rw(nRW)]

    • ω: angular velocity in body frame (rad/s)

    • q: unit quaternion (scalar-first)

    • h_rw: reaction wheel angular momentum (N·m·s)

  • B_eci – Magnetic field vector in ECI frame (3 × 1), Tesla

  • q_goal – Goal quaternion (4 × 1), unit quaternion (scalar-first)

  • boresight_body – Desired boresight direction in body frame (3 × 1), unit vector

Returns:

Control vector (nu × 1) with actuator commands

Protected Functions

virtual void autoTuneGains() = 0#

Automatically tune controller gains based on satellite properties.

Pure virtual method implemented by derived classes to set control gains (e.g., proportional/derivative coefficients) based on satellite inertia, actuator capabilities, and expected operating conditions.

Protected Attributes

const Satellite &satellite_#

Reference to satellite model

double expected_b_field_leo_ = 35e-6#

Expected magnetic field magnitude in LEO (Tesla), used for gain tuning