blob: 75af90f798769590d7b2efa2dd3e249eacb5ae00 [file] [log] [blame]
Austin Schuh99f7c6a2024-06-25 22:07:44 -07001#include "absl/flags/flag.h"
2
Ravago Jonese12b7902022-02-04 22:50:44 -08003#include "aos/events/shm_event_loop.h"
4#include "aos/init.h"
Austin Schuh5f4cddd2023-01-27 21:01:28 -08005#include "aos/realtime.h"
Austin Schuh18cb1df2023-01-28 11:13:35 -08006#include "frc971/imu_reader/imu.h"
7#include "y2022/constants.h"
Ravago Jonese12b7902022-02-04 22:50:44 -08008
Austin Schuh99f7c6a2024-06-25 22:07:44 -07009ABSL_FLAG(std::string, config, "aos_config.json",
10 "Path to the config file to use.");
Ravago Jonese12b7902022-02-04 22:50:44 -080011
12int main(int argc, char *argv[]) {
13 aos::InitGoogle(&argc, &argv);
14
15 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
Austin Schuh99f7c6a2024-06-25 22:07:44 -070016 aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config));
Ravago Jonese12b7902022-02-04 22:50:44 -080017
Austin Schuh5f4cddd2023-01-27 21:01:28 -080018 PCHECK(system("sudo chmod 644 /dev/adis16505") == 0)
19 << ": Failed to set read permissions on IMU device.";
20
Ravago Jonese12b7902022-02-04 22:50:44 -080021 aos::ShmEventLoop event_loop(&config.message());
Austin Schuh18cb1df2023-01-28 11:13:35 -080022 frc971::imu::Imu imu(&event_loop,
23 y2022::constants::Values::DrivetrainEncoderToMeters(1));
Ravago Jonese12b7902022-02-04 22:50:44 -080024
Austin Schuh5f4cddd2023-01-27 21:01:28 -080025 event_loop.SetRuntimeRealtimePriority(30);
26
Ravago Jonese12b7902022-02-04 22:50:44 -080027 event_loop.Run();
28
29 return 0;
30}