ISIS iMTQ API¶
Core¶
Command Response Flags
- 
RESP_NEW¶
- First time retrieving this response. 
- 
RESP_IVA_X¶
- X-axis measurement might be invalid. 
- 
RESP_IVA_Y¶
- Y-axis measurement might be invalid. 
- 
RESP_IVA_Z¶
- Z-axis measurement might be invalid. 
Enums
- 
enum KADCSStatus¶
- ADCS function return values. - Values: - 
ADCS_OK¶
 - 
ADCS_ERROR¶
- Generic error. 
 - 
ADCS_ERROR_CONFIG¶
- Configuration error. 
 - 
ADCS_ERROR_NO_RESPONSE¶
- No response received from subsystem. 
 - 
ADCS_ERROR_INTERNAL¶
- An error was thrown by the subsystem. 
 - 
ADCS_ERROR_MUTEX¶
- Mutex-related error. 
 - 
ADCS_ERROR_NOT_IMPLEMENTED¶
- Requested function has not been implemented for the subsystem. 
 
- 
- 
enum KIMTQStatus¶
- iMTQ Return Values Error codes which may be returned in the imtq_resp_header.status byte of a response message - Values: - 
IMTQ_OK¶
 - 
IMTQ_ERROR= 0x01¶
- Generic error. 
 - 
IMTQ_ERROR_BAD_CMD= 0x02¶
- Invalid command. 
 - 
IMTQ_ERROR_NO_PARAM= 0x03¶
- Parameter missing. 
 - 
IMTQ_ERROR_BAD_PARAM= 0x04¶
- Parameter invalid. 
 - 
IMTQ_ERROR_MODE= 0x05¶
- Command unavailable in current mode. 
 - 
IMTQ_ERROR_RESERVED= 0x06¶
- (Internal reserved value) 
 - 
IMTQ_ERROR_INTERNAL= 0x07¶
- Internal error. 
 
- 
Functions
- 
KADCSStatus k_adcs_init(char *bus, uint16_t addr, int timeout)¶
- Initialize the ADCS interface. - Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- bus: I2C bus device name
- addr: I2C address
- timeout: Watchdog timeout in seconds
 
 
- 
void k_adcs_terminate(void)¶
- Terminate the ADCS interface. 
- 
KADCSStatus k_imtq_watchdog_start(void)¶
- Start a thread to kick the iMTQ’s watchdog at an interval of - (timeout/3)seconds (- timeoutspecified in- k_adcs_init)- Return
- KADCSStatus ADCS_OKif OK, error otherwise
 
- 
KADCSStatus k_imtq_watchdog_stop(void)¶
- Stop the watchdog thread. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
 
- 
KADCSStatus k_imtq_reset(void)¶
- Reboot the iMTQ. - Note
- All configuration options will be reset to their default values
- Return
- KADCSStatus ADCS_OKif OK, error otherwise
 
- 
KADCSStatus k_adcs_passthrough(const uint8_t *tx, int tx_len, uint8_t *rx, int rx_len, const struct timespec *delay)¶
- Pass a command packet directly through to the ADCS. - Useful for executing commands which have not been implemented in either the generic or specific ADCS APIs. - Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- tx: Pointer to command packet to send
- tx_len: Size of command packet
- rx: Pointer to storage for command response
- rx_len: Expected length of command response
- delay: Time to wait inbetween sending the command packet and requesting a response
 
 
- 
KADCSStatus kprv_imtq_transfer(const uint8_t *tx, int tx_len, uint8_t *rx, int rx_len, const struct timespec *delay)¶
- Send an iMTQ request and fetch the response. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- tx: Pointer to data to send
- tx_len: Length of data to send
- rx: Pointer to buffer for response data
- rx_len: Length of data to read for response
- delay: Delay between sending data to the iMTQ and reading the response. A value of- NULLindicates that the default should be used.
 
 
- 
static KIMTQStatus kprv_imtq_check_error(uint8_t status)¶
- Extract the return code in a response status byte. - Return
- Converted KIMTQStatus value
- Parameters
- status: A imtq_resp_header.status byte returned in a response message structure
 
 
Variables
- 
pthread_mutex_t imtq_mutex¶
- System mutex to preserve iMTQ command/response ordering. 
- 
struct imtq_resp_header¶
- #include <imtq.h>Response header structure. Public Members - 
uint8_t cmd¶
- Command which produced this response. 
 - 
