.. _scenarioAttitudeSteering: scenarioAttitudeSteering ======================== Overview -------- Demonstrates how to use the :ref:`mrpSteering` module to stabilize the attiude relative to the Hill Frame. Details on the math of this module can be found in this `paper `__. This script sets up a spacecraft with 3 RWs which is orbiting the Earth. The goal is to illustrate how to use the :ref:`mrpSteering` module with a rate sub-servo system to control the attitude. The script is found in the folder ``xmera/examples`` and executed by using:: python3 scenarioAttitudeSteering.py The simulation layout is shown in the following illustration. A single simulation process is created which contains both the spacecraft simulation modules, as well as the Flight Software (FSW) algorithm modules. .. image:: /_images/static/test_scenarioAttitudeSteering.svg :align: center The spacecraft is equipped with three RW, just as in the :ref:`scenarioAttitudeFeedbackRW` tutorial. The :ref:`hillPoint` guidance module is used to align the body frame :math:`\cal B` to the Hill frame :math:`\cal H`. The :ref:`rateServoFullNonlinear` module is used to create the rate tracking sub-servo system. How to setup the Hill frame guidance module is discussed in :ref:`scenarioAttitudeGuidance`. When the simulation completes several plots are shown for the MRP attitude history, the rate tracking errors, as well as the RW motor torque components, as well as the RW wheel speeds. Illustration of Simulation Results ---------------------------------- The following images illustrate the expected simulation run returns for a range of script configurations. :: show_plots = True, simCase = 0 Here an unknown external torque is applied, but the integral feedback term is included as well. Note that in the RW motor torque plot both the required control torque :math:`\hat u_B` and the true motor torque :math:`u_B` are shown. This illustrates that with this maneuver the RW devices are being saturated, and the attitude still eventually stabilizes. .. image:: /_images/Scenarios/scenarioAttitudeSteeringSigmaBR0.svg :align: center .. image:: /_images/Scenarios/scenarioAttitudeSteeringomegaBR0.svg :align: center .. image:: /_images/Scenarios/scenarioAttitudeSteeringrwUs0.svg :align: center .. image:: /_images/Scenarios/scenarioAttitudeSteeringOmega0.svg :align: center In this simulation setup the integral feedback term is included, and the unknown external torque is automatically compensated for to yield exponential convergence. This convergence is despite having to track a time-varying Hill frame on an elliptic orbit. This illustrates that all the orbital motion is propoerly feed-forward compensated. :: show_plots = True, simCase = 1 .. image:: /_images/Scenarios/scenarioAttitudeSteeringSigmaBR1.svg :align: center .. image:: /_images/Scenarios/scenarioAttitudeSteeringomegaBR1.svg :align: center :: show_plots = True, simCase = 2 This setup investigates the small depature motion stability about the Hill frame. Here only small initial attitude and rate errors are introduced. However, the outer loop feedback gain :math:`K_1` is increased such that it violates the sub-servo loop separation principle. .. image:: /_images/Scenarios/scenarioAttitudeSteeringSigmaBR2.svg :align: center .. image:: /_images/Scenarios/scenarioAttitudeSteeringomegaBR2.svg :align: center Here the local motion is now unstable, as predicted in this `conference paper `__. :: show_plots = True, simCase = 3 This setup also investigates the small departure motion stability about the Hill frame. However, in this case the feedword term :math:`\omega'_{\cal B^\ast/R}` is omitted, which is predicted to yield locally stabilizing control similar in performance to a standard proportional-derivative or PD feedback control. .. image:: /_images/Scenarios/scenarioAttitudeSteeringSigmaBR3.svg :align: center