Class SafetyCommands


  • public class SafetyCommands
    extends java.lang.Object
    This class contains several helper methods to ensure safe operation of the robot (aka. prevents stuff from breaking)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static edu.wpi.first.wpilibj.buttons.Trigger whenHighCurrent​(HighCurrentSensor currentSensor, edu.wpi.first.wpilibj.command.Command command)
      Runs a command when the current is too high
      static edu.wpi.first.wpilibj.buttons.Trigger whenOutOfBounds​(java.util.function.DoubleSupplier value, double minimum, double maximum, edu.wpi.first.wpilibj.command.Command command)
      Runs a command when the value exceeds the range
      static edu.wpi.first.wpilibj.buttons.Trigger whileHighCurrent​(HighCurrentSensor currentSensor, edu.wpi.first.wpilibj.command.Command command)
      Runs a command while the current is too high
      static edu.wpi.first.wpilibj.buttons.Trigger whileOutOfBounds​(java.util.function.DoubleSupplier value, double minimum, double maximum, edu.wpi.first.wpilibj.command.Command command)
      Runs a command while the value exceeds the range
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • whenHighCurrent

        public static edu.wpi.first.wpilibj.buttons.Trigger whenHighCurrent​(HighCurrentSensor currentSensor,
                                                                            edu.wpi.first.wpilibj.command.Command command)
        Runs a command when the current is too high
        Parameters:
        currentSensor - the high current sensor
        command - the command to run
        Returns:
        the trigger that is binded to the high current sensor (was set to automatically start command already)
      • whileHighCurrent

        public static edu.wpi.first.wpilibj.buttons.Trigger whileHighCurrent​(HighCurrentSensor currentSensor,
                                                                             edu.wpi.first.wpilibj.command.Command command)
        Runs a command while the current is too high
        Parameters:
        currentSensor - the high current sensor
        command - the command to run
        Returns:
        the trigger that is binded to the high current sensor (was set to automatically start command already)
      • whenOutOfBounds

        public static edu.wpi.first.wpilibj.buttons.Trigger whenOutOfBounds​(java.util.function.DoubleSupplier value,
                                                                            double minimum,
                                                                            double maximum,
                                                                            edu.wpi.first.wpilibj.command.Command command)
        Runs a command when the value exceeds the range
        Parameters:
        value - a function which retrieves a value
        minimum - the minimum the value can be (inclusive)
        maximum - the maximum the value can be (inclusive)
        command - the command to run
        Returns:
        the trigger that is binded to the range (was set to automatically start command already)
      • whileOutOfBounds

        public static edu.wpi.first.wpilibj.buttons.Trigger whileOutOfBounds​(java.util.function.DoubleSupplier value,
                                                                             double minimum,
                                                                             double maximum,
                                                                             edu.wpi.first.wpilibj.command.Command command)
        Runs a command while the value exceeds the range
        Parameters:
        value - a function which retrieves a value
        minimum - the minimum the value can be (inclusive)
        maximum - the maximum the value can be (inclusive)
        command - the command to run
        Returns:
        the trigger that is binded to the range (was set to automatically start command already)