|
Mod Library
Sun Devil Rocketry's hardware agnostic utility library
|
: Contains functions to interface between SDEC terminal commands and SDR sensor APIs More...
#include "stm32h7xx_hal.h"#include "imu.h"#include "gps.h"Go to the source code of this file.
Classes | |
| struct | _IMU_CONVERTED |
| Physical-unit converted accel/gyro/mag data. More... | |
| struct | _STATE_ESTIMATION |
| struct | _IMU_DATA |
| Aggregate struct containing converted IMU data and state estimate. More... | |
| struct | SENSOR_DATA |
| struct | _BARO_PRESET |
Macros | |
| #define | SENSOR_DUMP_CODE ( 0x01 ) |
| #define | NUM_SENSORS ( 38 ) |
| #define | SENSOR_DATA_SIZE ( 128 ) |
Typedefs | |
| typedef struct _PRESET_DATA | PRESET_DATA |
| typedef struct _IMU_CONVERTED | IMU_CONVERTED |
| Physical-unit converted accel/gyro/mag data. | |
| typedef struct _STATE_ESTIMATION | STATE_ESTIMATION |
| typedef struct _IMU_DATA | IMU_DATA |
| Aggregate struct containing converted IMU data and state estimate. | |
| typedef struct SENSOR_DATA | SENSOR_DATA |
| typedef struct _BARO_PRESET | BARO_PRESET |
Functions | |
| SENSOR_STATUS | sensor_cmd_execute (uint8_t subcommand) |
| Executes a sensor subcommand. | |
| SENSOR_STATUS | sensor_dump (SENSOR_DATA *sensor_data_ptr) |
| Reads all sensors and fills the sensor data structure. | |
| SENSOR_STATUS | sensor_init (PRESET_DATA *preset_data) |
| Initializes sensor timing, velocity, and attitude state. | |
| MOUNT_ORIENTATION | sensor_get_mount_orientation (void) |
| Gets the configured flight-computer mount orientation. | |
| void | sensor_set_mount_orientation (MOUNT_ORIENTATION orientation) |
| Sets the flight-computer mount orientation. | |
| void | sensor_reset_velo (void) |
| Resets velocity values to prevent accumulation of drift. | |
| SENSOR_STATUS | sensor_body_state (const IMU_CONVERTED *imu_converted, STATE_ESTIMATION *state_estimate) |
| Performs sensor fusion on converted IMU data to get body rate. | |
| void | sensor_axis_remap (float *x, float *y, float *z) |
| Remaps sensor axes for the flight configuration. | |
| void | sensor_imu_velo (const IMU_CONVERTED *imu_converted, STATE_ESTIMATION *state_estimate) |
| Calculates velocity from acceleration. | |
| void | sensor_conv_imu (IMU_CONVERTED *imu_converted, IMU_RAW *imu_raw) |
| Converts raw IMU readouts into accelerometer, gyro, and magnetometer data. | |
| float | sensor_acc_conv (int16_t readout) |
| Converts accelerometer readouts to meters per second squared. | |
| float | sensor_gyro_conv (int16_t readout) |
| Converts gyro readouts to degrees per second. | |
| void | sensor_baro_alt (SENSOR_DATA *sensor_data_ptr) |
| Calculates altitude from pressure readings. | |
: Contains functions to interface between SDEC terminal commands and SDR sensor APIs
Copyright (c) 2025 Sun Devil Rocketry. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is covered under the BSD-3-Clause.
| typedef struct _IMU_CONVERTED IMU_CONVERTED |
Physical-unit converted accel/gyro/mag data.
| float sensor_acc_conv | ( | int16_t | readout | ) |
Converts accelerometer readouts to meters per second squared.
Converts a raw accelerometer reading to meters per second squared.
| readout | Raw accelerometer readout. |
Converts accelerometer readouts to meters per second squared.
| readout | Raw accelerometer readout. |
| void sensor_axis_remap | ( | float * | x, |
| float * | y, | ||
| float * | z ) |
Remaps sensor axes for the flight configuration.
Remaps sensor axes according to the flight-computer mounting orientation.
| x | X-axis value to remap. |
| y | Y-axis value to remap. |
| z | Z-axis value to remap. |
Remaps sensor axes for the flight configuration.
| x | X-axis value to remap. |
| y | Y-axis value to remap. |
| z | Z-axis value to remap. |
| void sensor_baro_alt | ( | SENSOR_DATA * | sen_data | ) |
Calculates altitude from pressure readings.
Calculates altitude from the current barometric pressure and temperature.
| sensor_data_ptr | Sensor data structure to update. |
Calculates altitude from pressure readings.
| sen_data | Sensor data structure to update. |
| SENSOR_STATUS sensor_body_state | ( | const IMU_CONVERTED * | imu_converted, |
| STATE_ESTIMATION * | state_estimate ) |
Performs sensor fusion on converted IMU data to get body rate.
Integrates gyro data to update the estimated body attitude and rate.
| imu_converted | Converted IMU data. |
| state_estimate | State estimate to update. |
Performs sensor fusion on converted IMU data to get body rate.
| imu_converted | Converted IMU data. |
| state_estimate | State estimate to update. |
| SENSOR_STATUS sensor_cmd_execute | ( | uint8_t | subcommand | ) |
Executes a sensor subcommand.
Executes a sensor subcommand and transmits the requested readings.
| subcommand | Sensor subcommand code. |
Executes a sensor subcommand.
| subcommand | Sensor subcommand code. |
| void sensor_conv_imu | ( | IMU_CONVERTED * | imu_converted, |
| IMU_RAW * | imu_raw ) |
Converts raw IMU readouts into accelerometer, gyro, and magnetometer data.
Converts raw IMU readings into calibrated, remapped sensor data.
| imu_converted | Converted IMU data to fill. |
| imu_raw | Raw IMU readouts. |
Converts raw IMU readouts into accelerometer, gyro, and magnetometer data.
| imu_converted | Converted IMU data to fill. |
| imu_raw | Raw IMU readouts. |
| SENSOR_STATUS sensor_dump | ( | SENSOR_DATA * | sensor_data_ptr | ) |
Reads all sensors and fills the sensor data structure.
Reads the available sensors and fills the sensor data structure.
| sensor_data_ptr | Pointer to the sensor data structure to fill. |
Reads all sensors and fills the sensor data structure.
| sensor_data_ptr | Pointer to the sensor data structure to fill. |
| MOUNT_ORIENTATION sensor_get_mount_orientation | ( | void | ) |
Gets the configured flight-computer mount orientation.
Get the mount orientation.
Gets the configured flight-computer mount orientation.
| float sensor_gyro_conv | ( | int16_t | readout | ) |
Converts gyro readouts to degrees per second.
Converts a raw gyro reading to degrees per second.
| readout | Raw gyro readout. |
Converts gyro readouts to degrees per second.
| readout | Raw gyro readout. |
| void sensor_imu_velo | ( | const IMU_CONVERTED * | imu_converted, |
| STATE_ESTIMATION * | state_estimate ) |
Calculates velocity from acceleration.
Calculates velocity from converted accelerometer measurements.
| imu_converted | Converted IMU data. |
| state_estimate | State estimate to update. |
Calculates velocity from acceleration.
| imu_converted | Converted IMU data. |
| state_estimate | State estimate to update. |
| SENSOR_STATUS sensor_init | ( | PRESET_DATA * | preset_data | ) |
Initializes sensor timing, velocity, and attitude state.
Initializes sensor timing and resets velocity state.
| preset_data | Pointer to the preset calibration data. |
Initializes sensor timing, velocity, and attitude state.
| preset_data | Pointer to the preset calibration data. |
| void sensor_reset_velo | ( | void | ) |
Resets velocity values to prevent accumulation of drift.
Resets accumulated velocity values to prevent drift.
Resets velocity values to prevent accumulation of drift.
| void sensor_set_mount_orientation | ( | MOUNT_ORIENTATION | orientation | ) |
Sets the flight-computer mount orientation.
Set the mount orientation.
| orientation | Mount orientation to use for axis remapping. |
Sets the flight-computer mount orientation.
| orientation | The new mount orientation |