Added a AutoEnded function
This gets called when the auto action finishes running. This lets us
reset state when the driver takes control. It gets run before
HandleTeleop.
Change-Id: I2969d95ed623f9e45735c07da1dc6c504efae06b
diff --git a/aos/input/action_joystick_input.cc b/aos/input/action_joystick_input.cc
index c2c3763..81e277d 100644
--- a/aos/input/action_joystick_input.cc
+++ b/aos/input/action_joystick_input.cc
@@ -16,6 +16,7 @@
data.GetControlBit(ControlBit::kEnabled);
if (auto_running_ != last_auto_running) {
if (auto_running_) {
+ auto_was_running_ = true;
StartAuto();
} else {
StopAuto();
@@ -23,6 +24,10 @@
}
if (!auto_running_ || (run_teleop_in_auto_ && !action_queue_.Running())) {
+ if (auto_was_running_) {
+ AutoEnded();
+ auto_was_running_ = false;
+ }
if (!data.GetControlBit(ControlBit::kEnabled)) {
action_queue_.CancelAllActions();
LOG(DEBUG, "Canceling\n");