Logo

Westside Robotics FTC Java Programming Guide

Plan An Autonomous OpMode with a State Machine

One of the more straightforward ways to structure an autonomous OpMode is in a state machine. You can visualize a state machine as a flow chart, with different states, or steps, that the robot performs, connected by transitions, or conditions when we move from one state to another.

We’ll start by planning a simple, two-state autonomous OpMode that drives forward 3000 encoder ticks.

State Actions Transitions
1 drive forward when drive encoder > 3000, go to state 99
2 stop none