-
Notifications
You must be signed in to change notification settings - Fork 3
AbstractAutoOp
Johan Vandegriff edited this page Nov 24, 2016
·
2 revisions
AbstractAutoOp extends AbstractOp and adds code to run a state machine. You can create an autonomous by extending this class and creating the StateMachine in the buildStates() method. Here is an example. See also: AbstractTeleOp
ftc/evlib/opmodes/AbstractAutoOp.java
package ftc.evlib.opmodes;
import ftc.electronvolts.statemachine.StateMachine;
import ftc.electronvolts.util.units.Time;
import ftc.evlib.hardware.config.RobotCfg;
/**
* This file was made by the electronVolts, FTC team 7393
* Date Created: 9/13/16
*
* extends AbstractOp and adds a 30 second timer and a state machine
*
* @see AbstractOp
* @see StateMachine
*/
public abstract class AbstractAutoOp<Type extends RobotCfg> extends AbstractOp<Type> {
protected StateMachine stateMachine;
/**
* This is implemented by the autonomous opmode
* It is called where the setup would have been
*
* @return A state machine to be run
*/
public abstract StateMachine buildStates();
@Override
public Time getMatchTime() {
return Time.fromSeconds(30); //autonomous is 30 seconds
}
@Override
public void setup() {
stateMachine = buildStates(); //get the state machine from the opmode
}
@Override
public void pre_act() {
}
@Override
public void post_act() {
stateMachine.act(); //update the state machine
}
}
This guide will step through the basics of how to set up OpModes using EVLib.
- Importing Into Your Project
- Sample Code
- Using EVLib Minimally
- Logging Example
- Robot Configuration
- Basic TeleOp Program
- Basic Autonomous Program
- Customizing StateMachineBuilder
- Servo Presets
- Adding Servos to the Configuration
- Adding Servos to TeleOp
- Adding Servos to Autonomous
- Vuforia and OpenCV Beacon Color Detection