Class Util

java.lang.Object
com.ctre.phoenix.Util

public class Util
extends Object
Class with basic utility methods
  • Constructor Details

  • Method Details

    • cap

      public static double cap​(double value, double peak)
      Caps the value
      Parameters:
      value - Value to cap
      peak - Maximum/-Minimum value can be
      Returns:
      Capped value
    • scaleRotationsToNativeUnits

      public static int scaleRotationsToNativeUnits​(double scalar, double fullRotations)
      Scales rotations to native units
      Parameters:
      scalar - Value to scale by
      fullRotations - Number of rotations to scale by
      Returns:
      Scaled units
    • scaleVelocityToNativeUnits

      public static int scaleVelocityToNativeUnits​(double scalar, double rpm)
      Scales velocity to native units
      Parameters:
      scalar - Value to scale by
      rpm - Velocity in rotations per minute
      Returns:
      Scaled velocity
    • scaleNativeUnitsToRotations

      public static double scaleNativeUnitsToRotations​(double scalar, long nativePos)
      Scales native units to rotations
      Parameters:
      scalar - Value to scale by
      nativePos - Native position units
      Returns:
      Scaled units
    • scaleNativeUnitsToRpm

      public static double scaleNativeUnitsToRpm​(double scalar, long nativeVel)
      Scales Native units to velocity
      Parameters:
      scalar - Value to scale by
      nativeVel - Native velocity units
      Returns:
      Scaled units