Skip to content

Annotation OpMode Loading

Mitchell Skaggs edited this page Dec 1, 2016 · 4 revisions

This year:

FIRST has implemented the opcode annotation system in the main GitHub branch. We are proud to have helped inspire this introduction. We now use FIRST's built-in annotation system to register OpModes.

Our documentation from last year:

The Improved FtcOpModeRegister Class

We used the ClassIndex framework to process and catalog all classes in the project that are annotated with our custom @OpMode annotation. The OpMode is named by providing a String object for the value of the annotation. Our modified FtcOpModeRegister class iterates over the entire list of classes annotated with @OpMode and registers those that extend OpMode.

This modification makes it easier and faster for programmers to create new OpModes, and removes the need to have FtcOpModeRegister open for modification constantly. We also modified the Gradle compilation script to include the index file in the build, so each class is only indexed once per build. This speeds up the loading times for the app.