-
Notifications
You must be signed in to change notification settings - Fork 7
FC Data
Flight controller data access: raw sensor readings and fused state estimates (attitude, rate, position, velocity).
Selects the sensor for Sensor_Get().
typedef enum {
Accelerometer, // Acceleration sensor
Gyroscope, // Rotation rate sensor
Magnetometer, // Magnetic field sensor
Barometer // Pressure sensor
} FC_Sensors_e;Selects which barometer reading Sensor_Get() returns.
typedef enum {
Pressure, // Barometric pressure
Temperature // Temperature reading
} BARO_Data_e;Selects the estimate for Estimate_Get().
typedef enum {
Angle, // Attitude angles
Rate, // Rotation rates
Position, // Position estimates
Velocity // Velocity estimates
} FC_Estimate_e;The functions below also take these enums (defined in axis.h):
typedef enum { X = 0, Y, Z, Net_Acc } axis_e; // Net_Acc = net acceleration magnitude
typedef enum { AG_ROLL = 0, AG_PITCH, AG_YAW } angle_e;Returns a scaled reading from the Accelerometer, Gyroscope, or Magnetometer for
the given axis (Net_Acc gives the accelerometer's net magnitude). Returns 0 for
unsupported types. Sensor data is live, so read it in plutoLoop().
void plutoLoop ( void ) {
int32_t accelX = Sensor_Get ( Accelerometer, X );
int32_t gyroZ = Sensor_Get ( Gyroscope, Z );
Monitor_Print ( "AccelX: ", accelX );
}Returns barometer data: pressure in units of 100millibar, or temperature in
units of 100degreeCelsius. _sensor must be Barometer.
void plutoLoop ( void ) {
int32_t pressure = Sensor_Get ( Barometer, Pressure ); // 100 * mbar
int32_t temp = Sensor_Get ( Barometer, Temperature ); // 100 * degC
Monitor_Print ( "Pressure: ", pressure );
}Returns a Rate, Position, or Velocity estimate for the X, Y, or Z axis
(for Position, Z is altitude).
void plutoLoop ( void ) {
int16_t altitude = Estimate_Get ( Position, Z ); // altitude
int16_t yawRate = Estimate_Get ( Rate, Z ); // yaw rate
Monitor_Print ( "Altitude: ", altitude );
}Warning:
Velocityestimates are only valid when localization sensors (GPS, optical flow, UWB, etc.) are in use.
Returns an attitude angle. _estimateOf must be Angle. Roll and pitch are in
deciDegrees; yaw (heading) is in degrees.
void plutoLoop ( void ) {
int16_t roll = Estimate_Get ( Angle, AG_ROLL ); // deciDegrees
int16_t pitch = Estimate_Get ( Angle, AG_PITCH ); // deciDegrees
int16_t heading = Estimate_Get ( Angle, AG_YAW ); // degrees
Monitor_Print ( "Heading: ", heading );
}Sensor and estimate values are live, so read them every loop in plutoLoop().
#include "PlutoPilot.h"
void plutoLoop ( void ) {
// Raw IMU
int32_t accelX = Sensor_Get ( Accelerometer, X );
int32_t gyroZ = Sensor_Get ( Gyroscope, Z );
// Barometer
int32_t pressure = Sensor_Get ( Barometer, Pressure ); // 100 * mbar
// Fused attitude estimates
int16_t roll = Estimate_Get ( Angle, AG_ROLL ); // deciDegrees
int16_t heading = Estimate_Get ( Angle, AG_YAW ); // degrees
int16_t altitude = Estimate_Get ( Position, Z ); // altitude
Monitor_Print ( "Roll: ", roll );
Monitor_Print ( "Heading: ", heading );
Monitor_Print ( "Altitude: ", altitude );
}MagisV2 © 2026 Drona Aviation | Licensed under GPL-3.0 | Report Issues