uint8_t status¶
- Status byte. - Contains command response flags, like RESP_IVA_X, and a return code which can be extracted with kprv_imtq_check_error 
 
- 
uint8_t 
- 
struct imtq_axis_data¶
- #include <imtq.h>Generic structure for data relating to the axes. 
Configuration¶
Magnetometer Configuration Parameter Codes
- 
MTM_SELECT¶
- Select MTM to use for measurement. - 0 - Internal, 1 - External 
- 
MTM_INTERNAL_TIME¶
- Integration time selection for idle mode MTM measurements. - Refer to Table 3-10 of the iMTQ User Manual for more information 
- 
MTM_EXTERNAL_TIME¶
- Integration time selection for idle mode MTM measurements. - Refer to Table 3-10 of the iMTQ User Manual for more information 
- 
MTM_INTERNAL_MAP_X¶
- iMTQ axis to which the MTM x-axis is mapped 
- 
MTM_INTERNAL_MAP_Y¶
- iMTQ axis to which the MTM y-axis is mapped 
- 
MTM_INTERNAL_MAP_Z¶
- iMTQ axis to which the MTM z-axis is mapped 
- 
MTM_EXTERNAL_MAP_X¶
- iMTQ axis to which the MTM x-axis is mapped 
- 
MTM_EXTERNAL_MAP_Y¶
- iMTQ axis to which the MTM y-axis is mapped 
- 
MTM_EXTERNAL_MAP_Z¶
- iMTQ axis to which the MTM z-axis is mapped 
- 
MTM_MATRIX_R1_C1¶
- MTM raw -> corrected correction matrix (Row 1, Column 1) 
- 
MTM_MATRIX_R1_C2¶
- MTM raw -> corrected correction matrix (Row 1, Column 2) 
- 
MTM_MATRIX_R1_C3¶
- MTM raw -> corrected correction matrix (Row 1, Column 3) 
- 
MTM_MATRIX_R2_C1¶
- MTM raw -> corrected correction matrix (Row 2, Column 1) 
- 
MTM_MATRIX_R2_C2¶
- MTM raw -> corrected correction matrix (Row 2, Column 2) 
- 
MTM_MATRIX_R2_C3¶
- MTM raw -> corrected correction matrix (Row 2, Column 3) 
- 
MTM_MATRIX_R3_C1¶
- MTM raw -> corrected correction matrix (Row 3, Column 1) 
- 
MTM_MATRIX_R3_C2¶
- MTM raw -> corrected correction matrix (Row 3, Column 2) 
- 
MTM_MATRIX_R3_C3¶
- MTM raw -> corrected correction matrix (Row 3, Column 3) 
- 
MTM_BIAS_X¶
- MTM raw -> corrected correction bias vector (X-axis value) 
- 
MTM_BIAS_Y¶
- MTM raw -> corrected correction bias vector (Y-axis value) 
- 
MTM_BIAS_Z¶
- MTM raw -> corrected correction bias vector (Z-axis value) 
Current/Temperature Measurement Configuration Parameter Codes
- 
ADC_COIL_CURRENT_BIAS_X¶
- X-axis voltage bias for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_BIAS_Y¶
- Y-axis voltage bias for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_BIAS_Z¶
- Z-axis voltage bias for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_MULT_X¶
- X-axis pre-multiplier for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_MULT_Y¶
- Y-axis pre-multiplier for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_MULT_Z¶
- Z-axis pre-multiplier for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_DIV_X¶
- X-axis post-divider for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_DIV_Y¶
- Y-axis post-divider for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_CURRENT_DIV_Z¶
- Z-axis post-divider for coil current ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_BIAS_X¶
- X-axis voltage bias for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_BIAS_Y¶
- Y-axis voltage bias for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_BIAS_Z¶
- Z-axis voltage bias for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_MULT_X¶
- X-axis pre-multiplier for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_MULT_Y¶
- Y-axis pre-multiplier for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_MULT_Z¶
- Z-axis pre-multiplier for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_DIV_X¶
- X-axis post-divider for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_DIV_Y¶
- Y-axis post-divider for coil temperature ADC -> engineering value conversion. 
- 
ADC_COIL_TEMP_DIV_Z¶
- Z-axis post-divider for coil temperature ADC -> engineering value conversion. 
Detumble Configuration Parameter Codes
- 
DETUMBLE_FREQUENCY¶
- Control frequency of the detumble mode control loop. - Values: 1, 2, 4, or 8 Hz 
- 
BDOT_GAIN¶
- B-Dot algorithm gain when converting from B-Dot to dipole. - Value should be negative 
- 
MTM_FILTER_SENSITIVITY¶
- Adaptive sensitivity of low-pass filter applied to calibrated MTM measurements during detumble mode. 
- 
MTM_FILTER_WEIGHT¶
- Adaptive weight of low-pass filter applied to calibrated MTM measurements during detumble mode. 
Dipole to Current Conversion Configuration Parameter Codes
- 
COIL_AREA_X¶
- X-axis area of the coil used to calculate the dipole from the current flowing through the coil. 
- 
COIL_AREA_Y¶
- Y-axis area of the coil used to calculate the dipole from the current flowing through the coil. 
- 
COIL_AREA_Z¶
- Z-axis area of the coil used to calculate the dipole from the current flowing through the coil. 
- 
COIL_CURRENT_LIMIT¶
- Maximum total coil current allowed for dipole generation (excluding idle current consumption) 
Current to Actuation-percentage Conversion Configuration Parameter Codes
- 
CURRENT_FEEDBACK_ENABLE¶
- Current feedback control. - 0 - Open-loop temperature-compensated, 1 - Software-based closed-loop 
- 
CURRENT_FEEDBACK_GAIN_X¶
- X-axis feedback gain of the proportional difference controller. 
- 
CURRENT_FEEDBACK_GAIN_Y¶
- Y-axis feedback gain of the proportional difference controller. 
- 
CURRENT_FEEDBACK_GAIN_Z¶
- Z-axis feedback gain of the proportional difference controller. 
- 
CURRENT_MAP_TEMP_T1¶
- Current-map profile temperature 1 (lowest) 
- 
CURRENT_MAP_TEMP_T2¶
- Current-map profile temperature 2. 
- 
CURRENT_MAP_TEMP_T3¶
- Current-map profile temperature 3. 
- 
CURRENT_MAP_TEMP_T4¶
- Current-map profile temperature 4. 
- 
CURRENT_MAP_TEMP_T5¶
- Current-map profile temperature 5. 
- 
CURRENT_MAP_TEMP_T6¶
- Current-map profile temperature 6. 
- 
CURRENT_MAP_TEMP_T7¶
- Current-map profile temperature 7 (highest) 
- 
CURRENT_MAX_X_T1¶
- X-axis maximum current at temperature 1. 
- 
CURRENT_MAX_X_T2¶
- X-axis maximum current at temperature 2. 
- 
CURRENT_MAX_X_T3¶
- X-axis maximum current at temperature 3. 
- 
CURRENT_MAX_X_T4¶
- X-axis maximum current at temperature 4. 
- 
CURRENT_MAX_X_T5¶
- X-axis maximum current at temperature 5. 
- 
CURRENT_MAX_X_T6¶
- X-axis maximum current at temperature 6. 
- 
CURRENT_MAX_X_T7¶
- X-axis maximum current at temperature 7. 
- 
CURRENT_MAX_Y_T1¶
- Y-axis maximum current at temperature 1. 
- 
CURRENT_MAX_Y_T2¶
- Y-axis maximum current at temperature 2. 
- 
CURRENT_MAX_Y_T3¶
- Y-axis maximum current at temperature 3. 
- 
CURRENT_MAX_Y_T4¶
- Y-axis maximum current at temperature 4. 
- 
CURRENT_MAX_Y_T5¶
- Y-axis maximum current at temperature 5. 
- 
CURRENT_MAX_Y_T6¶
- Y-axis maximum current at temperature 6. 
- 
CURRENT_MAX_Y_T7¶
- Y-axis maximum current at temperature 7. 
- 
CURRENT_MAX_Z_T1¶
- Z-axis maximum current at temperature 1. 
- 
CURRENT_MAX_Z_T2¶
- Z-axis maximum current at temperature 2. 
- 
CURRENT_MAX_Z_T3¶
- Z-axis maximum current at temperature 3. 
- 
CURRENT_MAX_Z_T4¶
- Z-axis maximum current at temperature 4. 
- 
CURRENT_MAX_Z_T5¶
- Z-axis maximum current at temperature 5. 
- 
CURRENT_MAX_Z_T6¶
- Z-axis maximum current at temperature 6. 
- 
CURRENT_MAX_Z_T7¶
- Z-axis maximum current at temperature 7. 
Read-Only Configuration Parameter Codes
- 
HW_CONFIG¶
- iMTQ hardware configuration. - 0 - Internal config, 1 - External config 
- 
WATCHDOG_TIMEOUT¶
- I2C watchdog timeout interval in seconds. - Value of 0 indicates the watchdog is disabled 
- 
SLAVE_ADDRESS¶
- iMTQ’s I2C address 
- 
SOFTWARE_VERSION¶
- iMTQ’s software version. - v[second byte].[third byte].[fourth byte]; first byte is ignored 
Functions
- 
KADCSStatus k_adcs_configure(const JsonNode *config)¶
- Configure the ADCS. - Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- config: ADCS configuration structure
 
 
- 
KADCSStatus k_imtq_get_param(uint16_t param, imtq_config_resp *response)¶
- Get the current value of a configuration parameter. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- param: ID of parameter value to fetch
- response: Pointer to storage for response message. Returns the current value of the parameter.
 
 
- 
KADCSStatus k_imtq_set_param(uint16_t param, const imtq_config_value *value, imtq_config_resp *response)¶
- Set the value of a configuration parameter. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- param: ID of parameter to update
- value: Pointer to new parameter value
- response: Pointer to storage for response message. Returns the updated value of the parameter. If successful, the new value should match the requested value.
 
 
- 
KADCSStatus k_imtq_reset_param(uint16_t param, imtq_config_resp *response)¶
- Reset the value of a configuration parameter to its default. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- param: ID of parameter value to reset
- response: Pointer to storage for response message. Returns the new value of the parameter.
 
 
- 
union imtq_config_value¶
- #include <imtq-config.h>Configuration value storage union Using a union allows one common variable type to be used for all configuration functions. Public Members - 
int8_t int8_val¶
- Storage for signed single-byte values. 
 - 
