Remove Potentiometer from Intake Pivot

Changed the intake pivot from a pot and absolute
encoder subsystem to just an absolute encoder subsystem

Signed-off-by: Niko Sohmers <nikolai@sohmers.com>
Change-Id: I9440cc1716420ca22c776db22e7694f2c1448aeb
diff --git a/y2024/control_loops/superstructure/superstructure.cc b/y2024/control_loops/superstructure/superstructure.cc
index 18db6d6..1d7c5b5 100644
--- a/y2024/control_loops/superstructure/superstructure.cc
+++ b/y2024/control_loops/superstructure/superstructure.cc
@@ -31,9 +31,8 @@
       joystick_state_fetcher_(
           event_loop->MakeFetcher<aos::JoystickState>("/aos")),
       transfer_goal_(TransferRollerGoal::NONE),
-      intake_pivot_(
-          robot_constants_->common()->intake_pivot(),
-          robot_constants_->robot()->intake_constants()->zeroing_constants()),
+      intake_pivot_(robot_constants_->common()->intake_pivot(),
+                    robot_constants_->robot()->intake_constants()),
       climber_(
           robot_constants_->common()->climber(),
           robot_constants_->robot()->climber_constants()->zeroing_constants()) {
@@ -153,7 +152,7 @@
   const frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemGoal
       *intake_pivot_goal = &intake_pivot_goal_buffer.message();
 
-  const flatbuffers::Offset<PotAndAbsoluteEncoderProfiledJointStatus>
+  const flatbuffers::Offset<AbsoluteEncoderProfiledJointStatus>
       intake_pivot_status_offset = intake_pivot_.Iterate(
           intake_pivot_goal, position->intake_pivot(),
           output != nullptr ? &output_struct.intake_pivot_voltage : nullptr,
diff --git a/y2024/control_loops/superstructure/superstructure.h b/y2024/control_loops/superstructure/superstructure.h
index 88db2e2..f85e0fc 100644
--- a/y2024/control_loops/superstructure/superstructure.h
+++ b/y2024/control_loops/superstructure/superstructure.h
@@ -21,6 +21,11 @@
 class Superstructure
     : public ::frc971::controls::ControlLoop<Goal, Position, Status, Output> {
  public:
+  using AbsoluteEncoderSubsystem =
+      ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
+          ::frc971::zeroing::AbsoluteEncoderZeroingEstimator,
+          ::frc971::control_loops::AbsoluteEncoderProfiledJointStatus>;
+
   using PotAndAbsoluteEncoderSubsystem =
       ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystem<
           ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator,
@@ -30,7 +35,7 @@
                           std::shared_ptr<const constants::Values> values,
                           const ::std::string &name = "/superstructure");
 
-  inline const PotAndAbsoluteEncoderSubsystem &intake_pivot() const {
+  inline const AbsoluteEncoderSubsystem &intake_pivot() const {
     return intake_pivot_;
   }
 
@@ -56,8 +61,9 @@
   aos::Alliance alliance_ = aos::Alliance::kInvalid;
 
   TransferRollerGoal transfer_goal_;
-  PotAndAbsoluteEncoderSubsystem intake_pivot_;
+  AbsoluteEncoderSubsystem intake_pivot_;
   PotAndAbsoluteEncoderSubsystem climber_;
+
   DISALLOW_COPY_AND_ASSIGN(Superstructure);
 };
 
diff --git a/y2024/control_loops/superstructure/superstructure_lib_test.cc b/y2024/control_loops/superstructure/superstructure_lib_test.cc
index 8020a4d..4b4ac8d 100644
--- a/y2024/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2024/control_loops/superstructure/superstructure_lib_test.cc
@@ -33,11 +33,16 @@
 using DrivetrainStatus = ::frc971::control_loops::drivetrain::Status;
 typedef Superstructure::PotAndAbsoluteEncoderSubsystem
     PotAndAbsoluteEncoderSubsystem;
+typedef Superstructure::AbsoluteEncoderSubsystem AbsoluteEncoderSubsystem;
 using PotAndAbsoluteEncoderSimulator =
     frc971::control_loops::SubsystemSimulator<
         frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus,
         PotAndAbsoluteEncoderSubsystem::State,
         constants::Values::PotAndAbsEncoderConstants>;
+using AbsoluteEncoderSimulator = frc971::control_loops::SubsystemSimulator<
+    frc971::control_loops::AbsoluteEncoderProfiledJointStatus,
+    AbsoluteEncoderSubsystem::State,
+    constants::Values::AbsoluteEncoderConstants>;
 
 class SuperstructureSimulation {
  public:
@@ -57,21 +62,14 @@
             new CappedTestPlant(intake_pivot::MakeIntakePivotPlant()),
             PositionSensorSimulator(simulated_robot_constants->robot()
                                         ->intake_constants()
-                                        ->zeroing_constants()
                                         ->one_revolution_distance()),
             {.subsystem_params =
                  {simulated_robot_constants->common()->intake_pivot(),
-                  simulated_robot_constants->robot()
-                      ->intake_constants()
-                      ->zeroing_constants()},
-             .potentiometer_offset = simulated_robot_constants->robot()
-                                         ->intake_constants()
-                                         ->potentiometer_offset()},
+                  simulated_robot_constants->robot()->intake_constants()}},
             frc971::constants::Range::FromFlatbuffer(
                 simulated_robot_constants->common()->intake_pivot()->range()),
             simulated_robot_constants->robot()
                 ->intake_constants()
-                ->zeroing_constants()
                 ->measured_absolute_position(),
             dt_),
         climber_(new CappedTestPlant(climber::MakeClimberPlant()),
@@ -127,9 +125,9 @@
     ::aos::Sender<Position>::Builder builder =
         superstructure_position_sender_.MakeBuilder();
 
-    frc971::PotAndAbsolutePosition::Builder intake_pivot_builder =
-        builder.MakeBuilder<frc971::PotAndAbsolutePosition>();
-    flatbuffers::Offset<frc971::PotAndAbsolutePosition> intake_pivot_offset =
+    frc971::AbsolutePosition::Builder intake_pivot_builder =
+        builder.MakeBuilder<frc971::AbsolutePosition>();
+    flatbuffers::Offset<frc971::AbsolutePosition> intake_pivot_offset =
         intake_pivot_.encoder()->GetSensorValues(&intake_pivot_builder);
 
     frc971::PotAndAbsolutePosition::Builder climber_builder =
@@ -151,7 +149,7 @@
     transfer_beambreak_ = triggered;
   }
 
