Module: hillToAttRef

Executive Summary

This module acts as an attitude reference generator based on attitude-driven formation control laws whose gain matrices are derived elsewhere. Specifically, it:

  1. Obtains a relative state in the form of a HillRelStateMsgPayload

  2. Applies a defined gain matrix to the state to obtain a relative attitude

  3. Maps that attitude given a reference attitude to a full attitude reference message

  4. Writes out a AttRefMsgPayload describing the current commanded attitude

Message Connection Descriptions

Module I/O Messages

Msg Variable Name

Msg Type

Description

hillStateInMsg

HillRelStateMsgPayload

Provides state relative to chief

attRefInMsg

AttRefMsgPayload

(Optional) Provides basis for relative attitude

attNavInMsg

NavAttMsgPayload

(Optional) Provides basis for relative attitude

attRefOutMsg

AttRefMsgPayload

Provides the attitude reference output message.

Detailed Module Description

This module maps from a Hill-frame relative state into an attitude that, under the presence of drag, should result in rendezvous (i.e., a minimization of the relative state.)

More details on this process can be found in this paper, Linear Coupled Attitude-Orbit Control Through Aerodynamic Drag.

Module Assumptions and Limitations

This module assumes that the user has supplied a gain matrix that correctly maps from relative positions and velocities to relative attitudes such that attitude-coupled orbital dynamics will result in desired behavior. As a result, this module is best used with other modules that implement attitude-coupled orbital dynamics, such as Module: facetDragDynamicEffector.

User Guide

This module is configured to multiply a user-provided gain matrix by an evolving relative Hill-frame state. As such, this module requires the user to provide a 3times6 gain matrix. In addition, users can specify saturation limits for the calculated relative MRP by specifying the relMRPMin and relMRPMax attributes.

Notably, the computed relative attitude is automatically combined with a reference attitude (provided either as another AttRefMsgPayload or as the chief spacecrafts NavAttMsgPayload), allowing it to write an AttRefMsgPayload directly to a corresponding attitude control stack.

A simple example of this module’s initialization alongside a recorder to store the reference attitude information is provided here:

 1#       Configure a gain matrix; this one is for demonstration
 2lqr_gain_set = np.array([[0,1,0],
 3[0,0,0],
 4[0,0,0],
 5[0,0,0],
 6[0,0,0.25],
 7[0,0,0],       ]).T #   Note that the gain matrix is 3x6, not 6x3
 8
 9#   Set up the hillStateConverter
10depAttRefData = hillToAttRef.hillToAttRef()
11depAttRefData.ModelTag = "dep_hillControl"
12depAttRefData.gainMatrix = hillToAttRef.MultiArray(lqr_gain_set)
13depAttRefData.hillStateInMsg.subscribeTo(hillStateMsg)
14if msg_type == 'NavAttMsg':
15        depAttRefData.attNavInMsg.subscribeTo(attNavMsg)
16else:
17        depAttRefData.attRefInMsg.subscribeTo(attRefMsg)
18
19if use_limits:
20        depAttRefData.relMRPMin = -0.2 #    Configure minimum MRP
21        depAttRefData.relMRPMax = 0.2  #    Configure maximum MRP

In addition, this module is used in the example script scenarioDragRendezvous, where it directly commands a spacecraft’s attitude.


Functions

void SelfInit_hillToAttRef(HillToAttRefConfig *configData, int64_t moduleID)
void Update_hillToAttRef(HillToAttRefConfig *configData, uint64_t callTime, int64_t moduleID)

This module reads an OpNav image and extracts circle information from its content using OpenCV’s HoughCircle Transform. It performs a greyscale, a bur, and a threshold on the image to facilitate circle-finding.

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_hillToAttRef(HillToAttRefConfig *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.

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

AttRefMsgPayload RelativeToInertialMRP(HillToAttRefConfig *configData, double relativeAtt[3], double sigma_XN[3])
struct HillToAttRefConfig
#include <hillToAttRef.h>

Top level structure for the sub-module routines.

Public Members

HillRelStateMsg_C hillStateInMsg

Provides state relative to chief.

AttRefMsg_C attRefInMsg

(Optional) Provides basis for relative attitude

NavAttMsg_C attNavInMsg

(Optional) Provides basis for relative attitude

AttRefMsg_C attRefOutMsg

Provides the attitude reference output message.

BSKLogger *bskLogger

BSK Logging.

double gainMatrix[3][6]

User-configured gain matrix that maps from hill states to relative attitudes.

double relMRPMin

Minimum value for the relative MRP components; user-configurable.

double relMRPMax

Maximum value for the relative MRP components; user-configurable.