Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame] | 1 | #include "absl/flags/flag.h" |
| 2 | |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 3 | #include "aos/events/shm_event_loop.h" |
Nikolai Sohmers | 3cc1fc2 | 2024-05-04 12:27:58 -0700 | [diff] [blame] | 4 | #include "y2024_swerve/swerve_publisher_lib.h" |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 5 | |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame] | 6 | ABSL_FLAG(double, duration, 100.0, "Length of time in Ms to apply current for"); |
James Kuszmaul | eaba6d9 | 2024-07-31 20:42:20 -0700 | [diff] [blame] | 7 | ABSL_FLAG(std::string, drivetrain_goal, "swerve_drivetrain_goal.json", |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame] | 8 | "The path to the json drivetrain position to apply"); |
| 9 | ABSL_FLAG(std::string, config, "aos_config.json", |
| 10 | "The path to aos_config.json"); |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 11 | |
| 12 | int main(int argc, char **argv) { |
| 13 | aos::InitGoogle(&argc, &argv); |
| 14 | |
| 15 | aos::FlatbufferDetachedBuffer<aos::Configuration> config = |
Austin Schuh | 99f7c6a | 2024-06-25 22:07:44 -0700 | [diff] [blame] | 16 | aos::configuration::ReadConfig(absl::GetFlag(FLAGS_config)); |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 17 | |
| 18 | aos::ShmEventLoop event_loop(&config.message()); |
| 19 | |
| 20 | std::unique_ptr<aos::ExitHandle> exit_handle = event_loop.MakeExitHandle(); |
| 21 | |
James Kuszmaul | eaba6d9 | 2024-07-31 20:42:20 -0700 | [diff] [blame] | 22 | y2024_swerve::SwervePublisher publisher(&event_loop, exit_handle.get(), |
| 23 | absl::GetFlag(FLAGS_drivetrain_goal), |
| 24 | absl::GetFlag(FLAGS_duration)); |
Maxwell Henderson | f63a0d9 | 2023-06-24 14:49:51 -0700 | [diff] [blame] | 25 | |
| 26 | event_loop.Run(); |
| 27 | } |