blob: ae6f340810d577e420208128ffb674238ea41ef6 [file] [log] [blame]
Yash Chainani4b91ff12023-03-14 19:56:07 -07001#include <sys/resource.h>
2#include <sys/time.h>
3
Philipp Schrader790cb542023-07-05 21:06:52 -07004#include "glog/logging.h"
5
Yash Chainani4b91ff12023-03-14 19:56:07 -07006#include "aos/configuration.h"
Yash Chainani4b91ff12023-03-14 19:56:07 -07007#include "aos/events/shm_event_loop.h"
8#include "aos/flatbuffer_merge.h"
9#include "aos/init.h"
10#include "frc971/input/joystick_state_generated.h"
Yash Chainani4b91ff12023-03-14 19:56:07 -070011
12DEFINE_string(config, "aos_config.json", "Config file to use.");
13
14int main(int argc, char *argv[]) {
15 aos::InitGoogle(&argc, &argv);
16
17 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
18 aos::configuration::ReadConfig(FLAGS_config);
19 aos::ShmEventLoop event_loop(&config.message());
20
21 aos::Sender<aos::JoystickState> sender(
22 event_loop.MakeSender<aos::JoystickState>("/imu/aos"));
23
24 event_loop.MakeWatcher(
25 "/roborio/aos", [&](const aos::JoystickState &joystick_state) {
26 auto builder = sender.MakeBuilder();
27 flatbuffers::Offset<aos::JoystickState> state_fbs =
28 aos::CopyFlatBuffer(&joystick_state, builder.fbb());
29 builder.CheckOk(builder.Send(state_fbs));
30 });
31
32 event_loop.Run();
33 return 0;
34}