controller.hpp¶
ProsController — IController over pros::Controller (chunk R1a): the driver's hands behind the HAL.
This header declares 2 types (6 members).
Extracted from include/shulib/hal/pros/controller.hpp — this page is that header's documentation, reformatted, so it cannot disagree with the code. Prose about how to think about the API lives in the user guide; worked recipes live in the cookbook; this page is the complete, mechanical list of what exists.
Contents¶
enum class ControllerId¶
Which physical controller this adapter reads.
enum class, declared at include/shulib/hal/pros/controller.hpp:46.
ControllerId::Master¶
The controller paired to the brain — the only one present in a one-driver setup.
enumerator, declared at include/shulib/hal/pros/controller.hpp:48.
ControllerId::Partner¶
The second controller, tethered to the master for VEX U's two-driver case. With no partner attached it is simply a disconnected controller: zeros on every channel and isConnected() == false, which is the case that signal exists to make visible.
enumerator, declared at include/shulib/hal/pros/controller.hpp:52.
class ProsController¶
IController over pros::Controller — one adapter per physical controller, the id fixed at construction. Reports what the driver's hands are doing, normalized, and nothing else: no deadband, curve, slew or rumble, because driver-feel is policy and belongs above this seam. Buttons are read as LEVELS via get_digital(); this adapter never calls get_digital_new_press(), whose edge state is consumed on read, so edge detection is each consumer's own hal::ButtonEdge and N consumers all see the same press.
class, declared at include/shulib/hal/pros/controller.hpp:61.
ProsController::ProsController¶
Binds this adapter to one physical controller. id is a construction fact, not a per-call argument — two drivers means two instances. Touches no hardware: nothing is queried here, so construction succeeds with the controller switched off or unpaired, and isConnected() is what tells you afterwards.
function, declared at include/shulib/hal/pros/controller.hpp:67.
ProsController::axis¶
Normalized [-1, 1] via controllerAxisToCanonical (the ONE ÷127).
function, declared at include/shulib/hal/pros/controller.hpp:72.
ProsController::pressed¶
Level read via get_digital() — NEVER get_digital_new_press() (header).
function, declared at include/shulib/hal/pros/controller.hpp:78.
ProsController::isConnected¶
True while the controller is actually linked. Load-bearing rather than informational: a disconnected controller reads 0.0 on every axis and false on every button, so without this signal "the driver was unplugged" and "sticks centred, nothing pressed" are one number.
function, declared at include/shulib/hal/pros/controller.hpp:85.
Design commentary, from the header¶
The header opens with the reasoning behind these shapes. It is reproduced here in full because a reference that only lists signatures teaches nobody why.
The header’s own reasoning — 31 lines
ProsController — IController over pros::Controller (chunk R1a): the driver's
hands behind the HAL.
BINDS:
* get_analog() → axis() (controllerAxisToCanonical — ÷127, HA-103)
* get_digital() → pressed() — a LEVEL, deliberately. This adapter NEVER
calls get_digital_new_press(): PROS's edge detection is stateful on the
device object and CONSUMES the press when read, so with two consumers
one silently loses (HA-104, trap C). Edge detection belongs to each
consumer, above the seam, via hal::ButtonEdge (controller.hpp) — N
consumers all see the same press. The fence guard test greps this file
to keep the forbidden binding structurally absent.
* is_connected() → isConnected() — POSITIVE validity (imu.hpp:31-33
polarity). Load-bearing because a disconnected controller reads 0 on
every channel (HA-103): without this signal, "driver unplugged" and
"sticks centred" are the same number.
PARTNER SUPPORT: construct one adapter per physical controller
(ControllerId::Master / ControllerId::Partner) — "which controller" is a
construction fact, not an interface question (controller.hpp header).
SENTINELS: none to screen — the controller API reports disconnection
through is_connected() and benign zeros, not PROS_ERR (HA-103), so the
conversion's finiteness backstop is the only guard needed.
DELIBERATELY NOT here: deadband, curves, slew, rumble — driver-feel policy
is chunk T2's layer. This seam reports what the hands are doing, verbatim
(normalized), and nothing else.
HA register: HA-103, HA-104.
Last updated 2026-08-15 — published from the main release branch, commit fa545ff. This site tracks releases, so between them it can lag the repository — that lag is deliberate, and it is what keeps the development log off the public site. For the current state of the code, see the repository.