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