Latest version of my quadcopter controller with an LPC1768 and MPU9250.

Dependencies:   mbed

Currently running on a custom PCB with 30.5 x 30.5mm mounts. There are also 2 PC apps that go with the software; one to set up the PID controller and one to balance the motors and props. If anyone is interested, send me a message and I'll upload them.

Committer:
Anaesthetix
Date:
Tue Jul 17 14:56:05 2018 +0000
Revision:
7:d86c41443f6d
Parent:
4:fab65ad01ab4
Added 8th order low-pass IIR filters

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Anaesthetix 4:fab65ad01ab4 1 // Coded by Erik van de Coevering
Anaesthetix 4:fab65ad01ab4 2
Anaesthetix 0:0929d3d566cf 3 #ifndef __LPfilter_H__
Anaesthetix 0:0929d3d566cf 4 #define __LPfilter_H__
Anaesthetix 0:0929d3d566cf 5
Anaesthetix 0:0929d3d566cf 6 #define LP_A 0.02008336556421
Anaesthetix 0:0929d3d566cf 7 #define LP_B 1.561018075801
Anaesthetix 0:0929d3d566cf 8 #define LP_C -0.6413515380576
Anaesthetix 0:0929d3d566cf 9 #define LP_D 1.0f
Anaesthetix 0:0929d3d566cf 10 #define LP_E 2.0f
Anaesthetix 0:0929d3d566cf 11 #define LP_F 1.0f
Anaesthetix 0:0929d3d566cf 12
Anaesthetix 7:d86c41443f6d 13 /*
Anaesthetix 0:0929d3d566cf 14 class LPfilter {
Anaesthetix 0:0929d3d566cf 15 private:
Anaesthetix 0:0929d3d566cf 16 float filterbuffer[3];
Anaesthetix 0:0929d3d566cf 17 float out;
Anaesthetix 0:0929d3d566cf 18 public:
Anaesthetix 0:0929d3d566cf 19 float run(float input);
Anaesthetix 0:0929d3d566cf 20 };
Anaesthetix 0:0929d3d566cf 21
Anaesthetix 0:0929d3d566cf 22 class LPfilter2 {
Anaesthetix 0:0929d3d566cf 23 private:
Anaesthetix 0:0929d3d566cf 24 float filterbuffer1[3];
Anaesthetix 0:0929d3d566cf 25 float filterbuffer2[3];
Anaesthetix 0:0929d3d566cf 26 float out_temp;
Anaesthetix 0:0929d3d566cf 27 float out;
Anaesthetix 0:0929d3d566cf 28 public:
Anaesthetix 0:0929d3d566cf 29 float run(float input);
Anaesthetix 0:0929d3d566cf 30 };
Anaesthetix 0:0929d3d566cf 31
Anaesthetix 0:0929d3d566cf 32 class LPfilter2_1 {
Anaesthetix 0:0929d3d566cf 33 private:
Anaesthetix 0:0929d3d566cf 34 float filterbuffer1[3];
Anaesthetix 0:0929d3d566cf 35 float filterbuffer2[3];
Anaesthetix 0:0929d3d566cf 36 float out_temp;
Anaesthetix 0:0929d3d566cf 37 float out;
Anaesthetix 0:0929d3d566cf 38 public:
Anaesthetix 0:0929d3d566cf 39 float run(float input);
Anaesthetix 0:0929d3d566cf 40 };
Anaesthetix 7:d86c41443f6d 41 */
Anaesthetix 7:d86c41443f6d 42 class LPfilter8 {
Anaesthetix 7:d86c41443f6d 43 private:
Anaesthetix 7:d86c41443f6d 44 float filterbuffer1[3];
Anaesthetix 7:d86c41443f6d 45 float filterbuffer2[3];
Anaesthetix 7:d86c41443f6d 46 float filterbuffer3[3];
Anaesthetix 7:d86c41443f6d 47 float filterbuffer4[3];
Anaesthetix 7:d86c41443f6d 48 float out_temp1, out_temp2, out_temp3;
Anaesthetix 7:d86c41443f6d 49 float out;
Anaesthetix 7:d86c41443f6d 50 public:
Anaesthetix 7:d86c41443f6d 51 float run(float input);
Anaesthetix 7:d86c41443f6d 52 };
Anaesthetix 0:0929d3d566cf 53
Anaesthetix 0:0929d3d566cf 54 #endif
Anaesthetix 0:0929d3d566cf 55