Add Climber Constants

Signed-off-by: Filip Kujawa <filip.j.kujawa@gmail.com>
Change-Id: If56eca5a6b7a97ad6c0519d232086d7b0428c9d9
diff --git a/y2024/constants/7971.json b/y2024/constants/7971.json
index 7e04438..9e6bafb 100644
--- a/y2024/constants/7971.json
+++ b/y2024/constants/7971.json
@@ -1,4 +1,5 @@
 {% from 'y2024/constants/common.jinja2' import intake_pivot_zero %}
+{% from 'y2024/constants/common.jinja2' import climber_zero %}
 
 {
   "robot": {
@@ -8,7 +9,16 @@
               "measured_absolute_position" : 0.0
           }
       ) %}
-      "intake_pivot_zero": {{ intake_pivot_zero | tojson(indent=2)}},
+      "zeroing_constants": {{ intake_pivot_zero | tojson(indent=2)}},
+      "potentiometer_offset": 0.0
+    },
+    "climber_constants": {
+      {% set _ = climber_zero.update(
+          {
+              "measured_absolute_position" : 0.0
+          }
+      ) %}
+      "zeroing_constants": {{ climber_zero | tojson(indent=2)}},
       "potentiometer_offset": 0.0
     }
   },
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
index a061f39..641783f 100644
--- a/y2024/constants/971.json
+++ b/y2024/constants/971.json
@@ -1,4 +1,5 @@
 {% from 'y2024/constants/common.jinja2' import intake_pivot_zero %}
+{% from 'y2024/constants/common.jinja2' import climber_zero %}
 
 {
   "cameras": [
@@ -13,7 +14,16 @@
               "measured_absolute_position" : 0.0
           }
       ) %}
-      "intake_pivot_zero": {{ intake_pivot_zero | tojson(indent=2)}},
+      "zeroing_constants": {{ intake_pivot_zero | tojson(indent=2)}},
+      "potentiometer_offset": 0.0
+    },
+    "climber_constants": {
+      {% set _ = climber_zero.update(
+          {
+              "measured_absolute_position" : 0.0
+          }
+      ) %}
+      "zeroing_constants": {{ climber_zero | tojson(indent=2)}},
       "potentiometer_offset": 0.0
     }
   },
diff --git a/y2024/constants/9971.json b/y2024/constants/9971.json
index 7e04438..9e6bafb 100644
--- a/y2024/constants/9971.json
+++ b/y2024/constants/9971.json
@@ -1,4 +1,5 @@
 {% from 'y2024/constants/common.jinja2' import intake_pivot_zero %}
+{% from 'y2024/constants/common.jinja2' import climber_zero %}
 
 {
   "robot": {
@@ -8,7 +9,16 @@
               "measured_absolute_position" : 0.0
           }
       ) %}
-      "intake_pivot_zero": {{ intake_pivot_zero | tojson(indent=2)}},
+      "zeroing_constants": {{ intake_pivot_zero | tojson(indent=2)}},
+      "potentiometer_offset": 0.0
+    },
+    "climber_constants": {
+      {% set _ = climber_zero.update(
+          {
+              "measured_absolute_position" : 0.0
+          }
+      ) %}
+      "zeroing_constants": {{ climber_zero | tojson(indent=2)}},
       "potentiometer_offset": 0.0
     }
   },
diff --git a/y2024/constants/BUILD b/y2024/constants/BUILD
index 18e506a..1f25bcb 100644
--- a/y2024/constants/BUILD
+++ b/y2024/constants/BUILD
@@ -23,6 +23,7 @@
         "test_data/*.json",
     ]) + [
         "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_json",
+        "//y2024/control_loops/superstructure/climber:climber_json",
         "//y2024/control_loops/drivetrain:drivetrain_config.json",
         "common.json",
         "common.jinja2",
@@ -43,6 +44,7 @@
         "common.json",
         "//y2024/constants/calib_files",
         "//y2024/control_loops/drivetrain:drivetrain_config.json",
+        "//y2024/control_loops/superstructure/climber:climber_json",
         "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_json",
         "//y2024/vision/maps",
     ],
diff --git a/y2024/constants/common.jinja2 b/y2024/constants/common.jinja2
index b260074..21b061c 100644
--- a/y2024/constants/common.jinja2
+++ b/y2024/constants/common.jinja2
@@ -14,3 +14,16 @@
     "allowable_encoder_error": 0.9
 }
 %}
+
+{# TODO(Filip): Update climber values #}
+{% set climber_encoder_ratio = (1.0 / 1.0) %}
+{% set climber_radius = 0.436496 %}
+{%
+set climber_zero = {
+    "average_filter_size": zeroing_sample_size,
+    "one_revolution_distance": pi * 2.0 * climber_encoder_ratio * climber_radius,
+    "zeroing_threshold": 0.0005,
+    "moving_buffer_size": 20,
+    "allowable_encoder_error": 0.9
+}
+%}
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index 3da88fe..c632afb 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -52,5 +52,29 @@
   "transfer_roller_voltages": {
     "transfer_in": 12.0,
     "transfer_out": -12.0
+  },
+  "climber_set_points": {
+    "full_extend": 0.0,
+    "half_extend": 0.0,
+    "retract": 0.0
+  },
+  "climber": {
+    "zeroing_voltage": 3.0,
+    "operating_voltage": 12.0,
+    "zeroing_profile_params": {
+      "max_velocity": 0.5,
+      "max_acceleration": 3.0
+    },
+    "default_profile_params":{
+      "max_velocity": 6.0,
+      "max_acceleration": 30.0
+    },
+    "range": {
+        "lower_hard": -0.01,
+        "upper_hard": 0.5,
+        "lower": 0.003,
+        "upper": 0.4
+    },
+    "loop": {% include 'y2024/control_loops/superstructure/climber/integral_climber_plant.json' %}
   }
 }
diff --git a/y2024/constants/constants.fbs b/y2024/constants/constants.fbs
index 4a40487..70bcd6d 100644
--- a/y2024/constants/constants.fbs
+++ b/y2024/constants/constants.fbs
@@ -36,9 +36,18 @@
   retracted:double (id: 1);
 }
 
-// Intake Constants
-table IntakeConstants {
-  intake_pivot_zero:frc971.zeroing.PotAndAbsoluteEncoderZeroingConstants (id: 0);
+// Set points for the climber in meters when:
+// fully extended, which represents meters for when ClimberGoal is FULL_EXTEND
+// partially extended, which represents meters for when ClimberGoal is HALF_EXTEND
+// and retracted, which represents meters for when ClimberGoal is RETRACT
+table ClimberSetPoints {
+  full_extend:double (id: 0);
+  half_extend:double (id: 1);
+  retract:double (id: 2);
+}
+
+table PotAndAbsEncoderConstants {
+  zeroing_constants:frc971.zeroing.PotAndAbsoluteEncoderZeroingConstants (id: 0);
   potentiometer_offset:double (id: 1);
 }
 
@@ -60,7 +69,9 @@
 }
 
 table RobotConstants {
-  intake_constants:IntakeConstants (id: 0);
+  intake_constants:PotAndAbsEncoderConstants (id: 0);
+  climber_constants:PotAndAbsEncoderConstants (id: 1);
+
 }
 
 // Common table for constants unrelated to the robot
@@ -73,6 +84,8 @@
   drivetrain:frc971.control_loops.drivetrain.fbs.DrivetrainConfig (id: 5);
   current_limits:CurrentLimits (id: 6);
   transfer_roller_voltages:TransferRollerVoltages (id: 7);
+  climber:frc971.control_loops.StaticZeroingSingleDOFProfiledSubsystemCommonParams (id: 8);
+  climber_set_points:ClimberSetPoints (id: 9);
 }
 
 table Constants {
diff --git a/y2024/constants/test_data/test_team.json b/y2024/constants/test_data/test_team.json
index 7e04438..9e6bafb 100644
--- a/y2024/constants/test_data/test_team.json
+++ b/y2024/constants/test_data/test_team.json
@@ -1,4 +1,5 @@
 {% from 'y2024/constants/common.jinja2' import intake_pivot_zero %}
+{% from 'y2024/constants/common.jinja2' import climber_zero %}
 
 {
   "robot": {
@@ -8,7 +9,16 @@
               "measured_absolute_position" : 0.0
           }
       ) %}
-      "intake_pivot_zero": {{ intake_pivot_zero | tojson(indent=2)}},
+      "zeroing_constants": {{ intake_pivot_zero | tojson(indent=2)}},
+      "potentiometer_offset": 0.0
+    },
+    "climber_constants": {
+      {% set _ = climber_zero.update(
+          {
+              "measured_absolute_position" : 0.0
+          }
+      ) %}
+      "zeroing_constants": {{ climber_zero | tojson(indent=2)}},
       "potentiometer_offset": 0.0
     }
   },