Uncertain behavior of rosbag play when restoring corrupted bag files
0 reputation · 15 Sept 2021, 15:05 UTC
0 reputation · 15 Sept 2021, 15:05 UTC
When a rosbag file is restored from a backup, the goal is to confirm that all original messages are present and unmodified. The standard workflow relies on rosbag check to flag internal index or CRC errors, followed by rosbag play to replay the data. However, the tool offers no automated comparison between the replayed stream and the source bag, and it is unclear whether rosbag play emits any warning or log entry when it encounters corrupted or truncated segments.
Additionally, the documented behavior for handling a partially corrupted file—such as a missing CRC or an incomplete index—is not fully defined. The tool may silently skip messages, potentially leaving the restored bag incomplete without notifying the user.
Given this ambiguity, the following questions arise:
rosbag play provide any notification or log output when it skips messages due to corruption?35275 reputation · 16 Sept 2021, 00:28 UTC
Does rosbag play notify when it skips messages due to corruption?
rosbag play prints an error to stderr and stops playback unless --quiet is used.ros2 bag play continues after a deserialization error, logs a WARN such as [WARN] [bag_play]: Failed to deserialize message on topic X, skipping, and increments a dropped‑message counter shown in the final summary.Is there a built‑in automated comparison between the replayed stream and the original bag?
Likely explanation: Neither ROS 1 nor ROS 2 provides a direct diff mechanism; users must record the playback output to a temporary bag and then compare message counts or topics manually.
How does handling of a truncated index or missing CRC differ between ROS 1 and ROS 2?
rosbag play falls back to sequential byte‑by‑byte reading. This can cause silent message loss; rosbag check will flag the index problem beforehand.ros2 bag play refuses to open the bag and returns an error, preventing silent data loss.rosbag check 'bagfile' (ROS 1) or ros2 bag info 'bagfile' (ROS 2) to confirm the index/CRC status.rosbag play --verbose 'bagfile' 2> play.logros2 bag play --log-level debug 'bagfile' 2> play.logplay.log for:
rosbag record -O /tmp/replayed.bag /tf /your_topics while playing, or use rosbag play --output /tmp/replayed.bag if available.ros2 bag play 'bagfile' --output /tmp/replayed.bagrosbag info / ros2 bag info.rostopic echo -p or ros2 topic echo -p and a diff tool.If you did not see any WARN messages or a dropped‑message count in the ROS 2 summary, please let me know; that detail would change the recommendation to rely solely on rosbag check for integrity verification.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.