Theme
Tier 5 · lesson 7 of 9 · 45 min

Alive is not the same as ready

You will: Separate liveness from readiness, and make a dashboard that cannot report stale state as current.

The dashboard runs on the robot, not on a server — a dashboard that needs the internet to tell you the arm is fine is a dashboard that lies during an outage. It answers two questions that sound the same and are not:

  • /healthz — is this process alive? It answers 200 even when the arm has been unplugged for an hour.
  • /readyz — is the robot usable? Joint state arriving and the controllers that move it active. Otherwise 503, with reasons.

Conflating them breaks in both directions. An orchestrator watching a combined check would restart a perfectly healthy dashboard every time you switched the arm off. A monitor watching only liveness stays green through a total robot outage. Deploy gates, alerts and humans watch /readyz.

Two bugs were found by killing a running robot and watching the screen, and they had the same shape: the dashboard kept reporting the last thing it knew as though it were current. After the controller process died, all three controllers still showed active. After that was fixed, the hardware still showed active.

The cause is worth remembering anywhere you poll a service: in ROS 2's Python client, service_is_ready() keeps returning True after the server is gone. The poll keeps firing, never completes, and the previous answer survives forever. So every piece of state now carries a timestamp and ages out — six seconds for controller data — and stale values are shown as stale and never counted as active.

Readiness had looked correct through the first bug, only because joint state happened to go stale at the same moment. Relying on that would have been relying on a coincidence.

The version block comes from the environment, injected at build or deploy time — never read from a local checkout, because a deployed robot has none. Anything unknown says unknown, in amber, and is logged at startup. A robot that cannot say which commit it runs cannot be debugged.

The SO-101 can answer one more question, because its bus servos measure their own load and temperature. So readiness here has two more conditions: no joint straining, pushing at 90% or more of its effort limit for half a second, and no servo at 65 °C or above. A gripper is exempt from the first, because a gripper holding something is meant to push. In Gazebo the load comes from the physics engine and there is no temperature; on the real arm both come from the servos.

In the simulation

Reproduce the lesson's push into the bench. The simulation is kinematic, with no effort to measure, so it cannot say "straining"; the bench check plays the part /readyz plays here: a move the arm accepted, reported as wrong.

Kinematic: joints move at their real speed limit, but there is no gravity, no load and no physics. That is what the steps below are for.

The SO-101 loads as you reach it.

In this lesson

  1. Open Inspect, then /joint_states. Effort is empty here; on the real arm it is what the strain check reads.
  2. Send shoulder_lift towards the lesson's goal of 1.2 rad, and bend elbow_flex, until a link goes below the bench.
  3. Send it back to ready. Nothing latches; the warning goes when the arm leaves the bench.

Do it

  1. Start the SO-101 in Gazebo, then the dashboard in a second terminal.

    make sim
    make dash
    
  2. Open http://localhost:8107/. Each joint now has a load: its effort as a share of its limit. Then ask the two questions from a third terminal.

    curl -s -o /dev/null -w "healthz %{http_code}\n" http://127.0.0.1:8107/healthz
    curl -s -w "\n%{http_code}\n" http://127.0.0.1:8107/readyz
    

    Expect: healthz 200 and a ready verdict. shoulder_lift carries the most load, about 40%: it is holding the arm up against gravity.

  3. Drive the arm down into the bench, on purpose.

    make shell
    ros2 action send_goal /arm_controller/follow_joint_trajectory \
      control_msgs/action/FollowJointTrajectory \
      "{trajectory: {joint_names: [shoulder_pan, shoulder_lift, elbow_flex, wrist_flex, wrist_roll], points: [{positions: [0.0, 1.2, 0.8, 1.0, 0.0], time_from_start: {sec: 3}}]}}"
    

    Expect: SUCCEEDED. Remember that.

  4. Ask for readiness again, from the third terminal.

    curl -s -w "\n%{http_code}\n" http://127.0.0.1:8107/readyz
    

    Expect: 503, with reasons: shoulder_lift and elbow_flex are straining at about 100% of their limit. The arm stopped well short of the goal, against the bench, and the controller called the goal reached.

  5. Send it back to its ready pose, and ask once more.

    ros2 action send_goal /arm_controller/follow_joint_trajectory \
      control_msgs/action/FollowJointTrajectory \
      "{trajectory: {joint_names: [shoulder_pan, shoulder_lift, elbow_flex, wrist_flex, wrist_roll], points: [{positions: [0.0, -0.6, 0.8, 0.5, 0.0], time_from_start: {sec: 3}}]}}"
    curl -s -w "\n%{http_code}\n" http://127.0.0.1:8107/readyz
    

    Expect: 200 again. Nothing latches: readiness describes now.

  6. Finally, stop the simulator with Ctrl-C in its terminal, wait ten seconds, and ask again.

    curl -s -o /dev/null -w "healthz %{http_code}\n" http://127.0.0.1:8107/healthz
    curl -s -w "\n%{http_code}\n" http://127.0.0.1:8107/readyz
    

    Expect: healthz 200 still, and /readyz 503 because joint state is stale and the controllers stopped answering. No word about straining, even if you stopped it mid-push: an old effort reading says nothing about now.

You will know it worked when: You watched a goal report SUCCEEDED while readiness said the arm was pushing against something, and you watched liveness stay 200 while readiness went to 503 when the robot went away.

When it goes wrong

A goal reports SUCCEEDED and the arm is not where it was sent.

Why: The trajectory controller here sets no per-joint goal tolerance, so it checks that time ran out, not that the joints arrived.

Fix: Watch /readyz, which judges what the servos report, and compare the final joint state with the goal yourself.

The dashboard shows a load for every joint, but /readyz never mentions straining.

Why: The arm is not actually pushing against anything; 90% for half a second is a high bar on purpose.

Fix: Check that the goal really drives it into the bench. A normal move peaks well under half its limit.

A joint has no load, or no temperature.

Why: Load needs an effort limit, read from /robot_description. Temperature comes only from real servos, never from Gazebo.

Fix: Start the dashboard while the robot is running, so it receives the description.

make dash dies at once with OSError: [Errno 98] Address already in use.

Why: A dashboard from an earlier run still holds port 8107.

Fix: make stop.

Terms

Liveness
Whether a process is able to respond at all. Says nothing about whether the thing it manages works.
Readiness
Whether the system can do its job right now — here, joint state arriving and controllers active. What deploy gates and alerts watch.
Staleness
Data older than it should be. Shown, flagged, and never counted as current.
Strain
A joint pushing at or near its effort limit and staying there. Something is in its way, or the load is more than it can move.

Every term in the course: glossary.

Check yourself

Answer in your head first, then open it.

The goal said SUCCEEDED and /readyz said 503. Which one was right, and why could the other be wrong?

/readyz. The controller only checked that the trajectory's time ran out; the servos reported that two joints were pushing at their limit against something.

Why is the gripper exempt from the strain check?

A gripper closed on an object pushes at its limit by design. Counting that would make every successful grasp a fault.

Why does a second-old effort reading not count as straining?

It says nothing about now. The robot is already not ready because its state is stale, and blaming a joint would send someone after the wrong fault.

Stretch

Find another place in this project where a service is polled, and check whether its result can go stale in the same way. If it can, what would you timestamp?

Hint

Search for service_is_ready across src/.

Going deeper