WPILib includes utility classes that go beyond basic motor control. This page coversDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Holden9607/FRC-Academy/llms.txt
Use this file to discover all available pages before exploring further.
MathUtil, PIDController, and NetworkTable — tools you’ll use as your robot code grows more sophisticated. While FRC Academy’s introductory lessons focus on direct motor output, these classes become essential the moment you start handling real joystick drift, automated movement, or driver-station telemetry.
edu.wpi.first.math.*
MathUtil
Full class:edu.wpi.first.math.MathUtil
A static utility class that exposes helper methods to bounds-restrict and normalize numeric ranges gracefully. All methods are static — no instance is needed.
Key Static Methods
| Method | Returns | Description | ||
|---|---|---|---|---|
MathUtil.clamp(double value, double low, double high) | double | Clamps value to the range [low, high] — values outside the range are pinned to the nearest bound | ||
MathUtil.applyDeadband(double value, double deadband) | double | Returns 0.0 if ` | value | < deadband`; otherwise scales the remaining range to start from zero. Useful for joystick drift |
MathUtil.inputModulus(double input, double minimumInput, double maximumInput) | double | Wraps input within a continuous range — handy for angle arithmetic |
0.0 when centered. Use applyDeadband to ignore small noise values and prevent the motors from creeping:
PIDController
Full class:edu.wpi.first.math.controller.PIDController
Calculates error-correction outputs using proportional, integral, and derivative gains. Feed it a sensor measurement and a target setpoint each loop cycle, and it returns the corrective output to apply to your motor.
Constructor
| Parameter | Type | Description |
|---|---|---|
kP | double | Proportional gain — primary driving term |
kI | double | Integral gain — corrects steady-state error over time |
kD | double | Derivative gain — dampens oscillation |
| Method | Returns | Description |
|---|---|---|
calculate(double measurement, double setpoint) | double | Returns the corrective output for this loop cycle |
setTolerance(double positionTolerance) | void | Defines the acceptable error window around the setpoint |
atSetpoint() | boolean | Returns true when the measurement is within the configured tolerance |
reset() | void | Clears the integral accumulator — call this before restarting a move |
edu.wpi.first.networktables.*
NetworkTable
Full class:edu.wpi.first.networktables.NetworkTable
The core data structure managing fast telemetry synchronization between the robot and driver station dashboards such as Shuffleboard and SmartDashboard. Data is organized into named tables, and each table holds key-value entries that stream live over the network.
Key Usage Pattern
teleopPeriodic() or periodic() to continuously push live values to the dashboard.
MathUtil and PIDController are not directly used in FRC Academy’s current introductory lessons, but they are essential tools in any real FRC codebase. Expect to reach for them as soon as you start building autonomous routines or more precise teleop behaviors.Related Pages
WPILib Core
TimedRobot, XboxController, DriverStation, and the foundational WPILib framework classes.
WPILib Commands
CommandXboxController, RunCommand, InstantCommand, and the command-based architecture.