Add a bit to enable sandstorm mode.
2019 auto needs to flow into teleop regardless of the robot mode. Add a
configuration bit to our base class so we can turn this mode on in 2019
and leave it off in past years.
Change-Id: I8759b3def1c0c055ec84b2b57bb7fe61e6b3c412
diff --git a/aos/input/action_joystick_input.cc b/aos/input/action_joystick_input.cc
index 991ea17..c2c3763 100644
--- a/aos/input/action_joystick_input.cc
+++ b/aos/input/action_joystick_input.cc
@@ -22,7 +22,7 @@
}
}
- if (!auto_running_) {
+ if (!auto_running_ || (run_teleop_in_auto_ && !action_queue_.Running())) {
if (!data.GetControlBit(ControlBit::kEnabled)) {
action_queue_.CancelAllActions();
LOG(DEBUG, "Canceling\n");
diff --git a/aos/input/action_joystick_input.h b/aos/input/action_joystick_input.h
index d4023ca..9936c98 100644
--- a/aos/input/action_joystick_input.h
+++ b/aos/input/action_joystick_input.h
@@ -24,6 +24,11 @@
virtual ~ActionJoystickInput() {}
+ protected:
+ void set_run_teleop_in_auto(bool run_teleop_in_auto) {
+ run_teleop_in_auto_ = run_teleop_in_auto;
+ }
+
private:
// Handles any year specific superstructure code.
virtual void HandleTeleop(const ::aos::input::driver_station::Data &data) = 0;
@@ -38,6 +43,12 @@
// True if an action was running last cycle.
bool was_running_ = false;
+ // If true, we will run teleop during auto mode after auto mode ends. This is
+ // to support the 2019 sandstorm mode. Auto will run, and then when the
+ // action ends (either when it's done, or when the driver triggers it to
+ // finish early), we will run teleop regardless of the mode.
+ bool run_teleop_in_auto_ = false;
+
::std::unique_ptr<DrivetrainInputReader> drivetrain_input_reader_;
::aos::common::actions::ActionQueue action_queue_;
};