Bringup main robot

This gets all mechanisms zeroed and running.

Many profiles are still heavily detuned.

Catapult motors are moved to the CANivore bus.

Change-Id: I38a1845f804bd490d5fff285c636010ac8ea2c27
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
index 54d083e..f717765 100644
--- a/y2024/constants/971.json
+++ b/y2024/constants/971.json
@@ -14,27 +14,27 @@
   "robot": {
     {% set _ = intake_pivot_zero.update(
       {
-          "measured_absolute_position" : 2.99648178674155
+          "measured_absolute_position" : 3.2990161941868
       }
     ) %}
     "intake_constants":  {{ intake_pivot_zero | tojson(indent=2)}},
     "climber_constants": {
       {% set _ = climber_zero.update(
           {
-              "measured_absolute_position" : 0.0102739460232857
+              "measured_absolute_position" : 0.00260967415741875
           }
       ) %}
       "zeroing_constants": {{ climber_zero | tojson(indent=2)}},
-      "potentiometer_offset": {{ -0.935529777248618 + 1.83632555414775 }}
+      "potentiometer_offset": {{ -0.935529777248618 + 1.83632555414775 + 0.0431080619919798 - 0.493015437796464 }}
     },
     "catapult_constants": {
       {% set _ = catapult_zero.update(
           {
-              "measured_absolute_position" : 2.79735930670211
+              "measured_absolute_position" : 2.8342002173381
           }
       ) %}
       "zeroing_constants": {{ catapult_zero | tojson(indent=2)}},
-      "potentiometer_offset": 8.54315997763211
+      "potentiometer_offset": {{ 8.54315997763211 - 0.189243355470936 + 0.148884325074452 }}
     },
     "altitude_constants": {
       {% set _ = altitude_zero.update(
@@ -48,20 +48,20 @@
     "turret_constants": {
       {% set _ = turret_zero.update(
           {
-              "measured_absolute_position" : 0.0
+              "measured_absolute_position" : 0.143052032770428
           }
       ) %}
       "zeroing_constants": {{ turret_zero | tojson(indent=2)}},
-      "potentiometer_offset": 0.0
+      "potentiometer_offset": {{ -6.26847263904651 + 0.00657023078932103 }}
     },
     "extend_constants": {
       {% set _ = extend_zero.update(
           {
-              "measured_absolute_position" : 0.0
+              "measured_absolute_position" : 0.0223997590714573
           }
       ) %}
       "zeroing_constants": {{ extend_zero | tojson(indent=2)}},
-      "potentiometer_offset": 0.0
+      "potentiometer_offset": {{ -0.2574404033256 + 0.0170793439542 }}
     }
   },
   {% include 'y2024/constants/common.json' %}
diff --git a/y2024/constants/common.jinja2 b/y2024/constants/common.jinja2
index c2902af..27f28ac 100644
--- a/y2024/constants/common.jinja2
+++ b/y2024/constants/common.jinja2
@@ -6,8 +6,8 @@
 {# we do this here so we keep the encoder ratio in plaintext and also keep the math we're using. #}
 {% set intake_pivot_encoder_ratio = (15.0 / 24.0) %}
 
-{% set intake_upper = 2.1 %}
-{% set intake_lower = 0.1 %}
+{% set intake_upper = 1.75 %}
+{% set intake_lower = -0.195 %}
 
 {%
 set intake_pivot_zero = {
@@ -33,7 +33,7 @@
 %}
 
 {% set climber_encoder_ratio = (16.0 / 60.0) %}
-{% set climber_circumference = 16.0 * 0.25 / 2.0 / pi * 0.0254 %}
+{% set climber_circumference = 16.0 * 0.25 * 0.0254 %}
 {%
 set climber_zero = {
     "average_filter_size": zeroing_sample_size,
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index 38d0a76..866f8b6 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -27,23 +27,23 @@
     "intaking": 12.0
   },
   "intake_pivot_set_points": {
-    "extended": 0.1,
-    "retracted": 2.0
+    "extended": 0.0,
+    "retracted": 1.0
   },
   "intake_pivot": {
     "zeroing_voltage": 3.0,
-    "operating_voltage": 12.0,
+    "operating_voltage": 6.0,
     "zeroing_profile_params": {
       "max_velocity": 0.5,
       "max_acceleration": 3.0
     },
     "default_profile_params":{
-      "max_velocity": 6.0,
-      "max_acceleration": 30.0
+      "max_velocity": 0.5,
+      "max_acceleration": 3.0
     },
     "range": {
-        "lower_hard": 0.0,
-        "upper_hard": 2.1,
+        "lower_hard": -0.2,
+        "upper_hard": 1.80,
         "lower": {{ intake_lower }},
         "upper": {{ intake_upper }}
     },
@@ -53,27 +53,29 @@
   // TODO: (niko) update the stator and supply current limits for the intake
   "current_limits": {
     // Values in amps
-    "intake_pivot_supply_current_limit": 35,
-    "intake_pivot_stator_current_limit": 60,
-    "intake_roller_supply_current_limit": 35,
-    "intake_roller_stator_current_limit": 60,
-    "transfer_roller_supply_current_limit": 35,
-    "transfer_roller_stator_current_limit": 60,
+    "intake_pivot_supply_current_limit": 5,
+    "intake_pivot_stator_current_limit": 40,
+    "intake_roller_supply_current_limit": 24,
+    "intake_roller_stator_current_limit": 55,
+    "transfer_roller_supply_current_limit": 25,
+    "transfer_roller_stator_current_limit": 66,
     "drivetrain_supply_current_limit": 35,
     "drivetrain_stator_current_limit": 60,
-    "climber_supply_current_limit": 35,
-    "climber_stator_current_limit": 300,
-    "extend_supply_current_limit": 35,
-    "extend_stator_current_limit": 300,
-    "extend_roller_supply_current_limit": 35,
-    "extend_roller_stator_current_limit": 60,
-    "turret_supply_current_limit": 35,
-    "turret_stator_current_limit": 60,
-    "altitude_supply_current_limit": 35,
+    "climber_supply_current_limit": 30,
+    "climber_stator_current_limit": 100,
+    "extend_supply_current_limit": 20,
+    "extend_stator_current_limit": 100,
+    "extend_roller_supply_current_limit": 23,
+    "extend_roller_stator_current_limit": 118,
+    "turret_supply_current_limit": 20,
+    "turret_stator_current_limit": 40,
+    "altitude_supply_current_limit": 10,
     "altitude_stator_current_limit": 60,
+    "catapult_supply_current_limit": 10,
+    "catapult_stator_current_limit": 30,
     "retention_roller_stator_current_limit": 5,
     "slower_retention_roller_stator_current_limit": 2,
-    "retention_roller_supply_current_limit": 60
+    "retention_roller_supply_current_limit": 10
   },
   "transfer_roller_voltages": {
     "transfer_in": 12.0,
@@ -84,9 +86,9 @@
     "reversing": -12.0
   },
   "climber_set_points": {
-    "full_extend": 0.8,
-    "stowed": 0.4,
-    "retract": 0.2
+    "full_extend": -0.005,
+    "stowed": -0.35,
+    "retract": -0.44
   },
   "climber": {
     "zeroing_voltage": 3.0,
@@ -96,33 +98,33 @@
       "max_acceleration": 3.0
     },
     "default_profile_params":{
-      "max_velocity": 6.0,
-      "max_acceleration": 30.0
+      "max_velocity": 0.05,
+      "max_acceleration": 3.0
     },
     "range": {
-        "lower_hard": 0.1,
-        "upper_hard": 2.01,
-        "lower": 0.2,
-        "upper": 2.0
+        "lower_hard": -0.488,
+        "upper_hard": 0.005,
+        "lower": -0.478,
+        "upper": -0.005
     },
     "loop": {% include 'y2024/control_loops/superstructure/climber/integral_climber_plant.json' %}
   },
   "catapult": {
     "zeroing_voltage": 3.0,
-    "operating_voltage": 12.0,
+    "operating_voltage": 3.0,
     "zeroing_profile_params": {
       "max_velocity": 1.0,
       "max_acceleration": 6.0
     },
     "default_profile_params":{
-      "max_velocity": 6.0,
-      "max_acceleration": 30.0
+      "max_velocity": 0.025,
+      "max_acceleration": 0.05
     },
     "range": {
-        "lower_hard": -0.15971,
-        "upper_hard": 2.85,
-        "lower": -0.020,
-        "upper": 2.5
+        "lower_hard": -0.05,
+        "upper_hard": 4.2,
+        "lower": 0.0,
+        "upper": 2.38
     },
     "loop": {% include 'y2024/control_loops/superstructure/catapult/integral_catapult_plant.json' %}
   },
@@ -135,13 +137,13 @@
       "max_acceleration": 3.0
     },
     "default_profile_params":{
-      "max_velocity": 6.0,
-      "max_acceleration": 30.0
+      "max_velocity": 0.25,
+      "max_acceleration": 0.25
     },
     "range": {
-        "lower_hard": -0.85,
-        "upper_hard": 1.85,
-        "lower": -0.400,
+        "lower_hard": -0.01,
+        "upper_hard": 1.66,
+        "lower": 0.0135,
         "upper": 1.57
     },
     "loop": {% include 'y2024/control_loops/superstructure/altitude/integral_altitude_plant.json' %}
@@ -154,14 +156,14 @@
       "max_acceleration": 3.0
     },
     "default_profile_params":{
-      "max_velocity": 6.0,
-      "max_acceleration": 30.0
+      "max_velocity": 1.00,
+      "max_acceleration": 1.5
     },
     "range": {
-        "lower_hard": -2.36,
-        "upper_hard": 2.36,
-        "lower": -2.16,
-        "upper": 2.16
+        "lower_hard": -4.8,
+        "upper_hard": 4.8,
+        "lower": -4.7,
+        "upper": 4.7
     },
     "loop": {% include 'y2024/control_loops/superstructure/turret/integral_turret_plant.json' %}
   },
@@ -173,14 +175,14 @@
       "max_acceleration": 3.0
     },
     "default_profile_params":{
-      "max_velocity": 6.0,
-      "max_acceleration": 20.0
+      "max_velocity": 0.1,
+      "max_acceleration": 0.3
     },
     "range": {
-        "lower_hard": -0.85,
-        "upper_hard": 1.85,
-        "lower": -0.400,
-        "upper": 1.57
+        "lower_hard": -0.005,
+        "upper_hard": 0.47,
+        "lower": 0.005,
+        "upper": 0.46
     },
     "loop": {% include 'y2024/control_loops/superstructure/extend/integral_extend_plant.json' %}
   },
@@ -208,10 +210,11 @@
         "theta": 0.0
     }
   },
