Library containing Crazyflie 2.0 controller classes: - Attitude estimator - Horizontal estimator - Vertical estimator - Attitude controller - Horizontal controller - Vertical controller - Mixer
Mixer/Mixer.h@5:b9947e3d20cf, 2018-09-27 (annotated)
- Committer:
- fbob
- Date:
- Thu Sep 27 13:51:54 2018 +0000
- Revision:
- 5:b9947e3d20cf
- Parent:
- 0:b1f2c9e88e32
- Child:
- 6:3188b00263e8
Included parameters.h;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fbob | 0:b1f2c9e88e32 | 1 | #ifndef Mixer_h |
fbob | 0:b1f2c9e88e32 | 2 | #define Mixer_h |
fbob | 0:b1f2c9e88e32 | 3 | |
fbob | 0:b1f2c9e88e32 | 4 | #include "mbed.h" |
fbob | 5:b9947e3d20cf | 5 | #include "Parameters.h" |
fbob | 0:b1f2c9e88e32 | 6 | |
fbob | 5:b9947e3d20cf | 7 | // Mixer class |
fbob | 0:b1f2c9e88e32 | 8 | class Mixer |
fbob | 0:b1f2c9e88e32 | 9 | { |
fbob | 0:b1f2c9e88e32 | 10 | public: |
fbob | 0:b1f2c9e88e32 | 11 | // Class constructor |
fbob | 0:b1f2c9e88e32 | 12 | Mixer(); |
fbob | 5:b9947e3d20cf | 13 | // Actuate motors with desired total trust force (N) and torques (N.m) |
fbob | 0:b1f2c9e88e32 | 14 | void actuate(float f_t, float tau_phi, float tau_theta, float tau_psi); |
fbob | 0:b1f2c9e88e32 | 15 | private: |
fbob | 0:b1f2c9e88e32 | 16 | // Motors PWM outputs |
fbob | 0:b1f2c9e88e32 | 17 | PwmOut motor_1, motor_2, motor_3, motor_4; |
fbob | 0:b1f2c9e88e32 | 18 | // Angular velocities (rad/s) |
fbob | 0:b1f2c9e88e32 | 19 | float omega_1, omega_2, omega_3, omega_4; |
fbob | 5:b9947e3d20cf | 20 | // Converts total trust force (N) and torques (N.m) to angular velocities (rad/s) |
fbob | 0:b1f2c9e88e32 | 21 | void force_and_torques_to_angular_velocities(float f_t, float tau_phi, float tau_theta, float tau_psi); |
fbob | 5:b9947e3d20cf | 22 | // Converts desired angular velocity (rad/s) to PWM signal (%) |
fbob | 0:b1f2c9e88e32 | 23 | float angular_velocity_to_pwm(float omega); |
fbob | 0:b1f2c9e88e32 | 24 | }; |
fbob | 0:b1f2c9e88e32 | 25 | |
fbob | 0:b1f2c9e88e32 | 26 | #endif |