Move core/RT configuration for imu to y2022 main

This lets us share the 2022 and 2023 IMU userspace code.

Change-Id: I1c7b648b78b677932745ab669e1b332eaffb3b38
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2022/localizer/imu.cc b/y2022/localizer/imu.cc
index 2310e99..7b5022f 100644
--- a/y2022/localizer/imu.cc
+++ b/y2022/localizer/imu.cc
@@ -19,9 +19,6 @@
     : event_loop_(event_loop),
       imu_sender_(
           event_loop_->MakeSender<frc971::IMUValuesBatch>("/localizer")) {
-  event_loop->SetRuntimeRealtimePriority(30);
-  PCHECK(system("sudo chmod 644 /dev/adis16505") == 0)
-      << ": Failed to set read permissions on IMU device.";
   imu_fd_ = open("/dev/adis16505", O_RDONLY | O_NONBLOCK);
   PCHECK(imu_fd_ != -1) << ": Failed to open SPI device for IMU.";
   aos::internal::EPoll *epoll = event_loop_->epoll();
diff --git a/y2022/localizer/imu_main.cc b/y2022/localizer/imu_main.cc
index 5bdab41..53811ea 100644
--- a/y2022/localizer/imu_main.cc
+++ b/y2022/localizer/imu_main.cc
@@ -1,5 +1,6 @@
 #include "aos/events/shm_event_loop.h"
 #include "aos/init.h"
+#include "aos/realtime.h"
 #include "y2022/localizer/imu.h"
 
 DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
@@ -10,9 +11,14 @@
   aos::FlatbufferDetachedBuffer<aos::Configuration> config =
       aos::configuration::ReadConfig(FLAGS_config);
 
+  PCHECK(system("sudo chmod 644 /dev/adis16505") == 0)
+      << ": Failed to set read permissions on IMU device.";
+
   aos::ShmEventLoop event_loop(&config.message());
   y2022::localizer::Imu imu(&event_loop);
 
+  event_loop.SetRuntimeRealtimePriority(30);
+
   event_loop.Run();
 
   return 0;