You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicabstractclassMotionControllerimplementsSubsystem {
protectedDoubleConsumeroutput;
protectedfinalPIDSensorsensor;
protecteddoublesetpoint;
protecteddoubleabsoluteTolerance;
......
publicMotionController(PIDSensorsensor, DoubleConsumeroutput) {
this.sensor = sensor;
setOutput(output);
enable = false;
overridden = false;
absoluteTolerance = Double.MIN_VALUE; // Nonzero to avoid floating point errors
......
}
/** * True if the error in the motion controller is less than the tolerance of the * motion controller. * * @return */publicbooleanonTarget() {
returnMath.abs(getError()) <= absoluteTolerance;
}
......
}
the onTarget() method only returns true IF our error (offset from the target point) is less than or equal to absoluteTolerance = Double.MIN_VALUE, which will never happen. absoluteTolerance needs to be increased to a reasonably small decimal value or tuned based on the required tolerance of each individual subsystem.
The text was updated successfully, but these errors were encountered:
b-cho
changed the title
MotionController.onTarget() is only true when error is exactly zeroMotionController.onTarget() is only true when error is <= Double.MIN_VALUEFeb 20, 2022
In
MotionController.java
:the
onTarget()
method only returns true IF our error (offset from the target point) is less than or equal toabsoluteTolerance = Double.MIN_VALUE
, which will never happen.absoluteTolerance
needs to be increased to a reasonably small decimal value or tuned based on the required tolerance of each individual subsystem.The text was updated successfully, but these errors were encountered: