Hi everyone.

I wanted to provide some links to a three-part State Machine tutorial I've just finished.

Even though the new linearOpMode class has simplified the process of writing Autonomous code , I still think that knowing the way to design and code State Machines is a really useful tool that every programmer should have in their utility belt.

I've created a mid-level autonomous scenario, based on the RES-Q challenge, and then created an opMode that executes that autonomous sequence.

The sample code implements several driving styles (constant power, constant speed and encoder based path following) and it uses several additional sensors (CORE and legacy).

It's by no means a field-tested autonomous, but it does run on a test bed, so I know that each of the states perform as expected.

The tutorial is for rookies, so it eases into the discussion, and then gets into specifics. 

I make good use of the Telemetry display to help see the State Machine in action.

The 3 tutorial parts are:

1) Introduction to the principles of State Machines. https://www.youtube.com/watch?v=Pu7PMN5NGkQ

2) Using a State Transition Diagram to design your opmode. https://www.youtube.com/watch?v=-J_m-FdO45c

3) Detailed opMode code walk-through. https://www.youtube.com/watch?v=cPgJ8bbBj_o

Unfortunately the audio for the first part isn't the best, but crank up the volume and you should be OK. 

A link to the actual opMode java file is found in each of the Tutorial descriptions. 

I just tested it with the latest release and it works as expected.

Hopefully you find this useful.


Go to Top