35 lines
996 B
C
35 lines
996 B
C
#ifndef ATTITUDE_H
|
|
#define ATTITUDE_H
|
|
|
|
#include "imu_processing.h"
|
|
#include "radio_receiver.h"
|
|
#include "pid.h"
|
|
|
|
#define CF_ALPHA 0.99f
|
|
|
|
typedef struct
|
|
{
|
|
float roll; // deg
|
|
float pitch; // deg
|
|
float yaw_rate; // deg/s
|
|
} attitude_t;
|
|
|
|
void complementary_filter_update(attitude_t* att, const imu_scaled_t* imu);
|
|
void attitude_update(attitude_t* attitude, imu_scaled_t* imu);
|
|
void yaw_rate_update(attitude_t* attitude, imu_scaled_t* imu);
|
|
void attitude_pid_update(control_channels_t* control,
|
|
const rc_channels* rx,
|
|
const attitude_t* att,
|
|
const imu_scaled_t* imu);
|
|
void TIM6_DAC_IRQHandler();
|
|
|
|
float accel_roll_deg(const imu_scaled_t* imu);
|
|
float accel_pitch_deg(const imu_scaled_t* imu);
|
|
|
|
void integrate_gyro_roll_deg(float* roll, const imu_scaled_t* imu);
|
|
void integrate_gyro_pitch_deg(float* pitch, const imu_scaled_t* imu);
|
|
void integrate_gyro_yaw_deg(float* yaw, const imu_scaled_t* imu);
|
|
|
|
|
|
|
|
#endif |