Core
The FeatureRegistrar
Templating
EnhancedSuppliers
Controllers
Configuration
Core
The FeatureRegistrar
The FeatureRegistrar
is a singleton that manages Feature
s, but also makes it
possible to access a lot of information about the currently running OpMode
statically.
// is an OpMode running?
// this will return true most of the time
// as when a user OpMode isn't running, the SDK runs a special OpMode behind the scenes
FeatureRegistrar.isOpModeRunning();
// the active OpMode,
// this method exhibits undefined behaviour if isOpModeRunning returns false
FeatureRegistrar.getActiveOpMode();
// the active Wrapper, Wrapper is a Dairy class for wrapping over an OpMode and some additional information
// this method exhibits undefined behaviour if isOpModeRunning returns false
Wrapper wrapper = FeatureRegistrar.getActiveOpModeWrapper();
// get the Wrapper.State of the currently running Wrapper
// this method exhibits undefined behaviour if isOpModeRunning returns false
Wrapper.OpModeState state = FeatureRegistrar.getOpModeState();
// state:
// INIT
// ACTIVE
// STOPPED
Lets take a closer look at what Wrapper
can provide us.
// the same state we just saw
wrapper.getState();
// the name of the OpMode
wrapper.getName();
// the sdk's classification of type (known as Flavour)
// SYSTEM
// TELEOP
// AUTONOMOUS
wrapper.getOpModeType();
// if we want to inspect all the annotations
wrapper.getInheritedAnnotations();
// the OpModeMeta of the OpMode, this is how the sdk stores metadata about the OpMode
wrapper.getMeta();
// the actual OpMode
wrapper.getOpMode();
// active Features, we'll review these later
wrapper.getActiveFeatures();