-  "altitude_loading_position": 0.0,
-  "turret_loading_position": 0.0,
+  "altitude_loading_position": 0.02,
+  "turret_loading_position": 0.58,
   "catapult_return_position": 0.0,
-  "min_altitude_shooting_angle": 0.3,
+  "min_altitude_shooting_angle": 0.55,
+  "max_altitude_shooting_angle": 0.89,
   "retention_roller_voltages": {
     "retaining": 1.5,
     "spitting": -6.0
@@ -228,10 +231,10 @@
     "shot_velocity": 0.0
   },
   "extend_set_points": {
-    "trap": 0.2,
-    "amp": 0.3,
-    "catapult": 0.1,
-    "retracted": 0.0
+    "trap": 0.46,
+    "amp": 0.2,
+    "catapult": 0.017,
+    "retracted": 0.017
   },
-  "turret_avoid_extend_collision_position": 1.0
+  "turret_avoid_extend_collision_position": 0.0
 }
diff --git a/y2024/constants/constants.fbs b/y2024/constants/constants.fbs
index 883a945..d2e4ede 100644
--- a/y2024/constants/constants.fbs
+++ b/y2024/constants/constants.fbs
@@ -83,6 +83,8 @@
   retention_roller_supply_current_limit:double (id: 18);
   retention_roller_stator_current_limit:double (id: 19);
   slower_retention_roller_stator_current_limit:double (id: 20);
+  catapult_supply_current_limit:double (id: 21);
+  catapult_stator_current_limit:double (id: 22);
 }
 
 table TransferRollerVoltages {
@@ -162,6 +164,7 @@
   altitude_loading_position: double (id: 18);
   retention_roller_voltages:RetentionRollerVoltages (id: 19);
   min_altitude_shooting_angle: double (id: 20);
+  max_altitude_shooting_angle: double (id: 25);
   shooter_speaker_set_point: ShooterSetPoint (id: 21);
   shooter_podium_set_point: ShooterSetPoint (id: 22);
     extend_set_points:ExtendSetPoints (id: 23);