A library used for controlling a quadcopter. It provides an easy to use interface, which allows to mount, calibrate and run motors. It is also able to calibrate the actual speed according to calculated PID roll & pitch difference. I used the original Servo library as ESC modules use the same PWM signal as Servo motors.
Diff: Quadcopter.h
- Revision:
- 0:341a08dbf9ba
- Child:
- 3:84d246dccb8d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Quadcopter.h Wed Feb 18 23:44:04 2015 +0000 @@ -0,0 +1,21 @@ +#ifndef QUADCOPTER_H +#define QUADCOPTER_H + +#include "mbed.h" +#include "Servo.h" + +class Quadcopter { +public: + Quadcopter(PinName FL, PinName FR, PinName BL, PinName BR); + + void calibrate (float min, float max); + void run (float* speed); + void stabilise (float* speed, float* actSpeed, float rollDiff, float pitchDiff); +private: + float MIN_CALIBRATE; + float MAX_CALIBRATE; + Servo* motor[4]; + float map(float x, float in_min, float in_max, float out_min, float out_max); +}; + +#endif \ No newline at end of file