Module: spacecraftReconfig

Summary

The primary purpose of this module is to schedule burn timing and attitude for spacecraft formation reconfiguration. Basic idea is described in section 14.8.3 of Analytical Mechanics of Space Systems. Based on keplerian dynamics, formation reconfiguration from one initial orbital element difference to target orbital element difference is scheduled so that reconfiguration is completed in one orbit period.

In addition to formation control algorithm described in the textbook, some extensions and improvements are included in this module. First, this module assumes that deputy spacecraft has one-axis thrusters. Therefore, attitude control is also necessary along with burn at certain period. When burn timing is approaching, target attitude is output as attRefOutMsgName. Otherwise, and if attRefInMsgName (which is optional) is set, the reference message is output as attRefOutMsgName. Second, if \(\delta a\) is not zero, drift of \(\delta M\) occurs. This module can take this drift into consideration . Therefore, this module can achieve formation reconfiguration in orbital period. Third, in general three-time burn is necessary for reconfiguration. Two of them occur at perigee and apogee each. The other burn timing varies depending on necessary change of orbital element difference. In some cases, this burn timing can be close to perigee or apogee. In these cases, two burns are integrated into one burn. Parameter attControlTime is used to check whether this integration is necessary or not.

Message Connection Descriptions

The following table lists all the module input and output messages. The module msg variable name is set by the user from python. The msg type contains a link to the message structure definition, while the description provides information on what this message is used for.

Module I/O Messages

Msg Variable Name

Msg Type

Description

chiefTransInMsgName

navTransIntMsg

The name of the chief’s position and velocity input message

deputyTransInMsgName

navTransIntMsg

The name of the deputy’s position and velocity input message

thrustConfigInMsgName

thrArrayConfigFswMsg

The name of deputy’s thruster configuration input message

attRefInMsgName

attRefFswMsg

(optional) The name of deputy’s reference attitude input message. If set, then the deputy will point along this reference attitude unless it must point the thrusters in a control direction.

attRefOutMsgName

attRefFswMsg

The name of deputy’s target attitude output message

onTimeOutMsgName

thrArrayOnTimeCmdIntMsg

The name of deputy’s reference attitude input message

Module Assumptions and Limitations

  • This module uses classic orbital element, so this module cannot be applied to near-circular or near-equatorial orbits.

  • Too long or too short attControlTime may result in control error.

  • Impulsive maneuvers are approximated by steady thrust of a certain period.

User Guide

This module requires the following variables to be set as parameters:

  • attControlTime time [s] necessary to control one attitude to another attitude

  • mu gravitational constant for a central body in m^3/s^2

  • targetClassicOED desired orbital element difference.

  • scMassDeputy deputy’s mass [kg]

For targetClassicOED, normalized semi major axis must be used.


Functions

void SelfInit_spacecraftReconfig(spacecraftReconfigConfig *configData, int64_t moduleID)

This method initializes the configData for this module. It checks to ensure that the inputs are sane and then creates the output message

Return

void

Parameters
  • configData: The configuration data associated with this module

  • moduleID: The Basilisk module identifier

void CrossInit_spacecraftReconfig(spacecraftReconfigConfig *configData, int64_t moduleID)

This method performs the second stage of initialization for this module. Its primary function is to link the input messages that were created elsewhere. Nothing else should be happening in this function.

Return

void

Parameters
  • configData: The configuration data associated with this module

  • moduleID: The Basilisk module identifier

void Update_spacecraftReconfig(spacecraftReconfigConfig *configData, uint64_t callTime, int64_t moduleID)

Add a description of what this main Update() routine does for this module

Return

void

Parameters
  • configData: The configuration data associated with the module

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

  • moduleID: The Basilisk module identifier

void Reset_spacecraftReconfig(spacecraftReconfigConfig *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. The local copy of the message output buffer should be cleared.

Return

void

Parameters
  • configData: The configuration data associated with the module

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

  • moduleID: The Basilisk module identifier

void UpdateManeuver(spacecraftReconfigConfig *configData, NavTransIntMsg chiefTransMsg, NavTransIntMsg deputyTransMsg, AttRefFswMsg attRefInMsg, THRArrayConfigFswMsg thrustConfigMsg, AttRefFswMsg *attRefMsg, THRArrayOnTimeCmdIntMsg *thrustOnMsg, uint64_t callTime, int64_t moduleID)

based on burn schedule, this function creates a message of reference attitude and thruster on time

Return

void

Parameters
  • configData: The configuration data associated with the module

  • chiefTransMsg: chief’s position and velocity

  • deputyTransMsg: deputy’s position and velocity

  • thrustConfigMsg: thruster’s config information

  • attRefMsg: target attitude

  • thrustOnMsg: thruster on time

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

  • moduleID: The Basilisk module identifier

double AdjustRange(double lower, double upper, double angle)

This function is used to adjust a certain value in a certain range between lower threshold and upper threshold. This function is particularily used to adjsut angles used in orbital motions such as True Anomaly, Mean Anomaly, and so on.

Return

double

Parameters
  • lower: lower threshold

  • upper: upper threshold

  • angle: an angle which you want to be between lower and upper

int CompareTime(const void *n1, const void *n2)

This function is used to sort an array of spacecraftReconfigConfigBurnInfo in ascending order.

Return

void

Parameters
  • n1:

  • n2:

void ScheduleDV(spacecraftReconfigConfig *configData, classicElements oe_c, classicElements oe_d, THRArrayConfigFswMsg thrustConfigMsg)

This function is used to sort an array of spacecraftReconfigConfigBurnInfo in ascending order.

Return

void

Parameters
  • configData: The configuration data associated with this module

  • oe_c: chief’s orbital element

  • oe_d: deputy’s orbital element

  • thrustConfigMsg:

struct spacecraftReconfigConfigBurnInfo
#include <spacecraftReconfig.h>

Local module specific data structure.

Public Members

uint8_t flag

0:not scheduled yet, 1:not burned yet, 2:already burned, 3:skipped (combined with another burn)

double t

when to burn [s]

double thrustOnTime

thrust on duration time [s]

double sigma_RN[3]

target attitude

struct spacecraftReconfigConfig
#include <spacecraftReconfig.h>

Data structure for the MRP feedback attitude control routine.

Public Members

char chiefTransInMsgName[MAX_STAT_MSG_LENGTH]
int32_t chiefTransInMsgID
char deputyTransInMsgName[MAX_STAT_MSG_LENGTH]
int32_t deputyTransInMsgID
char thrustConfigInMsgName[MAX_STAT_MSG_LENGTH]
int32_t thrustConfigInMsgID
char attRefInMsgName[MAX_STAT_MSG_LENGTH]
int32_t attRefInMsgID
char attRefOutMsgName[MAX_STAT_MSG_LENGTH]
int32_t attRefOutMsgID
char onTimeOutMsgName[MAX_STAT_MSG_LENGTH]
int32_t onTimeOutMsgID

central body gravity constant

double mu

[m^3/s^2] gravity constant of planet being orbited

double attControlTime

[s] attitude control margin time (time necessary to change sc’s attitude)

double targetClassicOED[6]

target classic orital element difference, SMA should be normalized

double resetPeriod

[s] burn scheduling reset period

double scMassDeputy

[kg] deputy SC mass

double tCurrent

[s] timer

uint64_t prevCallTime

[ns]

uint8_t thrustOnFlag

thrust control

spacecraftReconfigConfigBurnInfo dvArray[3]