Skip to content

NextOpMode

NextOpMode is the base class for every OpMode you write with NextFTC. It wraps the FTC SDK’s LinearOpMode, automatically wires up your NextRobot, and drives the command scheduler and triggers for you every loop.

Every NextOpMode exposes these directly, no hardwareMap.get(...) boilerplate required:

  • gamepad1 / gamepad2 — the standard FTC Gamepad objects.
  • telemetry — the standard FTC SDK Telemetry.
  • hardwareMap — the standard FTC SDK HardwareMap.

Override whichever of these you need — all are optional:

Method Called
disabledPeriodic() Repeatedly, while the Driver Station is in INIT.
start() Once, right after the PLAY button is pressed.
periodic() Repeatedly, while the OpMode is running.
end() Once, when the OpMode finishes.
@NextTeleop(name = "My Teleop")
class MyTeleop(robot: MyRobot) : NextOpMode(robot) {
override fun periodic() {
Telemetry.log("Status", "Running")
}
}

Take your NextRobot as a constructor parameter and pass it straight to super(...). NextFTC’s scanner instantiates your OpMode and injects the discovered robot instance for you, so you never construct MyRobot yourself. See NextFTC robot project structure for the full injection rules.

Bind gamepad input to your mechanisms’ commands from start(); see Triggers and RangeTriggers for the full binding API.

What NextOpMode does for you automatically

Section titled “What NextOpMode does for you automatically”

You’ll never need to call these yourself, as NextOpMode runs them every loop behind the scenes:

  • Calls periodic() on your NextRobot and every one of its mechanisms.
  • Polls triggers and executes the Ivy scheduler, so bound commands actually run.
  • Updates motor control loops.
  • Flushes telemetry.

One additional behavior is opt-in rather than automatic: bulk-reading hardware from your control/expansion hubs. Pass BulkReadHook as an extra constructor argument to switch your Lynx modules to manual bulk-caching mode and have the cache cleared for you every loop:

class MyTeleop(robot: MyRobot) : NextOpMode(robot, BulkReadHook)

Annotate your class with @NextTeleop or @NextAutonomous to make it selectable on the Driver Station. Both are picked up automatically, just like the @TeleOp and @Autonomous annotations in the FTC SDK. See NextFTC robot project structure for how this discovery works.