Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

Committer:
Hypna
Date:
Fri Nov 14 18:51:04 2014 +0000
Revision:
12:edcae0f36e9c
Parent:
10:210c8f1e3a92
Child:
13:aa6f64c73271
adjusted error correction algorithm

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Hypna 0:e60f22c1d573 1 #ifndef DRIVECONTROLLER_H
Hypna 0:e60f22c1d573 2 #define DRIVECONTROLLER_H
Hypna 0:e60f22c1d573 3 #include "mbed.h"
Hypna 5:f53f06a866e9 4 #include "LineSensors.h"
Hypna 0:e60f22c1d573 5
Hypna 0:e60f22c1d573 6 class DriveController
Hypna 0:e60f22c1d573 7 {
Hypna 0:e60f22c1d573 8 private:
Hypna 4:ac6b2e5b240b 9 PwmOut wheelSpeed1;
Hypna 4:ac6b2e5b240b 10 PwmOut wheelSpeed2;
Hypna 4:ac6b2e5b240b 11 PwmOut wheelSpeed3;
Hypna 4:ac6b2e5b240b 12 PwmOut wheelSpeed4;
Hypna 2:d0ce8e26cbc4 13
Hypna 4:ac6b2e5b240b 14 DigitalOut wheelDirection1;
Hypna 4:ac6b2e5b240b 15 DigitalOut wheelDirection2;
Hypna 4:ac6b2e5b240b 16 DigitalOut wheelDirection3;
Hypna 4:ac6b2e5b240b 17 DigitalOut wheelDirection4;
Hypna 4:ac6b2e5b240b 18
Hypna 5:f53f06a866e9 19 I2CSlave i2c;
Hypna 4:ac6b2e5b240b 20
Hypna 5:f53f06a866e9 21 LineSensors sensors;
Hypna 5:f53f06a866e9 22 bool sensorStates[8][3];
Hypna 0:e60f22c1d573 23
Hypna 5:f53f06a866e9 24 int command;
Hypna 5:f53f06a866e9 25 int edge;
Hypna 0:e60f22c1d573 26
Hypna 5:f53f06a866e9 27 void move(char direction = 'F');
Hypna 2:d0ce8e26cbc4 28 void getCommand();
Hypna 5:f53f06a866e9 29 void rotate(char direction);
Hypna 12:edcae0f36e9c 30 void spinTest();
Hypna 4:ac6b2e5b240b 31 void sendComplete();
Hypna 12:edcae0f36e9c 32 double calculateError();
Hypna 2:d0ce8e26cbc4 33 bool intersection();
Hypna 0:e60f22c1d573 34
Hypna 0:e60f22c1d573 35 public:
Hypna 2:d0ce8e26cbc4 36 DriveController();
Hypna 0:e60f22c1d573 37 void go();
Hypna 0:e60f22c1d573 38 };
Hypna 0:e60f22c1d573 39
Hypna 0:e60f22c1d573 40 #endif