C++ Module: starTracker

Executive Summary

Sensor model to simulate a Star Tracker.

The principal-rotation-vector error state evolves according to

\[\boldsymbol e_{k+1} = A\boldsymbol e_k + P\boldsymbol z_k, \qquad \boldsymbol z_k \sim \mathcal{N}(\boldsymbol 0, I),\]

where PMatrix is a matrix square root of the process-noise covariance and setAMatrix() configures the propagation matrix. The propagation matrix defaults to zero, so configuring only PMatrix produces independent white Gaussian attitude errors. RNGSeed controls the repeatable random sequence.

A correlated process or random walk must be configured explicitly. For example, identity propagation with positive walk bounds creates a bounded random walk:

tracker.setAMatrix([[1.0, 0.0, 0.0],
                    [0.0, 1.0, 0.0],
                    [0.0, 0.0, 1.0]])
tracker.setWalkBounds([0.01, 0.01, 0.01])  # [rad]

Each positive walk-bound entry is an exact hard bound on the corresponding error state. A non-positive entry disables clipping for that state.

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

Message Connection Descriptions

The following table lists all the module input and output messages. The module msg connection 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.

starTracker module input and output messages

Module I/O Messages

Msg Variable Name

Msg Type

Description

scStateInMsg

SCStatesMsgPayload

sc input state message

sensorOutMsg

STSensorMsgPayload

sensor output state message


class StarTracker : public SysModel
#include <starTracker.h>

Star tracker sensor model that simulates quaternion measurements with configurable noise.

The star tracker supports noise configuration through:

  • PMatrix: Matrix square root of the process-noise covariance [rad]

  • AMatrix: Propagation matrix for the error model (defaults to zero for white noise)

  • Walk bounds: Optional hard bounds on the propagated error state [rad]

Example Python usage:

tracker = starTracker.StarTracker()

# Configure noise (rad)
tracker.PMatrix = [[0.001, 0.0, 0.0],
                   [0.0, 0.001, 0.0],
                   [0.0, 0.0, 0.001]]

# Optional: configure a bounded random walk explicitly
tracker.setAMatrix([[1.0, 0.0, 0.0],
                    [0.0, 1.0, 0.0],
                    [0.0, 0.0, 1.0]])
tracker.setWalkBounds([0.01, 0.01, 0.01])

Public Functions

StarTracker()
~StarTracker()
void UpdateState(uint64_t CurrentSimNanos)

update module states

void Reset(uint64_t CurrentClock)

Method for resetting the module.

This method is used to reset the module.

Parameters:

CurrentSimNanos – The current simulation time from the architecture

void readInputMessages()

read input messages

void writeOutputMessages(uint64_t Clock)

write output messages

void computeSensorErrors()

compute sensor errors

void applySensorErrors()

apply sensor errors

void computeTrueOutput()

compute true output values

void computeQuaternion(double *sigma, STSensorMsgPayload *sensorValue)

compute quaternion from MRPs

Parameters:
  • sigma

  • sensorValues

void setAMatrix(const Eigen::MatrixXd &propMatrix)

Setter for AMatrix used for error propagation

Parameters:

propMatrix – Matrix to set

Eigen::MatrixXd getAMatrix() const

Getter for AMatrix used for error propagation

Returns:

Current matrix

void setWalkBounds(const Eigen::Vector3d &bounds)

Sets walk bounds [rad]

Eigen::Vector3d getWalkBounds() const

Gets current walk bounds [rad]

Public Members

uint64_t sensorTimeTag

[ns] Current time tag for sensor out

ReadFunctor<SCStatesMsgPayload> scStateInMsg

[-] sc input state message

Message<STSensorMsgPayload> sensorOutMsg

[-] sensor output state message

Eigen::Matrix3d PMatrix

[rad] Matrix square root of the process-noise covariance

Eigen::Vector3d walkBounds

[rad] Hard bounds on error states; non-positive entries disable clipping

Eigen::Vector3d navErrors

[rad] Current principal-rotation-vector errors applied to truth

double dcm_CB[3][3]

[-] Transformation matrix from body to case

STSensorMsgPayload trueValues

[-] total measurement without perturbations

STSensorMsgPayload sensedValues

[-] total measurement including perturbations

double mrpErrors[3]

[-] Errors to be applied to the input MRP set indicating whether

SCStatesMsgPayload scState

[-] Module variable where the input State Data message is stored

BSKLogger bskLogger

&#8212; BSK Logging

Private Members

Eigen::Matrix3d AMatrix

[-] Error propagation matrix; defaults to zero for white noise

GaussMarkov errorModel

[-] Gauss-markov error states