Module: spacecraftReconfig

Executive 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

chiefTransInMsg

NavTransMsgPayload

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

deputyTransInMsg

NavTransMsgPayload

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

thrustConfigInMsg

THRArrayConfigMsgPayload

The name of deputy’s thruster configuration input message

attRefInMsg

AttRefMsgPayload

(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.

attRefOutMsg

AttRefMsgPayload

The name of deputy’s target attitude output message

onTimeOutMsg

THRArrayOnTimeCmdMsgPayload

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

Parameters
  • configData – The configuration data associated with this module

  • moduleID – The Basilisk module identifier

Returns

void

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

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

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

Returns

void

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.

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

Returns

void

void UpdateManeuver(spacecraftReconfigConfig *configData, NavTransMsgPayload chiefTransMsg, NavTransMsgPayload deputyTransMsg, AttRefMsgPayload attRefInMsg, THRArrayConfigMsgPayload thrustConfigMsg, AttRefMsgPayload *attRefMsg, THRArrayOnTimeCmdMsgPayload *thrustOnMsg, uint64_t callTime, int64_t moduleID)

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

Parameters
  • configData – The configuration data associated with the module

  • chiefTransMsg – chief’s position and velocity

  • deputyTransMsg – deputy’s position and velocity

  • attRefInMsg – target attitude

  • 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

Returns

void

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.

Parameters
  • lower – lower threshold

  • upper – upper threshold

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

Returns

double

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

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

Parameters
  • n1

  • n2

Returns

void

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

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

Parameters
  • configData – The configuration data associated with this module

  • oe_c – chief’s orbital element

  • oe_d – deputy’s orbital element

  • thrustConfigMsg

Returns

void

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

NavTransMsg_C chiefTransInMsg

chief orbit input msg

NavTransMsg_C deputyTransInMsg

deputy orbit input msg

THRArrayConfigMsg_C thrustConfigInMsg

THR configuration input msg.

AttRefMsg_C attRefInMsg

nominal attitude reference input msg

AttRefMsg_C attRefOutMsg

attitude reference output msg

THRArrayOnTimeCmdMsg_C onTimeOutMsg

THR on-time output msg.

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

int attRefInIsLinked

flag if the attitude reference input message is linked

spacecraftReconfigConfigBurnInfo dvArray[3]

array of burns

BSKLogger *bskLogger

BSK Logging.