Signs and units
Robot code goes wrong most often when two parts disagree about which way is "positive". This library uses ONE set of rules everywhere. Learn these, and you can read any part of it.
Driving
Section titled “Driving”| Value | Positive means | Where you see it |
|---|---|---|
forward |
robot moves forward | MecanumDrive.drive, TankDrive.arcade, the mixers |
strafeRight |
robot moves to its right (mecanum only) | MecanumDrive.drive, MecanumMixer.mix |
turnClockwise |
robot turns right (clockwise, seen from above) | same |
| IMU heading | robot turned left (counterclockwise) | ImuSetup.headingDeg, AutoDrive.turn, AutoDrive.turnTo, FieldPose.headingDeg |
move(..., directionDeg, ...) |
counterclockwise from forward, like a heading: 0 forward, 90 left, 180 back, -90 right | AutoDrive.move, Steps.move |
moveWithTurn(..., directionDeg, headingDeg, ...) |
both counterclockwise, from the start heading (the direction stays fixed on the field, because the robot turns on the way): 90 = left | AutoDrive.moveWithTurn, Steps.moveWithTurn |
In an autonomous, every angle counts the same way: counterclockwise, 90 = left. This is true for a move’s
direction, a turn and a heading. In Steps, you can also use words with no angle at all: forward, back,
left, right, turnLeft, turnRight (the autos/ page).
Before v0.40.0, a move’s direction counted clockwise (90 = right). To update an old auto, read the CHANGELOG.
Why TeleOp’s turn command is clockwise-positive, but every autonomous angle is counterclockwise-positive:
- The right stick’s X is positive when you push it right. Pushing right should turn the robot right.
So
drive(forward, strafe, gamepad1.right_stick_x)works with no sign change. - The FTC SDK’s IMU makes the heading grow when the robot turns left. That is the math rule (counterclockwise = positive), and we do not fight the SDK.
The names tell you which one you have: turnClockwise, headingCcwDeg (“CCW” = counterclockwise).
Gamepad sticks
Section titled “Gamepad sticks”The SDK gives negative left_stick_y when you push the stick UP (away from you).
So “forward” is -gamepad1.left_stick_y. Every example in these docs has the minus sign.
Servos and motors: which way is “bigger”?
Section titled “Servos and motors: which way is “bigger”?”There is no standard for this, so the library makes no promise about it:
- A servo position from 0 to 1 is a pulse length: 0 is the short pulse, 1 the long one. Which way a bigger number turns the shaft (clockwise or counterclockwise) depends on the servo’s brand and model.
- Which way positive power turns a motor also depends on the motor and its gearbox.
.reversed()in Robot.java swaps the ends (servo: 0 and 1; motor: + and -). It changes the numbers, not the wiring.
So check each one by test, never by its label. In the Servo Finder, press D-pad up (a bigger number) and
watch which way the part moves. For a motor, use the Motor Finder or the Hardware Check. Then choose the numbers
(or .reversed()) so they read the way you think about the part. Any order is fine for named positions:
a claw’s open can be higher or lower than closed.
Two servos that face each other (one on each side of a claw, an arm or a pinch): the same number turns them
opposite ways, as seen from outside. So such a part uses alsoServoReversed (the second servo mirrors
the first). Two servos facing the same way use alsoServo (two servos on one part).
| Thing | Unit |
|---|---|
| Distances (drive) | inches |
| Angles | degrees |
| Motor power | -1 to 1 |
| Servo position | 0 to 1 |
| Mechanism positions (lifts, arms) | encoder ticks (counts) |
| Time | seconds, unless the name ends in Ms (milliseconds) or Nanos |
Wheel order
Section titled “Wheel order”Any array of four wheel values is in this order:
[front-left, front-right, back-left, back-right]
Standard (tank) drive left/right arrays are [left, right].
MecanumMixer.FRONT_LEFT (0), FRONT_RIGHT (1), BACK_LEFT (2), BACK_RIGHT (3) name the positions.
Button names: START and ▶
Section titled “Button names: START and ▶”- ▶ is the Driver Hub’s start button: press it after INIT to start the OpMode. The screens never call it START.
- ■ is the Driver Hub’s stop button (STOP).
- START is the small button on the gamepad (OPTIONS on a PS controller).
- In the docs, the Driver Hub’s start is always ▶: “press ▶ (start on the Driver Hub)” the first time
on a page, then “▶” or “after ▶”. The moment the OpMode starts is “at ▶” or “when the OpMode starts
(▶)”. The gamepad’s button is “the gamepad’s START button”, or “START (OPTIONS on a PS
controller)”. Code names keep their words (
atStart,Btn.START). - The docs use the Logitech names (A, B, X, Y, LB, RB, LT, RT, BACK, START, GUIDE). The library’s screens show the names on YOUR controller: × ○ □ △, L1 R1 L2 R2, SHARE OPTIONS PS on a PlayStation one (ButtonNames).
Something wrong on this page? Tell us with a short GitHub form.