scenarioAttitudeFeedback2T¶
Overview¶
Demonstrates how to stabilize the tumble of a spacecraft orbiting the Earth that is initially tumbling, but uses 2 separate threads. This script sets up a 6-DOF spacecraft which is orbiting the Earth. This setup is similar to the scenarioAttitudeFeedback, but here the dynamics simulation and the Flight Software (FSW) algorithms are run at different time steps using two separate task groups (also called processes).
The script is found in the folder src/examples
and executed by using:
python3 scenarioAttitudeFeedback2T.py
The simulation layout is shown in the following illustration. Both a simulation process is created which contains the spacecraft simulation modules. A separate FSW algorithm process is run at a different updated rate to evaluate the Flight Software (FSW) algorithm modules. Interface messages are now shared across SIM and FSW message passing interfaces (MPIs).
A key difference to the 1-process setup is that after the processes are created, the dynamics and FSW messages system must be linked to connect messages with the same name. Note that the interface references are added to the process that they are SUPPLYING data to. Reversing that setting is hard to detect as the data will still show up, it will just have a single frame of latency.
When the simulation completes 3 plots are shown for the MRP attitude history, the rate tracking errors, as well as the control torque vector.
Illustration of Simulation Results¶
show_plots = True, useUnmodeledTorque = False, useIntGain = False
Note that now the FSW algorithms are called in a separate process, in the first time step the navigation message has not been copied over, and the initial FSW values for the tracking errors are zero. This is why there is a slight difference in the resulting closed loop performance.
show_plots = True, useUnmodeledTorque = True, useIntGain = False
As expected, the orientation error doesn’t settle to zero, but rather converges to a non-zero offset proportional to the un-modeled torque being simulated. Also, the control torques settle on non-zero steady-state values.
show_plots = True, useUnmodeledTorque = True, useIntGain = True
In this case the orientation error does settle to zero. The integral term changes the control torque to settle on a value that matches the un-modeled external torque.
-
scenarioAttitudeFeedback2T.
run
(show_plots, useUnmodeledTorque, useIntGain)[source]¶ The scenarios can be run with the followings setups parameters:
- Parameters
show_plots (bool) – Determines if the script should display plots
useUnmodeledTorque (bool) – Specify if an external torque should be included
useIntGain (bool) – Specify if the feedback control uses an integral feedback term