Allow pre-compiling arm trajectories
The robot takes a while before it's usable because it has to re-optimize
the arm trajectories when it runs. This commit takes the outputted c++
from graph_codegen and optimizes the trajectories before the robot
runs. It then puts them into a bfbs which is able to be placed on the
robot and read.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: Ic75f9d590d6b89bfd5eed8b804e73c8c84ecec6b
diff --git a/y2023/control_loops/superstructure/superstructure_main.cc b/y2023/control_loops/superstructure/superstructure_main.cc
index bb25ad8..10a9ca9 100644
--- a/y2023/control_loops/superstructure/superstructure_main.cc
+++ b/y2023/control_loops/superstructure/superstructure_main.cc
@@ -2,6 +2,12 @@
#include "aos/init.h"
#include "y2023/control_loops/superstructure/superstructure.h"
+DEFINE_string(arm_trajectories, "arm_trajectories_generated.bfbs",
+ "The path to the generated arm trajectories bfbs file.");
+
+using y2023::control_loops::superstructure::Superstructure;
+using y2023::control_loops::superstructure::arm::ArmTrajectories;
+
int main(int argc, char **argv) {
::aos::InitGoogle(&argc, &argv);
@@ -9,11 +15,15 @@
aos::configuration::ReadConfig("aos_config.json");
::aos::ShmEventLoop event_loop(&config.message());
+
+ auto trajectories =
+ y2023::control_loops::superstructure::Superstructure::GetArmTrajectories(
+ FLAGS_arm_trajectories);
+
std::shared_ptr<const y2023::constants::Values> values =
std::make_shared<const y2023::constants::Values>(
y2023::constants::MakeValues());
- ::y2023::control_loops::superstructure::Superstructure superstructure(
- &event_loop, values);
+ Superstructure superstructure(&event_loop, values, trajectories);
event_loop.Run();