blob: 6870ae1944bb634698721c02eb1b6f36ba5f1117 [file] [log] [blame]
Ravago Jonesb84f2062023-01-29 13:46:59 -08001#include "aos/events/shm_event_loop.h"
2#include "aos/init.h"
3#include "y2023/vision/aprilrobotics.h"
James Kuszmauld67f6d22023-02-05 17:37:25 -08004#include "frc971/constants/constants_sender_lib.h"
Ravago Jonesb84f2062023-01-29 13:46:59 -08005
6DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
7
8namespace y2023::vision {
9void AprilViewerMain() {
10 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
11 aos::configuration::ReadConfig(FLAGS_config);
12
James Kuszmauld67f6d22023-02-05 17:37:25 -080013 frc971::constants::WaitForConstants<Constants>(&config.message());
14
Ravago Jonesb84f2062023-01-29 13:46:59 -080015 aos::ShmEventLoop event_loop(&config.message());
16
17 AprilRoboticsDetector detector(&event_loop, "/camera");
18
19 detector.SetWorkerpoolAffinities();
20
21 event_loop.SetRuntimeAffinity(aos::MakeCpusetFromCpus({5}));
22
23 struct sched_param param;
24 param.sched_priority = 21;
25 PCHECK(sched_setscheduler(0, SCHED_FIFO, &param) == 0);
26
27 event_loop.Run();
28}
29
30} // namespace y2023::vision
31
32int main(int argc, char **argv) {
33 aos::InitGoogle(&argc, &argv);
34 y2023::vision::AprilViewerMain();
35
36 return 0;
37}