Skip to main content

Overview

sunSafePoint computes an attitude guidance error message that steers a desired body vector (e.g., a solar panel normal) toward the measured sun direction. When the sun measurement is lost or below the minimum acceptable norm, the module commands a safe spin about a fallback eigenaxis.
from Basilisk.fswAlgorithms import sunSafePoint

sunPoint = sunSafePoint.sunSafePoint()
sunPoint.ModelTag = "sunSafePoint"

Configuration parameters

sHatBdyCmd
double[3]
Desired body-frame unit vector to point toward the sun (e.g., a solar panel normal or an instrument boresight).
sunPoint.sHatBdyCmd = [1.0, 0.0, 0.0]  # body +X toward sun
minUnitMag
double
Minimum acceptable norm of the sun-direction vector. If the measured sun vector norm falls below this threshold, the module switches to the safe-spin mode.
sunPoint.minUnitMag = 0.1
smallAngle
double
Angular threshold [rad] below which the attitude error is treated as near 0° or 180°, selecting the appropriate rotation path.
sunPoint.smallAngle = 0.001  # [rad]
eHat180_B
double[3]
Eigenaxis to use when the commanded direction is 180° from the measured sun direction (to avoid a singularity).
sunPoint.eHat180_B = [0.0, 1.0, 0.0]
omega_RN_B
double[3]
Desired body angular-rate vector [rad/s] commanded when no valid sun measurement is available (safe-spin mode).
sunPoint.omega_RN_B = [0.0, 0.0, 0.0]  # [rad/s]
sunAxisSpinRate
double
Constant spin rate [rad/s] about the sun heading vector to maintain power generation while sun pointing.
sunPoint.sunAxisSpinRate = 0.0  # [rad/s]

Input messages

sunDirectionInMsg
NavAttMsg_C
Navigation attitude message containing the measured sun-direction vector in the body frame.
sunPoint.sunDirectionInMsg.subscribeTo(cssNavMsg)
imuInMsg
NavAttMsg_C
IMU navigation attitude message providing the current spacecraft angular velocity.
sunPoint.imuInMsg.subscribeTo(imuNavMsg)

Output messages

attGuidanceOutMsg
AttGuidMsg_C
Attitude guidance output message containing sigma_BR (MRP error), omega_BR_B (rate error), omega_RN_B (reference rate), and domega_RN_B (reference angular acceleration).

Full setup example

from Basilisk.fswAlgorithms import sunSafePoint
from Basilisk.utilities import SimulationBaseClass, macros

scSim = SimulationBaseClass.SimBaseClass()
scSim.CreateNewProcess("fswProc")
scSim.CreateNewTask("fswTask", macros.sec2nano(0.5))

sunPoint = sunSafePoint.sunSafePoint()
sunPoint.ModelTag        = "sunSafePoint"
sunPoint.sHatBdyCmd      = [1.0, 0.0, 0.0]   # body +X toward sun
sunPoint.minUnitMag      = 0.1
sunPoint.smallAngle      = 0.001              # [rad]
sunPoint.eHat180_B       = [0.0, 1.0, 0.0]
sunPoint.omega_RN_B      = [0.0, 0.0, 0.0]   # [rad/s]
sunPoint.sunAxisSpinRate = 0.0               # [rad/s]

sunPoint.sunDirectionInMsg.subscribeTo(cssNavMsg)
sunPoint.imuInMsg.subscribeTo(imuNavMsg)

scSim.AddModelToTask("fswTask", sunPoint)

Build docs developers (and LLMs) love