githubEdit

OpModeManager

package com.skeletonarmy.marrow

Overview

OpModeManager provides a simple interface for accessing the internal OpMode manager. It allows your code to read the current OpMode, robot state, hardware map, telemetry, and register lifecycle listeners - without direct access to the SDK internals.

This is useful when you need to interact with OpMode-level information from subsystems or utilities without manually passing references around.

circle-exclamation

Usage

getManager()

Returns the active OpModeManagerImpl instance.

OpModeManagerImpl manager = OpModeManager.getManager();

getActiveOpMode()

Returns the currently running OpMode, or null if none is running.

OpMode active = OpModeManager.getActiveOpMode();

getActiveOpModeName()

Returns the name of the active OpMode.


getRobotState()

Returns the current RobotState enum (e.g., INIT, RUNNING, STOPPED).


getHardwareMap()

Returns the active HardwareMap.

Useful when you need hardware access outside your OpMode.


getTelemetry()

Returns the active Telemetry.

Useful when you need to debug things outside your OpMode.


registerListener(listener)

Registers a listener for OpMode lifecycle changes.

The listener receives callbacks such as:

  • onOpModePreInit

  • onOpModePreStart

  • onOpModePostStop

Returns the active OpMode at the time of registration.


unregisterListener(listener)

Removes a previously registered listener.

Last updated