Unit 17 · lesson
Debug the Layer, Not the Symptom
A robot drifts left.
That is a symptom.
Possible causes exist in several layers:
mission
↓
software command
↓
control loop
↓
sensor measurement
↓
motor driver
↓
motor / gearbox
↓
wheel / traction
↓
frame alignment
Changing code before locating the layer can make the system worse.
Evidence ladder
Start with observations that separate branches.
For a drift problem:
- Are left/right target commands equal?
- Are measured wheel speeds equal?
- Are motor outputs equal?
- Do unloaded wheel speeds differ?
- Is wheel diameter/traction different?
- Is chassis alignment correct?
Each answer removes possibilities.
Fault injection
A powerful way to understand a system is to create a safe, simulated fault.
Examples:
- add encoder scale error;
- delay one message;
- reduce one motor's maximum output;
- introduce sensor noise;
- shift the robot's center of mass.
Then observe which signals reveal the problem first.
Logs need meaning
A thousand lines of telemetry are not useful if nothing is tied to a question.
Log values that support a diagnosis:
timestamp, state, target, measurement, output, fault
That set can reconstruct many control failures.
Build a diagnostic path
Choose one symptom:
- robot does not move;
- robot drifts;
- arm overshoots;
- vision is intermittent;
- autonomous mission freezes.
Create a decision tree with at least three layers and one observable check at each branch.
Do not put "replace part" as the first check.
Find the first wrong boundary
A robot veers left.
That symptom does not tell you which subsystem is wrong.
Trace the chain:
path target
↓
wheel velocity targets
↓
motor commands
↓
motor outputs
↓
wheel motion
↓
robot motion
Now compare expected and observed values at each boundary.
| Boundary | Left | Right | Interpretation |
|---|---|---|---|
| target velocity | 1.0 | 1.0 | planner symmetric |
| controller output | 0.55 | 0.54 | commands nearly symmetric |
| measured wheel speed | 0.72 | 0.96 | physical response diverges |
The first major disagreement appears between motor command and measured wheel motion, not in the path planner.
Investigate that layer: friction, gearing, motor health, sensor conversion, mechanical drag.
Do not erase the evidence
Changing gains before saving the trace destroys a useful baseline.
A good debug cycle is:
preserve failure → localize boundary → change one cause → rerun same test
A fix is more defensible when the same test that exposed the problem demonstrates that it changed.
process flow
Robotics Careers, Ethics, and Social Impact: Engineering Evidence Flow
Plan
Name the system, criterion, constraint, and safety condition.
Model
Trace the control, energy, and feedback paths.
Test
Run a bounded approved test and record evidence.
Revise
Document correction, limitation, and next safe action.
Read this concept flow as plain text
- Plan. Name the system, criterion, constraint, and safety condition.
- Model. Trace the control, energy, and feedback paths.
- Test. Run a bounded approved test and record evidence.
- Revise. Document correction, limitation, and next safe action.