integratedbdotcontroller#
B-dot detumbling and PD attitude control law with integrated magnetic derivatives.
-
namespace saltro
-
namespace controller
-
class IntegratedBdotController : public saltro::controller::Controller#
- #include <integratedbdotcontroller.h>
Integrated B-dot controller for satellite detumbling and attitude control.
Implements a dual-mode control law combining:
Magnetorquer B-dot control: Opposes the time rate of change of the magnetic field to dissipate rotational energy. Uses integrated magnetic field derivative approximation.
Reaction wheel PD control: Provides precise attitude tracking after initial detumbling.
The magnetorquer control law is:
\[ \mathbf{m}_{\text{mtq}} = -k_p \mathbf{C}(\mathbf{q})^T \mathbf{B}_{\text{ECI}} - k_d \frac{d}{dt}[\mathbf{C}(\mathbf{q})^T \mathbf{B}_{\text{ECI}}] \]where the derivative is approximated using integrated (accumulated) magnetic field changes.The reaction wheel control law uses quaternion-based PD feedback:
\[ \boldsymbol{\tau}_{\text{rw}} = -k_p \mathbf{q}_{\text{err,vec}} - k_d \boldsymbol{\omega} \]where \(\mathbf{q}_{\text{err,vec}}\) is the vector part of the quaternion error \(\mathbf{q}_{\text{goal}}^{-1} \otimes \mathbf{q}\).The controller automatically tunes gains based on satellite inertia and expected magnetic field strength in LEO (35 µT nominal).
Public Functions
-
explicit IntegratedBdotController(const Satellite &satellite)#
Construct an integrated B-dot controller with auto-tuned gains.
Initializes the controller and automatically computes proportional and derivative gains for both magnetorquers and reaction wheels based on satellite properties.
- Parameters:
satellite – Satellite model with actuator configuration and inertia tensor
-
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 override#
Compute control input using B-dot and PD feedback.
Implements the dual-mode control law combining magnetorquer B-dot damping with reaction wheel PD attitude control. The control is saturated by actuator limits defined in the satellite model.
- Parameters:
x – Attitude state vector (7+nRW × 1): [ω(3), q(4), h_rw(nRW)]
B_eci – Magnetic field vector in ECI frame (3 × 1), Tesla
q_goal – Goal quaternion (4 × 1), unit quaternion
boresight_body – Desired boresight direction in body frame (3 × 1), unit vector
- Returns:
Control vector (nu × 1): [m_mtq, τ_rw, τ_magic]
Protected Functions
-
virtual void autoTuneGains() override#
Automatically tune controller gains based on satellite properties.
Computes proportional and derivative gains for magnetorquers and reaction wheels using scaling laws based on inertia eigenvalues, actuator capabilities, and expected magnetic field strength. Uses damping ratio ζ ≈ 0.7 for critically damped response.
Private Members
-
double max_rate_ref_ = 5.0 * 3.14159265358979323846 / 180.0#
Maximum reference angular rate for gain normalization (rad/s)
-
std::vector<double> mtq_kp_#
Proportional gains for each magnetorquer axis (A·m²/T)
-
std::vector<double> mtq_kd_#
Derivative gains for each magnetorquer axis (A·m²·s/T)
-
std::vector<double> rw_kp_#
Proportional gains for each reaction wheel (N·m/rad)
-
std::vector<double> rw_kd_#
Derivative gains for each reaction wheel (N·m·s/rad)
-
class IntegratedBdotController : public saltro::controller::Controller#
-
namespace controller