Skip to content

[T-096a] GazeboMaterializer: SdfPatcher (lxml XPath), Nav2ParamOverlay (deep-merge), perturb/bridge/episode files #201

Closed

Description

@CodewithJha

Task T-096a · Milestone M9 — Gazebo backend · Size M · Priority P0 · Epic #9

Implements FR-SIM-003

Branch feat/t-096a-gazebomaterializer-sdfpatcher-lxml-xpath-nav2paramoverlay — one task = one branch = one PR (doc 32 §6)

Summary

Implement backends/gazebo_nav2/materialize.py producing the workdir files of doc 10 §4 for every parameter mechanism (P1–P8), speed keys from SUT profile speed_param_paths, pallet via place_obstacle, lighting scaling, friction tags.

Context / motivation

Pure file generation — fully unit-testable without ROS.

Scope

In scope

  • Golden-file tests for patched SDF and params per fixture scenario.

Implementation guidance

  • backends/gazebo_nav2/materialize.py: class GazeboMaterializer: def __init__(self, settings: GazeboSettings, sut: SutProfile, task: TaskSpec) -> None; def materialize(self, scenario: Scenario, workdir: Path, seeds: EpisodeSeeds) -> MaterializedEpisode, producing the files in the doc 10 §4 table.
  • sdf.py SdfPatcher: parse the pinned base world (path from backends.gazebo_nav2.base_world, resolved via ament_index_python and injectable for tests) with lxml.etree.XMLParser(resolve_entities=False, no_network=True); XPath edits: light <diffuse> scaled by min(1, L/L_ref) and scene <ambient>; ground <surface><friction><ode><mu>/<mu2> = P5; pallet <include> pose from place_obstacle(nominal_path, along=P7, clearance=P2, side=left) with z = half height.
  • nav2_params.py Nav2ParamOverlay: deep-merge base params with overrides at sut.speed_param_paths (P1) and costmap depth-layer enablement; output YAML with sorted keys for golden tests.
  • Also perturb_params.yaml (P3 model + illuminance, P4, P6, P8, per-node seeds via derive_seed), bridge.yaml (Jinja2, StrictUndefined, T-028) and episode.yaml (start/goal/time limit/sample rate/record_bag).
  • Scenario values go only into files, never onto command lines (TM-08).
  • 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.base_world
  • backends.gazebo_nav2.base_nav2_params
  • backends.gazebo_nav2.perception_model_file
  • backends.gazebo_nav2.sample_hz
  • backends.gazebo_nav2.record_bag

Acceptance criteria

  • Golden outputs stable; every parameter changes the expected element/key.
  • Each of P1–P8 changes exactly the expected element/key (parametrised golden test).
  • An XXE payload in a crafted base world is not resolved (security test).
  • 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/gazebo/test_materialize.py.

Dependencies

Blocked by: #41 (T-028), #42 (T-016), #190 (T-091)

Blocks: #202 (T-096b)

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/gazebo_nav2/materialize.py
  • backend/src/roboprobe/backends/gazebo_nav2/sdf.py
  • backend/src/roboprobe/backends/gazebo_nav2/nav2_params.py

Can start before the image exists (pure).

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-096a (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 §4 · doc 06 §3 · doc 31 §3

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

External:

Activity

  1. added
    area:simulatorSimulator backends (kinematic2d, Gazebo adapter)
    priority:P0Critical path / blocks others
    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:M9M9 — Gazebo backendpriority: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