blob: bf3acf845f9400ecd597d0ee77d71227a3c9ebc4 [file] [log] [blame]
Comran Morshed9a9948c2016-01-16 15:58:04 +00001#include <stdio.h>
2
3#include "aos/common/time.h"
4#include "aos/linux_code/init.h"
5#include "aos/common/logging/logging.h"
6#include "frc971/autonomous/auto.q.h"
7#include "y2014/autonomous/auto.h"
8
9using ::aos::time::Time;
10
11int main(int /*argc*/, char * /*argv*/[]) {
12 ::aos::Init(-1);
13
14 LOG(INFO, "Auto main started\n");
15 ::frc971::autonomous::autonomous.FetchLatest();
16 while (!::frc971::autonomous::autonomous.get()) {
17 ::frc971::autonomous::autonomous.FetchNextBlocking();
18 LOG(INFO, "Got another auto packet\n");
19 }
20
21 while (true) {
22 while (!::frc971::autonomous::autonomous->run_auto) {
23 ::frc971::autonomous::autonomous.FetchNextBlocking();
24 LOG(INFO, "Got another auto packet\n");
25 }
26 LOG(INFO, "Starting auto mode\n");
27 ::aos::time::Time start_time = ::aos::time::Time::Now();
28 ::y2014::autonomous::HandleAuto();
29
30 ::aos::time::Time elapsed_time = ::aos::time::Time::Now() - start_time;
31 LOG(INFO, "Auto mode exited in %f, waiting for it to finish.\n",
32 elapsed_time.ToSeconds());
33 while (::frc971::autonomous::autonomous->run_auto) {
34 ::frc971::autonomous::autonomous.FetchNextBlocking();
35 LOG(INFO, "Got another auto packet\n");
36 }
37 LOG(INFO, "Waiting for auto to start back up.\n");
38 }
39 ::aos::Cleanup();
40 return 0;
41}
42