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.cpp
- Revision:
- 1:cadf589cab2f
- Parent:
- 0:341a08dbf9ba
- Child:
- 2:62e387f1d095
--- a/Quadcopter.cpp Wed Feb 18 23:44:04 2015 +0000 +++ b/Quadcopter.cpp Thu Feb 19 00:15:36 2015 +0000 @@ -25,11 +25,11 @@ wait(2.0); } //-------------------------------------Function for Stabilising--------------- -void Quadcoter::stabilise (float* speed, float* actSpeed, float rollDiff, float pitchDiff){ - actSpeed[0] = speed[0] + (rollDif / 2) + (pitchDif / 2); - actSpeed[1] = speed[1] - (rollDif / 2) + (pitchDif / 2); - actSpeed[2] = speed[2] + (rollDif / 2) - (pitchDif / 2); - actSpeed[3] = speed[3] - (rollDif / 2) - (pitchDif / 2); +void Quadcopter::stabilise (float* speed, float* actSpeed, float rollDiff, float pitchDiff){ + actSpeed[0] = speed[0] + (rollDiff / 2) + (pitchDiff / 2); + actSpeed[1] = speed[1] - (rollDiff / 2) + (pitchDiff / 2); + actSpeed[2] = speed[2] + (rollDiff / 2) - (pitchDiff / 2); + actSpeed[3] = speed[3] - (rollDiff / 2) - (pitchDiff / 2); } //-----------------------Function for producing thrust in Z direction -------- void Quadcopter::run (float* speed){