Skip to content

[T-093b] Node sensor_perturber: lidar Gaussian noise + dropout /scan_raw → /scan #193

Closed

Description

@CodewithJha

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

Implements FR-SIM-003

Branch feat/t-093b-node-lidar-gaussian-noise-dropout — one task = one branch = one PR (doc 32 §6)

Summary

Implement the node applying P4 σ and P8 Bernoulli dropout using the shared perturbation functions, preserving header/frame, sensor QoS.

Context / motivation

Doc 10 §4 table; identical model to k2d (T-031a).

Scope

In scope

  • Seed from perturb_params.yaml.

Implementation guidance

  • sensor_perturber.py: class SensorPerturber(RoboProbeNode); subscribe topics.scan_raw (LaserScan, qos_profile_sensor_data), publish topics.scan.
  • Per message: ranges = np.asarray(msg.ranges); apply vendored perturbation.lidar.apply_noise(ranges, sigma=P4, rng) and apply_dropout(ranges, p=P8, rng) (dropped beams → inf per REP 117, matching k2d); clip to [range_min, range_max] except inf.
  • Header/frame/stamp unchanged; parameters read once at startup from perturb_params.yaml (lidar.sigma_m, lidar.dropout_p, seed).
  • Publish /roboprobe/perturber_stats at 1 Hz (count, dropped) for the recorder.
  • 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

  • launch_testing: published scans have expected σ/dropout statistically; deterministic with seed.
  • Empirical σ within ±10 % and dropout within ±2 pp over 10 000 beams (launch_testing).
  • Same seed ⇒ identical output sequence.
  • 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_sensor_perturber.py (launch_testing).

Dependencies

Blocked by: #192 (T-093a), #45 (T-031a)

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/sensor_perturber.py
  • ros_ws/src/roboprobe_ros/test/test_sensor_perturber.py

Parallel with T-093c/d.

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-093b (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.4

Requirements: FR-SIM-003 (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