Skip to content

Commit

Permalink
Update MotionProfiledDcMotor.java
Browse files Browse the repository at this point in the history
  • Loading branch information
pserb committed Apr 13, 2022
1 parent b70ff8f commit 51904c5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ public void setTargetPosition(double targetPosition) {
profileTimer.reset();
}

public void setTargetPosition(double targetPosition, double retractionMultiplier) {
if (targetPosition < getPosition()) { profile = generateProfile(targetPosition, MAX_VEL * retractionMultiplier, MAX_ACCEL * RETRACTION_MULTIPLIER); }
else { profile = generateProfile(targetPosition, MAX_VEL, MAX_ACCEL); }
profileTimer.reset();
}

/**
* Overrides DcMotor method setTargetPosition(int) to utilize motion profile
*
Expand Down

0 comments on commit 51904c5

Please sign in to comment.