Add intake zeroing constants
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I37406f09566c36a8ff1eb68c91c8c7b7d03ea278
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
index ec59033..ee1d2a1 100644
--- a/y2024/constants/971.json
+++ b/y2024/constants/971.json
@@ -14,7 +14,7 @@
"robot": {
{% set _ = intake_pivot_zero.update(
{
- "measured_absolute_position" : 0.0
+ "measured_absolute_position" : 2.99648178674155
}
) %}
"intake_constants": {{ intake_pivot_zero | tojson(indent=2)}},
diff --git a/y2024/constants/common.jinja2 b/y2024/constants/common.jinja2
index e132993..d2ac3dc 100644
--- a/y2024/constants/common.jinja2
+++ b/y2024/constants/common.jinja2
@@ -4,12 +4,16 @@
{# Intake #}
{# 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 = (24.0 / 15.0) %}
+{% set intake_pivot_encoder_ratio = (15.0 / 24.0) %}
+
+{% set intake_upper = 2.1 %}
+{% set intake_lower = 0.1 %}
{%
set intake_pivot_zero = {
"average_filter_size": zeroing_sample_size,
"one_revolution_distance": pi * 2.0 * intake_pivot_encoder_ratio,
+ "middle_position": (intake_upper + intake_lower) / 2,
"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 e444f8d..99664b7 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -1,3 +1,5 @@
+{% from 'y2024/constants/common.jinja2' import intake_upper, intake_lower %}
+
"common": {
"target_map": {% include 'y2024/vision/maps/target_map.json' %},
"shooter_interpolation_table": [
@@ -16,8 +18,8 @@
"intaking": 12.0
},
"intake_pivot_set_points": {
- "extended": 1.5,
- "retracted": 0.5
+ "extended": 0.1,
+ "retracted": 2.0
},
"intake_pivot": {
"zeroing_voltage": 3.0,
@@ -31,10 +33,10 @@
"max_acceleration": 30.0
},
"range": {
- "lower_hard": -0.85,
- "upper_hard": 1.85,
- "lower": -0.400,
- "upper": 1.57
+ "lower_hard": 0.0,
+ "upper_hard": 2.1,
+ "lower": {{ intake_lower }},
+ "upper": {{ intake_upper }}
},
"loop": {% include 'y2024/control_loops/superstructure/intake_pivot/integral_intake_pivot_plant.json' %}
},
diff --git a/y2024/wpilib_interface.cc b/y2024/wpilib_interface.cc
index 7e55780..508b610 100644
--- a/y2024/wpilib_interface.cc
+++ b/y2024/wpilib_interface.cc
@@ -392,6 +392,8 @@
&constant_fetcher_event_loop);
const Constants *robot_constants = &constants_fetcher.constants();
+ AddLoop(&constant_fetcher_event_loop);
+
// Thread 1.
::aos::ShmEventLoop joystick_sender_event_loop(&config.message());
::frc971::wpilib::JoystickSender joystick_sender(