PID LABLogicnaut · VEX IQ

VEX IQ BaseBot · closed loop control

Measure.
Correct. Repeat.

Hi Explorer. Your BaseBot's two motors are not twins, so it drifts. In these missions you read the gyro, work out the error, and steer it back, first with an if, then with P, I, and D. Every block here has the same name in VEXcode IQ.

0Missions
0Stars
0Bolts

The control loop, in one breath

  1. Read the sensor. BrainInertial rotation says how far the robot has turned.
  2. Find the error. error = target minus reading.
  3. Push back. correction = Kp × error. Later add Ki × integral and Kd × derivative.
  4. Wait a little, then repeat. The wait keeps the loop timing steady, on the Brain and in this lab.

Hints are always free, stars never go down, and every mission is checked on more than one robot so a fix that only works for one is caught.

Flight path // mission log

Six units, from drift to full PID

For parents and mentors

Grown-up Guide

PID Lab teaches closed loop control the way robotics teams meet it: a BaseBot that will not drive straight. The simulator has two motors with slightly different strength, motor lag, a gyro that reports 40 ms late, and a little noise, so the same tricks and the same failures happen here as on the floor.

The path

Unit 1 shows the drift and proves that hand tuning only fixes one robot. Unit 2 closes the loop with an if, then with proportional control, then tunes Kp. Unit 3 steers and turns by encoder degrees, the way many teams start, and shows how a slipping wheel fools it. Unit 4 adds the integral for leftover error and clamps it. Unit 5 adds the derivative for turns and introduces encoder distance. Unit 6 combines them into drives, turns, and a square lap.

Checking

Check runs the program on two or three of four simulated robots with different drift and measures forward distance, wander from the centre line, heading crossings, settle time, and overshoot. A program that only works on one robot fails, which is the point.

Moving to the real BaseBot

Every mission has an “In VEXcode IQ” card with the exact block names. Configure LeftMotor and RightMotor as separate motors so the built in Drivetrain does not hide the drift, then rebuild the mission in VEXcode IQ Blocks. Start the robot on a tile line so the drift is easy to see.

Privacy

Progress, drafts, and the optional explorer name stay in this browser. Type faces load from Google Fonts. Nothing else is fetched. See privacy for families.

VEX, VEX IQ, and VEXcode are trademarks of Innovation First, Inc. PID Lab is an independent Logicnaut learning lab and is not affiliated with or endorsed by VEX Robotics.

VEX card

Unit

Optional

What should the lab call you?

A first name or nickname is plenty. It stays on this device.

Variables

Make a variable

Gains get names like Kp, Ki, Kd. Working numbers get names like error, integral, out.