blob: 333a67af4e98fffcc29b3dea0c3362d83b9468de [file] [log] [blame]
Daniel Petti1f448512013-10-19 19:35:55 +00001#include "stdio.h"
2
3#include "aos/common/control_loop/Timing.h"
4#include "aos/common/time.h"
5#include "aos/atom_code/init.h"
6#include "aos/common/logging/logging.h"
7#include "bot3/autonomous/auto.q.h"
8#include "bot3/autonomous/auto.h"
9
10using ::aos::time::Time;
11
12int main(int /*argc*/, char * /*argv*/[]) {
13 ::aos::Init();
14
15 ::bot3::autonomous::autonomous.FetchLatest();
16 while (!::bot3::autonomous::autonomous.get()) {
17 ::bot3::autonomous::autonomous.FetchNextBlocking();
18 LOG(INFO, "Got another auto packet\n");
19 }
20
21 while (true) {
22 while (!::bot3::autonomous::autonomous->run_auto) {
23 ::bot3::autonomous::autonomous.FetchNextBlocking();
24 LOG(INFO, "Got another auto packet\n");
25 }
26 LOG(INFO, "Starting auto mode\n");
27 ::bot3::autonomous::HandleAuto();
28
29 LOG(INFO, "Auto mode exited, waiting for it to finish.\n");
30 while (::bot3::autonomous::autonomous->run_auto) {
31 ::bot3::autonomous::autonomous.FetchNextBlocking();
32 LOG(INFO, "Got another auto packet\n");
33 }
34 LOG(INFO, "Waiting for auto to start back up.\n");
35 }
36 ::aos::Cleanup();
37 return 0;
38}
39