Skip to content

[T-094b] Node episode_recorder: 20 Hz Trace v1 Parquet writer + optional rosbag2 MCAP #197

Closed

Description

@CodewithJha

Task T-094b · Milestone M9 — Gazebo backend · Size S · Priority P0 · Epic #9

Implements FR-SIM-003 · FR-SIM-005

Branch feat/t-094b-node-20-hz-trace-v1 — one task = one branch = one PR (doc 32 §6)

Summary

Sample GT pose, AMCL pose, cmd, odom, min distance, nav status and recoveries (/behavior_tree_log) at 20 Hz and write trace.parquet with the shared Trace v1 schema; optionally record MCAP bag per record_bag policy.

Context / motivation

Same Trace schema ⇒ oracles work unchanged on Gazebo runs.

Scope

In scope

  • Flush on stop/shutdown; partial trace on crash marked incomplete.

Implementation guidance

  • episode_recorder.py: timer at backends.gazebo_nav2.sample_hz (20 Hz) on sim time; caches the latest GT pose, AMCL pose, odom, cmd, perturber stats, nav status (from episode_manager) and BT-log recoveries; computes min_obstacle_dist via GroundTruthMonitor; appends to column buffers.
  • On stop: write trace.parquet with the Trace v1 schema (columns, dtypes and metadata identical to T-018: trace_schema_version, units in field metadata, zstd); mark trace.complete=false if stopped by crash/timeout; validate with the vendored validator before exit.
  • Bag: when the record_bag policy says so, spawn ros2 bag record -s mcap -o <workdir>/bag <topics> as a managed subprocess, stopped with SIGINT.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Configuration keys

From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).

  • backends.gazebo_nav2.sample_hz
  • backends.gazebo_nav2.record_bag

Acceptance criteria

  • Trace validates against schema v1 (T-018 validator).
  • A 10 s synthetic run yields 200 ± 1 rows.
  • Schema validation identical to the backend validator (shared test vectors).
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • test/test_episode_recorder.py.

Dependencies

Blocked by: #192 (T-093a), #47 (T-018)

Blocks: #199 (T-094d)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • ros_ws/src/roboprobe_ros/roboprobe_ros/episode_recorder.py
  • ros_ws/src/roboprobe_ros/test/test_episode_recorder.py

Parallel.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-094b (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 10 §6 · doc 11 §6

Requirements: FR-SIM-003 · FR-SIM-005 (traceability: doc 28)

External:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:rosROS 2 nodes and packagesarea:storagePostgres schema, repositories, artifactsmilestone:M9M9 — Gazebo backendpriority:P0Critical path / blocks otherssize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions