C Module: horizonOpNav

Executive Summary

Converter that takes a limb message and camera information and outputs a relative position to the object. This algorithm was developed by J. Christian.

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

Measurement Freshness

The module consumes each written limb message once. After the first write, its message-header write time must increase strictly, including after an invalid measurement. Unwritten, retained, or older inputs leave the output and its write time unchanged, allowing slower consumers to read the last result. A new invalid input produces a zero output with valid = 0. Consumers must check the output write time to detect new results. Updating camera or attitude data alone does not trigger another conversion. Reset clears the timestamp history, allowing a write at time zero. Producers must timestamp new measurements when writing them; republishing an old image with a newer write time 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.

horizonOpNav module input and output messages

Module I/O Messages

Msg Variable Name

Msg Type

Description

opNavOutMsg

OpNavMsgPayload

Output navigation message for relative position

cameraConfigInMsg

CameraConfigMsgPayload

camera config input message

attInMsg

NavAttMsgPayload

attitude input message

limbInMsg

OpNavLimbMsgPayload

limb input message

Planet Selection

Set planetTarget to 1 (Earth), 2 (Mars), or 3 (Jupiter). For a valid limb measurement, a nonzero planetIds in limbInMsg replaces planetTarget before the navigation calculation. A zero ID leaves the current target unchanged. Unsupported IDs raise BasiliskError in Python.


Functions

void SelfInit_horizonOpNav(HorizonOpNavData *configData, int64_t moduleID)

This method transforms pixel, line, and diameter data into heading data for orbit determination or heading determination.

Parameters:
  • configData – The configuration data associated with the ephemeris model

  • moduleID – The module identification integer

void Update_horizonOpNav(HorizonOpNavData *configData, uint64_t callTime, int64_t moduleID)

This method reads in the camera and circle messages and extracts navigation data from them. It outputs the heading (norm and direction) to the celestial body identified in the inertial frame. It provides the heading to the most robust circle identified by the image processing algorithm.

Parameters:
  • configData – The configuration data associated with the ephemeris model

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

  • moduleID – The module identification integer

void Reset_horizonOpNav(HorizonOpNavData *configData, uint64_t callTime, int64_t moduleID)

This resets the module to original states.

Parameters:
  • configData – The configuration data associated with the ephemeris model

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

  • moduleID – The module identification integer

void QRDecomp(double *inMat, size_t nRow, double *Q, double *R)

This performs a QR decomposition on a input matrix. In this method it’s used on the H matrix made up of the limb points

Parameters:
  • inMat – The input matrix to decompose

  • nRow – The number of rows

  • Q – The output Q matrix (numbLimb x 3)

  • R – The output R matrix (3 x 3)

void BackSub(double *R, double *inVec, int32_t nRow, double *n)

Perform a back-substitution solve for n given Rn = V, where R is an upper-triangular matrix.

Parameters:
  • R – The upper triangular matrix for the backsolve

  • inVec – Vector on the Right-Hand-Side of the Rn = V equation

  • nRow – The number of rows/columns

  • n – The solution vector

struct HorizonOpNavData
#include <horizonOpNav.h>

The configuration structure for the horizon OpNav module.

Public Members

OpNavMsg_C opNavOutMsg

[-] output navigation message for relative position

CameraConfigMsg_C cameraConfigInMsg

camera config input message

NavAttMsg_C attInMsg

attitude input message

OpNavLimbMsg_C limbInMsg

limb input message

int32_t planetTarget

The planet targeted (None = 0, Earth = 1, Mars = 2, Jupiter = 3 are allowed).

double noiseSF

A scale factor to control measurement noise.

uint64_t lastWriteTime

[ns] Last consumed limb message write time

int hasReadMessage

Whether a limb message has been consumed since reset.

BSKLogger *bskLogger

BSK Logging.