Module: simple_nav

Simple navigation model used to provide error-ed truth (or truth). This class is used to perturb the truth state away using a gauss-markov error model. It is designed to look like a random walk process put on top of the nominal position, velocity, attitude, and attitude rate. This is meant to be used in place of the nominal navigation system output.

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


class SimpleNav : public SysModel

Public Functions

SimpleNav()

This is the constructor for the simple nav model. It sets default variable values and initializes the various parts of the model

~SimpleNav()

Destructor. Nothing here.

void SelfInit()

This is the self-init routine for the simple navigation model. It initializes the various containers used in the model as well as creates the output message. The error states are allocated as follows: Total states: 18

  • Position errors [0-2]

  • Velocity errors [3-5]

  • Attitude errors [6-8]

  • Body Rate errors [9-11]

  • Sun Point error [12-14]

  • Accumulated DV errors [15-17]

    Return

    void

void CrossInit()

This method pulls the input message IDs from the messaging system. It will alert the user if either of them are not found in the messaging database

Return

void

void UpdateState(uint64_t CurrentSimNanos)

This method calls all of the run-time operations for the simple nav model.

Return

void

Parameters
  • CurrentSimNanos: The clock time associated with the model call

void computeTrueOutput(uint64_t Clock)

This method uses the input messages as well as the calculated model errors to compute what the output navigation state should be.

Return

void

Parameters
  • Clock: The clock time associated with the model’s update call

void computeErrors(uint64_t CurrentSimNanos)

This method sets the propagation matrix and requests new random errors from its GaussMarkov model.

Return

void

Parameters
  • CurrentSimNanos: The clock time associated with the model call

void applyErrors()
void readInputMessages()

This method reads the input messages associated with the vehicle state and the sun state

void writeOutputMessages(uint64_t Clock)

This method writes the aggregate nav information into the output state message.

Return

void

Parameters
  • Clock: The clock time associated with the model call

Public Members

uint64_t outputBufferCount

Number of output state buffers in msg

Eigen::MatrixXd PMatrix

Covariance matrix used to perturb state

Eigen::VectorXd walkBounds

“3-sigma” errors to permit for states

Eigen::VectorXd navErrors

Current navigation errors applied to truth

std::string inputStateName

Message that contains s/c state

std::string outputAttName

Message that we output state to

std::string outputTransName

Message that we output state to

std::string inputSunName

Message name for the sun state

bool crossTrans

Have position error depend on velocity

bool crossAtt

Have attitude depend on attitude rate

NavAttIntMsg trueAttState

attitude nav state without errors

NavAttIntMsg estAttState

attitude nav state including errors

NavTransIntMsg trueTransState

translation nav state without errors

NavTransIntMsg estTransState

translation nav state including errors

SCPlusStatesSimMsg inertialState

input inertial state from Star Tracker

SpicePlanetStateSimMsg sunState

input Sun state

BSKLogger bskLogger

BSK Logging

Private Members

int64_t inputStateID

Message ID associated with s/c state

int64_t outputAttID

Message ID associated with att-nav state

int64_t outputTransID

Message ID associated with trans-nav state

int64_t inputSunID

Message ID associated with the sun position

Eigen::MatrixXd AMatrix

The matrix used to propagate the state

GaussMarkov errorModel

Gauss-markov error states

uint64_t prevTime

Previous simulation time observed