[wpimath] Fix Rotation2d interpolation in Java (#4125)

Fixes #4112.
This commit is contained in:
Tyler Veness
2022-03-29 08:42:43 -07:00
committed by GitHub
parent 2e462a19d3
commit b4620f01f9
2 changed files with 16 additions and 1 deletions

View File

@@ -206,6 +206,6 @@ public class Rotation2d implements Interpolatable<Rotation2d> {
@Override
@SuppressWarnings("ParameterName")
public Rotation2d interpolate(Rotation2d endValue, double t) {
return new Rotation2d(MathUtil.interpolate(this.getRadians(), endValue.getRadians(), t));
return plus(endValue.minus(this).times(MathUtil.clamp(t, 0, 1)));
}
}