The Robot Won't Drive Straight (and Other Drivetrain Sins)
Diagnose veering, scrub, and inconsistent drive: mismatched feedforward, toed modules/wheels, uneven friction, and tread/encoder issues.
Sign in to track progress, earn XP, and save lessons.
Symptom
Commanded straight, the robot pulls left or right, or feels sluggish and draws too much current.
Root cause 1: Mismatched feedforward / open-loop scaling
If left and right (or four swerve) drive motors have slightly different kV, the same voltage produces different speeds and the robot curves. The fix is per-side/per-module SysId characterization so each gets its own kS/kV/kA, then run closed-loop velocity control instead of raw duty cycle. This is the textbook cause of a tank or swerve robot veering.
Root cause 2: Toe / non-square modules or wheels
In swerve, if modules aren't mounted parallel and square, the wheels fight each other (scrub), wasting current and curving the path. In tank, bent frame rails or misaligned wheels do the same. Check with a straightedge across module mounts; never hand-drill module holes, use the machined bellypan pattern.
Root cause 3: Uneven friction or preload
A pinched bearing, over-tight chain, or a dragging belt on one side adds friction there. Spin each wheel by hand with the robot on blocks, every wheel should coast similarly. A notably stiff wheel is your culprit.
Root cause 4: Worn or mismatched tread
Different tread wear left/right changes effective wheel diameter and grip. Replace tread in matched sets.
Root cause 5: Encoder / sign errors
A flipped encoder direction or a wrong conversion factor makes closed-loop control fight itself. Push the robot by hand and watch reported velocities; signs must match motion.
The gearbox-grenade warning
A robot cannot instantly go from full speed to a dead stop or slam direction without damaging gearbox teeth or slipping wheels. Add slew-rate limiting (e.g. SlewRateLimiter) and current limits so you don't shear gears or pop a breaker on every direction change.
Diagnostic workflow
- Robot on blocks. Spin every wheel by hand, compare coast.
- Drive +X slowly off the ground, confirm all wheels point/spin forward with correct reported velocity signs.
- Re-run SysId per side/module; apply distinct gains.
- Drive on the floor closed-loop; if it still veers, recheck module squareness and tread wear.
- Only then blame code.
Key takeaways
- Veering is usually mismatched feedforward; characterize each side/module with SysId and run closed-loop velocity, not raw duty cycle.
- Non-square swerve modules or bent tank rails cause scrub: check squareness off the machined bellypan, never hand-drilled mounts.
- Spin every wheel by hand on blocks to find pinched bearings/over-tight chain, and add slew limiting + current limits to spare the gearbox.
Lesson quiz
RequiredAnswer all 3 questions correctly to complete this lesson.
1.A tank-drive robot consistently veers to one side at full throttle even with both joysticks centered/equal. Which is the most likely root cause to check first?
2.You add a gyro to drive straight by correcting heading, but the robot turns harder the more it drifts and never settles. Of these, what should you verify in the heading-correction setup?
3.After a rebuild, one drive side runs backwards relative to the other when both are commanded forward, spinning the robot in place. What is the correct fix?
Answer every question to submit.