🦾 Training Platform

Clawbot +
EZ Template

Use the V5 Clawbot as a complete programming training robot — drive PID, autonomous routines, arm position control, and the built-in PID tuner — all on one safe, rebuild-friendly platform.

1
Why
2
Add IMU
3
EZ Setup
4
Arm + Claw
5
Exercises
// Section 01
Why the Clawbot is a Perfect Training Robot 🦾
It has everything you need to teach every concept in this curriculum — and nothing that breaks in ways that confuse students.
Short answer: Yes, EZ Template works on the Clawbot. It requires one addition — a V5 Inertial Sensor plugged into any spare smart port. With that, the Clawbot becomes a full EZ Template robot capable of PID drive, turns, autonomous routines, and the built-in PID tuner.

Why the Clawbot Works So Well for Training

🔒
Safe to Crash
Low and slow. Students can let autonomous routines fail without damaging anything. Mistakes are safe and educational.
🔄
Fast to Rebuild
If a student wires motors wrong, the Clawbot is easy to disassemble and reassemble. No complex custom mechanisms to break.
🎯
Three Subsystems
Drive, arm, and claw — teaches tank drive, position control, and toggle/button control all in one robot.
📚
Known Dimensions
4" wheels, 11.5" track width, green (200 RPM) cartridges. No measuring needed — just enter the values.

What Students Will Learn Using This Setup

  1. Configuring a real robot chassis in code (ports, wheel size, cartridge)
  2. Adding an IMU and why it matters for turning
  3. Writing and tuning drive PID and turn PID
  4. Arm position control with move_absolute()
  5. Claw toggle control with rising-edge detection
  6. Writing and running a complete autonomous routine
  7. Using EZ Template's built-in PID tuner (no re-uploading needed)
⚠️
One required addition: The stock Clawbot has no V5 Inertial Sensor. EZ Template's turning PID requires it. Adding one is simple — plug it into any free smart port and mount it flat anywhere on the robot. This is actually a great exercise: students learn why heading sensors matter.
// Section 02
Adding the IMU to Your Clawbot 🧭
One sensor, one smart port — transforms the Clawbot from a basic drive robot into a full EZ Template platform.

Why the IMU Is Required

EZ Template uses the IMU (Inertial Measurement Unit) for heading-based turning. Instead of guessing how far each motor needs to spin to turn 90°, it reads the actual rotation of the robot and stops when it reaches exactly 90°. Without it, turns drift significantly — especially on foam tiles.

Where to Mount It

💡
The Clawbot typically uses ports 1 (left motor), 10 (right motor), 3 (claw), and 8 (arm). Ports 11–20 are usually free — pick any one for the IMU. Port 11 is a clean choice that keeps wiring tidy.

Calibration — The IMU Must Warm Up

When the robot turns on, the IMU needs about 3 seconds to calibrate. During this time the robot must be completely still. EZ Template handles this automatically in initialize() when you call chassis.imu_calibrate().

⚠️
Never move the robot during IMU calibration! If you pick it up or bump it in the first 3 seconds after turning on, the heading will be wrong for the entire session. The V5 Brain screen shows "Calibrating..." — wait until it disappears before driving.

Verify It's Working

After mounting, turn on the Brain and go to Devices → Inertial Sensor. You should see heading, pitch, roll, and yaw values. Rotate the robot by hand — the heading value should change. If it reads 0 and doesn't move, check the smart cable connection.

// Section 03
EZ Template Clawbot Configuration 🖥️
Exact port assignments and the chassis constructor — ready to copy and adapt.

Standard Clawbot Port Map

PortDeviceNotesReversed?
1Left Drive MotorGreen cartridge (200 RPM)Yes — use -1
10Right Drive MotorGreen cartridge (200 RPM)No — use 10
8Arm MotorRed cartridge (100 RPM)Check physically
3Claw MotorRed cartridge (100 RPM)Check physically
11IMU (Inertial Sensor)Added — any free portN/A
⚠️
Always verify port numbers by checking the Brain's Devices screen before coding. Some Clawbots are assembled differently. The reversal directions (negative ports) depend on how the motors are physically oriented — test each motor on the Brain dashboard first.

robot-config.cpp — Clawbot Chassis

