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.
Quadcopter.h
- Committer:
- moklumbys
- Date:
- 2015-02-18
- Revision:
- 0:341a08dbf9ba
- Child:
- 3:84d246dccb8d
File content as of revision 0:341a08dbf9ba:
#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