uint8_t uint8_val¶
- Storage for unsigned single-byte values. 
 - 
int16_t int16_val¶
- Storage for signed byte-pair values. 
 - 
uint16_t uint16_val¶
- Storage for unsigned byte-pair values. 
 - 
int32_t int32_val¶
- Storage for signed four-byte values. 
 - 
uint32_t uint32_val¶
- Storage for unsigned four-byte values. 
 - 
float float_val¶
- Storage for IEEE754 single-precision floating point values (four bytes) 
 - 
int64_t int64_val¶
- Storage for signed eight-byte values. 
 - 
uint64_t uint64_val¶
- Storage for unsigned eight-byte values. 
 - 
double double_val¶
- Storage for IEEE754 double-precision floating point values (eight bytes) 
 
- 
int8_t 
- 
struct imtq_config_resp¶
- #include <imtq-config.h>Message structure returned by all get/set/reset configuration requests. Public Members - 
imtq_resp_header hdr¶
- Response message header. 
 - 
uint16_t param¶
- Echo of requested parameter ID. 
 - 
imtq_config_value value¶
- Current value of requested parameter. 
 
- 
imtq_resp_header 
Operations¶
Typedefs
- 
typedef uint16_t adcs_mode_param¶
- Parameter for - k_adcs_set_mode- For the iMTQ, exclusively used to specify the duration when entering DETUMBLE mode 
- 
typedef JsonNode *adcs_test_results¶
- Pointer to self-test results JSON structure created by - k_adcs_run_test
Enums
Functions
- 
KADCSStatus k_adcs_noop(void)¶
- Execute ADCS no-op command. - Note
- This function might not be implemented for all ADCSs.
- Return
- KADCSStatus ADCS_OK if OK, error otherwise
 
