Skip to content

Lesson 4.1: WPILib Documentation Deep Dive

🎯 What You’ll Learn

By the end of this lesson you will be able to:

  • Navigate the WPILib documentation site and find answers to common questions
  • Use the Zero to Robot guide as a reference for hardware and software setup
  • Find command-based programming topics in the WPILib docs index
  • Look up specific classes and methods in the WPILib API javadocs
  • Distinguish between tutorial-style docs and API reference docs

Why WPILib Docs Matter

In Units 1–3 you learned to read your team’s robot code. But what happens when you see a class you don’t recognize, or a method you’ve never used? That’s where the WPILib documentation comes in.

WPILib is the official library that powers every FRC robot. Its documentation is the single most important reference you’ll use as an FRC programmer. The docs live at:

docs.wpilib.org

Think of it as the instruction manual for everything your robot code depends on. The challenge isn’t that the docs are bad — they’re actually quite good. The challenge is that they’re big, and knowing where to look is half the battle.


The Three Layers of WPILib Docs

WPILib documentation is organized into three layers, each serving a different purpose:

LayerWhat It IsWhen to Use It
Zero to RobotStep-by-step setup guideSetting up a new robot project, flashing the roboRIO, installing tools
Programming GuideConceptual tutorials organized by topicLearning how subsystems, commands, triggers, and schedulers work
API JavadocsAuto-generated reference for every class and methodLooking up exact method signatures, parameters, and return types

Let’s explore each one.


Layer 1: Zero to Robot

The Zero to Robot guide is the first thing you see on the WPILib docs site. It walks through everything from unboxing the control system to deploying your first robot program. You probably used parts of it when your team set up the robot at the start of the season.

Even if you’re past the setup phase, Zero to Robot is still useful as a reference:

  • Hardware overview — diagrams of the control system, wiring layouts, pneumatics setup
  • Software installation — WPILib installer, VS Code, vendor libraries
  • roboRIO imaging — how to flash and configure the roboRIO
  • Radio programming — configuring the robot radio for competition

You won’t use Zero to Robot every day, but when something goes wrong with the physical setup (roboRIO won’t connect, radio needs re-imaging, new laptop needs WPILib installed), this is where you go.


Layer 2: The Programming Guide

This is where you’ll spend most of your time. The WPILib Programming Guide covers every major concept in FRC programming, organized by topic. The most important sections for your team’s code are:

Command-Based Programming

Since your team uses the command-based framework (you’ve seen SubsystemBase, Command, RobotContainer), the command-based section is your home base. Key pages include:

  • What Is Command-Based Programming? — the philosophy behind subsystems and commands
  • Subsystems — how SubsystemBase works, the periodic() method, default commands
  • CommandsInstantCommand, RunCommand, SequentialCommandGroup, ParallelCommandGroup
  • Binding Commands to TriggersonTrue, whileTrue, toggleOnTrue (you traced these in Unit 2!)
  • The Command Scheduler — how WPILib decides which commands run each loop

Let’s connect this to code you already know. Open RobotContainer.java and look at the button bindings. Every binding type you see (toggleOnTrue, whileTrue, onTrue) has a dedicated page in the WPILib docs explaining exactly how it behaves.

Other Key Sections

Beyond command-based programming, these sections come up frequently:

SectionWhat You’ll FindExample from Your Code
ActuatorsMotor controller APIs, servo controlHow TalonFX and TalonFXS methods work
SensorsEncoders, gyros, limit switchesHow CommandSwerveDrivetrain reads the Pigeon gyro
NetworkTablesPublish/subscribe, SmartDashboardThe SmartDashboard.putNumber() calls you added in Unit 3
Kinematics & OdometrySwerve math, pose trackingThe math behind CommandSwerveDrivetrain
Path PlanningTrajectory generation, path followingHow PathPlanner integrates with WPILib

You want to understand exactly how toggleOnTrue works — when the command starts, when it stops, and what happens if you press the button while the command is already running. Which layer of WPILib docs should you check first?


Layer 3: API Javadocs

The API javadocs are the most detailed — and most intimidating — layer. They’re auto-generated from the WPILib source code and list every class, method, parameter, and return type in the library.

You access them at:

first.wpi.edu/allwpilib/docs/release/java/

When to Use Javadocs

Use the javadocs when you need to answer very specific questions:

  • “What parameters does SwerveDriveKinematics.toSwerveModuleStates() take?”
  • “What does Rotation2d.fromDegrees() return?”
  • “Does CommandScheduler.getInstance().run() return anything?”

How to Navigate Javadocs

Javadocs can feel overwhelming at first. Here’s the fastest way to find what you need:

  1. Use the search bar — type the class name (e.g., Trigger) and click the result
  2. Scan the method summary — this table at the top lists every method with a one-line description
  3. Click a method — scroll down to the full description with parameters, return type, and sometimes examples
  4. Check “See Also” — related classes and methods are linked at the bottom

Connecting Javadocs to Your Code

Let’s try it. Your team’s RobotContainer.java uses controller.x() to get a trigger for the X button. If you look up the CommandXboxController class in the javadocs, you’ll find:

  • x() returns a Trigger object
  • Trigger has methods like onTrue(), whileTrue(), toggleOnTrue()
  • Each method takes a Command parameter

This is exactly what you see in the code. The javadocs confirm the pattern and show you what other options are available (like onFalse(), whileTrue(), debounce()).


Practical Exercise: Find It in the Docs

Let’s practice navigating the docs with real questions from your team’s code. For each question below, try to find the answer in the WPILib docs before revealing it.

