Skip to content

[T-033d] kinematic2d episode loop → Trace; determinism and ≤ 2 s/episode benchmark #54

Closed

Description

@CodewithJha

Task T-033d · Milestone M2 — Scenario + kinematic2d · Size M · Priority P0 · Epic #2

Implements FR-SIM-001 · NFR-PERF-001 · NFR-REP-001

Branch feat/t-033d-kinematic2d-episode-loop-trace-determinism — one task = one branch = one PR (doc 32 §6)

Summary

Implement backends/kinematic2d/episode.py: fixed-step loop wiring robot, sensors, localisation, costmap, planner and controller; sample at sample_hz; produce a Trace with every column of doc 05 §1 and nav_status semantics.

Context / motivation

M2 exit criterion: k2d episode ≤ 2 s and bit-identical traces for equal seeds.

Scope

In scope

  • run_k2d_episode(world, task, scenario_values, model, settings, seed) -> Trace.
  • Stops on goal reached (tolerances from task), T_max, or ABORTED.
  • Separate RNG streams (sensor, perception, localization) from the run seed.
  • pytest-benchmark for a 120 s sim episode.

Implementation guidance

  • Pre-allocate trace arrays; avoid per-step Python object creation. Use threadpoolctl to pin BLAS threads to 1 inside the loop.
  • 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.

Acceptance criteria

  • Nominal scenario reaches the goal.
  • Trace hash identical across two runs and two processes for the same seed (NFR-REP-001).
  • Median wall time ≤ 2 s per 120 s episode on the CI runner (NFR-PERF-001).
  • 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

  • tests/unit/backends/kinematic2d/test_episode.py, tests/benchmark/test_k2d_episode_bench.py.

Dependencies

Blocked by: #51 (T-033a), #52 (T-033b), #53 (T-033c), #50 (T-032), #47 (T-018), #41 (T-028)

Blocks: #55 (T-035b), #121 (T-053)

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:

  • backend/src/roboprobe/backends/kinematic2d/episode.py

Integration point for the k2d stream.

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-033d (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 §7 · doc 10 §7.3 · doc 05 §1 · doc 02 §5

Requirements: FR-SIM-001 · NFR-PERF-001 · NFR-REP-001 (traceability: doc 28)

External:

Activity

  1. added
    area:simulatorSimulator backends (kinematic2d, Gazebo adapter)
    priority:P0Critical path / blocks others
    milestone:M2M2 — Scenario + kinematic2d
    taskChild task of a milestone epic
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:simulatorSimulator backends (kinematic2d, Gazebo adapter)milestone:M2M2 — Scenario + kinematic2dpriority:P0Critical path / blocks otherssize:M1-3 daystaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions