Reduce hysteresis in 2023 target selector
This should make things more reasonable for the drivers, such that the
manipulator changing the button forces us to realign.
Change-Id: I31a9d6527654706f96d9d0b57c35721599ce5336
Signed-off-by: James Kuszmaul <jabukuszmaul@gmail.com>
diff --git a/frc971/control_loops/drivetrain/localizer.h b/frc971/control_loops/drivetrain/localizer.h
index c805f35..6e53138 100644
--- a/frc971/control_loops/drivetrain/localizer.h
+++ b/frc971/control_loops/drivetrain/localizer.h
@@ -36,6 +36,9 @@
virtual double TargetRadius() const = 0;
// Which direction we want the robot to drive to get to the target.
virtual Side DriveDirection() const = 0;
+ // Indicates that the line following *must* drive to the currently selected
+ // target, regardless of any hysteresis we try to use to protect the driver.
+ virtual bool ForceReselectTarget() const = 0;
};
// Defines an interface for classes that provide field-global localization.
@@ -119,15 +122,20 @@
TypedPose<double> TargetPose() const override { return pose_; }
double TargetRadius() const override { return target_radius_; }
Side DriveDirection() const override { return drive_direction_; }
+ bool ForceReselectTarget() const override { return force_reselect_; }
void set_pose(const TypedPose<double> &pose) { pose_ = pose; }
void set_target_radius(double radius) { target_radius_ = radius; }
void set_has_target(bool has_target) { has_target_ = has_target; }
void set_drive_direction(Side side) { drive_direction_ = side; }
+ void set_force_reselect(bool force_reselect) {
+ force_reselect_ = force_reselect;
+ }
bool has_target() const { return has_target_; }
private:
bool has_target_ = true;
+ bool force_reselect_ = false;
TypedPose<double> pose_;
double target_radius_ = 0.0;
Side drive_direction_ = Side::DONT_CARE;