Have you ever told your robot to turn 90 degrees, only to watch it spin to 95 or 100? This overshooting problem is one of the most frustrating challenges in VEX IQ programming.
In this guide, we’ll teach you a technique called momentum compensation that makes your robot stop exactly where you want it.
Why Does My Robot Overshoot?
When you tell a motor to stop, the robot doesn’t freeze instantly. It has momentum - the tendency of moving objects to keep moving. Here’s what happens:
- Robot is spinning toward 90 degrees
- Brain Inertial reads 90 degrees - time to stop!
- You send the stop command
- But the robot is still moving… it coasts to 95 degrees
The heavier your robot and the faster it’s turning, the worse the overshoot becomes.
The Solution: Stop Early
The trick is simple: stop before you reach the target and let momentum carry you the rest of the way.
If your robot typically overshoots by 10 degrees:
- Target: 90 degrees
- Stop at: 80 degrees
- Momentum carries you to: ~90 degrees
This “stop early” amount is what we call the momentum value.
The Turn Function
Here’s a custom block that turns your robot to any angle with momentum compensation:
What Each Parameter Does
| Parameter | What It Controls |
|---|---|
rotation | Target angle (in degrees from start) |
velocity | Turn speed (0-100%) |
momentum | How many degrees early to stop |
How the Turn Logic Works
The function first figures out which way to turn by comparing where you want to be (rotation) with where you are (BrainInertial rotation):
Turning Right (target > current):
- Left motor spins forward
- Right motor spins reverse
- Robot rotates clockwise
Turning Left (target < current):
- Left motor spins reverse
- Right motor spins forward
- Robot rotates counter-clockwise
The Momentum Math
Let’s say you want to turn right to 90 degrees with momentum = 10:
Without momentum compensation:
Stop when: BrainInertial = 90
Robot coasts to: ~100 degrees (overshot by 10!)
With momentum compensation:
Stop when: BrainInertial = 90 - 10 = 80
Robot coasts to: ~90 degrees (perfect!)
For left turns, we add momentum instead of subtracting (because Brain Inertial decreases when turning left).
Putting It All Together
Here’s a complete program that demonstrates turning:
This program:
- Calibrates the inertial sensor (keep robot still!)
- Turns right to 90 degrees
- Turns back to 0 degrees (center)
- Turns left to -90 degrees
- Returns to center
Tuning Your Momentum Value
The right momentum value depends on your robot’s weight, wheel grip, and turn speed. Every robot is different!
| Momentum | Behavior |
|---|---|
| Too low | Robot overshoots the target |
| Just right | Robot stops exactly on target |
| Too high | Robot stops short of the target |
How to tune:
- Robot overshooting? → Increase momentum
- Robot stopping short? → Decrease momentum
Speed Matters Too
Faster turns have more momentum, so they need higher compensation. If you change your turn velocity, you’ll likely need to re-tune your momentum value.
Common Problems and Fixes
Robot overshoots turns
- Increase your momentum value
- Try slowing down the velocity
Robot stops short of target
- Decrease your momentum value
- Your momentum setting is too aggressive
Robot turns the wrong direction
- Check motor directions in device configuration
- Make sure LeftMotor and RightMotor are on the correct sides
Inconsistent turn accuracy
- Make sure Brain Inertial is calibrated (robot must be still at startup)
- Check battery level - low battery affects motor performance
- Clean your wheels - slippage causes inconsistent results
Combining with Drive Straight
Now you can combine turning with the drive straight function from our previous guide:
This creates an L-shaped path:
- Drive forward (heading 0°)
- Turn right 90°
- Drive forward (heading 90°)
- Turn right another 90°
- Drive forward (heading 180°)
Quick Reference Table
| Problem | Most Likely Cause | Quick Fix |
|---|---|---|
| Overshoots turns | Momentum too low | Increase momentum |
| Stops short | Momentum too high | Decrease momentum |
| Turns wrong way | Motor direction wrong | Check device config |
| Inconsistent results | Calibration issue | Keep still at startup |
What’s Next?
Once you’ve mastered momentum turns, you can:
- Build complex autonomous routines combining drives and turns
- Learn about proportional turning for even smoother rotation
- Explore PID control for competition-level precision
The momentum compensation technique is used by teams at every level of VEX competition. Master these fundamentals, and you’ll have the building blocks for any autonomous challenge!
Pro tip: Keep a tuning log! Write down what momentum and velocity values work best for your robot. These values will change if you modify your robot’s weight or wheel configuration.