Repository navigation
Description
Task
T-096a· Milestone M9 — Gazebo backend · Size M · Priority P0 · Epic #9Implements 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.pySdfPatcher: parse the pinned base world (path frombackends.gazebo_nav2.base_world, resolved viaament_index_pythonand injectable for tests) withlxml.etree.XMLParser(resolve_entities=False, no_network=True); XPath edits: light<diffuse>scaled bymin(1, L/L_ref)and scene<ambient>; ground<surface><friction><ode><mu>/<mu2>= P5; pallet<include>pose fromplace_obstacle(nominal_path, along=P7, clearance=P2, side=left)with z = half height.nav2_params.pyNav2ParamOverlay: deep-merge base params with overrides atsut.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 viaderive_seed),bridge.yaml(Jinja2, StrictUndefined, T-028) andepisode.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_worldbackends.gazebo_nav2.base_nav2_paramsbackends.gazebo_nav2.perception_model_filebackends.gazebo_nav2.sample_hzbackends.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
Unreleasedupdated 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.pybackend/src/roboprobe/backends/gazebo_nav2/sdf.pybackend/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:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
place_obstacle#41configs/sut_profiles/(k2d default + TB4 Nav2 default) #42topics.yamland task file #190feat(ros): relay velocity commands on simulation time (T-093d) (#345)
feat(ros): degrade depth point clouds in low light (T-093c) (#343)
feat(gazebo): generate deterministic episode inputs for P1–P8 (T-096a) (