Skip to content

NextRobot

NextRobot is the root of your robot. It’s where you declare the mechanisms that make up your robot, and it’s automatically discovered and shared across every one of your NextOpModes, so you never construct or register it yourself.

interface NextRobot {
fun periodic() {}
val mechanisms: Set<Mechanism> get() = emptySet()
}

The set of Mechanisms that make up your robot. Every loop, NextFTC calls periodic() on each mechanism in this set for you.

Called once per loop, before any of your mechanisms’ periodic() methods. Use it for robot-wide logic that doesn’t belong to any single mechanism.

class MyRobot : NextRobot {
val claw = Claw()
val arm = Arm()
override val mechanisms = setOf(claw, arm)
}

You don’t construct your NextRobot yourself, and you don’t register it anywhere — NextFTC finds it for you. Give your implementing class a public no-arg constructor (the recommended approach in both Kotlin and Java) and it will be discovered automatically and made available to your NextOpModes. Exactly one NextRobot implementation should exist in your project. See NextFTC robot project structure for the full details of how this discovery works.