VEX Robotics Control System
SourceCompetition-ready VEX V5 control stack with reusable chassis math, odometry, and an on-brain autonomous selector.
Why I Built It
Every new V5 robot we fielded needed the same things: predictable motion, odometry-aware demos, and a way for the drive team to swap autonomous routines without reflashing code. I packaged those expectations into a reusable control system so future robots could inherit the same chassis math, PID profiles, and on-brain UX with only a few configuration tweaks.
Motion Stack
- Drive chassis:
Drive
wires left/right motor groups, an inertial sensor, and optional tracking wheels. A single constructor sets wheel diameter, gear ratio, gyro scale, and tracking offsets so hardware changes become parameter updates instead of code rewrites. - PID tuning surface: Separate gains for drive, turn, heading hold, and swing maneuvers (
set_drive_constants
,set_turn_constants
, etc.) keep closed-loop performance stable as mechanisms get heavier. - Odometry: The embedded
Odom
module integrates forward + sideways encoder data to maintain X/Y field coordinates, powering functions likedrive_to_point
,turn_to_point
, andholonomic_drive_to_point
for future holonomic builds.
Field Workflow
- Touchscreen auton selector: During
pre_auton
, the Brain cycles through labeled routines (drive, turn, odom diagnostics, full skills run). One tap locks in the routine the moment the match starts. - Driver aids:
control_arcade
handles operator driving while button toggles flip wings and spin the triball slapper at regulated voltages, giving the driver consistent subsystem behavior. - Diagnostics: Dedicated test modes print live odometry data to the screen or drive scripted motion sequences so we can debug alignment and sensor offsets between matches.
Engineering Notes
- Default PID constants live in one helper (
default_constants
) so new robots inherit battle-tested tuning before we dial in final gains. - Exit conditions on drive/turn maneuvers prevent oscillation and ensure the robot parks gracefully inside competition tolerances.
- The control stack slots into VEXcode Pro V5 with a one-time port configuration update, keeping the learning curve low for the rest of the drive team.
Takeaways
Abstracting the chassis and motion primitives into a standalone library meant every robot after this one started with working auton, reliable odometry, and an operator UX teams trusted. Instead of scrambling on practice night, we now spend that time refining game strategy—and the codebase keeps earning its keep season after season.