C Module: opNavPoint

Executive Summary

This module implements a opNav point attitude guidance routine.

This algorithm is intended to be incredibly simple and robust: it finds the angle error between the camera boresight (or desired control axis in the camera frame) and the planet heading in the camera frame and brings them to zero. This is analogous to sunSafePoint. The file PDF Description. contains further information on this module’s function, how to run it, as well as testing.

Frame Conventions

The target heading from opnavDataInMsg and the camera axis alignAxis_C are both expressed in camera frame \(\mathcal{C}\) components. The principal rotation axis is computed from these two vectors in camera components and then mapped into body frame \(\mathcal{B}\) components with the camera orientation \([CB]\) from cameraConfigInMsg:

\[{}^{\mathcal{B}}\hat{\boldsymbol{e}} = [CB]^{T}\, {}^{\mathcal{C}}\hat{\boldsymbol{e}}\]

The output sigma_BR is built from this body frame axis, so the implied reference attitude points alignAxis_C at the target for any camera mounting sigma_CB. The module variable opNavMnvrVec holds the body frame axis, while eHat180_C holds the fallback axis, in camera frame components, used when the target is nearly opposite alignAxis_C.

Saved Heading

Each new valid image saves the target heading in inertial frame components. While no new valid image is available, the saved heading is mapped back into the camera frame with the current attitude and used for guidance until timeOut seconds have passed since the write time of the last accepted valid message; the module then switches to the search rate omega_RN_B. A new valid image is always used immediately.

Freshness is determined by the message write timestamp: after the first valid message, only a strictly newer valid message replaces the saved heading. A retained valid=1 payload neither restarts the timeout nor changes the saved inertial heading. With timeOut=0, each new valid message is used for one update only. Producers must supply increasing write timestamps for new measurements; republishing an old image with a new write timestamp is treated as a new measurement.

Message Connection Descriptions

The following diagram and table list all the module input and output messages. The module message connection is set by the user from Python. The message type contains a link to the message structure definition, while the description provides information on what this message is used for.

opNavPoint module input and output messages

Module I/O Messages

Msg Variable Name

Msg Type

Description

attGuidanceOutMsg

AttGuidMsgPayload

name of the output guidance message

opnavDataInMsg

OpNavMsgPayload

name of the optical navigation input message

imuInMsg

NavAttMsgPayload

name of the incoming IMU message

cameraConfigInMsg

CameraConfigMsgPayload

name of the camera config message


Functions

void SelfInit_opNavPoint(OpNavPointConfig *configData, int64_t moduleID)

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

Parameters:
  • configData – The configuration data associated with the opNav guidance

  • moduleID – The Basilisk module identifier

void Update_opNavPoint(OpNavPointConfig *configData, uint64_t callTime, int64_t moduleID)

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

Parameters:
  • configData – The configuration data associated with the opNav attitude guidance

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

  • moduleID – The Basilisk module identifier

void Reset_opNavPoint(OpNavPointConfig *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 guidance module

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

  • moduleID – The Basilisk module identifier

struct OpNavPointConfig
#include <opNavPoint.h>

module configuration message definition

Public Members

AttGuidMsg_C attGuidanceOutMsg

The name of the output message

OpNavMsg_C opnavDataInMsg

The name of the Input message

NavAttMsg_C imuInMsg

The name of the incoming IMU message

CameraConfigMsg_C cameraConfigInMsg

The name of the camera config message.

double minUnitMag

– Currently not used by the module, kept for compatibility

double opNavAngleErr

– rad The current error between cmd and obs opNav angle

double smallAngle

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

double eHat180_C[3]

– Eigen axis (C frame) to use if commanded axis is 180 from opNav axis

double opNavMnvrVec[3]

– The eigen axis (B frame) that we want to rotate on to see target

uint64_t lastTime

[ns] Write time of the last accepted valid measurement

double timeOut

[s] If no images were seen in this much time, stop using past values

double alignAxis_C[3]

– Desired camera vector to point at target

double savedR_BN_N[3]

[m] Last measured r_BN in inertial frame, zero if no heading is saved

double omega_RN_B[3]

– Desired body rate vector if no opNav direction is available

double opNavAxisSpinRate

[rad/s] Desired constant spin rate about alignAxis_C

int hasReceivedMeasurement

Whether a valid measurement has been accepted since reset

AttGuidMsgPayload attGuidanceOutBuffer

– The output data that we compute

BSKLogger *bskLogger

BSK Logging.