Skip to content

Add VFH Step 1: polar histogram construction from LiDAR data - #80

Open
Khushi0512 wants to merge 1 commit into
ShisatoYano:mainfrom
Khushi0512:feature/vfh-step1-polar-histogram
Open

Add VFH Step 1: polar histogram construction from LiDAR data#80
Khushi0512 wants to merge 1 commit into
ShisatoYano:mainfrom
Khushi0512:feature/vfh-step1-polar-histogram

Conversation

@Khushi0512

Copy link
Copy Markdown

Implements the first incremental step of the Vector Field Histogram (VFH) roadmap agreed with the maintainer in issue #52: build a 1D polar obstacle density histogram around the vehicle directly from the existing 2D LiDAR sensor simulation, with configurable sector resolution and smoothing.

  • PolarHistogram (src/components/mapping/polar_histogram/polar_histogram.py): pure-logic histogram construction. Bins LiDAR returns into angular sectors, weights each by the classic VFH linear magnitude falloff (Borenstein & Koren, 1991), and applies a triangular smoothing filter across neighboring sectors.
  • PolarHistogramMapper (polar_histogram_mapper.py): wires PolarHistogram to the existing OmniDirectionalLidar point cloud and renders it as a ring of colored wedges around the vehicle (denser sectors longer/redder), using the project's existing mapper slot on FourWheelsVehicle - mirrors PotentialFieldMapper's update(point_cloud, state) / draw(axes, elems) interface, so no changes were needed to shared vehicle/visualizer code.
  • vfh_polar_histogram_construction.py: simulation entry point, reusing the same obstacle scenario as the existing lidar_obstacle_sensing sample so the histogram's behavior can be compared directly against the raw point cloud it's built from.
  • Unit tests for histogram binning/smoothing math, the mapper, and the simulation entry point (15 tests total).
  • Regenerated pyrightconfig.json / devcontainer.json extraPaths via generate_pyrightconfig.py for the two new module directories.

Valley/direction selection is intentionally left for Step 2 per the agreed roadmap, to keep this PR small and reviewable.

How it was verified: all 15 new tests pass via pytest (matching the project's existing show_plot=False test convention), and the full simulation runs cleanly end to end.

Implements the first incremental step of the Vector Field Histogram (VFH)
roadmap agreed with the maintainer in issue ShisatoYano#52: build a 1D polar obstacle
density histogram around the vehicle directly from the existing 2D LiDAR
sensor simulation, with configurable sector resolution and smoothing.

- PolarHistogram (src/components/mapping/polar_histogram/polar_histogram.py):
  pure-logic histogram construction. Bins LiDAR returns into angular sectors,
  weights each by the classic VFH linear magnitude falloff
  (Borenstein & Koren, 1991), and applies a triangular smoothing filter
  across neighboring sectors.
- PolarHistogramMapper (polar_histogram_mapper.py): wires PolarHistogram to
  the existing OmniDirectionalLidar point cloud and renders it as a ring of
  colored wedges around the vehicle (denser sectors longer/redder), using
  the project's existing mapper slot on FourWheelsVehicle - mirrors
  PotentialFieldMapper's update(point_cloud, state) / draw(axes, elems)
  interface, so no changes were needed to shared vehicle/visualizer code.
- vfh_polar_histogram_construction.py: simulation entry point, reusing the
  same obstacle scenario as the existing lidar_obstacle_sensing sample so
  the histogram's behavior can be compared directly against the raw point
  cloud it's built from.
- Unit tests for histogram binning/smoothing math, the mapper, and the
  simulation entry point (15 tests total).
- Regenerated pyrightconfig.json / devcontainer.json extraPaths via
  generate_pyrightconfig.py for the two new module directories.

Valley/direction selection is intentionally left for Step 2 per the agreed
roadmap, to keep this PR small and reviewable.

How it was verified: all 15 new tests pass via pytest (matching the
project's existing show_plot=False test convention), and the full
simulation runs cleanly end to end.
@Khushi0512 Khushi0512 closed this Sep 2, 2026
@Khushi0512 Khushi0512 reopened this Sep 2, 2026
@ShisatoYano ShisatoYano added the enhancement New feature or request label Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants