sum chang

This commit is contained in:
aarav18
2022-03-17 12:43:54 -06:00
parent 25426d7f33
commit 8212c2c70a
2 changed files with 6 additions and 7 deletions
@@ -146,16 +146,16 @@ public class Turret extends SubsystemBase {
leftPrevState = leftState; // * Update the state of the left limit switch.
// speed limiting near hard limits
// * speed limiting near hard limits. tolerance (distance when ramping starts) is 20 rotations. speed at hard limits is 0.2 (percent output).
double currentPos = this.getEncoderPosition();
double forwardDistance = Math.abs(currentPos - ShooterConstants.TURRET_FORWARD_SOFT_LIMIT);
double reverseDistance = Math.abs(currentPos - ShooterConstants.TURRET_REVERSE_SOFT_LIMIT);
if (forwardDistance < 20.0) {
if (forwardDistance < ShooterConstants.TURRET_HARD_LIMIT_TOLERANCE) {
this.speedLimiter = 0.2 + (forwardDistance * 0.05);
}
if (reverseDistance < 20.0) {
if (reverseDistance < ShooterConstants.TURRET_HARD_LIMIT_TOLERANCE) {
this.speedLimiter = 0.2 + (reverseDistance * 0.05);
}
}