runOpMode
This function is executed when this Op Mode is selected from the Driver Station.
Reverse one of the drive motors.
LeftDriveAsDcMotor
Direction
You will have to determine which motor to reverse for your robot. In this example, the right motor was reversed so that positive applied power makes it move the robot in the forward direction.
{"IDENTIFIER":"LeftDrive"}
REVERSE
DuckSpinnerAsServo
Position
{"IDENTIFIER":"DuckSpinner"}
0
Wait for the game to start (driver presses PLAY)
Run until end of the match
WHILE
DRIVETRAIN CODE
Power
LeftDriveAsDcMotor
RightDriveAsDcMotor
The Y axis of a joystick ranges from -1 in its topmost position to +1 in its bottommost position. We negate this value so that the topmost position corresponds to maximum forward power.
{"IDENTIFIER1":"LeftDrive","IDENTIFIER2":"RightDrive"}
1
NEG
gamepad1
LeftStickY
{"IDENTIFIER":"gamepad1"}
1
NEG
gamepad1
RightStickY
{"IDENTIFIER":"gamepad1"}
INTAKE CODE
GT
gamepad1
RightTrigger
{"IDENTIFIER":"gamepad1"}
0.5
IntakeAsDcMotor
Power
{"IDENTIFIER":"Intake"}
0
gamepad1
RightTrigger
{"IDENTIFIER":"gamepad1"}
GT
gamepad1
LeftTrigger
{"IDENTIFIER":"gamepad1"}
0.5
IntakeAsDcMotor
Power
{"IDENTIFIER":"Intake"}
0
NEG
9
gamepad1
LeftTrigger
{"IDENTIFIER":"gamepad1"}
IntakeAsDcMotor
Power
{"IDENTIFIER":"Intake"}
0
0
ARM CODE
gamepad1
A
{"IDENTIFIER":"gamepad1"}
On the ground for starting and intake
ArmAsDcMotor
TargetPosition
{"IDENTIFIER":"Arm"}
0
0
ArmAsDcMotor
Mode
{"IDENTIFIER":"Arm"}
RUN_TO_POSITION
ArmAsDcMotor
Power
{"IDENTIFIER":"Arm"}
1
gamepad1
X
{"IDENTIFIER":"gamepad1"}
Low level on the goal
ArmAsDcMotor
TargetPosition
{"IDENTIFIER":"Arm"}
120
120
ArmAsDcMotor
Mode
{"IDENTIFIER":"Arm"}
RUN_TO_POSITION
ArmAsDcMotor
Power
{"IDENTIFIER":"Arm"}
1
1
gamepad1
Y
{"IDENTIFIER":"gamepad1"}
Mid level on the goal
ArmAsDcMotor
TargetPosition
{"IDENTIFIER":"Arm"}
260
260
ArmAsDcMotor
Mode
{"IDENTIFIER":"Arm"}
RUN_TO_POSITION
ArmAsDcMotor
Power
{"IDENTIFIER":"Arm"}
1
1
gamepad1
B
{"IDENTIFIER":"gamepad1"}
High level on the goal
ArmAsDcMotor
TargetPosition
{"IDENTIFIER":"Arm"}
410
410
ArmAsDcMotor
Mode
{"IDENTIFIER":"Arm"}
RUN_TO_POSITION
ArmAsDcMotor
Power
{"IDENTIFIER":"Arm"}
1
1
gamepad1
RightBumper
{"IDENTIFIER":"gamepad1"}
High level on the goal scoring backwards
ArmAsDcMotor
TargetPosition
{"IDENTIFIER":"Arm"}
1420
1420
ArmAsDcMotor
Mode
{"IDENTIFIER":"Arm"}
RUN_TO_POSITION
ArmAsDcMotor
Power
{"IDENTIFIER":"Arm"}
1
1
gamepad1
LeftBumper
{"IDENTIFIER":"gamepad1"}
Mid level on the goal scoring backwards
ArmAsDcMotor
TargetPosition
{"IDENTIFIER":"Arm"}
1570
1570
ArmAsDcMotor
Mode
{"IDENTIFIER":"Arm"}
RUN_TO_POSITION
ArmAsDcMotor
Power
{"IDENTIFIER":"Arm"}
1
1
gamepad1
DpadRight
{"IDENTIFIER":"gamepad1"}
Duck spinner direction #1
DuckSpinnerAsServo
Position
{"IDENTIFIER":"DuckSpinner"}
0
gamepad1
DpadLeft
{"IDENTIFIER":"gamepad1"}
Duck spinner direction #2
DuckSpinnerAsServo
Position
{"IDENTIFIER":"DuckSpinner"}
1
Duck spinner stop when not pressing buttons
DuckSpinnerAsServo
Position
{"IDENTIFIER":"DuckSpinner"}
0.5