Add an apply throttle function to autonomous actor
This lets us push gently into the wall when shooting.
Change-Id: I1a3707df8def0f081e3e96a7d36b582ab97d1c77
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/frc971/autonomous/base_autonomous_actor.cc b/frc971/autonomous/base_autonomous_actor.cc
index 8a5b60e..ab31e52 100644
--- a/frc971/autonomous/base_autonomous_actor.cc
+++ b/frc971/autonomous/base_autonomous_actor.cc
@@ -42,6 +42,20 @@
event_loop->SetRuntimeRealtimePriority(29);
}
+void BaseAutonomousActor::ApplyThrottle(double throttle) {
+ goal_spline_handle_ = 0;
+
+ auto builder = drivetrain_goal_sender_.MakeBuilder();
+
+ drivetrain::Goal::Builder goal_builder =
+ builder.MakeBuilder<drivetrain::Goal>();
+ goal_builder.add_controller_type(drivetrain::ControllerType::POLYDRIVE);
+ goal_builder.add_highgear(true);
+ goal_builder.add_wheel(0.0);
+ goal_builder.add_throttle(throttle);
+ builder.Send(goal_builder.Finish());
+}
+
void BaseAutonomousActor::ResetDrivetrain() {
AOS_LOG(INFO, "resetting the drivetrain\n");
max_drivetrain_voltage_ = 12.0;