Library containing Crazyflie 2.0 controller classes: - Attitude estimator - Horizontal estimator - Vertical estimator - Attitude controller - Horizontal controller - Vertical controller - Mixer
Mixer/Mixer.h
- Committer:
- fbob
- Date:
- 2018-08-31
- Revision:
- 0:b1f2c9e88e32
- Child:
- 5:b9947e3d20cf
File content as of revision 0:b1f2c9e88e32:
#ifndef Mixer_h #define Mixer_h #include "mbed.h" // Physical constants const float alpha = 1.16e-07f; const float beta = 7.149e-10f; const float kl = 1.726e-08f; const float kd = 1.426e-10f; const float l = 0.033f; // Class implementation class Mixer { public: // Class constructor //Mixer(PinName pin_1 = PA_1, PinName pin_2 = PB_11, PinName pin_3 = PA_15, PinName pin_4 = PB_9_ALT1); Mixer(); // Actuate motors with the desired force (N) and torques (N.m) void actuate(float f_t, float tau_phi, float tau_theta, float tau_psi); private: // Motors PWM outputs PwmOut motor_1, motor_2, motor_3, motor_4; // Angular velocities (rad/s) float omega_1, omega_2, omega_3, omega_4; // Converts desired force (N) and torques (N.m) to angular velocities (rad/s) void force_and_torques_to_angular_velocities(float f_t, float tau_phi, float tau_theta, float tau_psi); // Converts desired angular velocity (rad/s) to PWM signal float angular_velocity_to_pwm(float omega); }; #endif