ConditionAction
Overview
ConditionAction
is a special RR Action
that runs another action only if a specified condition is true.
This is useful for conditionally executing parts of a sequence based on runtime values, such as the selected alliance color, gamepad inputs, or other in-match decisions.
Usage
ConditionAction(Action, Supplier<Boolean>)
runBlocking(
new SequentialAction(
new MotorToPositionAction(armMotor, 1000), // Extend arm
new ConditionAction(
new ServoToPositionAction(claw, 0.0), // Open claw if A is being pressed
() -> gamepad1.a // after the arm is fully extended
),
new MotorToPositionAction(armMotor, 0), // Retract arm
)
);
Last updated