TactivergeLite

Lite / Intelligent Robotic Systems / Week 29

No state left behind

A robot hits a wall, enters FAULT, and stays there forever, even after someone clears the path. The code has no bug. The design does.

About 35 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

Most state-machine failures are not typos: they are missing transitions. A state nobody can leave, or a state nobody can reach, passes every test you thought to write. Engineers check completeness systematically.

Predict

A junction's state machine goes from NS green straight to EW green. What is missing?

  1. Nothing: it is faster
  2. Amber and an all-red clearance between them
  3. A walk signal
Guess first, then reveal

Amber warns drivers and all-red lets the junction clear. Skipping them is the kind of missing state a safety audit is designed to catch.

Discover

Build the junction's controller as a cycle of states and run the server's safety audit. Start from the starter design and fix one failure at a time, re-running the audit after each fix.

What the interactive shows (text version)

In the traffic-system build, the starter state cycle fails the audit for missing amber, missing all-red clearance and no pedestrian walk phase; adding those states in order makes the audit pass.

You can also open the interactive on the full site when you have a faster connection.

Understand

Three completeness checks

Reachability: can every state be entered from the initial state? An unreachable state is dead code, or a sign a transition is missing. Escape: does every state have a way out? A trap state freezes the robot. Coverage: for every state, is every event either handled or deliberately ignored?

Fault and safe states

Real robots need a FAULT or SAFE_STOP state reachable from every state where something can go wrong, and an explicit, deliberate way out (a reset, after the cause is cleared). The way out is part of the design, not an afterthought.

Tables beat diagrams for checking

Diagrams are good for understanding; tables are good for checking. Write a grid with states as rows and events as columns. Every cell must say a target state or 'ignore', with a reason. An empty cell is a decision nobody made.

Explain it another way

Intuitive

Like a building's floor plan: every room needs a door in and a door out, and every corridor sign must point somewhere real.

Technical

Reachability is a graph search from the initial state. A trap is a reachable state with no outgoing transition to another state. Coverage is the state × event table with no undefined cells.

Applied

Traffic-signal controllers are checked for conflicting greens and minimum clearance times before deployment; the Build's audit applies the same kind of rules to your design.

Worked example 1

States IDLE, DRIVING, DELIVERING, FAULT. Transitions: IDLE→DRIVING (order), DRIVING→DELIVERING (arrived), DELIVERING→IDLE (done), DRIVING→FAULT (bump). Which check fails?

Escape: FAULT has no way out, so it is a trap. Add FAULT + reset → IDLE, ideally guarded by 'obstacle cleared'.

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

Practice 1. Which state in the worked example is a trap?

Practice 3. A state CHARGING exists in the code but no rule leads into it. What should you conclude?

state number

Practice 5. What is the best way out of a FAULT state on a delivery robot?

Apply it

Write the full state × event table for the delivery robot (5 states, 6 events). Fill every cell with a target or 'ignore: reason'. Find at least one cell where 'ignore' would be unsafe and fix it.

Reflect

Which empty cell in your table surprised you most?

Write your answer on paper or in your own notes. Lite never stores what you write.

← States, events and guardsTest every arrow →