Files
Jakob Oberbuchner 299c2c970b Saved
2025-09-08 09:34:39 -05:00

62 lines
877 B
C++

/*
* IMU.hpp
*
* Created on: Aug 17, 2025
* Author: jakoboberbuchner
*/
#ifndef AUTOPILOT_SHARED_DATA_IMU_HPP_
#define AUTOPILOT_SHARED_DATA_IMU_HPP_
#include <stdint.h>
namespace IMU {
enum class Orientation {
ENU = 0, // +X = East, +Y = North, +Z = up
NED = 1, // +X = North, +Y = East, +Z = down
};
struct Data {
int16_t magX = 0;
int16_t magY = 0;
int16_t magZ = 0;
int16_t temp = 0;
int16_t accX = 0;
int16_t accY = 0;
int16_t accZ = 0;
int16_t gyrX = 0;
int16_t gyrY = 0;
int16_t gyrZ = 0;
float temperature;
Orientation orientation = Orientation::ENU;
uint8_t* imuDataPtr( void ) {
return (uint8_t*)&temp;
}
uint8_t* magDataPtr( void ) {
return (uint8_t*)&magX;
}
void calcTemperature( void ) {
temperature = (((float)temp / 256.0f) + 25.0f);
}
};
} // namespace IMU
#endif /* AUTOPILOT_SHARED_DATA_IMU_HPP_ */