← Back to Home · Back to Programming

Programming · Autonomous

Autonomous that lands reliably

Encoders, IMU turns, basic PID, and reliability practices for match-ready autonomous.

What this is

  • Core motion building blocks: encoder drive and IMU turns.
  • Lightweight PID concepts for driving straight and turning.
  • Reliability habits to survive field variance.

When you need it

  • Auto misses targets, drifts, or times out.
  • Runs differently on carpet vs field tiles.
  • Need consistent scores for judging and playoffs.

How it works

  • Encoder drive: convert inches → ticks; run to position or open-loop with power cap and timeout.
  • IMU turns: read heading, compute error, apply proportional (and optional integral/derivative) correction.
  • PID basics: P corrects error, I handles bias (use small or zero), D damps oscillation.
  • Reliability: clamp power, add timeouts, and re-zero heading at start; gate motions by both position and time.

Common mistakes

  • No timeout → stuck robot burns whole auto.
  • Too high P on turns → oscillation; too low → saggy turns.
  • Ignoring battery level → distance overshoots when voltage is high.
  • Not resetting encoders/heading before path start.

How to test it

  • Bench: confirm encoder counts change with wheels raised.
  • Drive straight 1–2 m at low, then medium power; log drift vs heading.
  • Turn 90° both directions; measure average error; tune P (and small D) until settle is quick and stable.
  • Run full path 5×; confirm variance stays within scoring tolerance.

Related problems

  • Auto stops early → timeout too short or encoder not counting; check wiring.
  • Inconsistent turns → recalibrate IMU; warm-start and wait for init.
  • Slides sag during moves → add hold power or PID position control.