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 →Logs can't show what a robot saw when it failed. How to record cameras, ROS, model decisions and metrics around incidents as MCAP, and replay them.

It's Monday morning. A customer emails: one of the arms dropped a part on Saturday night and stopped. Someone on the night shift restarted it and it's been fine since.
You open the logs. There's a line from the controller saying the goal was aborted. A few seconds before it, nothing interesting. CPU was normal. Memory was normal. The model process never crashed.
So what happened?
You can't ask the robot. You can't ask the night shift, who saw the arm stopped but not why. You can try to reproduce it in the lab, but you don't know what the bin looked like, where the part was, or what the light was doing at 11 p.m. on a Saturday. You end up writing "could not reproduce" in the ticket, and you wait for it to happen again.
Airplanes solved this decades ago. When something goes wrong, the recorder already has the last minutes of everything. Robots need the same thing, and I'd argue they need it more.
The short answer: Keep a rolling buffer on the robot with the last few minutes of camera frames, ROS messages, model inputs and outputs, metrics and logs, and save a window around the event when a trigger fires. Store it as MCAP so everything sits on one timeline and opens in standard tools. Then replay it from the trigger backwards, next to a good cycle of the same task.
A robot running a learned policy is a living mind. It looks at the world and decides what to do many times a second. Its model changes when you ship a new checkpoint. The world around it changes every day. And it's far from you, doing real work for a customer.
With a fixed program, a log line usually tells you which branch ran and why. The logic is in the code, and the code is in git.
With a model, the "why" lives in the inputs. The same weights will grip correctly a million times and then fail on one frame where a reflection made the part look like it was somewhere else. Nothing in the logs will tell you about that reflection. To understand the failure you need to see what the robot saw, what the model decided, and what the body actually did. All three, on the same clock.
Logs are still useful. Keep them. But think about what they miss for a robot:
What you want is a short, complete, synchronized recording of the moment.
I'd record everything that could explain a decision or a movement, and nothing else. Concretely:
The thing that makes this useful is that all of it sits on one timeline. You drag a playhead and see the frame, the joint positions, the action the model chose and the log line, all at that instant.
The tempting answer is "record everything, all the time." Don't.
Continuous recording sounds safe, but it fails in practice. Video from two cameras around the clock is a lot of data. You can't upload it over a cellular link. You can't keep it on an SD card that's already half full. And nobody watches it. The interesting ten seconds are buried in a week of footage.
The pattern that works is the one airplanes use: a rolling buffer that's always recording on the machine, and triggers that decide which part of it to keep.
The device always holds the last few minutes of everything in a buffer, overwriting the oldest data as it goes. This costs some memory and disk, but almost no bandwidth, because nothing leaves the machine unless something happens. When a trigger fires, you freeze the buffer and save a window around the event: some time before, some time after.
The "before" matters most. Most failures start before they're visible. The camera froze twenty seconds before the arm missed. The loop rate dropped a minute before the timeout. If you only start recording when the error appears, you'll record the aftermath.
Good triggers are specific and cheap to evaluate on the device:
If your robot does repeated work, like picking, assembling, inspecting, mark the start and end of each cycle and whether it succeeded. Then a failed cycle becomes a trigger with natural boundaries: record from a little before the cycle started to a little after it ended. If you also mark steps inside the cycle, like pick_stator or insert_rotor, the recording shows exactly which step failed.
Then do the thing almost nobody does: keep some good cycles too.
A failed recording on its own is hard to read. Is that wrist angle normal? Does the gripper always pause there? You don't know until you put it next to a cycle of the same task that worked. Keeping one good cycle per task every hour or so is cheap, and it turns "something looks off" into "here, at step three, the arm went 4 cm lower than it does when it works."
Don't invent a format. Use MCAP.
An incident file you can open anywhere is worth more than a nicer one locked in one viewer.
A flight recorder that fills the disk is worse than no flight recorder. A robot that stops because its SD card is full of recordings of the time it stopped is not a joke I want to make twice.
Rules I'd follow:
This part deserves more care than it usually gets.
Robots work near people. A camera pointed at a packing table also sees the hands, and sometimes the faces, of the people working there. Your customer will ask what leaves the building, and they should.
Having the file is half of it. Here's the process I'd follow with a recording open:
A 3D view helps a lot here. If the robot publishes its URDF, you can pose a model of the arm from the recorded joint states and draw the planned path as a ghost next to it. A tracking problem you'd never spot in a plot of six joint angles is obvious when you see the arm cut a corner.
This sequence also tells you who should fix it. Bad inputs point to the camera or calibration. A bad decision on good inputs points to the model, and that recording is now training data. My post on learning from the field is about what to do with it. Good decisions but late ones point to timing, which Eitan covers in his post on control-loop latency and jitter. If you don't yet have the per-inference data a recording needs, start with how to monitor a robot policy in production.
A checklist:
In PhysicalFleet, the agent keeps the buffer and saves the last 5 minutes of metrics, logs, events, ROS logs and camera frames as MCAP when something goes wrong. Failed task cycles are recorded with step markers and replayed in the dashboard next to a good cycle, with a 3D arm built from the URDF and its planned path. Everything stays inside a disk budget and waits on the device while it's offline. We record triggered windows rather than continuous video, and for the reasons above I think that's the better default. More on our observability page.
If you've had to debug a robot incident from logs alone, I'd like to hear how you did it, and what you wish you'd had.
It's a rolling buffer on the robot that always holds the last few minutes of camera frames, ROS messages, model inputs and outputs, metrics and logs. When something goes wrong, it saves a window around the event, including the minutes before it. That lets you replay what the robot saw and did instead of guessing from log lines.
MCAP is an open file format that stores many timestamped channels, like images, ROS messages, metrics and logs, on one timeline. It's self-describing, indexed so you can jump to a moment quickly, and it's the default storage format for rosbag2 in ROS 2. Your recordings stay readable by many tools, including ones you write yourself.
Very little most of the time, because the buffer stays on the robot and nothing is uploaded unless a trigger fires. When one does, you send a bounded window, like the last five minutes, with camera frames downsampled to around 10 fps at reduced resolution. On cellular, send the event, metrics and logs first, and let the frames follow when the data budget allows.
For debugging, I don't think so. Continuous video from two cameras is too much to upload over cellular or keep on a small disk, and nobody watches it. A rolling buffer with triggers, like a failed cycle, a policy health check or a crash, keeps the moments that matter and lets the rest go.
Get a recording of the moment, start at the failure and look backwards for the first thing that looked different. Check the inputs first, then the model's decision, then whether the arm followed the plan, then the machine itself. Putting the failed run next to a good cycle of the same task usually shows where the two split.

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