blob: fe1738ac1fa27bd54b6d17ff0df00e0a69595b59 [file] [log] [blame]
Austin Schuh99f7c6a2024-06-25 22:07:44 -07001#include "absl/flags/flag.h"
Philipp Schrader790cb542023-07-05 21:06:52 -07002
3#include "aos/events/shm_event_loop.h"
4#include "aos/init.h"
Austin Schuhd58b2902020-03-01 19:28:04 -08005#include "y2020/setpoint_generated.h"
6
Austin Schuh99f7c6a2024-06-25 22:07:44 -07007ABSL_FLAG(double, accelerator, 250.0, "Accelerator speed");
8ABSL_FLAG(double, finisher, 500.0, "Finsher speed");
9ABSL_FLAG(double, hood, 0.45, "Hood setpoint");
10ABSL_FLAG(double, turret, 0.0, "Turret setpoint");
Austin Schuhd58b2902020-03-01 19:28:04 -080011
Austin Schuh094d09b2020-11-20 23:26:52 -080012int main(int argc, char **argv) {
Austin Schuhd58b2902020-03-01 19:28:04 -080013 aos::InitGoogle(&argc, &argv);
Austin Schuhd58b2902020-03-01 19:28:04 -080014
15 aos::FlatbufferDetachedBuffer<aos::Configuration> config =
Austin Schuhc5fa6d92022-02-25 14:36:28 -080016 aos::configuration::ReadConfig("aos_config.json");
Austin Schuhd58b2902020-03-01 19:28:04 -080017
18 aos::ShmEventLoop event_loop(&config.message());
19
20 ::aos::Sender<y2020::joysticks::Setpoint> setpoint_sender =
21 event_loop.MakeSender<y2020::joysticks::Setpoint>("/superstructure");
22
23 aos::Sender<y2020::joysticks::Setpoint>::Builder builder =
24 setpoint_sender.MakeBuilder();
25
26 y2020::joysticks::Setpoint::Builder setpoint_builder =
27 builder.MakeBuilder<y2020::joysticks::Setpoint>();
28
Austin Schuh99f7c6a2024-06-25 22:07:44 -070029 setpoint_builder.add_accelerator(absl::GetFlag(FLAGS_accelerator));
30 setpoint_builder.add_finisher(absl::GetFlag(FLAGS_finisher));
31 setpoint_builder.add_hood(absl::GetFlag(FLAGS_hood));
32 setpoint_builder.add_turret(absl::GetFlag(FLAGS_turret));
milind1f1dca32021-07-03 13:50:07 -070033 builder.CheckOk(builder.Send(setpoint_builder.Finish()));
Austin Schuhd58b2902020-03-01 19:28:04 -080034
Austin Schuhae87e312020-08-01 16:15:01 -070035 return 0;
Austin Schuhd58b2902020-03-01 19:28:04 -080036}