public class AngularMath
extends java.lang.Object
1/19/2016 --Derek Witcpalek -- Original implementation of add(), subtract(), and smallestAngle() methods. I also tested the math that this class does and it looked solid.
Modifier and Type | Class and Description |
---|---|
private static class |
AngularMath.RotationDirection |
Constructor and Description |
---|
AngularMath() |
Modifier and Type | Method and Description |
---|---|
static double |
add(double currentAngle,
double changeInAngle)
This is used to find the angle you are targeting in a clockwise rotation
|
static double[] |
getBestRotationDescriptor(double currentAngle,
double targetAngle)
This tells you how far to rotate and in which direction to get to a specific angle.
|
private static AngularMath.RotationDirection |
getBestRotationDirection(double currentAngle,
double targetAngle,
double smallestAngle)
This method is used to figure out the direction you should rotate between two angles to have the smallest angle to turn through.
|
private static double |
getSmallestAngle(double currentAngle,
double targetAngle)
This method is used to figure out how far you need to turn to get to a specific target angle.
|
static double |
subtract(double currentAngle,
double changeInAngle)
This is used to find the angle you are targeting in a counter-clockwise rotation
|
public static double add(double currentAngle, double changeInAngle)
currentAngle
- The starting angle of the robotchangeInAngle
- How far you want to turnpublic static double subtract(double currentAngle, double changeInAngle)
currentAngle
- The starting angle of the robotchangeInAngle
- How far you want to turnprivate static double getSmallestAngle(double currentAngle, double targetAngle)
currentAngle
- The starting angle of the robottargetAngle
- Where you want to end upprivate static AngularMath.RotationDirection getBestRotationDirection(double currentAngle, double targetAngle, double smallestAngle)
currentAngle
- The starting angle of the robottargetAngle
- Where you want to end upsmallestAngle
- ???public static double[] getBestRotationDescriptor(double currentAngle, double targetAngle)
currentAngle
- The starting angle of the robottargetAngle
- Where you want to end up