Increase shot power and range
We can now shoot from further away. This change also sets us up so we
can shoot from off center better too.
The acceleration plant wasn't matching the deceleration plant very well
since the note was going away and we were fighting efficiency the other
way. Gain schedule to a different set of gains when decelerating the
cataputl.
Change-Id: Ie1955226e7148e10b447084ec04cc5bf7e91e78a
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2024/control_loops/superstructure/shooter.cc b/y2024/control_loops/superstructure/shooter.cc
index 88bf390..7002657 100644
--- a/y2024/control_loops/superstructure/shooter.cc
+++ b/y2024/control_loops/superstructure/shooter.cc
@@ -248,7 +248,7 @@
//
// accel = v^2 / (2 * x)
catapult_.mutable_profile()->set_maximum_velocity(
- catapult::kFreeSpeed * catapult::kOutputRatio * 4.0 / 12.0);
+ catapult::kFreeSpeed * catapult::kOutputRatio * 5.5 / 12.0);
if (disabled) {
state_ = CatapultState::RETRACTING;
@@ -272,6 +272,7 @@
if (subsystems_in_range && shooter_goal != nullptr && fire &&
catapult_close && piece_loaded) {
state_ = CatapultState::FIRING;
+ max_catapult_goal_velocity_ = catapult_.goal(1);
} else {
catapult_.set_controller_index(0);
catapult_.mutable_profile()->set_maximum_acceleration(
@@ -294,10 +295,17 @@
robot_constants_->common()
->current_limits()
->shooting_retention_roller_stator_current_limit();
- catapult_.set_controller_index(1);
+ max_catapult_goal_velocity_ =
+ std::max(max_catapult_goal_velocity_, catapult_.goal(1));
+
+ if (max_catapult_goal_velocity_ > catapult_.goal(1) + 0.1) {
+ catapult_.set_controller_index(2);
+ } else {
+ catapult_.set_controller_index(1);
+ }
catapult_.mutable_profile()->set_maximum_acceleration(400.0);
- catapult_.mutable_profile()->set_maximum_deceleration(500.0);
- catapult_.set_unprofiled_goal(2.0, 0.0);
+ catapult_.mutable_profile()->set_maximum_deceleration(1000.0);
+ catapult_.set_unprofiled_goal(2.45, 0.0);
if (CatapultClose()) {
state_ = CatapultState::RETRACTING;
++shot_count_;