An interrupt handler, or interrupt service routine (ISR), is a predefined function that runs when hardware or software signals an event. In a robot, it lets urgent events such as bumper presses, stop-button activation, or timer expiry interrupt the currently running program instead of waiting for polling. section 3.5
The interrupt path has three practical concerns:
- The interrupt source signals an event, either externally through hardware or internally through the system. section 3.5
- The CPU and operating system switch from the current task to the ISR, introducing interrupt latency. section 3.5
- Variation in that latency is jitter, which matters when robot reactions must be predictable. section 3.5
#1 input.on_change(True, do_something)
Compare event-driven input handling with cyclic polling: register a callback so the system invokes the handler when the input changes. section 3.5