- 
KADCSStatus k_adcs_reset(KADCSReset type)¶
- Reset the ADCS. - Note
- This function might not be implemented for all ADCSs
- Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- type: Type of reset to perform (hard, soft, etc)
 
 
- 
KADCSStatus k_adcs_set_mode(ADCSMode mode, const adcs_mode_param *params)¶
- Set the ADCS’s operating mode. - Note
- See specific ADCS API documentation for available modes
- Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- mode: Operating mode to change to
- params: Pointer to optional parameters which may be needed to configure the new operational mode
 
 
- 
KADCSStatus k_adcs_run_test(ADCSTestType test, adcs_test_results buffer)¶
- Run an ADCS self-test. - Note
- This function might not be implemented for all ADCSs. See specific ADCS API documentation for available self-tests.
- Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- test: Type of self-test to run
- buffer: (Pointer to) structure which the test-results should be copied to
 
 
- 
KADCSStatus k_imtq_cancel_op(void)¶
- Switch to idle mode and cancel any ongoing actuation. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
 
- 
KADCSStatus k_imtq_start_measurement(void)¶
- Start a 3-axis measurement of the magnetic field using the MTM. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
 
- 
KADCSStatus k_imtq_start_actuation_current(imtq_axis_data current, uint16_t time)¶
- Turn on the coils by current. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- current: Axes current values in [10-4 Am2]
- time: Amount of time coils should remain at the specified levels, in milliseconds. If time is zero, the coils will stay on until another command capable of changing the coils’ states/levels is run.
 
 
- 
KADCSStatus k_imtq_start_actuation_dipole(imtq_axis_data dipole, uint16_t time)¶
- Turn on the coils by desired dipole. - Note
- If the specified values exceed the coils’ capabilities, the dipole will be scaled. The resulting values can be retrieved with k_imtq_get_dipole.
- Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- dipole: Axes dipole values in [10-4 Am2]
- time: Amount of time coils should remain at the specified levels, in milliseconds. If time is zero, the coils will stay on until another command capable of changing the coils’ states/levels is run.
 
 
- 
KADCSStatus k_imtq_start_actuation_PWM(imtq_axis_data pwm, uint16_t time)¶
- Turn on the coils by PWM duty cycle. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- pwm: Axes PWM duty cycles in [0.1%]. Max single-axis value: 1000 (100%)
- time: Amount of time coils should remain at the specified levels, in milliseconds. If time is zero, the coils will stay on until another command capable of changing the coils’ states/levels is run.
 
 
- 
KADCSStatus k_imtq_start_test(ADCSTestType axis)¶
- Start axis self-test. - Use k_imtq_get_test_results_single or k_imtq_get_test_results_all to check the output - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- axis: Axis to test. Should be a ADCSTestType value (use TEST_ALL to text each axis sequentially)
 
 
- 
KADCSStatus k_imtq_start_detumble(uint16_t time)¶
- Switch to detumble mode. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- time: Length of time to spend in detumble mode (seconds)
 
 
Data Requests¶
Self-Test Error Byte Flags
- 
TEST_ERROR_I2C¶
- I2C Failure. 
- 
TEST_ERROR_SPI¶
- SPI Failure (MTM connectivity) 
- 
TEST_ERROR_ADC¶
- ADC Failure (current/temp measurement) 
- 
TEST_ERROR_PWM¶
- PWM Failure (coil actuation) 
- 
TEST_ERROR_TC¶
- System Failure. 
- 
TEST_ERROR_MTM¶
- MTM values outside of expected range. 
- 
TEST_ERROR_COIL¶
- Coil currents outside of expected range. 
Typedefs
- 
typedef uint32_t adcs_power_status¶
- System uptime returned by - k_adcs_get_power_status
- 
typedef imtq_axis_msg imtq_coil_current¶
- Coil currents in [10-4 A] returned by k_imtq_get_coil_current. 
- 
typedef imtq_axis_msg imtq_coil_temp¶
- Coil temperatures in [oC] returned by k_imtq_get_coil_temps. 
- 
typedef imtq_axis_msg imtq_dipole¶
- Commanded actuation dipole in [10-4 Am2] returned by k_imtq_get_dipole. 
Enums
Functions
- 
KADCSStatus k_adcs_get_power_status(adcs_power_status *data)¶
- Get the ADCS’s power status. - Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- data: Pointer to storage for returned system uptime. If the value is zero, then the ADCS is offline.
 
 
- 
KADCSStatus k_adcs_get_mode(ADCSMode *mode)¶
- Get the ADCS’s current operating mode. - Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- mode: Pointer to storage which the mode value should be copied to
 
 
- 
KADCSStatus k_adcs_get_orientation(adcs_orient *data)¶
- Get the ADCS’s current orientation. - Note
- This function might not be implemented for all ADCSs.
- Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- data: Pointer to storage for returned data.
 
 
- 
KADCSStatus k_adcs_get_spin(adcs_spin *data)¶
- Get the ADCS’s current spin. - Note
- This function might not be implemented for all ADCSs.
- Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- data: Pointer to storage for returned data.
 
 
- 
KADCSStatus k_adcs_get_telemetry(ADCSTelemType type, JsonNode *buffer)¶
- Read ADCS telemetry values. - Note
- See specific ADCS API documentation for available telemetry types
- Return
- KADCSStatus ADCS_OK if OK, error otherwise
- Parameters
- type: Telemetry packet to read
- buffer: (Pointer to) structure which data should be copied to
 
 
- 
KADCSStatus k_imtq_get_system_state(imtq_state *state)¶
- Get iMTQ system state. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- state: Pointer to storage for state data
 
 
- 
KADCSStatus k_imtq_get_raw_mtm(imtq_mtm_msg *data)¶
- Get raw data values from MTM. - Measurement units are in [7.5 * 10-9 T], as documented in the XEN1210 datasheet - Note
- The k_imtq_start_measurement function must have been called in order for this function to be able to retrieve data
- Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_calib_mtm(imtq_mtm_msg *data)¶
- Get calibrated data values from MTM. - Measurement units are in [10-9 T] - Note
- The k_imtq_start_measurement function must have been called in order for this function to be able to retrieve data
- Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_coil_current(imtq_coil_current *data)¶
- Get coil currents. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_coil_temps(imtq_coil_temp *data)¶
- Get coil temperatures. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_dipole(imtq_dipole *data)¶
- Get commanded actuation dipole. - Note
- Only applies to coil actuations started with k_imtq_start_actuation_dipole. Can also be used in detumble mode to retrieve the latest actuation dipole
- Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_test_results_single(imtq_test_result_single *data)¶
- Get results from a single-axis self-test. - The test can be started with k_imtq_start_test - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_test_results_all(imtq_test_result_all *data)¶
- Get results from an all-axes self-test. - The test can be started with k_imtq_start_test by specifying TEST_ALL - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_detumble(imtq_detumble *data)¶
- Get detumble data. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_raw_housekeeping(imtq_housekeeping_raw *data)¶
- Get the housekeeping data of the iMTQ as raw ADC values. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus k_imtq_get_eng_housekeeping(imtq_housekeeping_eng *data)¶
- Get the housekeeping data of the iMTQ in interpreted engineering units. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- data: Pointer to storage for data
 
 
- 
KADCSStatus kprv_adcs_get_status_telemetry(JsonNode *buffer)¶
- Get the current system status and add it to the telemetry JSON. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- buffer: Pointer to telemetry JSON structure
 
 
- 
KADCSStatus kprv_adcs_get_nominal_telemetry(JsonNode *buffer)¶
- Get the current system measurements and add them to the telemetry JSON. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- buffer: Pointer to telemetry JSON structure
 
 
- 
KADCSStatus kprv_adcs_get_debug_telemetry(JsonNode *buffer)¶
- Get the current system configuration and last self-test results and add them to the telemetry JSON. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- buffer: Pointer to telemetry JSON structure
 
 
- 
void kprv_adcs_process_test(JsonNode *parent, imtq_test_result test)¶
- Add a self-test result to the requested JSON structure. - Return
- KADCSStatus ADCS_OKif OK, error otherwise
- Parameters
- parent: Pointer to JSON structure results should be added to
- test: Self-test results to be parsed into JSON
 
 
- 
struct imtq_state¶
- #include <imtq-data.h>iMTQ system state data returned by k_imtq_get_system_state 
- 
struct imtq_mtm_data¶
- #include <imtq-data.h>MTM measurements data structure. 
- 
struct imtq_mtm_msg¶
- #include <imtq-data.h>MTM measurement returned by k_imtq_get_raw_mtm and k_imtq_get_calib_mtm. Public Members - 
imtq_resp_header hdr¶
- Response message header. 
 - 
