New to WPILib

Already know how to write code? Start here to learn how a WPILib robot program is organized. WPILib provides the classes you use to control motors, read sensors, and communicate with the Driver Station.

Tip

New to programming too? Start with Zero to Robot. Follow the setup steps, then write and run your first robot program.

How the Pieces Fit Together

These are the main pieces you’ll encounter in WPILib code, plus a comparison with FTC SDK OpModes.

Robot Class

Defines what runs when the robot is enabled, disabled, or switches modes.

Mechanisms

Groups the code for a mechanism, such as a drivetrain, arm, or intake. It owns the mechanism’s motors and sensors.

Commands

Defines an action, such as driving forward or raising an arm. The command scheduler runs the action and manages which commands can use each subsystem.

OpModes

If you’ve used the FTC SDK, you’ve written OpModes. In WPILib, the Robot Class defines what runs in each robot mode.

Hardware APIs

The classes for motor controllers, encoders, and other devices. Use them to set motor outputs and read sensor values.

Where FRC and FTC Differ

The Driver Station and motor connections differ between FRC and FTC. FRC uses the FRC Driver Station, with motor controllers wired into the FRC control system. FTC uses its own Driver Station software, and motors connect through Motioncore. Servos will not be supported for FTC on Systemcore.

The programming building blocks above apply to both programs; the Zero to Robot guide identifies the program-specific steps.

Tip

Still setting up the hardware? Use the hardware overview to identify the controllers, power distribution, and connections on your robot.