Package choreo.auto

Class AutoRoutine

java.lang.Object
choreo.auto.AutoRoutine

public class AutoRoutine extends Object
An object that represents an autonomous routine.

This loop is used to handle autonomous trigger logic and schedule commands. This loop should **not** be shared across multiple autonomous routines.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    A boolean utilized in running() to resolve trueness
    protected boolean
    A boolean that is true when the loop is killed
    protected final EventLoop
    The underlying EventLoop that triggers are bound to and polled
    protected final String
    The name of the auto routine this loop is associated with
    protected int
    The amount of times the routine has been polled
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Creates a new loop with a specific name
    protected
    A constructor to be used when inhereting this class to instantiate a custom inner loop
  • Method Summary

    Modifier and Type
    Method
    Description
    cmd()
    Creates a command that will poll this event loop and reset it when it is cancelled.
    cmd(BooleanSupplier finishCondition)
    Creates a command that will poll this event loop and reset it when it is finished or canceled.
    void
    Kills the loop and prevents it from running again.
    Gets the event loop that this routine is using.
    void
    Polls the routine.
    void
    Resets the routine.
    Returns a Trigger that is true while this autonomous routine is being polled.

    Methods inherited from class java.lang.Object

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

    • loop

      protected final EventLoop loop
      The underlying EventLoop that triggers are bound to and polled
    • name

      protected final String name
      The name of the auto routine this loop is associated with
    • isActive

      protected boolean isActive
      A boolean utilized in running() to resolve trueness
    • isKilled

      protected boolean isKilled
      A boolean that is true when the loop is killed
    • pollCount

      protected int pollCount
      The amount of times the routine has been polled
  • Constructor Details

  • Method Details

    • running

      public Trigger running()
      Returns a Trigger that is true while this autonomous routine is being polled.

      Using a Trigger.onFalse(Command) will do nothing as when this is false the routine is not being polled anymore.

      Returns:
      A Trigger that is true while this autonomous routine is being polled.
    • poll

      public void poll()
      Polls the routine. Should be called in the autonomous periodic method.
    • loop

      public EventLoop loop()
      Gets the event loop that this routine is using.
      Returns:
      The event loop that this routine is using.
    • reset

      public void reset()
      Resets the routine. This can either be called on auto init or auto end to reset the routine incase you run it again. If this is called on a routine that doesn't need to be reset it will do nothing.
    • kill

      public void kill()
      Kills the loop and prevents it from running again.
    • cmd

      public Command cmd()
      Creates a command that will poll this event loop and reset it when it is cancelled.
      Returns:
      A command that will poll this event loop and reset it when it is cancelled.
      See Also:
    • cmd

      public Command cmd(BooleanSupplier finishCondition)
      Creates a command that will poll this event loop and reset it when it is finished or canceled.
      Parameters:
      finishCondition - A condition that will finish the loop when it is true.
      Returns:
      A command that will poll this event loop and reset it when it is finished or canceled.
      See Also: