New version of quadcopter software written to OO principles

Dependencies:   mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS

Committer:
joe4465
Date:
Wed Mar 04 18:50:37 2015 +0000
Revision:
0:c6a85bb2a827
Child:
2:969dfa4f2436
New version of quadcopter software, written following OO principles

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joe4465 0:c6a85bb2a827 1 #include "mbed.h"
joe4465 0:c6a85bb2a827 2 #include "Global.h"
joe4465 0:c6a85bb2a827 3 #include "MODSERIAL.h"
joe4465 0:c6a85bb2a827 4 #include "Status.h"
joe4465 0:c6a85bb2a827 5 #include "Sensors.h"
joe4465 0:c6a85bb2a827 6 #include "BaseStation.h"
joe4465 0:c6a85bb2a827 7 #include "Rc.h"
joe4465 0:c6a85bb2a827 8 #include "FlightController.h"
joe4465 0:c6a85bb2a827 9 #include "NavigationController.h"
joe4465 0:c6a85bb2a827 10
joe4465 0:c6a85bb2a827 11 MODSERIAL _debug(USBTX, USBRX);
joe4465 0:c6a85bb2a827 12
joe4465 0:c6a85bb2a827 13 //Wireless Serial
joe4465 0:c6a85bb2a827 14 MODSERIAL _base(p9, p10);
joe4465 0:c6a85bb2a827 15
joe4465 0:c6a85bb2a827 16 //GPS Serial
joe4465 0:c6a85bb2a827 17 //MODSERIAL _gps(p13, p14);
joe4465 0:c6a85bb2a827 18
joe4465 0:c6a85bb2a827 19 //Onboard LED's
joe4465 0:c6a85bb2a827 20 //DigitalOut _led1(LED1);
joe4465 0:c6a85bb2a827 21 //DigitalOut _led2(LED2);
joe4465 0:c6a85bb2a827 22 //DigitalOut _led3(LED3);
joe4465 0:c6a85bb2a827 23 //DigitalOut _led4(LED4);
joe4465 0:c6a85bb2a827 24
joe4465 0:c6a85bb2a827 25 //MaxBotix Ping sensor
joe4465 0:c6a85bb2a827 26 //Timer _maxBotixTimer;
joe4465 0:c6a85bb2a827 27 //Sonar _maxBotixSensor(p15, _maxBotixTimer);
joe4465 0:c6a85bb2a827 28
joe4465 0:c6a85bb2a827 29 //Lidar
joe4465 0:c6a85bb2a827 30 //LidarLite _lidar(p28, p27);
joe4465 0:c6a85bb2a827 31
joe4465 0:c6a85bb2a827 32 //Unused analog pins
joe4465 0:c6a85bb2a827 33 DigitalOut _spare1(p16);
joe4465 0:c6a85bb2a827 34 DigitalOut _spare2(p17);
joe4465 0:c6a85bb2a827 35 DigitalOut _spare3(p18);
joe4465 0:c6a85bb2a827 36 DigitalOut _spare4(p19);
joe4465 0:c6a85bb2a827 37
joe4465 0:c6a85bb2a827 38 //Classes
joe4465 0:c6a85bb2a827 39 Status _status;
joe4465 0:c6a85bb2a827 40 //Sensors *_sensors(_status, p13, p14, p15, p28, p27);
joe4465 0:c6a85bb2a827 41 //BaseStation *_baseStation(p9, p10);
joe4465 0:c6a85bb2a827 42 Rc _rc;
joe4465 0:c6a85bb2a827 43 FlightController _flightController;
joe4465 0:c6a85bb2a827 44 //NavigationController *_navigationController;
joe4465 0:c6a85bb2a827 45
joe4465 0:c6a85bb2a827 46 int main()
joe4465 0:c6a85bb2a827 47 {
joe4465 0:c6a85bb2a827 48 _base.baud(115200);
joe4465 0:c6a85bb2a827 49
joe4465 0:c6a85bb2a827 50 DEBUG("\r\n");
joe4465 0:c6a85bb2a827 51 DEBUG("********************************************************************************\r\n");
joe4465 0:c6a85bb2a827 52 DEBUG("Starting Setup\r\n");
joe4465 0:c6a85bb2a827 53 DEBUG("********************************************************************************\r\n");
joe4465 0:c6a85bb2a827 54
joe4465 0:c6a85bb2a827 55 //Set Status
joe4465 0:c6a85bb2a827 56 _status.initialise();
joe4465 0:c6a85bb2a827 57
joe4465 0:c6a85bb2a827 58 //Initalise Base Station
joe4465 0:c6a85bb2a827 59
joe4465 0:c6a85bb2a827 60 //Initialise RC
joe4465 0:c6a85bb2a827 61 _rc.initialise(_status, p8);
joe4465 0:c6a85bb2a827 62
joe4465 0:c6a85bb2a827 63 //Initialise Sensors
joe4465 0:c6a85bb2a827 64
joe4465 0:c6a85bb2a827 65 //Initialise Navigation
joe4465 0:c6a85bb2a827 66
joe4465 0:c6a85bb2a827 67 //Initialise Flight Controller
joe4465 0:c6a85bb2a827 68 _flightController.initialise(_status, _sensors, _navigationController, p21, p22, p23, p24);
joe4465 0:c6a85bb2a827 69
joe4465 0:c6a85bb2a827 70
joe4465 0:c6a85bb2a827 71
joe4465 0:c6a85bb2a827 72 DEBUG("********************************************************************************\r\n");
joe4465 0:c6a85bb2a827 73 DEBUG("Finished Setup\r\n");
joe4465 0:c6a85bb2a827 74 DEBUG("********************************************************************************\r\n");
joe4465 0:c6a85bb2a827 75 }