Austin Schuh | 4701741 | 2013-03-10 11:50:46 -0700 | [diff] [blame] | 1 | #include "stdio.h" |
| 2 | |
| 3 | #include "aos/aos_core.h" |
| 4 | #include "aos/common/control_loop/Timing.h" |
| 5 | #include "aos/common/time.h" |
| 6 | #include "frc971/autonomous/auto.q.h" |
| 7 | #include "frc971/autonomous/auto.h" |
| 8 | |
| 9 | using ::aos::time::Time; |
| 10 | |
| 11 | int main(int /*argc*/, char * /*argv*/[]) { |
| 12 | ::aos::Init(); |
| 13 | |
| 14 | ::frc971::autonomous::autonomous.FetchLatest(); |
| 15 | while (!::frc971::autonomous::autonomous.get()) { |
Austin Schuh | 6be011a | 2013-03-19 10:07:02 +0000 | [diff] [blame^] | 16 | ::frc971::autonomous::autonomous.FetchNextBlocking(); |
| 17 | LOG(INFO, "Got another auto packet\n"); |
Austin Schuh | 4701741 | 2013-03-10 11:50:46 -0700 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | while (true) { |
| 21 | while (!::frc971::autonomous::autonomous->run_auto) { |
| 22 | ::frc971::autonomous::autonomous.FetchNextBlocking(); |
Austin Schuh | 6be011a | 2013-03-19 10:07:02 +0000 | [diff] [blame^] | 23 | LOG(INFO, "Got another auto packet\n"); |
Austin Schuh | 4701741 | 2013-03-10 11:50:46 -0700 | [diff] [blame] | 24 | } |
Austin Schuh | 6be011a | 2013-03-19 10:07:02 +0000 | [diff] [blame^] | 25 | LOG(INFO, "Starting auto mode\n"); |
Austin Schuh | 4701741 | 2013-03-10 11:50:46 -0700 | [diff] [blame] | 26 | ::frc971::autonomous::HandleAuto(); |
| 27 | |
Austin Schuh | 6be011a | 2013-03-19 10:07:02 +0000 | [diff] [blame^] | 28 | LOG(INFO, "Auto mode exited, waiting for it to finish.\n"); |
Austin Schuh | 4701741 | 2013-03-10 11:50:46 -0700 | [diff] [blame] | 29 | while (::frc971::autonomous::autonomous->run_auto) { |
| 30 | ::frc971::autonomous::autonomous.FetchNextBlocking(); |
Austin Schuh | 6be011a | 2013-03-19 10:07:02 +0000 | [diff] [blame^] | 31 | LOG(INFO, "Got another auto packet\n"); |
Austin Schuh | 4701741 | 2013-03-10 11:50:46 -0700 | [diff] [blame] | 32 | } |
Austin Schuh | 6be011a | 2013-03-19 10:07:02 +0000 | [diff] [blame^] | 33 | LOG(INFO, "Waiting for auto to start back up.\n"); |
Austin Schuh | 4701741 | 2013-03-10 11:50:46 -0700 | [diff] [blame] | 34 | } |
| 35 | ::aos::Cleanup(); |
| 36 | return 0; |
| 37 | } |
| 38 | |