Module: imuSensor

Executive Summary

Sensor model to simulate an IMU.

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.

Module I/O Messages

Msg Variable Name

Msg Type

Description

scStateInMsg

SCStatesMsgPayload

input essage name for spacecraft state

sensorOutMsg

IMUSensorMsgPayload

output message name for IMU output data


class ImuSensor : public SysModel
#include <imuSensor.h>

IMU sensor class.

Public Functions

ImuSensor()
~ImuSensor()
void Reset(uint64_t CurrentSimNanos)

Reset the module

Parameters

CurrentSimNanos – current time (ns)

Returns

void

void UpdateState(uint64_t CurrentSimNanos)

update module states

Parameters

CurrentSimNanos – current time (ns)

void readInputMessages()

read input messages

void writeOutputMessages(uint64_t Clock)

write output messages

void setBodyToPlatformDCM(double yaw, double pitch, double roll)

set body orientation DCM relative to platform

void computePlatformDR()

This function gathers actual spacecraft attitude from the spacecraft output message. It then differences the state attitude between this time and the last time the IMU was called to get a DR (delta radians or delta rotation) The angular rate is retrieved directly from the spacecraft output message and passed through to theother IMU functions which add noise, etc.

void computePlatformDV(uint64_t CurrentTime)

This functions gathers actual spacecraft velocity from the spacecraft output message. It then differences the velocity between this time and the last time the IMU was called to get a DV (delta velocity). The acceleration of the spacecraft in the body frame is gathered directly from the spacecraft output message. Then, it is converted to the platform frame and rotational terms are added to it to account for CoM offset of the platform frame.

Parameters

CurrentTime

void applySensorErrors(uint64_t CurrentTime)

apply sensor errors

void applySensorDiscretization(uint64_t CurrentTime)

apply sensor direction

Parameters

CurrentTime

void applySensorSaturation(uint64_t CurrentTime)

apply sensor saturation

void computeSensorErrors()

compute sensor errors

void scaleTruth()

scale truth method

void setLSBs(double LSBa, double LSBo)

set LSB values

void setCarryError(bool aCarry, bool oCarry)

set Carry error value

void setRoundDirection(roundDirection_t aRound, roundDirection_t oRound)

set round direction value

void set_oSatBounds(Eigen::MatrixXd oSatBounds)

set o saturation bounds

Parameters

oSatBounds

void set_aSatBounds(Eigen::MatrixXd aSatBounds)

set a saturation bounds

Parameters

aSatBounds

Public Members

ReadFunctor<SCStatesMsgPayload> scStateInMsg

input essage name for spacecraft state

Message<IMUSensorMsgPayload> sensorOutMsg

output message name for IMU output data

Eigen::Vector3d sensorPos_B

[m] IMU sensor location in body

Eigen::Matrix3d dcm_PB

&#8212; Transform from body to platform

Eigen::Vector3d senRotBias

[r/s] Rotational Sensor bias value

Eigen::Vector3d senTransBias

[m/s2] Translational acceleration sen bias

double senRotMax

[r/s] Gyro saturation value

double senTransMax

[m/s2] Accelerometer saturation value

uint64_t OutputBufferCount

&#8212; number of output msgs stored

bool NominalReady

&#8212; Flag indicating that system is in run

Eigen::Matrix3d PMatrixAccel

[-] Cholesky-decomposition or matrix square root of the covariance matrix to apply errors with

Eigen::Matrix3d AMatrixAccel

[-] AMatrix that we use for error propagation

Eigen::Vector3d walkBoundsAccel

[-] “3-sigma” errors to permit for states

Eigen::Vector3d navErrorsAccel

[-] Current navigation errors applied to truth

Eigen::Matrix3d PMatrixGyro

[-] Cholesky-decomposition or matrix square root of the covariance matrix to apply errors with

Eigen::Matrix3d AMatrixGyro

[-] AMatrix that we use for error propagation

Eigen::Vector3d walkBoundsGyro

[-] “3-sigma” errors to permit for states

Eigen::Vector3d navErrorsGyro

[-] Current navigation errors applied to truth

IMUSensorMsgPayload trueValues

[-] total measurement without perturbations

IMUSensorMsgPayload sensedValues

[-] total measurement including perturbations

Eigen::Vector3d accelScale

(-) scale factor for acceleration axes

Eigen::Vector3d gyroScale

(-) scale factors for acceleration axes

Discretize aDisc

(-) instance of discretization utility for linear acceleration

Discretize oDisc

(-) instance of idscretization utility for angular rate

Saturate aSat

(-) instance of saturate utility for linear acceleration

Saturate oSat

(-) instance of saturate utility for angular rate

BSKLogger bskLogger

&#8212; BSK Logging

Private Members

uint64_t PreviousTime

&#8212; Timestamp from previous frame

int64_t numStates

&#8212; Number of States for Gauss Markov Models

SCStatesMsgPayload StatePrevious

&#8212; Previous state to delta in IMU

SCStatesMsgPayload StateCurrent

&#8212; Current SSBI-relative state

GaussMarkov errorModelAccel

[-] Gauss-markov error states

GaussMarkov errorModelGyro

[-] Gauss-markov error states

Eigen::MRPd previous_sigma_BN

&#8212; sigma_BN from the previous spacecraft message

Eigen::MRPd current_sigma_BN

&#8212; sigma_BN from the most recent spacecraft message

Eigen::Vector3d previous_omega_BN_B

&#8212; omega_BN_B from the previous spacecraft message

Eigen::Vector3d current_omega_BN_B

&#8212; omega_BN_B from the current spacecraft message

Eigen::Vector3d current_nonConservativeAccelpntB_B

&#8212; nonConservativeAccelpntB_B from the current message

Eigen::Vector3d current_omegaDot_BN_B

&#8212; omegaDot_BN_B from the curret spacecraft message

Eigen::Vector3d previous_TotalAccumDV_BN_B

&#8212; TotalAccumDV_BN_B from the previous spacecraft message

Eigen::Vector3d current_TotalAccumDV_BN_B

&#8212; TotalAccumDV_BN_B from the current spacecraft message

Eigen::Vector3d accel_SN_P_out

&#8212; rDotDot_SN_P for either next method or output messages

Eigen::Vector3d DV_SN_P_out

&#8212; time step deltaV for either next method or output messages

Eigen::Vector3d omega_PN_P_out

&#8212; omega_PN_P for either next method or output messages

Eigen::Vector3d prv_PN_out

&#8212; time step PRV_PN for either next method or output messages