Set retention roller current limits
This also lets us set the current limits of the retention roller
dynamically as if we have the note we want to slow down and apply ~2.0
amps while if we don't think we have it we want to be doing ~5.0 amps.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I682d86fcfb20673e8d04ad57f70556784907e0d7
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index 282b3c7..6c32627 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -70,7 +70,9 @@
"turret_supply_current_limit": 35,
"turret_stator_current_limit": 60,
"altitude_supply_current_limit": 35,
- "altitude_stator_current_limit": 60
+ "altitude_stator_current_limit": 60,
+ "retention_roller_stator_current_limit": 5,
+ "retention_roller_supply_current_limit": 60
},
"transfer_roller_voltages": {
"transfer_in": 12.0,
diff --git a/y2024/constants/constants.fbs b/y2024/constants/constants.fbs
index f1c86a0..3b4942d 100644
--- a/y2024/constants/constants.fbs
+++ b/y2024/constants/constants.fbs
@@ -80,6 +80,8 @@
turret_stator_current_limit:double (id: 15);
altitude_supply_current_limit:double (id: 16);
altitude_stator_current_limit:double (id: 17);
+ retention_roller_supply_current_limit:double (id: 18);
+ retention_roller_stator_current_limit:double (id: 19);
}
table TransferRollerVoltages {
diff --git a/y2024/control_loops/superstructure/superstructure_output.fbs b/y2024/control_loops/superstructure/superstructure_output.fbs
index b0ae6de..37796ba 100644
--- a/y2024/control_loops/superstructure/superstructure_output.fbs
+++ b/y2024/control_loops/superstructure/superstructure_output.fbs
@@ -44,6 +44,9 @@
// Positive voltage rolls the game piece up towards the scoring mechanisms,
// either the catapult or amp/trap mechanism
extend_roller_voltage:double (id: 9);
+
+ // Dynamically sets the stator current limit for the retention_rollers
+ retention_roller_stator_current_limit: double (id: 10);
}
root_type Output;
diff --git a/y2024/wpilib_interface.cc b/y2024/wpilib_interface.cc
index 2cd4672..2686651 100644
--- a/y2024/wpilib_interface.cc
+++ b/y2024/wpilib_interface.cc
@@ -659,6 +659,11 @@
output.turret_voltage());
talonfx_map.find("retention_roller")
->second->WriteVoltage(output.retention_roller_voltage());
+ if (output.has_retention_roller_stator_current_limit()) {
+ talonfx_map.find("retention_roller")
+ ->second->set_stator_current_limit(
+ output.retention_roller_stator_current_limit());
+ }
});
can_drivetrain_writer.set_talonfxs({right_front, right_back},