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 and attitude rate 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.
Msg Variable Name |
Msg Type |
Description |
---|---|---|
locationAccessInMsg |
input msg containing the ground location access |
|
attGuidInMsg |
input message containing the attitude guidance |
|
deviceStatusInMsg |
(optional) input message containing the device status |
|
deviceCmdOutMsg |
output message with the device command |
Detailed Module Description
This module writes out a DeviceCmdMsgPayload to turn on an instrument, i.e. Module: simpleInstrument.
Note
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 instrument controller is active using the controllerStatus
variable. This
variable defaults to 1 (active), but the user may set the variable to 0 (inactive) with the deviceStatusInMsg
or controllerStatus
variable. Then, the module checks if 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.
Optionally, attitude rate error checking may be enabled by setting useRateTolerance
to 1
. If enabled,
rateErrTolerance
should be set to the norm of the acceptable attitude rate error in rad/s when imaging.
If the user desires to make the instrument controller inactive, the controllerStatus
variable should be set to 0.
This may be done if the controller is to match the status of corresponding instrument data and power modules. This
may also be accomplished by writing out a DeviceStatusMsgPayload to the deviceStatusInMsg
.
Functions
-
void SelfInit_simpleInstrumentController(simpleInstrumentControllerConfig *configData, int64_t moduleID)
This method initializes the output messages for this module.
- Parameters:
configData – The configuration data associated with this module
moduleID – The module identifier
- Returns:
void
-
void Update_simpleInstrumentController(simpleInstrumentControllerConfig *configData, uint64_t callTime, int64_t moduleID)
Add a description of what this main Update() routine does for this module
- Parameters:
configData – The configuration data associated with the module
callTime – The clock time at which the function was called (nanoseconds)
moduleID – The module identifier
- Returns:
void
-
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.
- Parameters:
configData – The configuration data associated with the module
callTime – [ns] time the method is called
moduleID – The module identifier
- Returns:
void
-
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 useRateTolerance
Flag to enable rate error tolerance.
-
double rateErrTolerance
Rate error tolerance in rad/s.
-
unsigned int imaged
Indicator for whether or not the image has already been captured.
-
unsigned int controllerStatus
dictates whether or not the controller should be running
-
AccessMsg_C locationAccessInMsg
Ground location access input message.
-
AttGuidMsg_C attGuidInMsg
attitude guidance input message
-
DeviceStatusMsg_C deviceStatusInMsg
(optional) device status input message
-
DeviceCmdMsg_C deviceCmdOutMsg
device status output message
-
BSKLogger *bskLogger
BSK Logging.
-
double attErrTolerance