Home / Summer / Week 8
Summer · Week 8 of 8

Bridge Week — XRP & WPILib

Java meets robot code. Write your first WPILib program and run it on an XRP.

You've earned this. Seven weeks of Java. Now you put it on a real robot. Everything you've learned — classes, methods, loops, enums — shows up here. If something in the robot code looks unfamiliar, go back to the relevant week.

How WPILib Wraps Your Java

WPILib is a library of Java classes that talk to the robot's hardware. Your code extends WPILib classes (which you now understand from Week 6) and fills in the behavior.

java — a minimal XRP tank drive program
package frc.robot;

import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj.xrp.XRPMotor;

public class Robot extends TimedRobot {

    private final XRPMotor leftMotor  = new XRPMotor(0);
    private final XRPMotor rightMotor = new XRPMotor(1);

    @Override
    public void teleopPeriodic() {
        // Runs every 20ms during teleop
        leftMotor.set(0.5);  // 50% forward
        rightMotor.set(-0.5); // inverted
    }
}

The Walton Codebase — Folder Structure

Folder / FileWhat lives here
robot/Robot.java, RobotContainer.java — the entry points
subsystems/One file per subsystem (Drivetrain, Shooter, Intake…)
commands/One file per action/command
Constants.javaAll motor IDs, gear ratios, PID values — never hardcode

Your First Git Commit

Before writing any robot code, you need to be able to push it. Do this now if you haven't yet — the next phase starts with Git.

terminal
# Clone the training repo
git clone https://github.com/sohnshaik/training-test-1.git

# Create your branch
git checkout -b feature/your-name-xrp

# After writing your XRP code:
git add .
git commit -m "feat: add XRP tank drive for [your name]"
git push origin feature/your-name-xrp

Install WPILib before the next session: Download WPILib from github.com/wpilibsuite/allwpilib/releases. Install the full package — it includes VS Code, Java, and all the FRC tools.

Knowledge Check

Bridge Assignment

🤖
XRP Tank Drive
Write real robot code using everything from Weeks 1–7

Using an XRP robot (or WPILib simulation if no hardware):

1. Create a DriveSubsystem class with two XRPMotor fields
2. Write a tankDrive(double left, double right) method
3. Write a stop() method
4. In teleopPeriodic(), call tankDrive with 0.4 and -0.4 (spin in place)
5. Add Javadocs to every method
6. Push to a branch and open a PR

Bonus: Add a RobotState enum with DRIVING and STOPPED, and use it to guard the tankDrive call.