Demonstrates how to use guidance modules to align the spacecraft frame to the velocity-pointing frame. This script sets up a 6-DOF spacecraft which is on a hyperbolic trajectory near Earth. It aligns the spacecraft to point along the velocity vector throughout the orbit.
The script is found in the folder
basilisk/examples and executed by using:
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.
When the simulation completes 4 plots are shown. This first three show the MRP attitude history, the rate tracking errors, and the control torque vector. The fourth shows the hyperbolic trajectory and the segment of that trajectory flown during the simulation.
The basic simulation setup is the same as the one used in scenarioAttitudeGuidance. The dynamics simulation is setup using a Module: spacecraft module to which a gravity effector is attached. Note that both the rotational and translational degrees of freedom of the spacecraft hub are turned on here to get a 6-DOF simulation. For more information on how to setup an orbit, see scenarioBasicOrbit.
Where the Attitude Guidance Tutorial pointed the spacecraft relative to the Hill frame, this tutorial
points it relative to the velocity vector. Note that in contrast to Hill pointing mode used in
scenarioAttitudeGuidance, the orbit velocity frame pointing
requires the attracting celestial body gravitational constant
mu to be set.
Note that if the celestial body ephemeris input message is not connected then
a zero message is created which corresponds to the planet having a zero position and velocity vector.
If non-zero ephemeris information is required then the input name must point
to a message of type EphemerisMsgPayload.
Illustration of Simulation Results¶
show_plots = True, useAltBodyFrame = False
This scenario shown has the
useAltBodyFrame flag turned off. This means that we seek
to align the body frame \(\cal B\) with the velocity vector \(\cal V\).
show_plots = True, useAltBodyFrame = True
Here the control should not align the principal body frame \(\cal B\) with \(\cal V\), but rather an alternate, corrected body frame Bc. For example, if a thruster is located on the :math:hat b_1 face, and it is desired to point it along the negative V-bar, this is achieved through:
attErrorConfig.sigma_R0R = [0,0,-1]
This corrected body frame has an orientation which is rotated 180 degrees about \(\hat b_3\), to point the correct face of the spacecraft along the negative V-bar.
- scenarioAttGuideHyperbolic.plot_control_torque(timeLineSet, dataLr)¶
Plot the attiude control torque effort.
- scenarioAttGuideHyperbolic.plot_orbit(oe, mu, planet_radius, dataPos, dataVel)¶
Plot the spacecraft orbit trajectory.
- scenarioAttGuideHyperbolic.plot_rate_error(timeLineSet, dataOmegaBR)¶
Plot the body angular velocity tracking errors.
- scenarioAttGuideHyperbolic.plot_track_error_norm(timeLineSet, dataSigmaBR)¶
Plot the attitude tracking error norm value.
- scenarioAttGuideHyperbolic.run(show_plots, useAltBodyFrame)¶
The scenarios can be run with the followings setups parameters:
show_plots (bool) – Determines if the script should display plots
useAltBodyFrame (bool) – Specify if the alternate body frame should be aligned with Hill frame.