BBR Button Board Documentation

Rotary encoders#

The enc1 tile carries a rotary encoder with a push-to-click shaft. Use them for continuous values — arm setpoint, shooter speed, LED brightness on the robot.

What the Driver Station sees#

FRC. Each encoder can be bound to one of four axes: under Robot gamepad → FRC, click the knob, choose An axis, then Axis 1 to 4. The axis reports an accumulated position — turn it clockwise and the number goes up, keep turning and it keeps going. There are four axes in total, so four enc1 tiles claim all of them.

An axis does not spring back to centre and has no deadzone.

How far a click moves it sets how far one click moves the axis. The default, 256, makes every click one step your robot code can see; smaller values need several clicks before anything changes. At 256 the axis reaches its end after about 128 clicks, around six turns of a typical knob. Pick a larger scale for a knob that should reach the end in fewer turns. Changing it zeroes the position. Anticlockwise counts up turns the direction round.

FTC. The FTC Driver Station puts a deadzone on every stick, so in xinput an encoder can’t use a stick axis. It has two other ways out.

  • A trigger count keeps the position. Under Robot gamepad → FTC, click the knob, choose Counts on a trigger, then Left trigger or Right trigger, and the knob counts on that trigger: one step per click, wrapping at 256. The TriggerKnob class turns that back into a running count in your OpMode. It comes with the FTC helpers:

java TriggerKnob knob = new TriggerKnob(); // before the loop int clicks = knob.update(gamepad2.left_trigger); // every loop, on the board's gamepad

Call update every loop. It stays right as long as the knob turns fewer than 128 clicks between two loops. The count starts at 0 on the first reading, and knob.reset() makes the current position zero. That trigger no longer works as button 15 (LT) or 16 (RT). Each trigger takes one knob, so two knobs can work this way. * Pulsed buttons: one button pulses per click clockwise, another per click anticlockwise, and your OpMode counts the presses. Choose A press per click, then what Clockwise presses and Anticlockwise presses.

If a knob has a trigger, it uses that in xinput and ignores its direction buttons there. Pulsed buttons are available under frc too, if you would rather count clicks than read a position.

Other modes. In desk a knob presses its direction buttons, so it can be a volume knob or a scroll wheel; see Keyboard and media keys. In midi it can send a relative controller; see MIDI. In sim there are eight axes rather than four, and a knob that is not on an axis is two buttons; see Flight and driving sims.

The shaft push#

The push switch on the encoder is an ordinary key. Bind it like any other key to a logical button number.

Zeroing#

The board can zero any axis, or all of them, on command — at the start of a match, or when the mechanism it drives is homed. In the config app, Back to the middle zeroes the knob you have selected.