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.

Dependents:   QuadcopterProgram

Committer:
moklumbys
Date:
Wed Feb 18 23:44:04 2015 +0000
Revision:
0:341a08dbf9ba
Child:
3:84d246dccb8d
So I wrote a library for the quadcopter to work with it easier.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
moklumbys 0:341a08dbf9ba 1 #ifndef QUADCOPTER_H
moklumbys 0:341a08dbf9ba 2 #define QUADCOPTER_H
moklumbys 0:341a08dbf9ba 3
moklumbys 0:341a08dbf9ba 4 #include "mbed.h"
moklumbys 0:341a08dbf9ba 5 #include "Servo.h"
moklumbys 0:341a08dbf9ba 6
moklumbys 0:341a08dbf9ba 7 class Quadcopter {
moklumbys 0:341a08dbf9ba 8 public:
moklumbys 0:341a08dbf9ba 9 Quadcopter(PinName FL, PinName FR, PinName BL, PinName BR);
moklumbys 0:341a08dbf9ba 10
moklumbys 0:341a08dbf9ba 11 void calibrate (float min, float max);
moklumbys 0:341a08dbf9ba 12 void run (float* speed);
moklumbys 0:341a08dbf9ba 13 void stabilise (float* speed, float* actSpeed, float rollDiff, float pitchDiff);
moklumbys 0:341a08dbf9ba 14 private:
moklumbys 0:341a08dbf9ba 15 float MIN_CALIBRATE;
moklumbys 0:341a08dbf9ba 16 float MAX_CALIBRATE;
moklumbys 0:341a08dbf9ba 17 Servo* motor[4];
moklumbys 0:341a08dbf9ba 18 float map(float x, float in_min, float in_max, float out_min, float out_max);
moklumbys 0:341a08dbf9ba 19 };
moklumbys 0:341a08dbf9ba 20
moklumbys 0:341a08dbf9ba 21 #endif