38 #ifndef IMU_POWER_GPIO_ON
39 #define IMU_POWER_GPIO_ON gpio_set
43 #if PERIODIC_TELEMETRY
48 pprz_msg_send_IMU_ACCEL_RAW(trans, dev, AC_ID,
54 pprz_msg_send_IMU_ACCEL_SCALED(trans, dev, AC_ID,
62 pprz_msg_send_IMU_ACCEL(trans, dev, AC_ID,
68 pprz_msg_send_IMU_GYRO_RAW(trans, dev, AC_ID,
74 pprz_msg_send_IMU_GYRO_SCALED(trans, dev, AC_ID,
82 pprz_msg_send_IMU_GYRO(trans, dev, AC_ID,
83 &gyro_float.p, &gyro_float.q, &gyro_float.r);
88 pprz_msg_send_IMU_MAG_RAW(trans, dev, AC_ID,
94 pprz_msg_send_IMU_MAG_SCALED(trans, dev, AC_ID,
102 pprz_msg_send_IMU_MAG(trans, dev, AC_ID,
113 #ifdef IMU_POWER_GPIO
123 #if defined IMU_MAG_X_NEUTRAL && defined IMU_MAG_Y_NEUTRAL && defined IMU_MAG_Z_NEUTRAL
127 INFO(
"Magnetometer neutrals are set to zero, you should calibrate!")
136 #if PERIODIC_TELEMETRY
156 body_to_imu_eulers.phi =
phi;
165 body_to_imu_eulers.theta =
theta;
174 body_to_imu_eulers.psi =
psi;
235 #if defined IMU_MAG_X_CURRENT_COEF && defined IMU_MAG_Y_CURRENT_COEF && defined IMU_MAG_Z_CURRENT_COEF
250 #elif USE_MAGNETOMETER
#define IMU_GYRO_Q_SENS_DEN
int32_t current
current in milliamps
#define IMU_BODY_TO_IMU_THETA
Generic transmission transport header.
void WEAK imu_scale_gyro(struct Imu *_imu)
static struct FloatEulers * stateGetNedToBodyEulers_f(void)
Get vehicle body attitude euler angles (float).
struct FloatVect3 accel_float
#define IMU_MAG_Z_SENS_DEN
Periodic telemetry system header (includes downlink utility and generated code).
static bool_t stateIsAttitudeValid(void)
Test if attitudes are valid.
struct Int32Vect3 accel_neutral
accelerometer bias
struct Int32Rates gyro_prev
previous gyroscope measurements
Some architecture independent helper functions for GPIOs.
#define VECT3_COPY(_a, _b)
#define VECT3_ASSIGN(_a, _x, _y, _z)
#define RATES_ASSIGN(_ra, _p, _q, _r)
Main include for ABI (AirBorneInterface).
void WEAK imu_scale_accel(struct Imu *_imu)
struct FloatVect3 mag_float
#define IMU_GYRO_Q_SENS_NUM
void imu_SetBodyToImuPhi(float phi)
#define IMU_GYRO_P_SENS_NUM
void WEAK imu_scale_mag(struct Imu *_imu)
#define IMU_ACCEL_Y_SENS_DEN
struct Imu imu
global IMU state
#define IMU_GYRO_R_SENS_NUM
#define IMU_GYRO_P_NEUTRAL
bool_t b2i_set_current
flag for adjusting body_to_imu via settings.
struct Int32Rates gyro_neutral
gyroscope bias
struct Int32Vect3 mag_unscaled
unscaled magnetometer measurements
void imu_impl_init(void)
must be defined by underlying hardware
int32_t r
in rad/s with INT32_RATE_FRAC
#define IMU_MAG_Y_SENS_NUM
#define IMU_MAG_X_SENS_NUM
struct Int32Rates gyro_unscaled
unscaled gyroscope measurements
struct Int32Vect3 accel
accelerometer measurements in m/s^2 in BFP with INT32_ACCEL_FRAC
#define IMU_GYRO_P_SENS_DEN
#define RATES_FLOAT_OF_BFP(_rf, _ri)
Interface for electrical status: supply voltage, current, battery status, etc.
struct Int32Vect3 mag_neutral
magnetometer neutral readings (bias)
#define DefaultPeriodic
Set default periodic telemetry.
#define IMU_ACCEL_Z_SENS_DEN
struct Int32Vect3 mag
magnetometer measurements scaled to 1 in BFP with INT32_MAG_FRAC
Inertial Measurement Unit interface.
#define ACCELS_FLOAT_OF_BFP(_ef, _ei)
struct OrientationReps body_to_imu
rotation from body to imu frame
#define IMU_MAG_X_SENS_DEN
static const struct usb_device_descriptor dev
#define IMU_ACCEL_Z_NEUTRAL
#define INT_VECT3_ZERO(_v)
void imu_SetBodyToImuCurrent(float set)
API to get/set the generic vehicle states.
#define IMU_ACCEL_X_SENS_DEN
static struct FloatEulers * orientationGetEulers_f(struct OrientationReps *orientation)
Get vehicle body attitude euler angles (float).
#define IMU_MAG_Z_SENS_NUM
struct Int32Vect3 accel_prev
previous accelerometer measurements
void imu_SetBodyToImuPsi(float psi)
int32_t p
in rad/s with INT32_RATE_FRAC
struct Int32Vect3 accel_unscaled
unscaled accelerometer measurements
#define MAGS_FLOAT_OF_BFP(_ef, _ei)
#define IMU_ACCEL_Y_NEUTRAL
void WEAK imu_periodic(void)
optional.
struct Electrical electrical
#define RATES_COPY(_a, _b)
abstract IMU interface providing fixed point interface
#define IMU_ACCEL_Y_SENS_NUM
#define IMU_BODY_TO_IMU_PSI
#define IMU_GYRO_R_SENS_DEN
#define IMU_GYRO_Q_NEUTRAL
#define IMU_ACCEL_Z_SENS_NUM
int32_t q
in rad/s with INT32_RATE_FRAC
#define IMU_GYRO_R_NEUTRAL
#define IMU_BODY_TO_IMU_PHI
void gpio_setup_output(uint32_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as outputs.
#define IMU_ACCEL_X_NEUTRAL
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
void imu_SetBodyToImuTheta(float theta)
static struct FloatQuat * orientationGetQuat_f(struct OrientationReps *orientation)
Get vehicle body attitude quaternion (float).
#define IMU_ACCEL_X_SENS_NUM
struct Int32Rates gyro
gyroscope measurements in rad/s in BFP with INT32_RATE_FRAC
#define IMU_MAG_Y_SENS_DEN
static void orientationSetEulers_f(struct OrientationReps *orientation, struct FloatEulers *eulers)
Set vehicle body attitude from euler angles (float).