Class Sleep

java.lang.Object
org.team1126.lib.util.Sleep

public final class Sleep extends Object
Utility class for sleeping the current thread, with the option to skip if in simulation.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    ms(double ms)
    Sleeps the thread for the specified duration in milliseconds.
    static void
    ms(double ms, boolean skipSim)
    Sleeps the thread for the specified duration in milliseconds.
    static void
    of(edu.wpi.first.units.measure.Time time)
    Sleeps the thread for the specified duration.
    static void
    of(edu.wpi.first.units.measure.Time time, boolean skipSim)
    Sleeps the thread for the specified duration.
    static void
    seconds(double seconds)
    Sleeps the thread for the specified duration in seconds.
    static void
    seconds(double seconds, boolean skipSim)
    Sleeps the thread for the specified duration in seconds.

    Methods inherited from class java.lang.Object

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

    • of

      public static void of(edu.wpi.first.units.measure.Time time)
      Sleeps the thread for the specified duration. Will always run, even if in simulation.
      Parameters:
      time - The time to sleep for.
    • of

      public static void of(edu.wpi.first.units.measure.Time time, boolean skipSim)
      Sleeps the thread for the specified duration.
      Parameters:
      time - The time to sleep for.
      skipSim - If the thread should skip sleeping if in simulation.
    • seconds

      public static void seconds(double seconds)
      Sleeps the thread for the specified duration in seconds. Will always run, even if in simulation.
      Parameters:
      seconds - The time to sleep for in seconds.
    • seconds

      public static void seconds(double seconds, boolean skipSim)
      Sleeps the thread for the specified duration in seconds.
      Parameters:
      seconds - The time to sleep for in seconds.
      skipSim - If the thread should skip sleeping if in simulation.
    • ms

      public static void ms(double ms)
      Sleeps the thread for the specified duration in milliseconds. Will always run, even if in simulation.
      Parameters:
      ms - The time to sleep for in milliseconds.
    • ms

      public static void ms(double ms, boolean skipSim)
      Sleeps the thread for the specified duration in milliseconds.
      Parameters:
      ms - The time to sleep for in milliseconds.
      skipSim - If the thread should skip sleeping if in simulation.