| Responsible |
|
| Last Updated | 10/12/2025, 12:48:54 PM |
| Last Author | Kai 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:
- Torque to actuator mapping
- 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:

where is the Hessian matrix and is the gradient of the cost function. The optimization variables 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, is defined as follows: We want to minimize the sum of the square of and , each with their individual weights and . This cost function can be written as Thus, the hessian matrix is a diagonal matrix with and and the gradient . The main objective is to minimize the torque error, therefore its penalty weight is chosen to be significantly larger than the penalty for the individual torques . Thus, can be written as

The inequality constraints are used to limit the maximum speed of the reaction wheels. The speed of a reaction wheel after applying the torque can be written as a first order explicit Euler integration where is the rotation speed of the reaction wheel before applying the torque (i.e., when this function is entered), is the speed after was applied. is the period of the control cycle and is the moment of inertia of the wheel. The rotation speed has an upper bound and a lower bound : This can be reformulated into which can easily be formulated into the matrix-vector from

The equality constraints are used to define two relationships: First, the relationship between and and second, a collinearity constraint which enforces that the resulting torque vector is collinear to the requested torque vector.
First, let's define which is the matrix containing the rotation axis of the reaction wheels where is the rotation axis of the -th reaction wheel. Therefore, the torque of the -th reaction wheel can be mapped in the satellite coordinate system via . We'll use this relationship to express the torque error (i.e., the difference between the torque from the reaction wheels and the requested torque) in the satellite coordinate system via where is the requested torque (ideally, the torque exerted by the reaction wheels should equal the requested torque). This equation can be rewritten as 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

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 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 around its rotation axis is spinning with rotational velocity when entering the actuator mapping function, we apply torque and the discretization step length is , the rotational velocity after the torque was applied will be We use 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 so that the constraints in the optimization problem can always be fulfilled by . 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 is set to . As long as the remaining axes matrix has column rank 3, i.e., the columns of 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 exceeds the speed boundary defined in in the inequality constraint due to measurement errors. If no can be calculated without exceeding the torque boundary for the reaction wheels, the problem becomes infeasible. This can be alleviated by limiting 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 can be written as where is the voltage of the -th magnetorquer, is the residual torque around the -th satellite axis and 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 -th magnetorquer can be written as Thus, the residual torque vector is defined as The absolute torque residual is defined as The objective is to minimize the sum of absolute residual torques which translates into the cost vector

The optimization problem is defined via matrices and vectors. The equality constraints are encoded in the and and the inequality constraints via and . The equality constraints are defined as follows:

Similarly, the inequality constraints are encoded in and as follows:

With the upper and lower bounds for the magnetorquer voltages , 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 must be defined to capture the quadratic term of the cost function:

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 and
- the change of angle error .
The first one is defined as the angle between the actual and the requested orientation of the satellite. With the definition of the pointing error quaternion as provided in the equation for the pointing error quaternion, the angle error can be calculated as

where is the first entry in the vector . Similarly, the change of angle error is calculated via
where is the angle error at timestep . The boolean decision variable 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 and are required:
- ,
- , .
The decision variable is set as follows:

In other words, the RWs are switched off, if the RWs are currently turned on and both and are below the lower limit of the hysteresis and . Similarly, the RWs are switched on, if they are currently turned on and either and are above the upper limit of the hysteresis and .
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

is the rotational velocity of the i-th reaction wheel, is the torque applied by the i-th reaction wheel. and are the maximum possible velocity and torque of a reaction wheel. is the input voltage into the j-th magnetorquer, is the torque applied by the j-th magnetorquer. 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:


is the inertia of the reaction wheel around the axis of rotation and is its current angular velocity. is the crossectional area of the magnetorquer, its axis and its resistance. is the magnetic field of Earth in the satellite coordinate system.
Using these expressions we can rewrite the constraint on the net torque,


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