Is there a way to check if motion magic has reached its set way point like a method?
If(Talon1.hasReachedsetPoint()){
New point
}
Is there another way to do such thing or
Is there a better way to do such thing
You can create a tolerance variable, then in a method check if the targetPosition - currentPosition < tolerance
public boolean hasReachedSetpoint() {
double tolerance = 100;
double error = Math.abs(targetPosition - currentPosition);
return (error < tolerance);
}
We have something like this in our code this year, but we didn’t actually use it. Line 309:
https://github.com/team6637/Robot2019/blob/master/src/main/java/frc/robot/subsystems/Lift.java
1 Like
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.