Ravago Jones | b84f206 | 2023-01-29 13:46:59 -0800 | [diff] [blame] | 1 | #include "aos/events/shm_event_loop.h" |
| 2 | #include "aos/init.h" |
| 3 | #include "y2023/vision/aprilrobotics.h" |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame^] | 4 | #include "frc971/constants/constants_sender_lib.h" |
Ravago Jones | b84f206 | 2023-01-29 13:46:59 -0800 | [diff] [blame] | 5 | |
| 6 | DEFINE_string(config, "aos_config.json", "Path to the config file to use."); |
| 7 | |
| 8 | namespace y2023::vision { |
| 9 | void AprilViewerMain() { |
| 10 | aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
| 11 | aos::configuration::ReadConfig(FLAGS_config); |
| 12 | |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame^] | 13 | frc971::constants::WaitForConstants<Constants>(&config.message()); |
| 14 | |
Ravago Jones | b84f206 | 2023-01-29 13:46:59 -0800 | [diff] [blame] | 15 | 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, ¶m) == 0); |
| 26 | |
| 27 | event_loop.Run(); |
| 28 | } |
| 29 | |
| 30 | } // namespace y2023::vision |
| 31 | |
| 32 | int main(int argc, char **argv) { |
| 33 | aos::InitGoogle(&argc, &argv); |
| 34 | y2023::vision::AprilViewerMain(); |
| 35 | |
| 36 | return 0; |
| 37 | } |