Class InstantCommand

    • Constructor Detail

      • InstantCommand

        public InstantCommand()
      • InstantCommand

        public InstantCommand​(String name)
        Creates a new InstantCommand with the given name.
        Parameters:
        name - the name for this command
      • InstantCommand

        public InstantCommand​(Subsystem subsystem)
        Creates a new InstantCommand with the given requirement.
        Parameters:
        subsystem - the subsystem this command requires
      • InstantCommand

        public InstantCommand​(String name,
                              Subsystem subsystem)
        Creates a new InstantCommand with the given name and requirement.
        Parameters:
        name - the name for this command
        subsystem - the subsystem this command requires
      • InstantCommand

        public InstantCommand​(Subsystem requirement,
                              Runnable func)
        Creates a new InstantCommand.
        Parameters:
        requirement - the subsystem this command requires
        func - the function to run when initialize() is run
      • InstantCommand

        public InstantCommand​(String name,
                              Subsystem requirement,
                              Runnable func)
        Creates a new InstantCommand.
        Parameters:
        name - the name for this command
        requirement - the subsystem this command requires
        func - the function to run when initialize() is run
    • Method Detail

      • isFinished

        protected boolean isFinished()
        Description copied from class: Command
        Returns whether this command is finished. If it is, then the command will be removed and end() will be called.

        It may be useful for a team to reference the isTimedOut() method for time-sensitive commands.

        Returning false will result in the command never ending automatically. It may still be cancelled manually or interrupted by another command. Returning true will result in the command executing once and finishing immediately. We recommend using InstantCommand for this.

        Specified by:
        isFinished in class Command
        Returns:
        whether this command is finished.
        See Also:
        isTimedOut()
      • _initialize

        protected void _initialize()
        Trigger the stored function.

        Called just before this Command runs the first time.