Skip to main content
Responsible
  • Samuel Schoenenberger
Last Updated10/12/2025, 12:48:54 PM
Last AuthorKai Berszin

Actuator Controllers

Scope

The chapters in this section describe how the actuator controllers work. Includes mathematical description as well as description of MATLAB implementation of:

  1. Torque to actuator mapping
  2. Reaction wheel desaturation controller

Satellite Torque to Actuator Command Mapping

The pointing and science controllers return the desired torque on the satellite in the satellite frame. To produce this torque, we need to find which commands to send to the reaction wheels and magnetorquers.

Reaction wheel command mapping

Mathematical explanation

The goal of the reaction wheel command mapping is to decompose the torque we want to produce into the torques created by each reaction wheel. This is done by solving the following quadratic program:

image

where H\vec{H} is the Hessian matrix and f\vec{f} is the gradient of the cost function. The optimization variables x\vec{x} consist of the torques of each reaction wheel and the torque error (i.e., the discrepancy between the torque exerted by the reaction wheels mapped in the satellite coordinate system and the requested torque). Thus, x\vec{x} is defined as follows: x=(τ1,τ2,τ3,Terr,1,Terr,2,Terr,3)T.\vec{x} = (\tau_1, \tau_2, \tau_3, T_{err,1}, T_{err,2}, T_{err,3})^T. We want to minimize the sum of the square of τ\vec{\tau} and Terr\vec{T_{err}}, each with their individual weights Qτ\vec{Q_\tau} and QT\vec{Q_T}. This cost function can be written as J(τ,Terr)=τTQττ+TerrTQTTerr.J(\vec{\tau}, \vec{T_{err}}) = \vec{\tau}^T \vec{Q_\tau} \vec{\tau} + \vec{T_{err}}^T \vec{Q_T} \vec{T_{err}}. Thus, the hessian matrix H\vec{H} is a diagonal matrix with Qτ\vec{Q_\tau} and QT\vec{Q_T} and the gradient f=0\vec{f} = \vec{0}. The main objective is to minimize the torque error, therefore its penalty weight QT=1E6\vec{Q_T} = 1E6 is chosen to be significantly larger than the penalty for the individual torques Qτ=1\vec{Q_{\tau}} = 1. Thus, H\vec{H} can be written as

image

The inequality constraints are used to limit the maximum speed of the reaction wheels. The speed of a reaction wheel after applying the torque τ\tau can be written as a first order explicit Euler integration ω=ωprev+ΔTτI\omega = \omega_{prev} + \Delta T\frac{\tau}{I} where ωprev\omega_{prev} is the rotation speed of the reaction wheel before applying the torque (i.e., when this function is entered), ω\omega is the speed after τ\tau was applied. ΔT\Delta T is the period of the control cycle and II is the moment of inertia of the wheel. The rotation speed has an upper bound uωu_\omega and a lower bound lωl_\omega: lωωuωlωωprev+ΔTτIuω.l_\omega \leq \omega \leq u_\omega \Leftrightarrow l_\omega \leq \omega_{prev} + \Delta T\frac{\tau}{I} \leq u_\omega. This can be reformulated into ΔTIτuωωprev\frac{\Delta T}{I} \tau \leq u_\omega - \omega_{prev} ΔTIτlω+ωprev-\frac{\Delta T}{I} \tau \leq - l_\omega + \omega_{prev} which can easily be formulated into the matrix-vector from Axb\vec{A} \vec{x} \leq \vec{b}

image

The equality constraints Aeqx=beq\vec{A_{eq}} \vec{x} = \vec{b_{eq}} are used to define two relationships: First, the relationship between Terr\vec{T_{err}} and τ\vec{\tau} and second, a collinearity constraint which enforces that the resulting torque vector is collinear to the requested torque vector.

First, let's define A\mathcal{A} which is the matrix containing the rotation axis of the reaction wheels A=[a1,a2,a3]R3×3\mathcal{A} = [\vec{a_1}, \vec{a_2}, \vec{a_3}] \in \mathcal{R}^{3\times3} where ai\vec{a_i} is the rotation axis of the ii-th reaction wheel. Therefore, the torque of the ii-th reaction wheel can be mapped in the satellite coordinate system via Ti=aiτi\vec{T_i} = \vec{a_i} \tau_i. We'll use this relationship to express the torque error Terr\vec{T_{err}} (i.e., the difference between the torque from the reaction wheels and the requested torque) in the satellite coordinate system via Terr=AτTreq\vec{T_{err}} = \mathcal{A} \vec{\tau} - \vec{T_{req}} where Treq\vec{T_{req}} is the requested torque (ideally, the torque exerted by the reaction wheels should equal the requested torque). This equation can be rewritten as AτTerr=Treq\mathcal{A} \vec{\tau} - \vec{T_{err}} = \vec{T_{req}} =^(A,I3×3)x=Treq\hat{=} (\mathcal{A} , -\vec{I_{3\times3}}) \vec{x} = \vec{T_{req}} =^Aeqx=beq\hat{=} \vec{A_{eq}} \vec{x} = \vec{b_{eq}} The torque collinenarity is achieved if and only if the cross product between the torque produced by the reaction wheels and the requested torque is 0 cross(Aτ,Treq)=0.cross (\mathcal{A} \vec{\tau}, \vec{T_{req}}) = \vec{0}.

image

The optimization problem can be solved by any solver for quadratic programs (QPs).

Reaction wheel input calculations

By solving the optimization problem from the previous subsection, we obtain the torque τi\tau_i to be applied by the i-th reaction wheel. However the reaction wheels use the target rotational velocity as their inputs.

If a reaction wheel with moment of inertia II around its rotation axis is spinning with rotational velocity ωprev\omega_{prev} when entering the actuator mapping function, we apply torque τ\tau and the discretization step length is ΔT\Delta T, the rotational velocity after the torque was applied will be ω=ωprev+τIΔT.\vec{\omega} = \vec{\omega_{prev}} + \frac{\vec{\tau}}{\vec{I}}\Delta T. We use ω\vec{\omega} as the input to the reaction wheel.

Feasibility Analysis

The optimization problem to calculate the reaction wheel torques is designed to always be feasible, meaning that there always exists an x\vec{x} so that the constraints in the optimization problem can always be fulfilled by x=0\vec{x} = \vec{0}. This is achieved by the torque error being included in the cost function rather than a constraint. Considerations must be made in the event of a malfunction of one reaction wheel. In that case, that reaction wheel is disabled and the corresponding axis in A\mathcal{A} is set to 0\vec{0}. As long as the remaining axes matrix A\mathcal{A} has column rank 3, i.e., the columns of A\mathcal{A} span a 3-dimensional space, the satellite can be controlled (even though the maximum exerted torque is reduced due to the missing reaction wheel).

The only condition under which the optimization problem can become infeasible is if the current reaction wheel speed ωprev\vec{\omega_{prev}} exceeds the speed boundary defined in in the inequality constraint due to measurement errors. If no τ\vec{\tau} can be calculated without exceeding the torque boundary for the reaction wheels, the problem becomes infeasible. This can be alleviated by limiting ωprev\vec{\omega_{prev}} before entering the torque mapping function.

Implementation

The implementation can be tested in run_files/combinedActuatorMapping/run_testCombinedActuatorControl.m. The optimization problem can be solved by any solver for quadratic programs (QPs). Currently MATLAB's quadprog() is used. This is implemented in ctrl/actuator_control/torqueTo3RWsMap.m.

Magnetorquer command mapping

Mathematical Description

Magnetorquers create a torque on the satellite by creating a magnetic field that interacts with Earth's magnetic field. Since the resulting torque is perpendicular to Earth's magnetic field, the magnetorquers can only create a torque in 2D.

A quadratic program is defined that calculates the optimal magnetorquer voltages from the desired torque in satellite frame. The decision variable x\vec{x} can be written as x=(U1,U2,U3,Tres,x,Tres,y,Tres,z,Tres,x,Tres,y,Tres,z)T\vec{x} = (U_1 , U_2 , U_3 , T_{res, x} , T_{res, y} , T_{res, z} , |T_{res, x}| , |T_{res, y}| , |T_{res, z}| )^T where UiU_i is the voltage of the ii-th magnetorquer, Tres,kT_{res, k} is the residual torque around the kk-th satellite axis and Tres,k|T_{res, k}| is the absolute value of the latter. The residual torque is the disrepancy between the requested torque and the torque that can be delivered by the magnetorquers.

The torque created by the ii-th magnetorquer can be written as τMT,i=oaMT,i×BsatRiUi\vec{\tau_{MT, i}} = \frac{o \vec{a_{MT, i}} \times \vec{B_{sat}}}{R_i} U_i Thus, the residual torque vector is defined as Tres=Treqi=13τMT,i\vec{T_{res}} = \vec{T_{req}} - \sum_{i=1}^3 \vec{\tau_{MT, i}} The absolute torque residual Tres,k|T_{res, k}| is defined as Tres,kTres,k|T_{res, k}| \geq T_{res, k} Tres,kTres,k|T_{res, k}| \geq -T_{res, k} The objective is to minimize the sum of absolute residual torques k={x,y,z}Tres,k\sum_{k=\{x,y,z\}} |T_{res, k}| which translates into the cost vector

image

