The FTC SDK is a Gradle Android project, so Kotlin works with a plugin line and zero rewrites. Java and Kotlin files interoperate inside the same module.
Enabling KotlinLink to this section
apply plugin: 'org.jetbrains.kotlin.android'What you gainLink to this section
- Null safety — the class of crash that kills autonomous runs.
- Data classes for poses, setpoints, and telemetry payloads.
- Extension functions to clean up SDK APIs without wrappers.
- Coroutines for sequencing, if your team understands them.
@TeleOp(name = "Kotlin Drive")
class KotlinDrive : LinearOpMode() {
override fun runOpMode() {
val left = hardwareMap.dcMotor["leftDrive"]
val right = hardwareMap.dcMotor["rightDrive"].apply {
direction = DcMotorSimple.Direction.REVERSE
}
waitForStart()
while (opModeIsActive()) {
left.power = -gamepad1.left_stick_y + gamepad1.right_stick_x
right.power = -gamepad1.left_stick_y - gamepad1.right_stick_x
}
}
}