Merge "Add aimer status to 2022 turret plot"
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index 4c94670..3db5f72 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -58,14 +58,6 @@
         this.level = 'Transversal';
     }
 
-    setClimbedTrue() {
-        this.climbed = true;
-    }
-
-    setClimbedFalse() {
-        this.climbed = false;
-    }
-
     nextSection() {
         if (this.section === 'Team Selection') {
             this.section = 'Auto';
diff --git a/scouting/www/entry/entry.ng.html b/scouting/www/entry/entry.ng.html
index 7bbc0f7..c5cf233 100644
--- a/scouting/www/entry/entry.ng.html
+++ b/scouting/www/entry/entry.ng.html
@@ -25,10 +25,12 @@
             <h4>Image</h4>
             <form>
                 <!--Choice for each ball location-->
-                <input type="radio" name="balls" value="1" id="ball-1"><label for="ball-1">Ball 1</label>
-                <input type="radio" name="balls" value="2" id="ball-2"><label for="ball-2">Ball 2</label><br>
-                <input type="radio" name="balls" value="3" id="ball-3"><label for="ball-3">Ball 3</label>
-                <input type="radio" name="balls" value="4" id="ball-4"><label for="ball-4">Ball 4</label>
+                <input type="checkbox" name="balls" value="1" id="ball-1"><label for="ball-1">Ball 1</label>
+                <input type="checkbox" name="balls" value="2" id="ball-2"><label for="ball-2">Ball 2</label><br>
+                <input type="checkbox" name="balls" value="3" id="ball-3"><label for="ball-3">Ball 3</label>
+                <input type="checkbox" name="balls" value="4" id="ball-4"><label for="ball-4">Ball 4</label><br>
+                <input type="checkbox" name="balls" value="5" id="ball-5"><label for="ball-5">Ball 5</label>
+                <input type="checkbox" name="balls" value="6" id="ball-6"><label for="ball-6">Ball 6</label>
             </form>
         </div>
         <div class="row">
diff --git a/y2022/constants.cc b/y2022/constants.cc
index 34ffae2..980735f 100644
--- a/y2022/constants.cc
+++ b/y2022/constants.cc
@@ -161,10 +161,10 @@
       intake_back->subsystem_params.zeroing_constants
           .measured_absolute_position = 0.280099007470002;
 
-      turret->potentiometer_offset =
-          -9.99970387166721 + 0.06415943 + 0.073290115367682;
+      turret->potentiometer_offset = -9.99970387166721 + 0.06415943 +
+                                     0.073290115367682 - 0.0634440443622909;
       turret->subsystem_params.zeroing_constants.measured_absolute_position =
-          0.511895084051468;
+          0.568649928102931;
 
       flipper_arm_left->potentiometer_offset = -6.4;
       flipper_arm_right->potentiometer_offset = 5.56;
diff --git a/y2022/constants.h b/y2022/constants.h
index e3bc93f..ffe1283 100644
--- a/y2022/constants.h
+++ b/y2022/constants.h
@@ -113,7 +113,7 @@
         .lower_hard = -6.0,  // Back Hard
         .upper_hard = 4.0,   // Front Hard
         .lower = -5.0,       // Back Soft
-        .upper = 3.7         // Front Soft
+        .upper = 3.3         // Front Soft
     };
   }
 
diff --git a/y2022/control_loops/superstructure/catapult/catapult.cc b/y2022/control_loops/superstructure/catapult/catapult.cc
index fda62ad..4a644e2 100644
--- a/y2022/control_loops/superstructure/catapult/catapult.cc
+++ b/y2022/control_loops/superstructure/catapult/catapult.cc
@@ -313,7 +313,7 @@
 const flatbuffers::Offset<
     frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>
 Catapult::Iterate(const Goal *unsafe_goal, const Position *position,
-                  double *catapult_voltage, bool fire,
+                  double battery_voltage, double *catapult_voltage, bool fire,
                   flatbuffers::FlatBufferBuilder *fbb) {
   const frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemGoal
       *catapult_goal = unsafe_goal != nullptr && unsafe_goal->has_catapult()
@@ -373,8 +373,9 @@
         } else {
           // TODO(austin): Voltage error?
           CHECK_NOTNULL(catapult_voltage);
-          *catapult_voltage =
-              std::max(0.0, std::min(12.0, *solution - 0.0 * next_X(2, 0)));
+          *catapult_voltage = std::max(
+              0.0, std::min(12.0, (*solution - 0.0 * next_X(2, 0)) * 12.0 /
+                                      std::max(battery_voltage, 8.0)));
           use_profile_ = false;
         }
       } else {
@@ -396,8 +397,10 @@
       }
 
     case CatapultState::RESETTING:
