Skip to content

[T-094c] Node episode_manager: wait lifecycle ACTIVE, initial pose, NavigateToPose, result → episode_done.json #198

Closed

Description

@CodewithJha

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

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

Branch feat/t-094c-node-wait-lifecycle-active-initial — one task = one branch = one PR (doc 32 §6)

Summary

Implement the episode orchestration node per doc 10 §5: wait for Nav2 lifecycle ACTIVE (timeout startup_timeout_s), publish /initialpose, start recorder, send goal, stop on result / T_max / wall timeout, write episode_done.json with status and timings, exit codes classifying infra failures.

Context / motivation

Worker ↔ episode communication is files + exit code (no live ROS link in the worker).

Scope

In scope

  • Exit-code table documented in topics.yaml comments or README.

Implementation guidance

  • episode_manager.py: reads episode.yaml (start pose, goal pose, time_limit_s, wall-timeout factor); waits for Nav2 lifecycle ACTIVE via nav2_simple_commander.BasicNavigator.waitUntilNav2Active() bounded by startup_timeout_s (own timer, since the helper blocks).
  • Publishes /initialpose, waits for the first amcl_pose within oracles.infra.spawn_tolerance_m, starts the recorder (service ~/start), sends NavigateToPose, monitors feedback; ends on result, time_limit_s (sim time) or wall timeout.
  • Writes episode_done.json {status: SUCCEEDED|ABORTED|CANCELED|TIMEOUT|STARTUP_TIMEOUT|SPAWN_FAILED, nav_result_code, t_start, t_end, sim_time_s, wall_time_s, rtf_mean, recoveries} and exits with a code table (0 episode completed with any nav result; 10 startup timeout; 11 spawn failure; 12 internal error) that T-096b maps to InfraCheck reasons.
  • 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.startup_timeout_s
  • oracles.infra.spawn_tolerance_m

Acceptance criteria

  • Mocked Nav2 action server tests for success, abort, timeout, startup timeout.
  • Exit-code table defined once in a shared constants YAML used by node and backend.
  • TIMEOUT measured in sim time; wall timeout as safety net.
  • 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_manager.py.

Dependencies

Blocked by: #192 (T-093a)

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_manager.py
  • ros_ws/src/roboprobe_ros/test/test_episode_manager.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-094c (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 §5 · doc 30 §RB-03

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

External:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:rosROS 2 nodes and packagesmilestone: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