Skip to Content
TutorialsZerotoheroZerotohero1
💡

Before We Begin: You don’t need to be a math genius or a computer wizard. You just need curiosity and a willingness to break things (digitally, please not the physical robot… mentors get sad when the robot breaks).

🎯 Learning Objectives


🏗️ Chapter 1: The Tools of the Trade

Before we code, we need… well, code editors. And libraries. And maybe a snack.

Essential Installations


🎨 Chapter 2: Creating a Robot Project

Open VS Code (hit the W icon). Press the magic WPILib button (top right, looks like a W). Type “Create a new project”. Select “Template” -> “Java” -> “Command Robot”. STOP! Why “Command Robot”? Because “Timed Robot” is like writing an essay in one long paragraph. “Command Robot” is like organizing it with headers, bullet points, and memes. It’s just better.


📝 Chapter 3: Naming Conventions (Or: How to Not Get Yelled At)

In programming, names matter. If you name a motor , nobody will know what it does. If you name it , everyone is happy.


💻 Chapter 4: Writing Your First Code

We will start with the most exciting thing in robotics: Making a motor spin!

Step 1: Define the Subsystem

A “Subsystem” is a physical part of the robot (Drivebase, Arm, Intake).

public class DriveSubsystem extends SubsystemBase { // 1. Define hardware private final PWMSparkMax leftMotor = new PWMSparkMax(0); private final PWMSparkMax rightMotor = new PWMSparkMax(1); // 2. Define methods (actions) public void setMotors(double leftSpeed, double rightSpeed) { leftMotor.set(leftSpeed); rightMotor.set(rightSpeed); } public void stop() { leftMotor.set(0); rightMotor.set(0); } }

Step 2: Create a Command

A “Command” is an action (Drive Forward, Shoot Note).

public class DriveForwardCmd extends Command { private final DriveSubsystem driveSubsystem; public DriveForwardCmd(DriveSubsystem subsystem) { this.driveSubsystem = subsystem; addRequirements(subsystem); // Important! Tells robot "I am using the wheels!" } @Override public void execute() { driveSubsystem.setMotors(0.5, 0.5); // Drive at 50% speed } @Override public void end(boolean interrupted) { driveSubsystem.stop(); } }

🎮 Chapter 5: Controller Input

Robots are cool. Robots you can control with an Xbox controller are cooler.

// In RobotContainer.java private final CommandXboxController driverController = new CommandXboxController(0); private void configureBindings() { // When 'A' button is held, run the intake driverController.a().whileTrue(new RunIntakeCmd()); // Default command: Drive with joysticks driveSubsystem.setDefaultCommand( new RunCommand( () -> driveSubsystem.arcadeDrive( -driverController.getLeftY(), -driverController.getRightX() ), driveSubsystem ) ); }

🤝 Chapter 6: Team Programming Etiquette

Coding on a team is different from coding alone. You can’t just delete everything because you feel like it.


🧠 Checkpoint

You’ve survived Episode 1! You now know:

In Episode 2, we’ll dive deeper into the Command-Based framework and learn how to make the robot do multiple things at once (without exploding).


🔮 What’s Next?


📞 Need Help? We’ve Got Your Back!

Keep coding, keep learning, and remember: every expert was once a beginner who refused to give up! 🚀

P.S. - If your robot starts talking back, that’s either very advanced AI or you need more sleep. Probably more sleep. 🤖💤


This documentation is part of the Zero to Hero programming series. For the complete learning experience, watch the accompanying video and practice with real robot code. Remember: the only way to get good at programming is to write lots of bad code first! 😄

💝

Special Thanks: To all the students who asked “Why doesn’t this work?” and inspired us to create better documentation. Your questions make us better teachers, and your curiosity drives innovation. You’re the real MVPs! 🏆

Remember: Every expert was once a beginner who refused to give up. Keep coding, keep learning, and most importantly - keep having fun! 🚀