-  PotAndAbsoluteEncoderSimulator *intake_pivot() { return &intake_pivot_; }
+  AbsoluteEncoderSimulator *intake_pivot() { return &intake_pivot_; }
 
   PotAndAbsoluteEncoderSimulator *climber() { return &climber_; }
 
@@ -166,7 +164,7 @@
 
   bool transfer_beambreak_;
 
-  PotAndAbsoluteEncoderSimulator intake_pivot_;
+  AbsoluteEncoderSimulator intake_pivot_;
   PotAndAbsoluteEncoderSimulator climber_;
 
   bool first_ = true;
@@ -223,6 +221,8 @@
     superstructure_status_fetcher_.Fetch();
     superstructure_output_fetcher_.Fetch();
 
+    ASSERT_FALSE(superstructure_status_fetcher_->estopped());
+
     ASSERT_TRUE(superstructure_goal_fetcher_.get() != nullptr) << ": No goal";
     ASSERT_TRUE(superstructure_status_fetcher_.get() != nullptr)
         << ": No status";
@@ -389,7 +389,6 @@
 
   // Give it a lot of time to get there.
   RunFor(chrono::seconds(15));
-
   VerifyNearGoal();
 }
 
@@ -435,7 +434,7 @@
   WaitUntilZeroed();
   RunFor(chrono::seconds(2));
 
-  EXPECT_EQ(PotAndAbsoluteEncoderSubsystem::State::RUNNING,
+  EXPECT_EQ(AbsoluteEncoderSubsystem::State::RUNNING,
             superstructure_.intake_pivot().state());
 
   EXPECT_EQ(PotAndAbsoluteEncoderSubsystem::State::RUNNING,
diff --git a/y2024/control_loops/superstructure/superstructure_position.fbs b/y2024/control_loops/superstructure/superstructure_position.fbs
index cd12da0..1c81332 100644
--- a/y2024/control_loops/superstructure/superstructure_position.fbs
+++ b/y2024/control_loops/superstructure/superstructure_position.fbs
@@ -5,7 +5,7 @@
 
 table Position {
     // Values of the encoder and potentiometer at the intake pivot
-    intake_pivot:frc971.PotAndAbsolutePosition (id: 0);
+    intake_pivot:frc971.AbsolutePosition (id: 0);
 
     // Values of the encoder and potentiometer at the turret
     turret:frc971.PotAndAbsolutePosition (id: 1);
diff --git a/y2024/control_loops/superstructure/superstructure_status.fbs b/y2024/control_loops/superstructure/superstructure_status.fbs
index cd727ac..24b0e17 100644
--- a/y2024/control_loops/superstructure/superstructure_status.fbs
+++ b/y2024/control_loops/superstructure/superstructure_status.fbs
@@ -39,7 +39,7 @@
   intake_roller_state:IntakeRollerState (id: 2);
 
   // Estimated angle and angular velocitiy of the intake.
-  intake_pivot_state:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 3);
+  intake_pivot_state:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 3);
 
   // State of transfer rollers
   transfer_roller_state:TransferRollerState (id: 4);