Skip to content
Lessons by Fizmat
02Video course

Programming Training

Write the code that makes your robot drive, then teach it to drive itself.

This short build-along course takes your team from an empty Java file to a working robot. In the first lesson you will configure your hardware on the Control Hub and write a Driver-Controlled (TeleOp) OpMode for a four-motor mecanum drivetrain, with a tank-drive alternative. In the second lesson you will write your first Autonomous OpMode that drives measured distances with encoders, turns with the IMU and protects itself with timeouts.

2
Lessons
2.5 team hours
Estimated time
4
Learning objectives
Start lesson
Team assignment

Drive it, then automate it

Build both OpModes from this course on your own robot. Drive the TeleOp around a small course to check that forward, strafe and turn all go the right way. Then run the Autonomous routine from a taped start position at least five times and record where it stops.

Deliverables

Tick items off as your team completes them.

0/4

Learning objectives

  • Create a robot configuration on the Control Hub and match its names in code
  • Write a complete TeleOp OpMode that drives a four-motor robot with gamepad1
  • Write an Autonomous OpMode that drives by encoder distance and turns by IMU heading
  • Test, debug and measure robot code until it behaves the same way every run

Required materials

  • A robot with four drive motors (mecanum or tank) with encoder cables connected
  • REV Control Hub (with built-in IMU) and a Driver Station (REV Driver Hub or Android phone)
  • One gamepad and at least one fully charged robot battery
  • Laptop with OnBot Java (in a web browser) or Android Studio with the current FTC SDK
  • A tape measure, painter's tape and a clear floor area or field tiles
  • Safety glasses for everyone near the moving robot

Expected outcomes

  • Students can name motors in the robot configuration and load them with `hardwareMap.get()`
  • Students can explain why forward on the stick is a negative `left_stick_y` value and fix it in code
  • Students can calculate ticks per inch from a motor datasheet and calibrate it with a tape measure
  • Students can write `driveInches()` and `turnToHeading()` helpers that always end, even if something goes wrong

Knowledge check

8 questions across this week's lessons. Your best score for each lesson is saved.

  • Your First TeleOp from Scratch–/4
  • Your First Autonomous–/4

Completion checklist

Tick items off as your team completes them.

0/6