MTQ#
-
class MTQ : public Actuator#
- #include <MTQ.h>
Magnetorquer (MTQ) actuator class.
Represents a magnetic torque coil that produces torque through interaction with Earth’s magnetic field. The torque is:
\[ \boldsymbol{\tau} = \mathbf{m} \times \mathbf{B} \]where \(\mathbf{m} = u \cdot \text{axis}\) is the magnetic dipole moment (A·m²) and \(\mathbf{B}\) is the magnetic field in body frame.Unlike reaction wheels, MTQs have no internal momentum state. The torque is always reaction-free (momentum is transferred to the Earth’s field).
See also
Actuator for base class interface
Public Types
Public Functions
-
MTQ(const Vec3 &axis, double max_dipole)#
Construct a magnetorquer with specified parameters.
- Parameters:
axis – Unit vector specifying the coil direction in body frame.
max_dipole – Maximum magnetic dipole moment magnitude (A·m²).
-
Vec3 torque(double u, const BaseState &x, const Vec3 &B_body) const#
Compute the magnetic torque produced by this MTQ.
The torque is the cross product of magnetic dipole moment and field:
\[ \boldsymbol{\tau} = (u \cdot \text{axis}) \times \mathbf{B}_{\text{body}} \]- Parameters:
u – Control input (dipole moment magnitude, A·m²).
x – Base state (contains quaternion for ECI→body transformation).
B_body – Magnetic field vector in body frame (Tesla).
- Returns:
3D torque vector (Newton-meters).
-
Mat13 dtorq_du(double u, const BaseState &x, const Vec3 &B_body) const#
Jacobian of torque with respect to control input.
- Parameters:
u – Control input.
x – Base state.
B_body – Magnetic field in body frame.
- Returns:
1×3 Jacobian matrix.
-
Mat73 dtorq_dbasestate(double u, const BaseState &x, const Vec3 &B_body, const Eigen::Matrix<double, 4, 3> &dB_dq) const#
Jacobian of torque with respect to base state.
Account for the fact that magnetic field depends on attitude (quaternion).
- Parameters:
u – Control input.
x – Base state.
B_body – Magnetic field in body frame.
dB_dq – Jacobian of magnetic field with respect to quaternion (4×3).
- Returns:
7×3 Jacobian matrix.
-
T113 ddtorq_dudu(double u, const BaseState &x, const Vec3 &B_body) const#
Hessian of torque control input (second derivatives).
- Parameters:
u – Control input.
x – Base state.
B_body – Magnetic field in body frame.
- Returns:
Tensor3 with 3 slices of 1×1 matrices.
-
T173 ddtorq_dudbasestate(double u, const BaseState &x, const Vec3 &B_body, const Eigen::Matrix<double, 4, 3> &dB_dq) const#
Hessian of mixed torque derivatives (control-state).
- Parameters:
u – Control input.
x – Base state.
B_body – Magnetic field in body frame.
dB_dq – Jacobian of magnetic field with respect to quaternion.
- Returns:
Tensor3 with 3 slices of 1×7 matrices.
-
T773 ddtorq_dbasestatedbasestate(double u, const BaseState &x, const Eigen::Matrix<double, 4, 3> &dB_dq, const std::array<Eigen::Matrix<double, 4, 4>, 3> &d2B_dq2) const#
Hessian of state-state torque derivatives.
- Parameters:
u – Control input.
x – Base state.
dB_dq – Jacobian of magnetic field with respect to quaternion.
d2B_dq2 – Array of three 4×4 Hessian matrices for magnetic field.
- Returns:
Tensor3 with 3 slices of 7×7 matrices.
-
virtual Vec3 torque(double u, const BaseState &x) const#
Compute the torque vector produced by this actuator.
Returns the torque vector as a function of control input and spacecraft state.
- Parameters:
u – Control input (typically in [-u_max, u_max]).
x – Base state vector (7D: [av; q; …]).
- Returns:
3D torque vector in body frame (Newton-meters).
-
virtual Mat13 dtorq_du(double u, const BaseState &x) const#
Jacobian of torque with respect to control input.
Returns \(\frac{\partial \boldsymbol{\tau}}{\partial u}\) as a 1×3 row vector.
- Parameters:
u – Control input.
x – Base state.
- Returns:
1×3 Jacobian matrix.
-
virtual Mat73 dtorq_dbasestate(double u, const BaseState &x) const#
Jacobian of torque with respect to base state.
Returns \(\frac{\partial \boldsymbol{\tau}}{\partial \mathbf{x}}\) as a 7×3 matrix.
- Parameters:
u – Control input.
x – Base state (7D).
- Returns:
7×3 Jacobian matrix.
-
virtual T113 ddtorq_dudu(double u, const BaseState &x) const#
Hessian of torque with respect to control input (second derivatives).
Returns a 3-slice tensor of \(\frac{\partial^2 \tau_i}{\partial u^2}\).
- Parameters:
u – Control input.
x – Base state.
- Returns:
Tensor3 with 3 slices of 1×1 matrices (one per torque component).
-
virtual T173 ddtorq_dudbasestate(double u, const BaseState &x) const#
Hessian of torque with respect to control input and base state.
Returns mixed partial derivatives \(\frac{\partial^2 \tau_i}{\partial u \partial x_j}\).
- Parameters:
u – Control input.
x – Base state.
- Returns:
Tensor3 with 3 slices of 1×7 matrices.
-
virtual T773 ddtorq_dbasestatedbasestate(double u, const BaseState &x) const#
Hessian of torque with respect to base state (full second derivatives).
Returns \(\frac{\partial^2 \tau_i}{\partial x_j \partial x_k}\) for each component i.
- Parameters:
u – Control input.
x – Base state.
- Returns:
Tensor3 with 3 slices of 7×7 matrices.
-
MTQ(const Vec3 &axis, double max_dipole)#