26 lines
310 B
C
26 lines
310 B
C
#ifndef PID_H
|
|
#define PID_H
|
|
|
|
#include "stm32g431xx.h"
|
|
|
|
typedef struct
|
|
{
|
|
float kp;
|
|
float ki;
|
|
float kd;
|
|
|
|
float integral;
|
|
float prev_error;
|
|
} pid_t;
|
|
|
|
typedef struct
|
|
{
|
|
float roll;
|
|
float pitch;
|
|
float yaw;
|
|
} control_channels_t;
|
|
|
|
float pid_update(pid_t* pid, float error, float gyro_rate, float dt);
|
|
|
|
|
|
#endif |