Skip to content
Johan Vandegriff edited this page Dec 16, 2016 · 5 revisions

This is an interface used to tell when a state is done. Every implementation of it must have an “init” method, where sensors or motors can be reset, and values can be initialized. It also must have an “isDone” method, where it can read the sensors, motors, etc., and report back to tell if the condition has been met. EndCondition objects are created in the EndConditions factory class, and used in the AbstractState class with a StateMap.

ftc/electronvolts/statemachine/EndCondition.java

package ftc.electronvolts.statemachine;

/**
 * This file was made by the electronVolts, FTC team 7393
 *
 * An EndCondition is used as a condition to tell when something is done. If the
 * end condition is true, the next state is run.
 */
public interface EndCondition {
    /**
     * Run once when the end condition is created Can be used to tell helper
     * classes to initialize Be careful to reset all variables here in case the
     * state is run a second time
     */
    void init();

    /**
     * Run every cycle after init() Used to get values from helper classes to
     * see if the condition is met
     *
     * @return true if condition is met.
     */
    boolean isDone();
}

Home | Features

This guide will walk you through the basics of creating state machines using the state-machine-framework.

  1. Importing Into Your Project
  2. The State Interface
  3. Simple State Machine
  4. Custom States
  5. Custom StateMachineBuilder
  6. Custom EndConditions

Clone this wiki locally