Add Climber Constants

Signed-off-by: Filip Kujawa <filip.j.kujawa@gmail.com>
Change-Id: If56eca5a6b7a97ad6c0519d232086d7b0428c9d9
diff --git a/y2024/control_loops/python/BUILD b/y2024/control_loops/python/BUILD
index f92b484..da80d87 100644
--- a/y2024/control_loops/python/BUILD
+++ b/y2024/control_loops/python/BUILD
@@ -61,6 +61,22 @@
     ],
 )
 
+py_binary(
+    name = "climber",
+    srcs = [
+        "climber.py",
+    ],
+    legacy_create_init = False,
+    target_compatible_with = ["@platforms//cpu:x86_64"],
+    deps = [
+        ":python_init",
+        "//frc971/control_loops/python:controls",
+        "//frc971/control_loops/python:linear_system",
+        "@pip//glog",
+        "@pip//python_gflags",
+    ],
+)
+
 py_library(
     name = "python_init",
     srcs = ["__init__.py"],
diff --git a/y2024/control_loops/python/climber.py b/y2024/control_loops/python/climber.py
new file mode 100644
index 0000000..10aeff9
--- /dev/null
+++ b/y2024/control_loops/python/climber.py
@@ -0,0 +1,54 @@
+#!/usr/bin/python3
+
+from frc971.control_loops.python import control_loop
+from frc971.control_loops.python import linear_system
+import numpy
+import sys
+import gflags
+import glog
+
+FLAGS = gflags.FLAGS
+
+try:
+    gflags.DEFINE_bool('plot', False, 'If true, plot the loop response.')
+except gflags.DuplicateFlagError:
+    pass
+
+# TODO(Filip): Update information the climber when design is finalized.
+kClimber = linear_system.LinearSystemParams(
+    name='Climber',
+    motor=control_loop.Falcon(),
+    G=(1.0 / 4.0) * (1.0 / 3.0) * (1.0 / 3.0),
+    radius=22 * 0.25 / numpy.pi / 2.0 * 0.0254,
+    mass=2.0,
+    q_pos=0.10,
+    q_vel=1.35,
+    kalman_q_pos=0.12,
+    kalman_q_vel=2.00,
+    kalman_q_voltage=35.0,
+    kalman_r_position=0.05)
+
+
+def main(argv):
+    if FLAGS.plot:
+        R = numpy.matrix([[0.2], [0.0]])
+        linear_system.PlotKick(kClimber, R, plant_params=kClimber)
+        linear_system.PlotMotion(kClimber,
+                                 R,
+                                 max_velocity=5.0,
+                                 plant_params=kClimber)
+
+    # Write the generated constants out to a file.
+    if len(argv) != 7:
+        glog.fatal(
+            'Expected .h file name and .cc file name for the climber and integral climber.'
+        )
+    else:
+        namespaces = ['y2024', 'control_loops', 'superstructure', 'climber']
+    linear_system.WriteLinearSystem(kClimber, argv[1:4], argv[4:7], namespaces)
+
+
+if __name__ == '__main__':
+    argv = FLAGS(sys.argv)
+    glog.init()
+    sys.exit(main(argv))
diff --git a/y2024/control_loops/superstructure/climber/BUILD b/y2024/control_loops/superstructure/climber/BUILD
new file mode 100644
index 0000000..4a044d2
--- /dev/null
+++ b/y2024/control_loops/superstructure/climber/BUILD
@@ -0,0 +1,42 @@
+package(default_visibility = ["//y2024:__subpackages__"])
+
+genrule(
+    name = "genrule_climber",
+    outs = [
+        "climber_plant.h",
+        "climber_plant.cc",
+        "climber_plant.json",
+        "integral_climber_plant.h",
+        "integral_climber_plant.cc",
+        "integral_climber_plant.json",
+    ],
+    cmd = "$(location //y2024/control_loops/python:climber) $(OUTS)",
+    target_compatible_with = ["@platforms//os:linux"],
+    tools = [
+        "//y2024/control_loops/python:climber",
+    ],
+)
+
+cc_library(
+    name = "climber_plants",
+    srcs = [
+        "climber_plant.cc",
+        "integral_climber_plant.cc",
+    ],
+    hdrs = [
+        "climber_plant.h",
+        "integral_climber_plant.h",
+    ],
+    target_compatible_with = ["@platforms//os:linux"],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//frc971/control_loops:hybrid_state_feedback_loop",
+        "//frc971/control_loops:state_feedback_loop",
+    ],
+)
+
+filegroup(
+    name = "climber_json",
+    srcs = ["integral_climber_plant.json"],
+    visibility = ["//visibility:public"],
+)
diff --git a/y2024/control_loops/superstructure/superstructure.cc b/y2024/control_loops/superstructure/superstructure.cc
index 9a703e3..566c402 100644
--- a/y2024/control_loops/superstructure/superstructure.cc
+++ b/y2024/control_loops/superstructure/superstructure.cc
@@ -33,7 +33,7 @@
       transfer_goal_(TransferRollerGoal::NONE),
       intake_pivot_(
           robot_constants_->common()->intake_pivot(),
-          robot_constants_->robot()->intake_constants()->intake_pivot_zero()) {
+          robot_constants_->robot()->intake_constants()->zeroing_constants()) {
   event_loop->SetRuntimeRealtimePriority(30);
 }
 
diff --git a/y2024/control_loops/superstructure/superstructure_lib_test.cc b/y2024/control_loops/superstructure/superstructure_lib_test.cc
index 26e75e4..710de4b 100644
--- a/y2024/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2024/control_loops/superstructure/superstructure_lib_test.cc
@@ -56,13 +56,13 @@
             new CappedTestPlant(intake_pivot::MakeIntakePivotPlant()),
             PositionSensorSimulator(simulated_robot_constants->robot()
                                         ->intake_constants()
-                                        ->intake_pivot_zero()
+                                        ->zeroing_constants()
                                         ->one_revolution_distance()),
             {.subsystem_params =
                  {simulated_robot_constants->common()->intake_pivot(),
                   simulated_robot_constants->robot()
                       ->intake_constants()
-                      ->intake_pivot_zero()},
+                      ->zeroing_constants()},
              .potentiometer_offset = simulated_robot_constants->robot()
                                          ->intake_constants()
                                          ->potentiometer_offset()},
@@ -70,7 +70,7 @@
                 simulated_robot_constants->common()->intake_pivot()->range()),
             simulated_robot_constants->robot()
                 ->intake_constants()
-                ->intake_pivot_zero()
+                ->zeroing_constants()
                 ->measured_absolute_position(),
             dt_) {
     intake_pivot_.InitializePosition(