Code to run the microcontrollers on the R5 competition bot
Dependencies: LineSensors mbed
DriveController.h@17:5046b27f5441, 2015-04-18 (annotated)
- Committer:
- jmar11
- Date:
- Sat Apr 18 03:02:28 2015 +0000
- Revision:
- 17:5046b27f5441
- Parent:
- 16:b49db5c8e16c
- Child:
- 18:2bd595af51d2
Jaime's library
Who changed what in which revision?
User | Revision | Line number | New 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 | |
jmar11 | 16:b49db5c8e16c | 6 | typedef enum {NORTH, EAST, SOUTH, WEST} abs_direction; |
jmar11 | 16:b49db5c8e16c | 7 | //typedef enum {FORWARD, RIGHT, BACK, LEFT} rel_direction; |
jmar11 | 16:b49db5c8e16c | 8 | |
Hypna | 0:e60f22c1d573 | 9 | class DriveController |
Hypna | 0:e60f22c1d573 | 10 | { |
jmar11 | 16:b49db5c8e16c | 11 | public: |
jmar11 | 16:b49db5c8e16c | 12 | typename ::abs_direction orient; |
jmar11 | 16:b49db5c8e16c | 13 | |
Hypna | 13:aa6f64c73271 | 14 | PwmOut treadSpeed1; |
Hypna | 13:aa6f64c73271 | 15 | PwmOut treadSpeed2; |
Hypna | 2:d0ce8e26cbc4 | 16 | |
Hypna | 13:aa6f64c73271 | 17 | DigitalOut treadDirection1; |
Hypna | 13:aa6f64c73271 | 18 | DigitalOut treadDirection2; |
Hypna | 4:ac6b2e5b240b | 19 | |
Hypna | 5:f53f06a866e9 | 20 | bool sensorStates[8][3]; |
Hypna | 0:e60f22c1d573 | 21 | |
Hypna | 12:edcae0f36e9c | 22 | void spinTest(); |
Hypna | 12:edcae0f36e9c | 23 | double calculateError(); |
Hypna | 2:d0ce8e26cbc4 | 24 | bool intersection(); |
Hypna | 0:e60f22c1d573 | 25 | |
Hypna | 2:d0ce8e26cbc4 | 26 | DriveController(); |
jmar11 | 17:5046b27f5441 | 27 | void move(typename ::abs_direction dir); |
jmar11 | 17:5046b27f5441 | 28 | void rotate(typename ::abs_direction dir); |
jmar11 | 16:b49db5c8e16c | 29 | LineSensors sensors; |
Hypna | 0:e60f22c1d573 | 30 | }; |
Hypna | 0:e60f22c1d573 | 31 | |
Hypna | 0:e60f22c1d573 | 32 | #endif |