The optimization problem is defined via matrices and vectors. The equality constraints are encoded in the A\vec{A} and b\vec{b} and the inequality constraints via Aeq\vec{A_{eq}} and beq\vec{b_{eq}}. The equality constraints are defined as follows:

image

Similarly, the inequality constraints are encoded in Aeq\vec{A_{eq}} and beq\vec{b_{eq}} as follows:

image

With the upper and lower bounds for the magnetorquer voltages UiU_i, the optimization problem is complete. Due to the lack of compatibility of linprog() with the C code generation of Matlab, quadprog() must be used to solve the optimization problem. For that a Hessian matrix H\vec{H} must be defined to capture the quadratic term of the cost function:

image

Implementation

The implementation can be tested in run_files/combinedActuatorMapping/run_testCombinedActuatorControl.m. The relevant implementation files are found in ctrl/actuator_control and are the folling:

  • torqueToMagnetorquerVoltage.m:
  • torqueToMagnetorquers.m:
  • torqueToActuatorsMap.m:
  • momentToMagnetorquerVoltage.m:
  • magnetorquerSaturationProtection.m:

Actuator Control State Machine

Reaction wheels produce a torque by rotating a wheel around it's axis. This mechanic rotation introduces vibrations which causes issues when we want to image the biological payload using the microscope. Thus, a logic for turning off the reaction wheels is required. The idea is that if the satellite can be controlled purely via the magnetorquers, the reaction wheels are deactivated. Different metrics to turn off the RWs are conceivable. In the following, we are going to focus on two metrics:

  • the angle error θ\theta and
  • the change of angle error θ˙\dot{\theta}.

The first one is defined as the angle θ\theta between the actual and the requested orientation of the satellite. With the definition of the pointing error quaternion qe\vec{q_{e}} as provided in the equation for the pointing error quaternion, the angle error can be calculated as

image

where qe[0]\vec{q_{e}}[0] is the first entry in the vector qe\vec{q_e}. Similarly, the change of angle error is calculated via

θk˙=θkθk1ΔT\dot{\theta_{k}} = \frac{\theta_{k} - \theta_{k-1}}{\Delta T}

where θk\theta_{k} is the angle error at timestep kk. The boolean decision variable δRW\delta_{RW} is introduced which characterizes whether the reaction wheels (RWs) are turned on at any given timestep. In order to avoid frequent changes in the status of the RWs, they are toggled via a hysteresis. For that, upper and lower boundaries for θ\theta and θ˙\dot{\theta} are required:

  • θmax\theta_{\text{max}}, θmin\theta_{\text{min}}
  • θmax˙\dot{\theta_{max}}, θmin˙\dot{\theta_{min}}.

The decision variable δRW\delta_{RW} is set as follows:

image

In other words, the RWs are switched off, if the RWs are currently turned on and both θ˙\dot{\theta} and θ\theta are below the lower limit of the hysteresis θmin˙\dot{\theta_{min}} and θmin\theta_{min}. Similarly, the RWs are switched on, if they are currently turned on and either θ˙\dot{\theta} and θ\theta are above the upper limit of the hysteresis θmax˙\dot{\theta_{max}} and θmax\theta_{max}.

Reaction Wheel Desaturation

The reaction wheels can be only spun up to a certain angular velocity. (They have a limited momentum storage.) For us to be able to use them throughout the whole SAGE mission, we need a procedure, called desaturation, to slow them down without applying a net torque on the satellite. To help us with that we have the magnetorquers.

Mathematical explanation

The desaturation problem requires us to find the inputs into the reaction wheels and magnetorquers so that all of the reaction wheel angular velocities are as small as possible at the end, no net torque is applied and all the inputs are within their constraints. Expressed mathematically

image

ωi\omega_i is the rotational velocity of the i-th reaction wheel, τRWi\tau_{RWi} is the torque applied by the i-th reaction wheel. ωmax\omega_{max} and τRWmax\tau_{RWmax} are the maximum possible velocity and torque of a reaction wheel. UjU_j is the input voltage into the j-th magnetorquer, τMTj\tau_{MTj} is the torque applied by the j-th magnetorquer. UmaxU_{max} is the maximum allowed input voltage.

For it to be easily solvable, we need to transform it into a linear program in the standard form:

image

image

II is the inertia of the reaction wheel around the axis of rotation aRWa_{RW} and ωcur\omega_{cur} is its current angular velocity. oo is the crossectional area of the magnetorquer, aMTa_{MT} its axis and RR its resistance. BsatB_{sat} is the magnetic field of Earth in the satellite coordinate system.

Using these expressions we can rewrite the constraint on the net torque,

image

image

CubeSpace

The reaction wheel management designed by CubeSpace is documented on Page 35 in the CubeSpace Commissioning and Operations Manual