Mavericks FTC: Autonomous Robotics Stack

Mar 1, 2024

Mavericks #24034: Autonomous Robotics Stack

Role: Lead Programmer

This project details the software architecture engineered for Team Mavericks #24034 during the 2023-2024 FIRST Tech Challenge (FTC) season. Moving beyond standard libraries, we implemented advanced control theory, stochastic state estimation, and robust computer vision pipelines to create a robot capable of high-speed, fully autonomous operation.

Robot Overview
Path Planning Visualization
Finite State Machine Architecture

Control Theory & Motion Planning

Sensor Fusion via Extended Kalman Filter

One of the significant challenges in FTC is localization drift. Odometry pods provide high-frequency updates but accumulate error over time (drift), while AprilTag vision targets provide absolute positioning but are noisy and have high latency.

To resolve this, we implemented an Extended Kalman Filter (EKF) to fuse these divergent data streams:

  • Prediction Step: Uses odometry data to predict the robot's state (x,y,θx, y, \theta) at high frequency ( 50Hz~50Hz).
  • Update Step: When an AprilTag is visible, the filter corrects the state estimate based on the visual pose, weighted by a covariance matrix representing our confidence in the camera's accuracy.

This probabilistic approach allowed us to maintain sub-inch localization accuracy throughout the 30-second autonomous period, even after heavy collisions or wheel slippage.

PIDF Control with Voltage Compensation

Standard PID controllers often fail to account for external system dynamics. We implemented a PIDF (Proportional-Integral-Derivative-Feedforward) controller for our Mecanum drivetrain and lift systems.

  • Feedforward (FF): Models the system's physics (gravity on the lift, static friction on the wheels) to apply the necessary base power before errors even occur.
  • Voltage Compensation: We dynamically scaled motor power based on real-time battery voltage readings, ensuring consistent trajectory execution regardless of battery charge levels.
PIDF Control Loop
Motion Profiling Logic
Sensor Fusion Diagram

Asymmetric Motion Profiling

To mitigate mechanical stress and wheel slip, we integrated S-curve (Jerk-limited) motion profiles. Unlike simple trapezoidal profiles, S-curves ensure continuous acceleration, preventing current spikes and improving the repeatability of autonomous paths.

Software Architecture

Finite State Machine (FSM)

We moved away from linear, blocking code (e.g., sleep()) to an asynchronous, event-driven Finite State Machine. This architecture allows the robot to:

  1. Multitask: Run vision processing, drivetrain loops, and lift mechanisms simultaneously.
  2. Recover: If a game element is missed (detected via intake current spikes), the robot transitions to a "Retry" state rather than failing the entire routine.

Singleton Design Pattern

To manage the complexity of hardware resources, we utilized the Singleton Pattern. This ensured a single, globally accessible instance for hardware wrappers (e.g., RobotHardware.getInstance()), preventing resource contention and ensuring thread safety across different subsystems.

Computer Vision Pipeline

Robust Object Detection

We developed a custom vision pipeline using OpenCV to identify game elements and determining optimal placement strategies.

Pipeline Stages:

  1. Color Space Conversion: Transformed RGB input to YCrCb. By isolating the Luminance (YY) channel, our detection became invariant to arena lighting conditions—a common point of failure in competition.
  2. Morphological Operations: Applied erosion and dilation to remove noise and separate connected game elements.
  3. Perspective Transformation: Utilized the homography matrix derived from AprilTags to map the 2D camera view to the 3D field coordinate system.
Odometry Hardware
Vision Pipeline Debugging
Pixel Scoring Algorithm

Heuristic Placement Algorithm

Once elements were detected, a Weighted Heuristic Algorithm calculated the optimal placement coordinate. The algorithm assigned scores to potential target zones based on:

  • Stability: Preferencing locations supported by existing game elements (avoiding "floating" placements).
  • Risk: Minimizing travel distance to reduce cycle time.
  • Scoring Potential: Prioritizing mosaic patterns for higher points.

Impact

This software stack powered Team Mavericks to a successful season, demonstrating that applying rigorous engineering principles—Sensor Fusion, Control Theory, and Software Architecture—yields tangible competitive advantages over standard implementation methods.

Outreach & Recognition

Beyond the competition, I established a training program reaching 120+ students across 6 Kazakhstan regions (Shymkent, Almaty, Astana, Turkestan, Kyzylorda, Taraz) over a 3-year period (2022-2025).

Additional Awards

  • 3rd Place Innovation Project, WPI FLL Championship (2023, 60+ countries)
  • 2nd Place, WRO RoboMission Junior Republic Stage (2022)
  • FTC Central Asia Finalist Alliance 2nd Pick
  • FGC Design Award
Taizhanov Nurbek