Skip to content

Commit

Permalink
Add set tolerance method to rotation PID controller
Browse files Browse the repository at this point in the history
  • Loading branch information
viggy96 committed Sep 18, 2024
1 parent 629f3c9 commit 66d8012
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/lasarobotics/drive/RotatePIDController.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ public Measure<Velocity<Angle>> calculate(Measure<Angle> currentAngle, Measure<V
return Units.DegreesPerSecond.of(m_pidController.calculate(currentAngle.in(Units.Degrees)));
}

/**
* Set the tolerable error
* @param positionTolerance Position error that is tolerable
* @param velocityTolerance Velocity error that is tolerable
*/
public void setTolerance(Measure<Angle> positionTolerance, Measure<Velocity<Angle>> velocityTolerance) {
m_pidController.setTolerance(positionTolerance.in(Units.Degrees), velocityTolerance.in(Units.DegreesPerSecond));
}

/**
* Set setpoint of rotation PID controller
* @param angle
Expand Down

0 comments on commit 66d8012

Please sign in to comment.