Connect perception to action without blocking control
Use a small state machine that expires observations and isolates slow inference.
Opening the Python editor…
Requirements and learning goals
Before you start
- Structured intents
- A simulated controller
You will be able to
- Separate model and control loops
- Handle stale observations
- Make cancellation explicit
The browser exercise above works without extra setup. The project brief below assumes the listed prerequisites and gives you a task and checks to perform. Need a guided first project?
Perception estimates what is around the robot; control decides how it moves. A state machine records which stage the task is in and which transitions are allowed. Separating these jobs lets a slow model finish without blocking stop requests. Here you will test the decision rules for waiting, approaching, and stopping.
Use separate app services for and control, then pause simulated sensors to verify that the controller stops on stale input.
Separate the rates
Camera inference may take hundreds of milliseconds while a controller needs frequent updates. Keep inference outside the motor loop. The controller reads the latest accepted observation and decides whether it is fresh enough for the current action.
The Sassy ROSMASTER demo keeps visual and language inference outside its motion loop. braking has independent freshness checks.
Try a state transition
def next_state(request, fresh_target, route_clear, arrived):
if request == "stop":
return "stopped"
if not fresh_target:
return "waiting_for_observation"
if not route_clear:
return "blocked"
if arrived:
return "complete"
return "approaching"
assert next_state("approach", False, True, False) == "waiting_for_observation"
assert next_state("stop", True, True, False) == "stopped"This is decision logic, not a motor controller. Define the output of every state. Waiting, blocked, and stopped should request the appropriate robot-specific stop behavior. Completion requires measured arrival, not merely sending a goal.
Test interruptions
In simulation, delay inference, remove the target, invalidate the route, and send stop during an approach. Log state transitions with the observation ID and reason. A late response from an earlier request must not reactivate a canceled action. Use request IDs or cancellation tokens to reject it.
Common snag: refreshing an old frame's timestamp when inference finishes. Preserve capture time and record completion time separately.
Finish with a transition log showing that slow perception does not prevent stopping. Optional extension: add a timeout and a bounded recovery action, such as requesting a new observation, while keeping the physical controller responsible for its own limits.
Before you move on
Can you do each of these?
- Separate model and control loops
- Handle stale observations
- Make cancellation explicit
0 of 2 checkpoints solved. Try checkpoint 1
All lessons in this topic
- 1. Run a VLM on a live camera
- 2. Understand vision-language-action models
- 3. Inspect a VLA action chunk
- 4. Ground a request in supported robot skills
- 5. Connect perception to action without blocking control
- 6. Record the evidence around a failed action
- 7. Compare a learned approach with a scripted baseline