RW#
-
class RW : public Actuator#
- #include <RW.h>
Reaction wheel (RW) actuator class.
Represents a momentum-exchange device that produces torque by changing its angular momentum. Inherits from Actuator and extends functionality to track and constrain the wheel’s angular momentum state.
Dynamics: The torque applied by the RW depends on the desired rate of momentum change:
\[ \boldsymbol{\tau} = u \cdot \text{axis} \]The wheel momentum evolves as:
\[ \frac{dh}{dt} = -u \quad \text{(reaction principle)} \]See also
Actuator for base class interface
Public Types
-
using Mat11 = Eigen::Matrix<double, 1, 1>#
-
using Mat17 = Eigen::Matrix<double, 1, 7>#
-
using Mat71 = Eigen::Matrix<double, 7, 1>#
Public Functions
-
RW(const Vec3 &axis, double max_torque, double J, double h0, double h_max)#
Construct a reaction wheel with specified parameters.
- Parameters:
axis – Unit vector specifying torque direction in body frame.
max_torque – Maximum torque magnitude (Nm).
J – Wheel moment of inertia (kg·m²).
h0 – Initial wheel momentum (N·m·s).
h_max – Maximum allowable wheel momentum (N·m·s).
-
~RW() override = default#
-
double wheelInertia() const noexcept#
Get the wheel’s moment of inertia.
- Returns:
J value in kg·m².
-
double momentum() const noexcept#
Get the current wheel momentum magnitude.
- Returns:
Current momentum in N·m·s.
-
double momentumMax() const noexcept#
Get the maximum allowable wheel momentum magnitude.
- Returns:
h_max in N·m·s.
-
void setMomentum(double h) noexcept#
Set the wheel momentum to a new value.
- Parameters:
h – New momentum value (N·m·s).
-
virtual Vec3 torque(double u, const BaseState &x) const override#
Compute the torque produced by the reaction wheel.
Overrides base class. Torque depends on control input and wheel inertia:
\[ \boldsymbol{\tau} = u \cdot \text{axis} \]- Parameters:
u – Control input (torque command rate, rad/s²·J).
x – Base state.
- Returns:
3D torque vector.
-
Mat11 storageTorque(double u, const BaseState &x) const#
Storage torque (momentum rate).
Returns the rate of change of wheel momentum:
\[ \frac{dh}{dt} = -u \]- Parameters:
u – Control input.
x – Base state.
- Returns:
1×1 matrix containing momentum rate.
-
virtual Mat13 dtorq_du(double u, const BaseState &x) const override#
Jacobian of torque with respect to control input.
- Parameters:
u – Control input.
x – Base state.
- Returns:
1×3 Jacobian.
-
virtual Mat73 dtorq_dbasestate(double u, const BaseState &x) const override#
Jacobian of torque with respect to base state.
- Parameters:
u – Control input.
x – Base state.
- Returns:
7×3 Jacobian.
-
Mat11 dstor_torq_du(double u, const BaseState &x) const#
Jacobian of storage torque with respect to control input.
- Parameters:
u – Control input.
x – Base state.
- Returns:
1×1 Jacobian.
-
Mat71 dstor_torq_dbasestate(double u, const BaseState &x) const#
Jacobian of storage torque with respect to base state.
- Parameters:
u – Control input.
x – Base state.
- Returns:
7×1 Jacobian.
-
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.
-
using Mat11 = Eigen::Matrix<double, 1, 1>#