Question 1: What does Commands.run() do?

Your team uses Commands.run() in RobotContainer to create inline commands. What exactly does this factory method do?

Commands.run() is a static factory method in the Commands class. It creates a RunCommand — a command that calls the given lambda every 20ms until cancelled. It takes two parameters: a Runnable (the lambda to execute) and zero or more Subsystem requirements.

You can find this in the Programming Guide under Command-Based → Command Compositions or in the Javadocs under edu.wpi.first.wpilibj2.command.Commands.

Question 2: What is finallyDo()?

In the X button intake binding, you saw .finallyDo(() -> { ... }). What does this decorator do?

finallyDo() is a command decorator that runs a given action when the command ends, whether it finishes normally or is interrupted. It’s like a finally block in Java try/catch — it always runs.

Find it in the Javadocs under the Command class → finallyDo(BooleanConsumer) method. The Programming Guide covers it under Command Compositions → Command Decorators.

Question 3: What’s the difference between SequentialCommandGroup and ParallelCommandGroup?

Your intake binding uses a SequentialCommandGroup. What would change if it were a ParallelCommandGroup?

A SequentialCommandGroup runs commands one after another — each must finish before the next starts. A ParallelCommandGroup runs all commands at the same time and finishes when all of them are done.

If the intake binding used ParallelCommandGroup, the deploy, wait, and roller commands would all start simultaneously — the rollers would spin before the intake is deployed, which would be useless (or dangerous).

Find this in the Programming Guide under Command-Based → Command Compositions.


Building a Docs Lookup Habit

The best FRC programmers aren’t the ones who memorize every API. They’re the ones who know how to find answers quickly. Here’s a workflow to build that habit:

The 3-Step Lookup

  1. Start with the Programming Guide — search for the concept (e.g., “triggers”, “subsystems”, “path following”)
  2. If you need exact details, go to Javadocs — search for the specific class or method name
  3. If you’re still stuck, search the WPILib GitHub — the source code itself is the ultimate reference

Common Lookup Scenarios

You’re Wondering…Where to Look
”How does this WPILib concept work?”Programming Guide
”What parameters does this method take?”API Javadocs
”What are all the trigger binding types?”Programming Guide → Binding Commands to Triggers
”How do I create a swerve drive?”Programming Guide → Kinematics & Odometry
”What does this error message mean?”Programming Guide → Troubleshooting, or search the WPILib GitHub issues
”Is there an example of this pattern?”Programming Guide examples, or WPILib example projects on GitHub

Checkpoint: Navigate the Docs
Without looking at the answers above, describe the three layers of WPILib documentation and when you'd use each one. Then: your teammate asks 'What's the difference between onTrue and toggleOnTrue?' — which doc layer would you check first, and what section would you navigate to?

Three layers:

  1. Zero to Robot — step-by-step hardware/software setup guide. Use when setting up a new robot, re-imaging the roboRIO, or installing WPILib on a new computer.
  2. Programming Guide — conceptual tutorials organized by topic. Use when learning how a concept works (subsystems, commands, triggers, kinematics).
  3. API Javadocs — auto-generated reference for every class and method. Use when you need exact method signatures, parameters, and return types.

For the onTrue vs toggleOnTrue question: Check the Programming Guide first, specifically the Command-Based → Binding Commands to Triggers section. It explains each binding type with behavior descriptions. If you need the exact method signatures after that, check the Trigger class in the Javadocs.


Beyond WPILib: Other Documentation You’ll Use

WPILib isn’t the only documentation you’ll reference. Your team’s robot uses vendor libraries that have their own docs:

LibraryDocumentation SiteWhat It Covers
CTRE Phoenix 6v6.docs.ctr-electronics.comTalonFX, TalonFXS, Pigeon 2, CANcoder — the motors and sensors on your robot
REV Roboticsdocs.revrobotics.comSPARK MAX, SPARK Flex, color sensors — if your team uses REV hardware
PathPlannerpathplanner.devAutonomous path planning — you’ll dive into this in Lessons 4.12 and beyond
AdvantageScopedocs.advantagescope.orgLog viewer and data analysis — essential for debugging

For now, focus on getting comfortable with WPILib docs. You’ll explore vendor docs in depth in Unit 5 (Lesson 5.9: Vendor Documentation Deep Dive).


Key Terms

📖 All terms below are also in the full glossary for quick reference.

TermDefinition
WPILibThe official FRC robot programming library, providing the framework for subsystems, commands, sensors, actuators, and more
Zero to RobotThe WPILib setup guide covering hardware configuration, software installation, and first robot program deployment
API JavadocsAuto-generated reference documentation listing every class, method, parameter, and return type in the WPILib library
Command-Based FrameworkThe WPILib programming paradigm that organizes robot code into subsystems (hardware control) and commands (behaviors)
TriggerA WPILib class that represents a boolean condition (like a button press) and can bind commands to state changes
Command DecoratorA method like finallyDo(), withTimeout(), or unless() that wraps a command to modify its behavior

What’s Next?

You now know how to navigate the WPILib docs — from high-level tutorials to exact method signatures. This skill will save you hours of guessing and trial-and-error throughout the season.

In Activity 4.4: Explore Your Own Robot Code, you’ll apply the Code Reading Framework to three files in your team’s project that you haven’t opened yet. You’ll use the WPILib docs to look up unfamiliar classes and methods as you go — putting your new docs navigation skills to work immediately.

In Lesson 4.2: Git & GitHub Team Workflow, you’ll learn the branching strategy, pull request process, code review, and merge conflict resolution your team uses to collaborate safely on robot code.