Add "disable_climber" and "disable_extend" to robot json files
This allows for disabling the climber and extend through robot.json files. Since the climber currently does not work it will be set to true.
Signed-off-by: Niko Sohmers <nikolai@sohmers.com>
Change-Id: I2e06d68c53a36cf6fd7a9fc6f8fb22beab78c334
diff --git a/y2024/constants/7971.json b/y2024/constants/7971.json
index 3beaae0..2fe58cf 100644
--- a/y2024/constants/7971.json
+++ b/y2024/constants/7971.json
@@ -71,7 +71,9 @@
) %}
"zeroing_constants": {{ extend_zero | tojson(indent=2)}},
"potentiometer_offset": 0.0
- }
+ },
+ "disable_extend": false,
+ "disable_climber": false
},
{% include 'y2024/constants/common.json' %}
}
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
index 974fb60..4fc2f3a 100644
--- a/y2024/constants/971.json
+++ b/y2024/constants/971.json
@@ -71,7 +71,9 @@
) %}
"zeroing_constants": {{ extend_zero | tojson(indent=2)}},
"potentiometer_offset": {{ -0.2574404033256 + 0.0170793439542 - 0.177097393974999 + 0.3473623911879 - 0.1577}}
- }
+ },
+ "disable_extend": false,
+ "disable_climber": true
},
{% include 'y2024/constants/common.json' %}
}
diff --git a/y2024/constants/9971.json b/y2024/constants/9971.json
index ec59033..23cad58 100644
--- a/y2024/constants/9971.json
+++ b/y2024/constants/9971.json
@@ -62,7 +62,9 @@
) %}
"zeroing_constants": {{ extend_zero | tojson(indent=2)}},
"potentiometer_offset": 0.0
- }
+ },
+ "disable_extend": false,
+ "disable_climber": false
},
{% include 'y2024/constants/common.json' %}
}
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index 65fe20e..99947ef 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -269,6 +269,5 @@
"ignore_targets": {
"red": [1, 2, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16],
"blue": [1, 2, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16]
- },
- "disable_extend": false
-}
+ }
+}
\ No newline at end of file
diff --git a/y2024/constants/constants.fbs b/y2024/constants/constants.fbs
index 1554f4c..99d49a4 100644
--- a/y2024/constants/constants.fbs
+++ b/y2024/constants/constants.fbs
@@ -132,6 +132,8 @@
altitude_constants:PotAndAbsEncoderConstants (id: 3);
turret_constants:PotAndAbsEncoderConstants (id: 4);
extend_constants:PotAndAbsEncoderConstants (id: 5);
+ disable_extend:bool (id: 6);
+ disable_climber:bool (id: 7);
}
table ShooterSetPoint {
@@ -197,7 +199,6 @@
altitude_avoid_extend_collision_position: double (id: 28);
autonomous_mode:AutonomousMode (id: 26);
ignore_targets:IgnoreTargets (id: 27);
- disable_extend:bool (id: 29);
}
table Constants {
diff --git a/y2024/constants/test_data/test_team.json b/y2024/constants/test_data/test_team.json
index b717224..37d9de1 100644
--- a/y2024/constants/test_data/test_team.json
+++ b/y2024/constants/test_data/test_team.json
@@ -71,7 +71,9 @@
) %}
"zeroing_constants": {{ extend_zero | tojson(indent=2)}},
"potentiometer_offset": 0.0
- }
+ },
+ "disable_extend": false,
+ "disable_climber": false
},
{% include 'y2024/constants/common.json' %}
}
diff --git a/y2024/control_loops/superstructure/shooter.cc b/y2024/control_loops/superstructure/shooter.cc
index 79da980..88bf390 100644
--- a/y2024/control_loops/superstructure/shooter.cc
+++ b/y2024/control_loops/superstructure/shooter.cc
@@ -186,10 +186,10 @@
{.intake_pivot_position = intake_pivot_position,
.turret_position = turret_.estimated_position(),
.extend_position =
- ((!robot_constants_->common()->disable_extend()) ? extend_position
- : 0.0)},
+ ((!robot_constants_->robot()->disable_extend()) ? extend_position
+ : 0.0)},
turret_goal->unsafe_goal(),
- ((!robot_constants_->common()->disable_extend()) ? extend_goal : 0.0));
+ ((!robot_constants_->robot()->disable_extend()) ? extend_goal : 0.0));
if (!CatapultRetracted()) {
altitude_.set_min_position(
diff --git a/y2024/control_loops/superstructure/superstructure.cc b/y2024/control_loops/superstructure/superstructure.cc
index 5727546..4ab5966 100644
--- a/y2024/control_loops/superstructure/superstructure.cc
+++ b/y2024/control_loops/superstructure/superstructure.cc
@@ -162,7 +162,7 @@
// considered ready to accept note from the transfer rollers. If disable
// extend is triggered, this will autoatically be false.
const bool extend_at_retracted =
- (!robot_constants_->common()->disable_extend() &&
+ (!robot_constants_->robot()->disable_extend() &&
PositionNear(extend_.position(), extend_set_points->retracted(),
kExtendThreshold));
@@ -532,7 +532,7 @@
const bool collided = collision_avoidance_.IsCollided({
.intake_pivot_position = intake_pivot_.estimated_position(),
.turret_position = shooter_.turret().estimated_position(),
- .extend_position = ((!robot_constants_->common()->disable_extend())
+ .extend_position = ((!robot_constants_->robot()->disable_extend())
? extend_.estimated_position()
: 0.0),
});
@@ -642,10 +642,15 @@
status->fbb());
// Zero out extend voltage if "disable_extend" is true
- if (robot_constants_->common()->disable_extend()) {
+ if (robot_constants_->robot()->disable_extend()) {
output_struct.extend_voltage = 0.0;
}
+ // Zero out climber voltage if "disable_climber" is true
+ if (robot_constants_->robot()->disable_climber()) {
+ output_struct.climber_voltage = 0.0;
+ }
+
if (output) {
output->CheckOk(output->Send(Output::Pack(*output->fbb(), &output_struct)));
}
diff --git a/y2024/wpilib_interface.cc b/y2024/wpilib_interface.cc
index 6b2acc4..803845c 100644
--- a/y2024/wpilib_interface.cc
+++ b/y2024/wpilib_interface.cc
@@ -493,7 +493,7 @@
current_limits->climber_stator_current_limit(),
current_limits->climber_supply_current_limit());
std::shared_ptr<TalonFX> extend =
- (robot_constants->common()->disable_extend())
+ (robot_constants->robot()->disable_extend())
? nullptr
: std::make_shared<TalonFX>(
12, false, "Drivetrain Bus", &canivore_signal_registry,
@@ -714,7 +714,7 @@
can_superstructure_writer.add_talonfx("catapult_two", catapult_two);
can_superstructure_writer.add_talonfx("turret", turret);
can_superstructure_writer.add_talonfx("climber", climber);
- if (!robot_constants->common()->disable_extend()) {
+ if (!robot_constants->robot()->disable_extend()) {
can_superstructure_writer.add_talonfx("extend", extend);
}
can_superstructure_writer.add_talonfx("intake_roller", intake_roller);