Module: sunSafePoint

This module provides the attitude guidance output for a sun pointing mode. This could be used for safe mode, or a power generation mode. The input is the sun direction vector which doesn’t have to be normalized, as well as the body rate information. The output is the standard BSK attitude reference state message. The sun direction measurement is cross with the desired body axis that is to point at the sun to create a principle rotation vector. The dot product between these two vectors is used to extract the principal rotation angle. With these a tracking error MRP state is computer. The body rate tracking errors relative to the reference frame are set equal to the measured body rates to bring the vehicle to rest when pointing at the sun. Thus, the reference angular rate and acceleration vectors relative to the inertial frame are nominally set to zero. If the sun vector is not available, then the reference rate is set to a body-fixed value while the attitude tracking error is set to zero.

The file PDF Description. contains further information on this module’s function, how to run it, as well as testing.


Functions

void SelfInit_sunSafePoint(sunSafePointConfig *configData, int64_t moduleID)

This method initializes the configData for the sun safe attitude guidance. It checks to ensure that the inputs are sane and then creates the output message

Return

void

Parameters
  • configData: The configuration data associated with the sun safe guidance

void CrossInit_sunSafePoint(sunSafePointConfig *configData, int64_t moduleID)

This method performs the second stage of initialization for the sun safe attitude interface. It’s primary function is to link the input messages that were created elsewhere.

Return

void

Parameters
  • configData: The configuration data associated with the sun safe attitude guidance

void Update_sunSafePoint(sunSafePointConfig *configData, uint64_t callTime, int64_t moduleID)

This method takes the estimated body-observed sun vector and computes the current attitude/attitude rate errors to pass on to control.

Return

void

Parameters
  • configData: The configuration data associated with the sun safe attitude guidance

  • callTime: The clock time at which the function was called (nanoseconds)

void Reset_sunSafePoint(sunSafePointConfig *configData, uint64_t callTime, int64_t moduleID)

This method performs a complete reset of the module. Local module variables that retain time varying states between function calls are reset to their default values.

Return

void

Parameters
  • configData: The configuration data associated with the guidance module

struct sunSafePointConfig
#include <sunSafePoint.h>

Top level structure for the sun-safe attitude guidance routine.

Public Members

char attGuidanceOutMsgName[MAX_STAT_MSG_LENGTH]

The name of the output message

char sunDirectionInMsgName[MAX_STAT_MSG_LENGTH]

The name of the Input message

char imuInMsgName[MAX_STAT_MSG_LENGTH]

The name of the incoming IMU message

double minUnitMag

The minimally acceptable norm of sun body vector

double sunAngleErr

rad The current error between cmd and obs sun angle

double smallAngle

rad An angle value that specifies what is near 0 or 180 degrees

double eHat180_B[3]

Eigen axis to use if commanded axis is 180 from sun axis

double sunMnvrVec[3]

The eigen axis that we want to rotate on to get sun

double sHatBdyCmd[3]

Desired body vector to point at the sun

double omega_RN_B[3]

Desired body rate vector if no sun direction is available

double sunAxisSpinRate

r/s Desired constant spin rate about sun heading vector

int32_t attGuidanceOutMsgID

ID for the outgoing body estimate message

int32_t sunDirectionInMsgID

ID for the incoming CSS sensor message

int32_t imuInMsgID

ID for the incoming IMU sensor message

AttGuidFswMsg attGuidanceOutBuffer

The output data that we compute

BSKLogger *bskLogger

BSK Logging.