Set retention roller current limits in shooter.cc
This lets us turn down the current to 2 amps if we are loaded, if not we
want to go back up to 5 amps.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: Ib164af63052dd00533a75fee8b1f89073dbec749
diff --git a/y2024/control_loops/superstructure/shooter.cc b/y2024/control_loops/superstructure/shooter.cc
index 72ad0d6..2ddaf64 100644
--- a/y2024/control_loops/superstructure/shooter.cc
+++ b/y2024/control_loops/superstructure/shooter.cc
@@ -36,7 +36,8 @@
const y2024::control_loops::superstructure::Position *position,
const y2024::control_loops::superstructure::ShooterGoal *shooter_goal,
double *catapult_output, double *altitude_output, double *turret_output,
- double *retention_roller_output, double /*battery_voltage*/,
+ double *retention_roller_output,
+ double *retention_roller_stator_current_limit, double /*battery_voltage*/,
CollisionAvoidance *collision_avoidance, const double intake_pivot_position,
double *max_intake_pivot_position, double *min_intake_pivot_position,
flatbuffers::FlatBufferBuilder *fbb) {
@@ -74,6 +75,18 @@
if (retention_roller_output != nullptr) {
*retention_roller_output =
robot_constants_->common()->retention_roller_voltages()->retaining();
+
+ if (piece_loaded) {
+ *retention_roller_stator_current_limit =
+ robot_constants_->common()
+ ->current_limits()
+ ->slower_retention_roller_stator_current_limit();
+ } else {
+ *retention_roller_stator_current_limit =
+ robot_constants_->common()
+ ->current_limits()
+ ->retention_roller_stator_current_limit();
+ }
}
bool aiming = false;
diff --git a/y2024/control_loops/superstructure/shooter.h b/y2024/control_loops/superstructure/shooter.h
index 521fa04..1550fdc 100644
--- a/y2024/control_loops/superstructure/shooter.h
+++ b/y2024/control_loops/superstructure/shooter.h
@@ -66,7 +66,8 @@
flatbuffers::Offset<ShooterStatus> Iterate(
const Position *position, const ShooterGoal *shooter_goal,
double *catapult_output, double *altitude_output, double *turret_output,
- double *retention_roller_output, double battery_voltage,
+ double *retention_roller_output,
+ double *retention_roller_stator_current_limit, double battery_voltage,
/* Hacky way to use collision avoidance in this class */
CollisionAvoidance *collision_avoidance,
const double intake_pivot_position, double *max_turret_intake_position,
diff --git a/y2024/control_loops/superstructure/superstructure.cc b/y2024/control_loops/superstructure/superstructure.cc
index 29b4cc9..eeaa2fa 100644
--- a/y2024/control_loops/superstructure/superstructure.cc
+++ b/y2024/control_loops/superstructure/superstructure.cc
@@ -193,6 +193,9 @@
output != nullptr ? &output_struct.altitude_voltage : nullptr,
output != nullptr ? &output_struct.turret_voltage : nullptr,
output != nullptr ? &output_struct.retention_roller_voltage : nullptr,
+ output != nullptr
+ ? &output_struct.retention_roller_stator_current_limit
+ : nullptr,
robot_state().voltage_battery(), &collision_avoidance_,
intake_pivot_.estimated_position(), &max_intake_pivot_position,
&min_intake_pivot_position, status->fbb());