imtq_mtm_data data¶
- MTM measurement data. - Units dependent on function used 
 - 
uint8_t act_status¶
- Coils actuation status during measurement. - 0 - Not actuating, 1 - Actuating 
 
- 
imtq_resp_header 
- 
struct imtq_axis_msg¶
- #include <imtq-data.h>Generic structure for messages relating to the axes. 
- 
struct imtq_test_result¶
- #include <imtq-data.h>Self-test step result structure. Public Members - 
imtq_resp_header hdr¶
- Response message header. 
 - 
uint8_t error¶
- Return code for the step. 
 - 
uint8_t step¶
- Axis being tested. 
 - 
imtq_mtm_data mtm_raw¶
- Raw MTM data in [7.5*10-9 T] per count. 
 - 
imtq_mtm_data mtm_calib¶
- Calibrated MTM data in [10-9 T]. 
 - 
imtq_axis_data coil_current¶
- Coil currents in [10-4 A]. 
 - 
imtq_axis_data coil_temp¶
- Coil temperatures in [oC]. 
 
- 
imtq_resp_header 
- 
struct imtq_test_result_single¶
- #include <imtq-data.h>Self-test single-axis result structure returned by k_imtq_get_test_results_single. Public Members - 
imtq_test_result init¶
- Measurements before actuation. 
 - 