📄 src/robot-config.cpp
#include "main.h" // ─── CLAWBOT DRIVETRAIN ─────────────────────────────── // V5 Clawbot: 4" wheels, green (200 RPM) cartridges, no external gearing ez::Drive chassis( {-1}, // Left motor — port 1, reversed {10}, // Right motor — port 10, forward 11, // IMU port — plugged into port 11 4.0, // Wheel diameter in inches (Clawbot uses 4" omni wheels) 200.0 // Wheel RPM — green cartridge = 200 RPM, no external gearing ); // ─── MECHANISMS ────────────────────────────────────── pros::Motor arm (8, pros::E_MOTOR_GEAR_RED); // port 8, red (100 RPM) pros::Motor claw(3, pros::E_MOTOR_GEAR_RED); // port 3, red (100 RPM) pros::Controller master(pros::E_CONTROLLER_MASTER);
📄 include/main.h — add these lines
extern pros::Motor arm; extern pros::Motor claw;

main.cpp — initialize() for the Clawbot

📄 src/main.cpp
void initialize() { ez::ez_template_print(); pros::delay(500); chassis.imu_calibrate(); // ~3 seconds — don't move robot! chassis.drive_brake_set(MOTOR_BRAKE_COAST); // Reset arm and claw positions to zero on startup arm.tare_position(); claw.tare_position(); default_constants(); ez::as::initialize(); }

opcontrol() — Basic Drive

📄 src/main.cpp
void opcontrol() { chassis.drive_brake_set(MOTOR_BRAKE_COAST); while (true) { // PID Tuner — press X to toggle, B to run current auton if (!pros::competition::is_connected()) { if (master.get_digital_new_press(DIGITAL_X)) chassis.pid_tuner_toggle(); if (master.get_digital_new_press(DIGITAL_B)) autonomous(); chassis.pid_tuner_iterate(); } chassis.opcontrol_tank(); // Tank drive arm_control(); // Arm function (next section) claw_control(); // Claw function (next section) pros::delay(ez::util::DELAY_TIME); } }
// Section 04
Arm Position Control + Claw Toggle 🦾
Complete code for both mechanisms — with EZ Template PID for the arm and toggle control for the claw.

Arm Control — Buttons + Position Presets

📄 src/main.cpp
// ─── ARM PRESETS (tune these values for your Clawbot) ─ const int ARM_DOWN = 0; // resting position const int ARM_MID = 800; // mid height — tune with printf! const int ARM_HIGH = 1600; // full height — tune with printf! int armTarget = ARM_DOWN; void arm_control() { // L1/L2 = manual control (also updates the hold target) if (master.get_digital(DIGITAL_L1)) { arm.move_velocity( 50); armTarget = arm.get_position(); } else if (master.get_digital(DIGITAL_L2)) { arm.move_velocity(-50); armTarget = arm.get_position(); } // D-pad UP = high preset, D-pad DOWN = low preset else if (master.get_digital_new_press(DIGITAL_UP)) armTarget = ARM_HIGH; else if (master.get_digital_new_press(DIGITAL_DOWN)) armTarget = ARM_DOWN; // Hold at target — motor does the work else arm.move_absolute(armTarget, 50); }
💡
Use velocity 50 for the Clawbot arm — it's slow and controlled. At 100 the arm swings fast and can overshoot or jolt. Tune ARM_MID and ARM_HIGH by running the arm manually, checking arm.get_position() with printf, and noting where it is at each useful height.

Add Arm to EZ Template PID Tuner (Optional but Educational)

📄 src/main.cpp — in initialize()
// Creates a dedicated PID for the arm you can tune live ez::PID armPID(0.45, 0.001, 2.0, 0, "Arm"); // Add it to EZ Template's tuner so you can adjust it from the controller chassis.pid_tuner_pids.push_back({"Arm PID", &armPID.constants});

Claw Control — Toggle

📄 src/main.cpp
// ─── CLAW TOGGLE ───────────────────────────────────── bool clawOpen = false; // is claw currently open? bool lastBtnR1 = false; // previous R1 state for rising edge void claw_control() { bool r1 = master.get_digital(DIGITAL_R1); // Rising edge: toggle claw on each press if (r1 && !lastBtnR1) { clawOpen = !clawOpen; if (clawOpen) claw.move_absolute(200, 50); // open position else claw.move_absolute(0, 50); // closed position } lastBtnR1 = r1; }

First Autonomous Routine for the Clawbot

📄 src/autons.cpp
void clawbot_auton() { // Drive forward 24 inches while opening claw claw.move_absolute(200, 50); // open claw (non-blocking) chassis.pid_drive_set(24_in, 80); chassis.pid_wait(); // Close claw (grab something) claw.move_absolute(0, 50); pros::delay(600); // wait for claw to close // Raise arm arm.move_absolute(ARM_HIGH, 50); while (abs(arm.get_position() - ARM_HIGH) > 100) pros::delay(10); // Back up and turn chassis.pid_drive_set(-12_in, 60); chassis.pid_wait(); chassis.pid_turn_set(90_deg, 60); chassis.pid_wait(); }
// Section 05
Progressive Training Exercises 📋
Work through these in order — each one builds on the last and covers a key EZ Template concept.
Exercise 1 · Beginner
Drive and Turn — Get the Clawbot Moving

Write an autonomous that drives forward 12 inches, turns right 90°, drives forward another 12 inches, then returns to the starting position.

Goal: Understand pid_drive_set(), pid_turn_set(), and pid_wait(). After running it, measure how close it got to the starting point. If it's off by more than 2 inches, the PID needs tuning.

Exercise 2 · Beginner
Square Routine — Consistency Test

Drive a 24" × 24" square — four sides, four 90° turns. Mark the starting position with tape and see if the robot returns exactly to it after the full square.

Goal: Expose PID tuning needs. A well-tuned robot will return within 1–2 inches. A poorly-tuned one will spiral outward. Record the final position error in your engineering notebook.

Exercise 3 · Intermediate
Use the Built-In PID Tuner

Enable the PID tuner (press X), run the default drive auton (press B), and use the controller to adjust kP, kI, and kD live. Try to reduce the robot's overshoot to zero. When happy, write down the constants you found.

Goal: Understand what each PID term does by experiencing its effect directly on the robot. See the PID Diagnostics guide for what each symptom means.

Exercise 4 · Intermediate
Arm Preset Calibration

Use printf to print arm.get_position() in real time. Manually drive the arm to three useful heights (down, mid, high). Record the encoder values at each position and update ARM_DOWN, ARM_MID, and ARM_HIGH constants.

Goal: Practice sensor-based constant calibration — the same workflow used for every mechanism on a competition robot.

Exercise 5 · Advanced
Full Mission Autonomous

Set up a simple object on the floor in front of the Clawbot. Write an autonomous that: drives to the object, closes the claw to grab it, raises the arm, turns 90°, drives to a "goal" zone, lowers the arm, opens the claw to release.

Goal: Combine all three subsystems (drive, arm, claw) in one routine. Time it and try to complete the mission in under 10 seconds through tuning and optimization.

🏆
When to move to the competition robot: When a student can consistently write and tune a Clawbot autonomous routine within a single practice session, they're ready to apply those skills to the competition robot. The Clawbot is training wheels — a safe place to make all the mistakes before they count.
⚙ STEM Highlight Engineering: Iterative Prototyping & Mechatronics
The Clawbot is a mechatronic system — the integration of mechanical design, electronics, and software. Studying it teaches system decomposition: break the robot into subsystems (drive, arm, claw), understand each independently, then integrate. This is how professional engineers tackle complex products. The IMU (Inertial Measurement Unit) in the Clawbot combines an accelerometer and gyroscope — using sensor fusion to produce heading measurements more stable than either sensor alone.
🎤 Interview line: “We use the Clawbot as a controlled mechatronic system for learning. Because the design is fixed, we can isolate software variables. The IMU integrates angular velocity over time to track heading — this is numerical integration, the same math as odometry.”
🔬 Check for Understanding
The IMU reports heading by integrating angular velocity over time. What type of error does this introduce over a long run?
No error — integration is mathematically exact
Drift — small measurement errors in angular velocity accumulate into growing heading error over time
Latency — the heading reading is always one frame behind
Quantization error — the IMU can only report whole-degree values
Related Guides
🚀 First 30 Minutes → 🏎 Driver Control Tuning → 🔍 Robot Pre-Check →
← ALL GUIDES