What is an MCAP file? How to open, read and convert it
What an MCAP file is, how ROS 2 records it, and how to inspect, read in Python, convert from .db3, compress and recover MCAP files on real robots.
By Eitan Chudnovsky →What to record on every inference of an RL or VLA policy in production, which health checks catch silent failures, and why each one matters.

A robot running a learned policy can fail without a single error line.
The process is up. CPU and memory are normal. The model returns an action every 33 ms. And the robot is picking the wrong item, or reaching two centimeters short, or pausing for a second in the middle of every move. Nothing crashed, so nothing alerted.
These machines used to run programs: same input, same output, and when they broke, they broke loudly. Now they run models that make decisions many times a second from what they see. The model changes with every release, the world around the robot changes every day, and the robot is in a warehouse far from the people who trained it. Monitoring has to follow. Watching the process is not enough. You have to watch the decisions.
This post is the practical version: what to record on every inference, which checks catch the failures I have seen most, what thresholds to start with, and how much code it takes.
The short answer: Record every inference: which model and version, how long it took, a summary of the inputs and outputs, and whether the cycle succeeded. Then run a few checks on the robot that each map to a real failure: inputs outside the training range, saturated or NaN actions, a dark or frozen camera, the robot stopping while the model computes, and a slow remote model server. Use fixed thresholds only for safety checks and per-robot baselines for the rest.
I think about policy monitoring in three layers:
Layer 1 tells you about crashes. Layer 3 tells you something got worse, a day late, with no idea why. Layer 2 is where you learn why, and usually before the yield numbers move. That's where this post spends most of its time.
Record these on every inference. Most are small numbers. None of them should be full images.
Keep the per-inference record in a local ring buffer at full rate. Send aggregates (per-minute percentiles, counts) upstream normally. Send the raw window, with camera frames, only when something happens. That is the job of a flight recorder, and it keeps a cellular-connected robot within its data plan.
Raw numbers are useless at 2 a.m. What you want is a short list of checks that each map to a real failure and a real fix. Here are the ones I'd put on every policy.
What: the state vector (joint positions, gripper width, base velocity) goes outside the range the model saw in training.
Why it matters: this is the classic calibration failure. Someone replaces a servo and the joint offset shifts by a few degrees. A camera mount gets bent. The policy never saw those values, so its output is a guess, and it guesses confidently.
How: when you train, save per-dimension percentiles of the training inputs alongside the checkpoint (they are tiny). In production, flag a dimension that stays beyond, say, the 0.5th or 99.5th percentile for more than a few seconds. Require it to be sustained: one frame out of range during a fast move is noise. If you don't have training stats, use the policy's own first hours on that robot as the reference and flag drift away from it.
What: an action dimension sits at its limit for many consecutive steps. For tanh-output policies, values pinned near plus or minus 1.
Why it matters: a saturated policy is asking for more than the robot can give. It is usually pushing against something (a jammed part, a wall, a joint limit) or it is lost and outputting extremes. Either way, the commands are no longer smooth control.
How: count the share of steps in a window where any dimension is within a few percent of its bound. A few percent of steps is normal on aggressive moves. A quarter of steps for ten seconds is not.
What: any non-finite value in the output.
Why it matters: this one has zero tolerance. A NaN sent to a motor controller does whatever that controller does with garbage. Usual causes: a corrupted or half-written weight file, a division by zero in normalization, fp16 overflow after moving to a different GPU.
How: check every output before it leaves your code. On a NaN, do not send it. Hold the last good command or stop, raise an event immediately, and keep the input that caused it. This check belongs in the control path, not only in monitoring.
What: a camera input goes dark (mean brightness near zero), or stops changing while the robot is moving.
Why it matters: frozen is worse than dark. A dark frame is obviously wrong. A frozen frame looks perfectly normal; it is just the frame from 40 seconds ago, repeated because a USB camera dropped and the driver kept returning its last buffer. The policy keeps acting on a world that no longer exists.
How: brightness under a threshold for a few seconds is dark. Frame-to-frame difference at (or very near) zero for more than a second while the joints are moving is frozen. Use the "while moving" part, or a robot waiting at an empty station will trigger it all night.
What: the robot finishes executing an action chunk and then waits, motionless, for the next one.
Why it matters: with synchronous chunked inference, the robot runs 50 actions, asks the model, and stands still until the answer comes back. On a fast GPU you never notice. On a slower one, or with a remote model, the robot stutters every second and a half. Cycle time goes up and nobody knows why.
How: measure the gap between the last executed action of one chunk and the first of the next. Report how often it happens and how long the robot stood still. The fix is usually asynchronous inference: start computing the next chunk before the current one runs out.
What: a large jump between the last action of one chunk and the first action of the next.
Why it matters: each chunk is planned from a slightly different observation, so their ends don't always line up. The result is a jerk at every seam. It wears hardware, it can drop parts, and on an arm near people it is the kind of motion that makes operators nervous.
How: compare the seam jump with the typical step-to-step change inside a chunk. A seam that is several times larger than the usual step, on a regular basis, needs smoothing or blending between chunks.
What: for policies served from a GPU box on the network or from the cloud, inference time goes up, or calls fail or time out.
Why it matters: "the model is slow" can mean three things. The server is overloaded. The network got worse (the Wi-Fi access point at the end of the aisle). Or the robot is starving the request because its own process is busy. You need to know which one before you buy a bigger GPU.
How: record round-trip time and server-reported compute time separately. If round trip rises and server time doesn't, it's the network. If both rise, it's the server. Track failure and timeout rates as their own numbers.
What: episode return, episode length or success rate falls compared with the policy's own recent history.
Why it matters: this is layer 3, and for RL policies the return is the most honest signal you have. But it is slow and noisy, so it tells you that something changed. The checks above usually tell you why.
How: compare a rolling window (an hour, a shift) with the same robot's baseline, ideally for the same hour of day. Alert on a drop that holds for a full window, not on single bad episodes.
What: the top-class probability falls, or entropy rises, for a perception model in the pipeline.
Why it matters: confidence is a noisy signal, but a shift in it means the images changed. Save the frames the model was unsure about. They are exactly the images you want in the next training set.
What: the policy returns the same action regardless of input.
Why it matters: this happens when the input pipeline is broken upstream (all zeros, a stale buffer) or the model was loaded wrong. It looks healthy on every system metric.
Static thresholds on model metrics are a trap. Inference time on a Jetson in a hot enclosure in August is not the same as in March. A robot on the night shift sees different light. Two robots with different cameras have different "normal".
My advice:
Alert on things a person should act on now: NaN actions, a dark or frozen camera, the remote server failing, a sustained drop in task success. Everything else goes into a per-policy health summary someone checks daily, and into the incident recording when something does happen.
The best format I've found is one sentence per policy: which robot, which policy, what is wrong, the evidence. "arm-07: the policy is not doing well because the robot stops for about 4 seconds every 60 steps while the model computes." An engineer can act on that sentence. A dashboard with 40 charts makes them go looking.
How much code should this take? Less than people expect.
Whatever you use, monitoring must never slow the loop or raise into it. Measure its overhead once, on your real hardware.
PhysicalFleet discovers models on the robot with no code: PyTorch, ONNX, TensorRT and JAX processes, openpi π0/π0.5, OpenVLA, LeRobot policies, Stable-Baselines3, the checkpoint each one loaded and its GPU memory. Run your app with pf run --name picker -- python3 app.py, or import physicalfleet, and every inference is traced, with the health checks above judged on the robot and summarized as one sentence per policy. When something goes wrong, the last minutes are saved as an MCAP recording you can replay. More on the observability page.
Once you can see the policy clearly, the next places to look are the loop around it (control-loop latency and jitter) and the test before it ever acts (shadow mode).
If you're running policies on real robots, tell me which failure took you the longest to find. I'm collecting them.
Compare each frame with the previous one, using a simple difference or a small hash. If the difference stays at or near zero for more than a second while the joints are moving, the camera is probably frozen, often a USB camera whose driver keeps returning its last buffer. Tie the check to motion, or a robot waiting at an empty station will trigger it all night.
The usual causes are a corrupted or half-written weights file, a division by zero in normalization, and fp16 overflow after moving to a different GPU. Check every output before it leaves your code. On a NaN, don't send it: hold the last good command or stop, raise an event right away, and keep the input that caused it.
Save per-dimension percentiles of the training inputs next to the checkpoint, and in production flag a dimension that stays beyond roughly the 0.5th or 99.5th percentile for more than a few seconds. Requiring it to be sustained filters out single frames during fast moves. This often catches calibration problems, like a replaced servo that shifted a joint offset by a few degrees.
Alert on things someone should act on now: NaN actions, a dark or frozen camera, a failing remote model server and a sustained drop in task success. Put everything else in a per-policy health summary someone reads daily. Use fixed thresholds only for safety checks, per-robot baselines for the rest, and require a sustained signal before anything fires.
With synchronous chunked inference, the robot executes a chunk, asks the model for the next one and stands still until it arrives. On a fast GPU you don't notice, but on slower hardware or with a remote model the robot stutters at every chunk. The usual fix is asynchronous inference: start computing the next chunk before the current one runs out.

What an MCAP file is, how ROS 2 records it, and how to inspect, read in Python, convert from .db3, compress and recover MCAP files on real robots.
By Eitan Chudnovsky →
Why a ROS 2 node can look alive while its topic goes quiet, how to catch it by hand and in code, and how to alert on silence across a robot fleet.
By Amit Ezer →Connect your first machine in minutes, develop it in the lab and run your whole fleet in production from one place.
Free for up to 3 machines · Then pay as you go