VEX Robotics Control System
SourceCompetition-ready VEX V5 control stack with reusable chassis math, odometry, and an on-brain autonomous selector.
Overview
A reusable control library for VEX V5 robots that provides chassis control, odometry, PID tuning, and an autonomous routine selector. The library abstracts motion primitives so robot configurations can be updated through parameters rather than code changes.
Motion Stack
- Drive chassis:
Drivewires 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
Odommodule integrates forward + sideways encoder data to maintain X/Y field coordinates, powering functions likedrive_to_point,turn_to_point, andholonomic_drive_to_pointfor 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_arcadehandles 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.
What I Learned
Building a reusable control library clarified how to structure embedded software for hardware portability. Separating motion control from robot-specific logic made it easier to iterate on mechanical designs without rewriting control code.