Rosbag Workflow: Test, Record, and Debug DDS/QoS

VerifiedSafe

Standard workflow for using rosbag (mcap): loop playback, recording, and troubleshooting DDS/QoS connectivity issues.

Sby Skills Guide Bot
TestingIntermediate
8/8/2026
Claude CodeCursorCodex
#ros2#rosbag#mcap#dds-qos#robotics

Recommended for

Automated summary

Provides a repeatable procedure for recording and loop-replaying rosbags (mcap) and for triaging DDS/QoS-related message delivery problems in ROS 2.

Strengths

  • Ordered triage checklist for DDS/QoS issues (ROS_DOMAIN_ID, RMW implementation, QoS, TRANSIENT_LOCAL durability, container discovery)
  • Concrete fixes for data missing at the start of a recording (--start-paused, dropping the first seconds)
  • Reproducible replay setup using a dedicated container, shared volume and a Makefile target
  • Normalizes inputs to mcap and caches already-converted mp4 previews

Limitations

  • Assumes a ROS 2 environment with the ros2 CLI and rosbags-convert already installed
  • QoS diagnosis stays manual: you must compare ros2 topic info -v output yourself
  • Provides no automated assertions usable directly in CI
When to use it

Use it when a ROS 2 topic receives nothing during bag replay, or when the frequency of recorded data looks wrong.

When not to use it

Not useful outside the ROS 2 ecosystem, or when you need an automated test framework rather than a manual replay procedure.

Security analysis

Safe
Quality score88/100

This is a documentation-only ROS 2 rosbag workflow. The included commands are local inspection, playback, recording, and DDS/QoS diagnostics. Mentions of Docker, volumes, and networking are for legitimate reproducibility. No destructive commands, secret exfiltration, obfuscated payloads, or safety-disabling instructions are present.

No concerns found

How this analysis is made

Examples

Loop replay test
sample.mcap をループ再生して、圧縮画像トピックが受信できているかと hz を確認したい。docker compose で再生専用コンテナを立てて data/ を共有する構成も含めて手順を教えて。
Topic not received
ros2 bag play で流しているのに /scan が受信できない。ROS_DOMAIN_ID、RMW_IMPLEMENTATION、QoS の順に切り分けて、確認するコマンドも一緒に教えて。
Missing data at record start
ros2 bag record の開始直後のデータが欠ける気がする。--start-paused を使った回避手順と、変換時に先頭数秒を捨てる方法を教えて。

name: rosbag-workflow description: rosbag(mcap)を使った記録・再生・ループ再生テストと、DDS/QoS 起因の疎通トラブル切り分けの定型手順。「rosbagをループ再生してテスト」「bagを流してもトピックが受信できない」「録画データの周波数がおかしい」「record開始直後のデータが欠けている」ときに使用する。

Rosbag Workflow(記録・再生テストと DDS/QoS 切り分け)

rosbag を使った開発テストループの定型と、頻出のハマりどころ。

再生テストループ

開発中の受信側(バックエンド・可視化 UI)をテストする定番構成:

# bag の中身を確認してから使う
ros2 bag info data/sample.mcap

# ループ再生(テスト用に流しっぱなしにする)
ros2 bag play data/sample.mcap --loop

# 受信確認(別ターミナル/コンテナ)
ros2 topic list
ros2 topic hz /camera/image_raw/compressed
  • コンテナ構成では、bag 再生専用コンテナを立てて data/ を volume 共有すると再現性が高い
  • make rosbag-loop のような Makefile ターゲットに包んでおくと毎回のタイプが減る(docker compose + bag play + msgs ビルドを薄くラップする)
  • カスタム msg を使う bag は、再生側・受信側の両方に msg パッケージのビルドが必要

記録(record)の注意点

  • 開始直後のデータ欠け: ros2 bag record は開始直後、全トピックの購読が完了するまでラグがあり、序盤のメッセージが欠ける。対策:
    • 記録開始から数秒間のデータは使わない前提で運用する(変換時に先頭を捨てる)
    • --start-paused で購読を確立してから再生/記録を始める
  • 画像トピックをロボット外のネットワーク越しに記録すると帯域圧迫で周波数が落ちる。記録はロボット側ホストで行うか compressed topic を使う

DDS/QoS トラブル切り分け

「トピックは流れているはずなのに受信できない/周波数が出ない」ときの確認順:

  1. ROS_DOMAIN_ID の一致 — 全コンテナ・ホストで同一か。既定は 0
  2. DDS 実装の統一 — CycloneDDS と FastDDS の混在を避ける。RMW_IMPLEMENTATION=rmw_cyclonedds_cpp で統一(迷ったら CycloneDDS)
  3. QoS の不一致 — ros2 topic info /topic -v で配信/購読の QoS を突合。BEST_EFFORT vs RELIABLE、depth 設定を確認
  4. TRANSIENT_LOCAL の残留 — durability が TRANSIENT_LOCAL のトピックは、購読開始時に過去の古いメッセージが届く。タイムスタンプ(header.stamp)で閾値フィルタして古いフレームを捨てる
  5. コンテナ間の DDS 発見 — network_mode、/dev/shm 共有、マルチキャスト可否を確認

bag ファイル形式

  • 入力は mcap に正規化すると扱いやすい。ROS 1 の .bag や sqlite3 形式は rosbags-convert で事前変換する
  • Python から読む場合は mcap パッケージの reader を使う(トピック・時刻でフィルタしながら streaming 読みできる)
  • プレビュー動画が欲しいときは image topic を ffmpeg で mp4 化する。一度変換した mp4 はキャッシュして再利用する(毎回の再変換は時間の無駄)

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/download' --output '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md.part' && mv '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md.part' '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md' && test -s '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/rosbag-workflow' && cp -R '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm' '.claude/skills/rosbag-workflow'

Cursor
test -f '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md' && test -s '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/rosbag-workflow' && cp -R '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm' '.cursor/skills/rosbag-workflow'

Codex
test -f '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md' && test -s '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/rosbag-workflow' && cp -R '.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm' '.agents/skills/rosbag-workflow'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm'

openskills read 'rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/rosbag-workflow-test-record-and-debug-dds-qos-msjwk4nm/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills