C Module: faultDetection
Executive Summary
This module is a fault detection module for optical navigation. It uses a scenario in which two image processing methods are implemented, and then can be compared in different ways.
Module Assumptions and Limitations
Each input is consumed once per strictly increasing message-header write time,
including invalid measurements. Unwritten, retained, and older inputs are treated
as unavailable. The fault modes operate only on fresh valid inputs in the current
update: mode 0 accepts either source, mode 1 accepts a primary alone, and mode 2
requires both sources. Inputs are not buffered for pairing on a later update.
If neither input has a new write, the output and its write time remain unchanged,
allowing slower consumers to read the last result. When a new input arrives but
the fault mode finds no usable measurement, the output is zero with valid = 0.
Consumers must check the output write time to detect new results.
Reset clears both timestamp histories, allowing writes 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. Other performance limitations
depend on the two input methods.
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.
Msg Variable Name |
Msg Type |
Description |
|---|---|---|
navMeasPrimaryInMsg |
Input primary nav message |
|
navMeasSecondaryInMsg |
Input secondary nav message |
|
cameraConfigInMsg |
Input camera message |
|
attInMsg |
Input attitude message |
|
opNavOutMsg |
Ouput navigation message given the two inputs |
Detailed Module Description
The document provides details that are reminded here: Three fault modes are possible:
FaultMode= 0: is the less restrictive: it uses either of the measurements available and merges them if they are both availableFaultMode= 1: is more restrictive: only the primary is used if both are available and the secondary is only used for a dissimilar checkFaultMode= 2: is most restrictive: the primary is not used in the absence of the secondary measurement
Equations
The important merging equations for the state and covariance of the two inputs are given here
The rest of the module is logic driven as explained in the doxygen documentation.
User Guide
An example setup is provided here:
1faults = faultDetection.FaultDetectionData()
2faults.sigmaFault = 3
3faults.faultMode = 1
The sigmaFault parameter is the multiplier on the covariances that needs to be passed for the faults to be triggered
Functions
-
void SelfInit_faultDetection(FaultDetectionData *configData, int64_t moduleID)
Self-init for the fault detection module
- Parameters:
configData – The configuration data associated with the model
moduleID – The module identification integer
-
void Update_faultDetection(FaultDetectionData *configData, uint64_t callTime, int64_t moduleID)
This method reads in the two compared navigation messages and outputs the best measurement possible. It compares the faults of each and uses camera and attitude knowledge to output the information in all necessary frames. Three fault modes are possible. FaultMode = 0 is the less restricitve: it uses either of the measurements availabe and merges them if they are both available FaultMode = 1 is more restricitve: only the primary is used if both are available and the secondary is only used for a dissimilar check FaultMode = 2 is most restricive: the primary is not used in the abscence of the secondary measurement
- Parameters:
configData – The configuration data associated with the model
callTime – The clock time at which the function was called (nanoseconds)
moduleID – The module identification integer
-
void Reset_faultDetection(FaultDetectionData *configData, uint64_t callTime, int64_t moduleID)
This resets the module to original states.
- Parameters:
configData – The configuration data associated with the model
callTime – The clock time at which the function was called (nanoseconds)
moduleID – The module identification integer
-
struct FaultDetectionData
- #include <faultDetection.h>
Module data structure.
Public Members
[-] output navigation message for relative position
-
NavAttMsg_C attInMsg
attitude input message
first measurement input message
second measurement input message
-
CameraConfigMsg_C cameraConfigInMsg
camera config inut message
-
int32_t planetTarget
The planet targeted (None = 0, Earth = 1, Mars = 2, Jupiter = 3 are allowed).
-
double faultMode
What fault mode to go in: 0 is dissimilar (use the primary measurement and compare with secondary), 1 merges the measurements if they are both valid and similar.
-
double sigmaFault
What is the sigma multiplication factor when comparing measurements.
-
uint64_t lastWriteTime[2]
[ns] Last consumed write time for primary (0) and secondary (1)
-
int hasReadMessage[2]
Whether each input has been consumed since reset.
-
BSKLogger *bskLogger
BSK Logging.