Skip to content

Command Gamepad

CommandGamepad wraps the standard FTC Gamepad and exposes its buttons and sticks as command-based Triggers. This lets you map controller inputs directly to commands using the WPILib-style Trigger API.

val gp1 = CommandGamepad(gamepad1)

CommandGamepad accepts an optional eventLoop parameter, defaulting to Trigger.defaultEventLoop. You generally won’t need to override it unless you’re managing multiple event loops.

Every button is exposed as a Trigger, which you can bind to commands with methods like onTrue() or onFalse() etc.

gp1.circle.onTrue(robot.intake.on())
gp1.circle.onFalse(robot.intake.off())

Joysticks and gamepad triggers are exposed as RangeTriggers instead of regular Triggers, since they report an analog value rather than a boolean value, letting you

gp1.rightTrigger.isOver(0.2).onTrue(robot.launcher.launch())