Library containing Crazyflie 2.0 controller classes: - Attitude estimator - Horizontal estimator - Vertical estimator - Attitude controller - Horizontal controller - Vertical controller - Mixer

Committer:
fbob
Date:
Thu Dec 06 16:44:40 2018 +0000
Revision:
24:7b9e3beb61d5
Parent:
17:f682b4a5686d
Adjust

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fbob 0:b1f2c9e88e32 1 #ifndef AttitudeEstimator_h
fbob 0:b1f2c9e88e32 2 #define AttitudeEstimator_h
fbob 0:b1f2c9e88e32 3
fbob 0:b1f2c9e88e32 4 #include "mbed.h"
fbob 5:b9947e3d20cf 5 #include "Parameters.h"
fbob 0:b1f2c9e88e32 6 #include "MPU9250.h"
fbob 0:b1f2c9e88e32 7
fbob 0:b1f2c9e88e32 8 // Attitude estimator class
fbob 0:b1f2c9e88e32 9 class AttitudeEstimator
fbob 0:b1f2c9e88e32 10 {
fbob 0:b1f2c9e88e32 11 public:
fbob 0:b1f2c9e88e32 12 // Class constructor
fbob 0:b1f2c9e88e32 13 AttitudeEstimator();
fbob 0:b1f2c9e88e32 14 // Initialize class
fbob 0:b1f2c9e88e32 15 void init();
fbob 0:b1f2c9e88e32 16 // Estimate Euler angles (rad) and angular velocities (rad/s)
fbob 0:b1f2c9e88e32 17 void estimate();
fbob 0:b1f2c9e88e32 18 // Euler angles (rad)
fbob 0:b1f2c9e88e32 19 float phi, theta, psi;
fbob 0:b1f2c9e88e32 20 // Angular velocities (rad/s)
fbob 0:b1f2c9e88e32 21 float p, q, r;
fbob 0:b1f2c9e88e32 22 private:
fbob 0:b1f2c9e88e32 23 // IMU sensor object
fbob 0:b1f2c9e88e32 24 MPU9250 imu;
fbob 17:f682b4a5686d 25 // LED digital output
fbob 17:f682b4a5686d 26 DigitalOut led_3_blue;
fbob 0:b1f2c9e88e32 27 // Calibrates gyroscope by calculating angular velocity bias (rad/s)
fbob 0:b1f2c9e88e32 28 void calibrate_gyro();
fbob 0:b1f2c9e88e32 29 // Estimate Euler angles (rad) from accelerometer data
fbob 0:b1f2c9e88e32 30 void estimate_accel();
fbob 0:b1f2c9e88e32 31 // Estimate Euler angles (rad) and angular velocities (rad/s) from gyroscope data
fbob 0:b1f2c9e88e32 32 void estimate_gyro();
fbob 0:b1f2c9e88e32 33 // Euler angles (rad) from accelerometer data
fbob 0:b1f2c9e88e32 34 float phi_accel, theta_accel;
fbob 0:b1f2c9e88e32 35 // Euler angles (rad) from gyroscope data
fbob 1:24effec9e9aa 36 float phi_gyro, theta_gyro, psi_gyro;
fbob 0:b1f2c9e88e32 37 // Angular velocities bias (rad/s)
fbob 0:b1f2c9e88e32 38 float p_bias, q_bias, r_bias;
fbob 0:b1f2c9e88e32 39
fbob 0:b1f2c9e88e32 40 };
fbob 0:b1f2c9e88e32 41
fbob 6:3188b00263e8 42 #endif