EZ-Template Documentation

website·Indexed 30 days ago

https://ez-robotics.github.io/EZ-Template

A robotics template providing PID controllers, odometry, and autonomous movement functions for VEX robots. Version 3.2.2 includes support for Okapi units, IMU calibration, tracking wheels, and a built-in autonomous selector, along with utilities for slew rate control and power take off (PTO).

Tokens
81.4K
Snippets
549
Records
635
Agent score
72%

What's inside EZ-Template

  1. Overview of EZ-Template for VEX V5

    EZ-Template is a C++ library for VEX V5 robots built on PROS. It provides out-of-the-box functionality for accurate driving, turning, and autonomous positioning. Key features include:

    • Movement: Accurate distance driving, angle turning, and swing turns with live controller adjustments.
    • Odometry: Pure pursuit and boomerang for smooth curved pathing to specific points.
    • Autonomous Selector: An on-screen selector to choose routines before a match, with settings saved to the SD card.
    • Drive Control: Support for Tank, Single Stick, and Dual Stick arcade control with tunable joystick curves.
  2. Overview of EZ-Template for VEX V5

    EZ-Template is a C++ library for VEX V5 robots built on PROS. It provides a framework to quickly implement drivetrain movements, autonomous positioning, and driver control. Key features include accurate driving and turning, odometry with pure pursuit and boomerang for curved paths, an autonomous routine selector saved to the SD card, and multiple joystick control schemes (Tank, Single Stick, Dual Stick Arcade) with live-tunable curves.
  3. Understand tracking wheel width offsets

    Tracking wheel width defines the distance from the tracker to the robot's center of rotation. Accurate offsets are critical for consistent robot behavior:

    • Left/Right Trackers: Incorrect offsets cause the robot to behave differently when moving right vs. left and reduce the accuracy of mirrored autonomous routines.
    • Front/Back Trackers: Incorrect offsets cause the robot's XY position to shift during turns, making the reported position unintuitive.

    Note: If you are tuning wheel diameter, you must complete that process before tuning tracking wheel width. If you are not using tracking wheels, no offsets are required.

  4. EZ-Template 2.x Feature Overview

    EZ-Template is a plug-and-play PROS template providing drive base functions, autonomous selector, input curves, and active brake with PTO support. Key capabilities include:

    • PID control for driving, turning, and swing turns (including asynchronous PID with blocking functions).
    • Drive support for Tank, Single Stick Arcade, and Dual Stick Arcade.
    • Joystick input curves with live adjustment and SD card persistence.
    • Autonomous selector with SD card saving and "Tug of war" detection.
    • Hardware support for 3-wire encoders, rotation sensors, and dynamic motor addition/removal for PTO use.
    • Safety features like PID exit conditions for overheating drive motors.
    • Exposed PID class for use in custom subsystems.
  5. Implement joystick input curves for finer robot control

    Joystick curves allow a driver to move the joystick halfway but only output a fraction of the power (e.g., 1/4 power), providing more precision at lower speeds. EZ-Template supports live adjustment of these curves via the controller. Curves are constrained between 0 (no curve) and 20. Higher values result in a flatter curve, meaning more of the joystick range is dedicated to lower speeds.
  6. Understand Slew behavior in EZ-Template

    Slew allows motors to start at a lower speed and build up to a faster speed. In EZ-Template, slew acts as a maximum speed limit for the PID output rather than a direct motor set. If a motion is extremely small, slew may have no effect, and the motion will execute at maximum possible speed. Slew is recommended for robots prone to tipping, wheelies, or wheel slip at the start of motions.
  7. Understand EZ-Template PID exit conditions

    Exit conditions determine when the program stops blocking and moves to the next line of code during a motion. Crucially, when a PID motion 'exits', the PID controller does not stop running; it continues in the background. This allows the robot to perform other tasks (like operating an intake or lift) while still attempting to reach its target. Exit conditions are managed via timers that check if the robot is within a specific threshold of the target, or via failsafes that trigger if the robot's velocity is 0 for too long or if motors are stalling (pulling too hard).
  8. Understand EZ-Template PID exit conditions

    Exit conditions determine when the robot has 'reached' its target and the code can proceed to the next command. Crucially, when a motion 'exits', the PID controller does not stop running in the background; it continues to maintain the target position while the code executes subsequent tasks (such as operating an intake or lift).
  9. Understand Slew behavior in EZ-Template

    Slew is a mechanism that ramps motor speeds from a starting speed up to a faster speed to prevent tipping, wheelies, or wheel slip. In EZ-Template, slew defines the maximum speed the PID controller can output; it is not set directly to the motors.

    Since version 4.0, slew ramps at a constant rate regardless of the motion's speed limit. The distance parameter defines how far the robot travels to ramp from the starting speed to full speed (127). If a motion has a lower speed limit (e.g., 80), it will reach that limit sooner than the defined slew distance.

  10. Implement joystick input curves for finer robot control

    Joystick curves allow a driver to have more precision at lower speeds by mapping the joystick input (x-axis) to a non-linear motor output (y-axis). For example, pushing a joystick halfway might only result in 1/4 power. Higher curve values increase the amount of joystick travel dedicated to lower speeds.
  11. Odometry Motion Algorithms Overview

    EZ-Template uses several algorithms for movement:

    • Point to Point: The core system using two simultaneous PID loops (xyPID for distance, angularPID for heading). It uses projected target points to prevent jitter and coordinate translation to handle overshooting.
    • Pure Pursuit: Continuously updates a target point along a path (a 'carrot on a stick' approach), allowing the robot to follow a series of points smoothly.
    • Boomerang: Calculates a path that allows the robot to arrive at a target point at a specific desired angle. It is slower than Pure Pursuit and requires sufficient distance to the target to be effective.
  12. Understand tracking wheel width offsets

    Tracking wheel width offsets define the distance from the tracking wheel to the robot's center of rotation. Accurate offsets are critical for precise odometry:

    • Left/Right Trackers: Modifying these moves the tracking center left or right. If inaccurate, the robot may behave inconsistently when moving right vs. left. Note: If both left and right trackers are used, EZ-Template averages them and ignores individual widths.
    • Front/Back Trackers: Modifying these moves the tracking center forwards or backwards. If inaccurate, the robot's XY position may shift during turns.

    Important: If you plan to tune wheel diameter, you must do that before tuning tracking wheel width. If you are not using tracking wheels, no offsets are required.