scenarioAttitudeConstraintViolation

Overview

Demonstrates how to set up conical keep-in and keep-out constraints for a spacecraft. This script sets up a 6-DOF spacecraft which is orbiting the Earth, in the presence of the Sun. The spacecraft is modelled according to the specifics of the Bevo-2 satellite, that has a sensitive star tracker aligned with the x body axis and two sun sensors aligned with the y and z body axes. The goal is to illustrate how to set up a Basilisk simulation to check whether certain slew maneuvers cause violations in the positional constraints of the spacecraft.

The script is found in the folder basilisk/examples and executed by using:

python3 scenarioAttitudeConstraintViolation.py

The main simulation layout is the same as in scenarioAttitudeFeedbackRW, 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.

../_images/test_scenarioAttitudeFeedbackRW.svg

The spacecraft mass, inertia, and control gains in this example script have been designed to match the performance of the Bevo 2 satellite. To better understand how to add RW to the Spacecraft Simulation to perform slew maneuvers from an initial to a final inertially fixed attitude, the reader is redirected to scenarioAttitudeFeedbackRW where this process is explained in the details.

This script uses simIncludeGravBody to add Earth and Sun to the simulation. The method createSpiceInterface to create Spice modules for the celestial bodies and generate the respective Spice planet state messages. The Module: boreAngCalc module is set up for each of the instruments that have geometric angular constraints. This module subscribes to the SCStatesMsgPayload and SpicePlanetStateMsgPayload of the bright object (the Sun) and returns a BoreAngleMsgPayload that contains the angle between the bright object and the direction of the boresight vector of the instrument.

Illustration of Simulation Results

Each run of the script produces 6 figures. Figures 1-4 report, respectively, attitude error, RW motor torque, rate tracking error, and RW speed. These plots are only relevant to the spacecraft / RW dynamics. Figures 5 and 6 show the angle between the boresight vector of the star tracker and the Sun (fig. 5), and of the sun sensor(s) and the Sun (fig. 6). Each plot features a dashed line that represents an angular threshold for that specific instrument. Opaque red zones in each plot represent the portions of each maneuver where that constraint has been violated.

Each plot describes a slew maneuver performed from an initial inertial attitude \(\sigma_{\mathcal{B/N},i}\) to a final inertial attitude \(\sigma_{\mathcal{B/N},f}\), both of which are set for each case to show the desired constraint violation.

show_plots = True, use2SunSensors = False, starTrackerFov = 20, sunSensorFov = 70, attitudeSetCase = 0

This case features the violation of the keep in constraint of the sun sensor only. Just for this case, only the sun sensor along the y body axis is considered. The keep in constraint is violated when the boresight angle exceeds the 70 def field of view of the instrument.

../_images/scenarioAttitudeConstraintViolation5020700.svg../_images/scenarioAttitudeConstraintViolation6020700.svg
show_plots = True, use2SunSensors = True, starTrackerFov = 20, sunSensorFov = 70, attitudeSetCase = 0

This case is identical to the previous one, except for the fact that both sun sensors along the y and z body axes are being used. No constraints are violated, since the keep in condition only needs to be satisfied for at least one sun sensor at the time.

../_images/scenarioAttitudeConstraintViolation5120700.svg../_images/scenarioAttitudeConstraintViolation6120700.svg
show_plots = True, use2SunSensors = True, starTrackerFov = 20, sunSensorFov = 70, attitudeSetCase = 1

In this case there is a portion of the slew maneuver where both the sun sensor boresights exceed the threshold, therefore the keep in constraint is violated.

../_images/scenarioAttitudeConstraintViolation5120701.svg../_images/scenarioAttitudeConstraintViolation6120701.svg
show_plots = True, use2SunSensors = True, starTrackerFov = 20, sunSensorFov = 70, attitudeSetCase = 2

In this case, the keep out constraint of the star tracker is violated, alongside with the keep in constraints for both the sun sensors.

../_images/scenarioAttitudeConstraintViolation5120702.svg../_images/scenarioAttitudeConstraintViolation6120702.svg
show_plots = True, use2SunSensors = True, starTrackerFov = 30, sunSensorFov = 70, attitudeSetCase = 3

In this last case, only the keep out constraint is violated. Since the fields of view of star tracker and sun sensors for the Bevo 2 are, respectively, 20 deg and 70 deg, and they are mounted 90 deg apart from each other on the spacecraft, this keep-out-only violation would not be possible. In this case it is obtained by increasing the field of view of the star tracker to 30 deg.

../_images/scenarioAttitudeConstraintViolation5130703.svg../_images/scenarioAttitudeConstraintViolation6130703.svg
scenarioAttitudeConstraintViolation.plot_attitude_error(timeData, dataSigmaBR)[source]

Plot the attitude errors.

scenarioAttitudeConstraintViolation.plot_rate_error(timeData, dataOmegaBR)[source]

Plot the body angular velocity rate tracking errors.

scenarioAttitudeConstraintViolation.plot_rw_cmd_torque(timeData, dataUsReq, numRW)[source]

Plot the RW command torques.

scenarioAttitudeConstraintViolation.plot_rw_motor_torque(timeData, dataUsReq, dataRW, numRW)[source]

Plot the RW actual motor torques.

scenarioAttitudeConstraintViolation.plot_rw_speeds(timeData, dataOmegaRW, numRW)[source]

Plot the RW spin rates.

scenarioAttitudeConstraintViolation.plot_ss_miss_angle(timeData, dataMissAngle, Fov)[source]

Plot the miss angle between sun sensor(s) boresight and Sun.

scenarioAttitudeConstraintViolation.plot_st_miss_angle(timeData, dataMissAngle, Fov)[source]

Plot the miss angle between star tacker boresight and Sun.