-      if (catapult_.controller().R(1, 0) > 0.0) {
-        catapult_.AdjustProfile(7.0, 1400.0);
+      if (catapult_.controller().R(1, 0) > 7.0) {
+        catapult_.AdjustProfile(7.0, 2000.0);
+      } else if (catapult_.controller().R(1, 0) > 0.0) {
+        catapult_.AdjustProfile(7.0, 1000.0);
       } else {
         catapult_state_ = CatapultState::PROFILE;
       }
@@ -420,8 +423,9 @@
     }
   }
 
-  catapult_.UpdateObserver(catapult_voltage != nullptr ? *catapult_voltage
-                                                       : 0.0);
+  catapult_.UpdateObserver(catapult_voltage != nullptr
+                               ? (*catapult_voltage * battery_voltage / 12.0)
+                               : 0.0);
 
   return catapult_.MakeStatus(fbb);
 }
diff --git a/y2022/control_loops/superstructure/catapult/catapult.h b/y2022/control_loops/superstructure/catapult/catapult.h
index ccd4b06..0606c0d 100644
--- a/y2022/control_loops/superstructure/catapult/catapult.h
+++ b/y2022/control_loops/superstructure/catapult/catapult.h
@@ -211,7 +211,7 @@
   const flatbuffers::Offset<
       frc971::control_loops::PotAndAbsoluteEncoderProfiledJointStatus>
   Iterate(const Goal *unsafe_goal, const Position *position,
-          double *catapult_voltage, bool fire,
+          double battery_voltage, double *catapult_voltage, bool fire,
           flatbuffers::FlatBufferBuilder *fbb);
 
  private:
diff --git a/y2022/control_loops/superstructure/superstructure.cc b/y2022/control_loops/superstructure/superstructure.cc
index c87cc95..0b693ef 100644
--- a/y2022/control_loops/superstructure/superstructure.cc
+++ b/y2022/control_loops/superstructure/superstructure.cc
@@ -394,12 +394,12 @@
   // Disable the catapult if we want to restart to prevent damage with
   // flippers
   const flatbuffers::Offset<PotAndAbsoluteEncoderProfiledJointStatus>
-      catapult_status_offset =
-          catapult_.Iterate(unsafe_goal, position,
-                            output != nullptr && !catapult_.estopped()
-                                ? &(output_struct.catapult_voltage)
-                                : nullptr,
-                            fire_, status->fbb());
+      catapult_status_offset = catapult_.Iterate(
+          unsafe_goal, position, robot_state().voltage_battery(),
+          output != nullptr && !catapult_.estopped()
+              ? &(output_struct.catapult_voltage)
+              : nullptr,
+          fire_, status->fbb());
 
   const flatbuffers::Offset<RelativeEncoderProfiledJointStatus>
       climber_status_offset = climber_.Iterate(
diff --git a/y2022/wpilib_interface.cc b/y2022/wpilib_interface.cc
index a1b1202..69883b4 100644
--- a/y2022/wpilib_interface.cc
+++ b/y2022/wpilib_interface.cc
@@ -701,13 +701,6 @@
 
     AddLoop(&output_event_loop);
 
-    // Thread 5
-    ::aos::ShmEventLoop can_sensor_reader_event_loop(&config.message());
-    CANSensorReader can_sensor_reader(&can_sensor_reader_event_loop);
-    can_sensor_reader.set_flipper_arms_falcon(
-        superstructure_writer.flipper_arms_falcon());
-    AddLoop(&can_sensor_reader_event_loop);
-
     RunLoops();
   }
 };