use of me.wobblyyyy.pathfinder2.geometry.Angle in project Pathfinder2 by Wobblyyyy.
the class RelativeMecanumKinematics method calculate.
@Override
public MecanumState calculate(Translation translation) {
double xyMagnitude = MinMax.clip(Math.hypot(translation.vx(), translation.vy()), minMagnitude, maxMagnitude);
Angle angle = Angle.atan2(translation.vy(), translation.vx()).add(angleOffset);
double turn = translation.vz() * turnMagnitude;
double fl = (calculatePower(angle, WHEEL_ANGLES[0]) * xyMagnitude) + turn;
double fr = (calculatePower(angle, WHEEL_ANGLES[1]) * xyMagnitude) - turn;
double bl = (calculatePower(angle, WHEEL_ANGLES[2]) * xyMagnitude) + turn;
double br = (calculatePower(angle, WHEEL_ANGLES[3]) * xyMagnitude) - turn;
return new MecanumState(fl, fr, bl, br).normalizeFromMaxUnderOne();
}
use of me.wobblyyyy.pathfinder2.geometry.Angle in project Pathfinder2 by Wobblyyyy.
the class AngleDeltaController method calculate.
@Override
public double calculate(double value) {
boolean isDegrees = angleUnit == Angle.AngleUnit.DEGREES;
Angle current = Angle.fixedDeg(value);
Angle target = Angle.fixedRad(this.getTarget());
double delta = isDegrees ? Angle.angleDeltaDeg(current, target) : Angle.angleDeltaRad(current, target);
return delta * this.coefficient;
}
Aggregations