Set limits and ports

Change-Id: Idbcb218d05e637d8b31e2d9a7541c440c9a046ea
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2022/constants.h b/y2022/constants.h
index 4c02af7..b1565e6 100644
--- a/y2022/constants.h
+++ b/y2022/constants.h
@@ -90,10 +90,10 @@
   // TODO (Yash): Constants need to be tuned
   static constexpr ::frc971::constants::Range kIntakeRange() {
     return ::frc971::constants::Range{
-        .lower_hard = -0.5,         // Back Hard
-        .upper_hard = 2.85 + 0.05,  // Front Hard
-        .lower = -0.300,            // Back Soft
-        .upper = 2.725              // Front Soft
+        .lower_hard = -0.85,  // Back Hard
+        .upper_hard = 1.85,   // Front Hard
+        .lower = -0.400,      // Back Soft
+        .upper = 1.57         // Front Soft
     };
   }
 
@@ -158,7 +158,7 @@
   // Voltage to open the flippers for firing
   static constexpr double kFlipperOpenVoltage() { return 3.0; }
   // Voltage to keep the flippers open for firing once they already are
-  static constexpr double kFlipperHoldVoltage() { return 2.0; }
+  static constexpr double kFlipperHoldVoltage() { return 2.5; }
   // Voltage to feed a ball from the transfer rollers to the catpult with the
   // flippers
   static constexpr double kFlipperFeedVoltage() { return -8.0; }
@@ -186,13 +186,13 @@
   // TODO: (Griffin) this needs to be set
   static constexpr ::frc971::constants::Range kFlipperArmRange() {
     return ::frc971::constants::Range{
-        .lower_hard = -0.01, .upper_hard = 0.6, .lower = 0.0, .upper = 0.5};
+        .lower_hard = -0.01, .upper_hard = 0.4, .lower = 0.0, .upper = 0.5};
   }
   // Position of the flippers when they are open
-  static constexpr double kFlipperOpenPosition() { return 0.4; }
+  static constexpr double kFlipperOpenPosition() { return 0.15; }
   // If the flippers were open but now moved back, reseat the ball if they go
   // below this position
-  static constexpr double kReseatFlipperPosition() { return 0.3; }
+  static constexpr double kReseatFlipperPosition() { return 0.1; }
 
   static constexpr double kFlipperArmsPotRatio() { return 16.0 / 36.0; }
 
diff --git a/y2022/control_loops/superstructure/collision_avoidance.h b/y2022/control_loops/superstructure/collision_avoidance.h
index ec7ce6f..a64bbd3 100644
--- a/y2022/control_loops/superstructure/collision_avoidance.h
+++ b/y2022/control_loops/superstructure/collision_avoidance.h
@@ -53,7 +53,7 @@
   static constexpr double kMaxCollisionZoneBackTurret = kCollisionZoneTurret;
 
   // Maximum position of the intake to avoid collisions
-  static constexpr double kCollisionZoneIntake = M_PI / 6.0;
+  static constexpr double kCollisionZoneIntake = 1.4;
 
   // Tolerance for the turret.
   static constexpr double kEpsTurret = 0.05;
diff --git a/y2022/wpilib_interface.cc b/y2022/wpilib_interface.cc
index bf5cfda..acc9fdd 100644
--- a/y2022/wpilib_interface.cc
+++ b/y2022/wpilib_interface.cc
@@ -438,10 +438,6 @@
     catapult_falcon_1_ = ::std::move(t);
   }
 
-  void set_catapult_falcon_2(::std::unique_ptr<::frc::TalonFX> t) {
-    catapult_falcon_2_ = ::std::move(t);
-  }
-
   void set_intake_falcon_front(::std::unique_ptr<frc::TalonFX> t) {
     intake_falcon_front_ = ::std::move(t);
   }
@@ -506,7 +502,6 @@
     intake_falcon_back_->SetDisabled();
     transfer_roller_victor_->SetDisabled();
     catapult_falcon_1_->SetDisabled();
-    catapult_falcon_2_->SetDisabled();
     turret_falcon_->SetDisabled();
   }
 
@@ -519,12 +514,11 @@
     WriteCan(output.roller_voltage_back(), roller_falcon_back_.get());
     WritePwm(output.transfer_roller_voltage(), transfer_roller_victor_.get());
 
-    WriteCan(output.flipper_arms_voltage(), flipper_arms_falcon_.get());
+    WriteCan(-output.flipper_arms_voltage(), flipper_arms_falcon_.get());
 
     WritePwm(output.catapult_voltage(), catapult_falcon_1_.get());
-    WritePwm(output.catapult_voltage(), catapult_falcon_2_.get());
 
-    WritePwm(output.turret_voltage(), turret_falcon_.get());
+    WritePwm(-output.turret_voltage(), turret_falcon_.get());
   }
 
   static void WriteCan(const double voltage,
@@ -549,7 +543,7 @@
       flipper_arms_falcon_;
 
   ::std::unique_ptr<::frc::TalonFX> turret_falcon_, catapult_falcon_1_,
-      catapult_falcon_2_, climber_falcon_;
+      climber_falcon_;
   ::std::unique_ptr<::frc::VictorSP> transfer_roller_victor_;
 };
 
@@ -680,25 +674,22 @@
     SuperstructureWriter superstructure_writer(&output_event_loop);
 
     superstructure_writer.set_turret_falcon(make_unique<::frc::TalonFX>(3));
-    // TODO(milind): correct CAN ports
     superstructure_writer.set_roller_falcon_front(
         make_unique<::ctre::phoenix::motorcontrol::can::TalonFX>(0));
     superstructure_writer.set_roller_falcon_back(
         make_unique<::ctre::phoenix::motorcontrol::can::TalonFX>(1));
+
     // TODO(milind): correct port
     superstructure_writer.set_transfer_roller_victor(
         make_unique<::frc::VictorSP>(5));
+
     superstructure_writer.set_intake_falcon_front(make_unique<frc::TalonFX>(2));
     superstructure_writer.set_intake_falcon_back(make_unique<frc::TalonFX>(4));
-    // TODO(milind): correct port
-    superstructure_writer.set_climber_falcon(make_unique<frc::TalonFX>(6));
-    // TODO(milind): correct CAN port
+    superstructure_writer.set_climber_falcon(make_unique<frc::TalonFX>(8));
     superstructure_writer.set_flipper_arms_falcon(
         make_unique<::ctre::phoenix::motorcontrol::can::TalonFX>(2));
 
-    // TODO(milind): correct ports
-    superstructure_writer.set_catapult_falcon_1(make_unique<::frc::TalonFX>(7));
-    superstructure_writer.set_catapult_falcon_2(make_unique<::frc::TalonFX>(8));
+    superstructure_writer.set_catapult_falcon_1(make_unique<::frc::TalonFX>(9));
 
     AddLoop(&output_event_loop);