Class MapleCommonMath

java.lang.Object
org.ironmaple.utils.mathutils.MapleCommonMath

public class MapleCommonMath extends Object
  • Constructor Details

    • MapleCommonMath

      public MapleCommonMath()
  • Method Details

    • generateRandomNormal

      public static double generateRandomNormal(double mean, double stdDev)
      using the random number generator of a fixed seed, generate the next random normal variable
      Parameters:
      mean - the center of the distribution
      stdDev - the standard deviation of the distribution
      Returns:
      the next random variable x from the distribution
    • constrainMagnitude

      public static double constrainMagnitude(double value, double maxMagnitude)

      Constrains the magnitude of a value.

      Parameters:
      value - the value to constrain
      maxMagnitude - the maximum allowed magnitude
      Returns:
      the constrained value
    • linearInterpretationWithBounding

      public static double linearInterpretationWithBounding(double x1, double y1, double x2, double y2, double x)
    • linearInterpretation

      public static double linearInterpretation(double x1, double y1, double x2, double y2, double x)
    • getAngle

      public static Rotation2d getAngle(Translation2d translation2d)

      Obtains the angle of a translation, ignores zero translation.

      This prevents the driver-station from throwing a bunch of "x and y components of Rotation2d are zero" warning.

      Parameters:
      translation2d - the translation
      Returns:
      the angle of the translation, or zero if the translation is zero