RobotGuide
Deliberate practice/Debugging Drills

Practice 3 / 4

Debugging Drills

24 real faults: symptom → path → root cause

The dividing line of debugging skill is layering, not guessing. For each scenario, write your own triage tree before reading the answer: the most valuable part of the answer is not the root cause but the order of the path.

24 scenarios in total. Say it yourself before opening any answer.

Power-Up and Boot 4

A new board is powered on for the first time: power LED off, current 0.

Path: measure input voltage → check fuse / reverse-polarity diode → measure LDO input and output → disconnect loads and re-power. Common root causes: reversed supply, LDO soldered backward, blown fuse.

Current spikes to 2 A at power-on and a component gets hot.

Path: current-limited supply starting at 100 mA → find hot spots with the back of your hand → check decoupling caps for shorts → disconnect supply domains one by one. Common root causes: shorted capacitor, chip soldered backward.

No UART output at all, but power is fine.

Path: measure BOOT pin levels → check the crystal / clock → swap the USB-TTL adapter → scope the TX line for waveforms. Common root cause: BOOT0 pulled high into DFU.

The board sometimes boots and sometimes does not.

Path: watch the reset pin waveform → measure supply rise time → check the watchdog → retest cold and hot. Common root cause: power ramp too slow, so the supply is not stable when reset releases.

Communication and Buses 4

CAN drops frames as soon as load rises.

Path: measure termination (both ends in parallel should read 60Ω) → check error frame counters → lower the bit rate and retest. Common root cause: only one 120Ω terminator; reflections cause bit errors.

I2C reads back all 0xFF.

Path: logic analyzer for ACK → check pull-up values → verify the slave address (7-bit / 8-bit confusion) → check bus capacitance. Common root causes: wrong address or missing pull-ups.

SPI reads back all 0x00 or 0xFF.

Path: verify CPOL/CPHA → check CS setup and hold times → drop the clock to 1 MHz and retest. Common root cause: mode mismatch (modes 0 and 3 are most often confused).

A USB device is plugged in but not recognized.

Path: measure the D+ pull-up (full speed should show 1.5 kΩ to 3.3 V) → measure VBUS → capture USB enumeration packets → swap cable and port. Common root causes: D+/D− swapped, missing pull-up.

Motion and Control 4

A 1 kHz loop occasionally times out at 20 ms.

Path: perf for scheduling latency → check the thread for malloc / logging / file IO → check USB and network interrupts → check CPU frequency scaling. Common root cause: blocking calls on the real-time path.

A joint goes 'clunk' at startup.

Path: scope the phase currents → check position-loop gain → feel the backlash by hand → lower the gain and retest. Common root cause: gain too high + drivetrain backlash.

The arm's end-effector is off by 5 mm, but repeatability is excellent.

Path: check calibration (hand-eye / tool) → check link parameters → check the absolute encoder zero. Common root cause: systematic calibration error — good repeatability rules out random error.

A mobile robot drifts off a straight line.

Path: check wheel-diameter calibration → check wheel track → check tire slip → drive 3 m straight and measure the offset. Common root cause: wrong wheel-track or wheel-diameter parameters.

Perception 3

Lidar mapping shows 'ghosts'; walls appear doubled.

Path: check lidar-odometry time sync → check odometry calibration → check scan-matching parameters → compare mapping while stationary. Common root cause: unsynchronized clocks smear the point cloud while moving.

The depth camera loses depth across large areas in sunlight.

Path: retest in another scene → look at the confidence map → compare stereo / structured-light options. Common root cause: active infrared drowned by sunlight.

Grasp success is 50%, and failures are mostly empty grasps.

Path: tally failure samples → check depth-map scale → recheck hand-eye calibration → validate with a known-size object. Common root cause: hand-eye calibration drift (collision or thermal drift).

Software and Systems 3

One node pins a whole core as soon as it starts.

Path: top -H for threads → perf for hotspots → check callback frequency and QoS queues. Common root cause: a timer period written as 1 ms, or queue backlog firing callbacks back-to-back.

Stable in simulation, oscillating on the real robot.

Path: measure end-to-end latency → check friction and backlash → lower gains and retest → do system identification. Common root cause: the sim2real gap (unmodeled latency + friction).

It slows down noticeably after 20 minutes of running.

Path: measure temperatures (motor / driver / SoC) → check current limits → check the derating policy. Common root cause: thermal derating, not the algorithm slowing down.

ROS 2 and Middleware 6

Publisher and subscriber both start fine with the same topic name, but the subscriber receives nothing, and ros2 topic echo works.

Path: run ros2 topic info -v on both ends for QoS → compare reliability and durability → check whether the domain id matches → finally check for multi-machine setups and blocked multicast. Common root causes: subscriber RELIABLE with publisher BEST_EFFORT, or different domain ids on the two ends.

It runs in simulation, but tf keeps throwing LookupException: extrapolation into the future.

Path: ros2 topic echo /clock to see whether a clock exists → check use_sim_time consistency → compare tf timestamps against sensor timestamps → check that static tf is actually published. Common root cause: half the nodes have use_sim_time on, half off.

Turning on the camera makes the control loop jitter; turn it off and it recovers instantly.

Path: rqt_graph to see whether both callbacks are in the same node → check whether they share a callback group → ros2 topic hz on the control topic's actual rate → ros2 topic bw on camera bandwidth. Common root causes: a camera callback blocking the control callback in the same mutually exclusive group, or large image copies saturating memory bandwidth.

Two robots launched from the same launch file: the second one moves and the first one's commands go haywire.

Path: ros2 node list for duplicate names → ros2 topic list for shared topics → check namespace and remap in the launch. Common root cause: no namespace, so both machines share one /cmd_vel.

After switching to Cyclone DDS, small messages are steadier, but large point clouds will not send.

Path: tune MTU and fragmentation parameters → check whether shared memory is in use → measure single-message size against bandwidth → compare against switching back to Fast DDS. Common root causes: default fragments too small, or shared memory inactive across machines falling back to UDP.

The control node occasionally stalls 40 ms per cycle, with nothing in the logs.

Path: capture one executor schedule with ros2_tracing → check for dynamic allocation and GC → check callbacks for logging and lock-taking → check CPU affinity and priority. Common root cause: heap allocation or synchronous IO inside a callback, yielding to kernel scheduling.