imtq_test_result step¶
- Measurements during actuation of requested axis. 
 - 
imtq_test_result final¶
- Measurements after actuation. 
 
- 
imtq_test_result 
- 
struct imtq_test_result_all¶
- #include <imtq-data.h>Self-test all-axes result structure returned by k_imtq_get_test_results_all. Public Members - 
imtq_test_result init¶
- Measurements before actuation. 
 - 
imtq_test_result x_pos¶
- Measurements during actuation of positive x-axis. 
 - 
imtq_test_result x_neg¶
- Measurements during actuation of negative x-axis. 
 - 
imtq_test_result y_pos¶
- Measurements during actuation of positive y-axis. 
 - 
imtq_test_result y_neg¶
- Measurements during actuation of negative y-axis. 
 - 
imtq_test_result z_pos¶
- Measurements during actuation of positive z-axis. 
 - 
imtq_test_result z_neg¶
- Measurements during actuation of negative z-axis. 
 - 
imtq_test_result final¶
- Measurements after actuation. 
 
- 
imtq_test_result 
- 
struct imtq_detumble¶
- #include <imtq-data.h>Detumble data returned by k_imtq_get_detumble. Public Members - 
imtq_resp_header hdr¶
- Response message header. 
 - 
imtq_mtm_data mtm_calib¶
- Calibrated MTM data in [10-9 T]. 
 - 
