![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
PlayBack
Dependencies: TPixy-Interface
Fork of ObjectFollower by
main.cpp@29:83c103d12078, 2018-04-10 (annotated)
- Committer:
- asobhy
- Date:
- Tue Apr 10 20:54:37 2018 +0000
- Branch:
- ManualControl
- Revision:
- 29:83c103d12078
- Parent:
- 19:4fbffc755ed7
ManualControl
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asobhy | 8:a0890fa79084 | 1 | /******************************************************************************/ |
asobhy | 0:a355e511bc5d | 2 | // ECE4333 |
asobhy | 9:fe56b888985c | 3 | // LAB Partner 1: Ahmed Sobhy - ID: 3594449 |
asobhy | 9:fe56b888985c | 4 | // LAB Partner 2: Brandon Kingman - ID: 3470444 |
asobhy | 9:fe56b888985c | 5 | // Project: Autonomous Robot Design |
asobhy | 9:fe56b888985c | 6 | // Instructor: Prof. Chris Diduch |
asobhy | 8:a0890fa79084 | 7 | /******************************************************************************/ |
asobhy | 0:a355e511bc5d | 8 | |
asobhy | 0:a355e511bc5d | 9 | #include "mbed.h" |
asobhy | 0:a355e511bc5d | 10 | #include "WatchdogThread.h" |
asobhy | 0:a355e511bc5d | 11 | #include "PiControlThread.h" |
asobhy | 0:a355e511bc5d | 12 | #include "ExternalInterruptThread.h" |
asobhy | 0:a355e511bc5d | 13 | #include "ui.h" |
asobhy | 10:8919b1b76243 | 14 | #include "CameraThread.h" |
asobhy | 15:cf67f83d5409 | 15 | #include "motor_driver_l.h" |
asobhy | 15:cf67f83d5409 | 16 | #include "motor_driver_r.h" |
asobhy | 0:a355e511bc5d | 17 | |
asobhy | 0:a355e511bc5d | 18 | /******************************************************************************/ |
asobhy | 0:a355e511bc5d | 19 | |
asobhy | 0:a355e511bc5d | 20 | |
asobhy | 0:a355e511bc5d | 21 | |
asobhy | 0:a355e511bc5d | 22 | /******************************************************************************* |
asobhy | 0:a355e511bc5d | 23 | * ******** Main Thread ******** |
asobhy | 0:a355e511bc5d | 24 | *******************************************************************************/ |
asobhy | 0:a355e511bc5d | 25 | int main() // This thread executes first upon reset or power-on. |
asobhy | 0:a355e511bc5d | 26 | { |
asobhy | 0:a355e511bc5d | 27 | |
asobhy | 0:a355e511bc5d | 28 | // displays msg on terminal |
asobhy | 0:a355e511bc5d | 29 | displayStartupMsg(); |
asobhy | 0:a355e511bc5d | 30 | |
asobhy | 0:a355e511bc5d | 31 | // Initialize and run the threads below: |
asobhy | 0:a355e511bc5d | 32 | WatchdogThreadInit(); |
asobhy | 17:1184df616383 | 33 | //CameraThreadInit(); |
asobhy | 0:a355e511bc5d | 34 | PiControlThreadInit(); |
asobhy | 0:a355e511bc5d | 35 | ExternalInterruptThreadInit(); |
asobhy | 0:a355e511bc5d | 36 | |
asobhy | 0:a355e511bc5d | 37 | while(1) |
asobhy | 0:a355e511bc5d | 38 | { |
asobhy | 15:cf67f83d5409 | 39 | // if robot goes crazy press 'r' to kill it |
asobhy | 15:cf67f83d5409 | 40 | if(killRobot == true) |
asobhy | 15:cf67f83d5409 | 41 | { |
asobhy | 15:cf67f83d5409 | 42 | osThreadTerminate(PiControlId); |
asobhy | 15:cf67f83d5409 | 43 | motorDriver_L_stop(); |
asobhy | 15:cf67f83d5409 | 44 | motorDriver_R_stop(); |
asobhy | 15:cf67f83d5409 | 45 | } |
asobhy | 15:cf67f83d5409 | 46 | |
asobhy | 11:9135e5bc2fcf | 47 | consoleUI(); |
asobhy | 19:4fbffc755ed7 | 48 | Thread::wait(20); // Go to sleep for 20 ms |
asobhy | 0:a355e511bc5d | 49 | } |
asobhy | 0:a355e511bc5d | 50 | } |