Skip to content

This is the code base for my Vex robotics team, Error Error

Notifications You must be signed in to change notification settings

MattHandzel/TeamErrorError

Repository files navigation

VEX Robotics: Team Error Error 🤖

This repository contains the software stack for VEX Robotics Team Error Error, developed for the Spin Up competition season. The project features a custom control architecture implemented in Python, focusing on autonomous precision, real-time physics simulations, and advanced state estimation.

🏗 System Architecture

The codebase is organized around a central Robot class that manages state estimation, subsystem control, and autonomous execution. It uses an asynchronous update loop to handle sensor polling and control calculations.

1. State Estimation & Sensor Fusion

The robot maintains a high-fidelity estimate of its field position by fusing data from multiple sensors.

  • Coordinate System: Real-time $(x, y, \theta)$ tracking using GPS for absolute references and wheel encoders for high-frequency relative displacement.
  • Sensor Fusion Logic: Main/src/main.py (lines 1238-1327)
  • Vector Math: Custom Vector class and rotate_vector_2d utilities for coordinate frame transformations in Main/src/main.py (lines 292-329).

2. Ballistics & Flywheel Control (Aimbot)

Automated scoring is handled via a kinematics engine that models the field in code to predict projectile paths.

  • Field Modeling: The robot uses a mathematical model of the game field to calculate the exact angle and velocity required to hit the target from any position. See Main/src/main.py (lines 436-608).
  • Computer Vision Aimbot: In addition to geometric modeling, the robot employs a Vision Sensor-based "aimbot" to track goal signatures and dynamically adjust heading. Main/src/main.py (lines 2451-2495)
  • Recovery PID: A specialized PID loop designed for high-inertia flywheels. It features a "recovery mode" that ignores derivative noise during the 0.5s window following a disc launch to minimize RPM drop. Main/src/main.py (lines 1445-1502)

3. Trajectory Design & Pathing Library

I developed a custom toolchain for designing and executing autonomous paths.

  • Visual Path Designer: A Pygame-based desktop application Main/drawtrajectories.py allows for drawing robot trajectories over a digital field map and exporting them as coordinate data.
  • Autonomous Recording & Replay: The system supports a "Recording Mode" where driver movements are sampled and stored as a series of state-targets, allowing complex manual maneuvers to be replayed as autonomous routines. Main/src/main.py (lines 2188-2202)
  • Intersection Geometry: Uses line-segment intersection algorithms to determine when the robot has passed specific checkpoints. Main/src/main.py (lines 1362-1372)

4. PID Optimization via Custom Gradient Descent

To identify the optimal flywheel PID constants ($k_P$, $k_I$, $k_D$), I developed a Gradient Descent algorithm from scratch.

  • Methodology: I implemented the optimization algorithm to process flywheel performance data and minimize RPM error. This allowed for a more mathematical approach to tuning than traditional trial-and-error.
  • Implementation: Main/gradient_descent.py contains the from-scratch implementation of the Gradient Descent algorithm, including custom vector math and gradient calculation logic.
  • Production Constants: The resulting optimized constants are implemented in the flywheel control loop in Main/src/main.py (lines 1460-1462).

5. Physical Modeling & Simulation

Before testing on hardware, I built mathematical models to predict robot performance limits.

  • Drivetrain Modeling: Main/robot_speed_calculator.py models motor torque curves, robot weight, and coefficients of friction to calculate theoretical maximum velocities and acceleration profiles.

6. Custom UI Framework (V5 Brain)

To facilitate on-field debugging and configuration, this project includes a lightweight UI framework built on the V5 touchscreen.

📊 Data & Analysis

The repository includes scripts used for offline performance tuning and scouting.

  • Performance Tuning: Main/dataAnalyzing.py processes telemetry logs using Pandas to identify drivetrain slip and flywheel consistency.
  • Regional Scouting: Main/3dgraphs.py visualizes regional competition data to track scoring trends and team progression.

🛠 Tech Stack

  • Platform: VEX V5 System
  • Language: Python 3.6 (VEX Python Runtime), Python 3.10+ (Desktop Tools)
  • Libraries: Pygame (Path Design), Pandas/Matplotlib (Offline Analysis), NumPy
  • Control Theory: PID Control, Gradient Descent Optimization, Alpha-Beta Filters, Kinematics

📁 Project Structure


Developed by Team Error Error

About

This is the code base for my Vex robotics team, Error Error

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors