Unit 10 · overview

Unit 5: Logs, Exceptions, and Controlled Diagnosis

Tests answer questions you chose in advance. Runtime failures often arrive with incomplete information. This chapter teaches you how exceptions and logs preserve what happened, how WPILib and ROS 2 logging differ, and how to build a diagnostic timeline without turning correlation into a made-up cause.

Chapter question

How can a robot software team turn exceptions, telemetry, tests, and runtime observations into a diagnosis that clearly separates detection, cause, recovery, and remaining uncertainty?

What you will understand

You will learn exception propagation, useful diagnostic context, WPILib DataLogManager and typed data-log entries, detection versus diagnosis versus recovery, ROS 2 logging severity and logger identity, and evidence-timeline construction.

What you will do

You will trace an exception through several Java methods, design timestamped WPILib telemetry, separate raw input from accepted component state, compare WPILib logs with ROS 2 logs, inject an invalid 3.70 m range value, and reconstruct the resulting incident from several independent evidence sources.

What you will produce

Your final artifact is a Controlled Diagnosis Record containing the known-good JUnit baseline, WPILib-style runtime timeline, rejected-value context, modeled health-state changes, controlled ROS 2 graph/configuration observations, competing hypotheses, and one justified next diagnostic action.

How the week connects

Week 9 established what controlled tests can prove. Week 10 asks what to do when a running component sees something the tests did not prevent. The next unit moves into ROS 2 Jazzy itself, where graph, topic, service, action, parameter, and logging evidence become the primary runtime investigation tools.

Key vocabulary

exception propagation, stack trace, cause, telemetry, DataLogManager, DataLog, log entry, timestamp, severity, logger, /rosout, detection, diagnosis, recovery, hypothesis, timeline

Approximate time

About 210 minutes for the five lessons, lab, and wrap-up. No physical robot is required. Students with local WPILib or ROS 2 environments may use their own runtime records when clearly labeled; otherwise the course supplies deterministic evidence for analysis.

Final evidence required

A complete Controlled Diagnosis Record that preserves the invalid input and software response, keeps WPILib and ROS 2 records labeled by source, distinguishes modeled recovery from physical recovery, identifies at least three plausible hypotheses, and names a next observation that would genuinely reduce uncertainty.