imtq_mtm_data mtm_filter¶
- Filtered MTM data in [10-9 T]. 
 - 
imtq_mtm_data bdot¶
- B-Dot in [10-9 T*s-1]. 
 - 
imtq_axis_data dipole¶
- Commanded actuation dipole in [10-4 Am2]. 
 - 
imtq_axis_data cmd_current¶
- Command current in [10-4 A]. 
 - 
imtq_axis_data coil_current¶
- Coil currents in [10-4 A]. 
 
- 
imtq_resp_header 
- 
struct imtq_axis_data_raw¶
- #include <imtq-data.h>Generic structure for raw ADC data relating to the axes. 
- 
struct imtq_housekeeping_raw¶
- #include <imtq-data.h>Housekeeping data (raw ADC values) returned by k_imtq_get_raw_housekeeping. Public Members - 
imtq_resp_header hdr¶
- Response message header. 
 - 
uint16_t voltage_d¶
- Digital supply voltage. 
 - 
uint16_t voltage_a¶
- Analog supply voltage. 
 - 
uint16_t current_d¶
- Digital supply current. 
 - 
uint16_t current_a¶
- Analog supply current. 
 - 
imtq_axis_data_raw coil_current¶
- Coil currents. 
 - 
imtq_axis_data_raw coil_temp¶
- Coil temperatures. 
 - 
uint16_t mcu_temp¶
- MCU temperature. 
 
- 
imtq_resp_header 
- 
struct imtq_housekeeping_eng¶
- #include <imtq-data.h>Housekeeping data (engineering values) returned by k_imtq_get_eng_housekeeping. Public Members - 
imtq_resp_header hdr¶
- Response message header. 
 - 
uint16_t voltage_d¶
- Digital supply voltage in [mV]. 
 - 
uint16_t voltage_a¶
- Analog supply voltage in [mV]. 
 - 
uint16_t current_d¶
- Digital supply current in [10-4 A]. 
 - 
uint16_t current_a¶
- Analog supply current in [10-4 A]. 
 - 
imtq_axis_data coil_current¶
- Coil currents in [10-4 A]. 
 - 
imtq_axis_data coil_temp¶
- Coil temperatures in [oC]. 
 - 
int16_t mcu_temp¶
- MCU temperature in [oC]. 
 
- 
imtq_resp_header