Module: simpleInstrumentController

Executive Summary

This module generates a command in the form of a DeviceCmdMsgPayload that turns on a Module: simpleInstrument if the spacecraft a.) has access to a Module: groundLocation and b.) the associated attitude error from an attitude guidance message is within the given tolerance.

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




input msg containing the ground location access



input message containing the attitude guidance



output message with the device command

Detailed Module Description

This module writes out a DeviceCmdMsgPayload to turn on an instrument, i.e. Module: simpleInstrument.


This module assumes that the simulated data is generated instantaneously. Therefore, the baudRate of the simpleInstrument must be sized as such.

The module first checks if the target has already been imaged. If the target has not been imaged, the module then checks if the norm of the attitude error is less than the user specified tolerance and if the Module: groundLocation is accessible. If both are true, the module sets the deviceCmd to 1. Otherwise, the deviceCmd is set to 0.

User Guide

Two variables must be set. The variable attErrTolerance is the norm of the acceptable attitude error in MRPs. It must be set at the beginning of the sim.

The imaged variable is always initialized to 0 (i.e. the target has not been imaged). However, if the simulation is stopped and restarted again this variable should be reinitialized to 0 in between. If it is not and the previous target was imaged, the new target will not be imaged.


void SelfInit_simpleInstrumentController(simpleInstrumentControllerConfig *configData, int64_t moduleID)

This method initializes the output messages for this module.

  • configData – The configuration data associated with this module

  • moduleID – The module identifier



void Update_simpleInstrumentController(simpleInstrumentControllerConfig *configData, uint64_t callTime, int64_t moduleID)

Add a description of what this main Update() routine does for this module

  • configData – The configuration data associated with the module

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

  • moduleID – The module identifier



void Reset_simpleInstrumentController(simpleInstrumentControllerConfig *configData, uint64_t callTime, int64_t moduleID)

This method performs a complete reset of the module. Local module variables that retain time varying states between function calls are reset to their default values.

  • configData – The configuration data associated with the module

  • callTime – [ns] time the method is called

  • moduleID – The module identifier



struct simpleInstrumentControllerConfig
#include <simpleInstrumentController.h>

Data configuration structure for the MRP feedback attitude control routine.

Public Members

double attErrTolerance

Normalized MRP attitude error tolerance.

unsigned int imaged

Indicator for whether or not the image has already been captured.

AccessMsg_C locationAccessInMsg

Ground location access input message.

AttGuidMsg_C attGuidInMsg

attitude guidance input message

DeviceCmdMsg_C deviceCmdOutMsg

device status output message

BSKLogger *bskLogger

BSK Logging.