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.h b/aos/input/action_joystick_input.h
index 9936c98..87b980e 100644
--- a/aos/input/action_joystick_input.h
+++ b/aos/input/action_joystick_input.h
@@ -30,6 +30,8 @@
}
private:
+ // Handles anything that needs to be cleaned up when the auto action exits.
+ virtual void AutoEnded() {}
// Handles any year specific superstructure code.
virtual void HandleTeleop(const ::aos::input::driver_station::Data &data) = 0;
@@ -49,6 +51,10 @@
// finish early), we will run teleop regardless of the mode.
bool run_teleop_in_auto_ = false;
+ // Bool to track if auto was running the last cycle through. This lets us
+ // call AutoEnded when the auto mode function stops.
+ bool auto_was_running_ = false;
+
::std::unique_ptr<DrivetrainInputReader> drivetrain_input_reader_;
::aos::common::actions::ActionQueue action_queue_;
};