Skip to content

Demo Nav2 scan observations in the layered global map#2

Open
SamuelFoo wants to merge 12 commits into
feat/layered-global-mapfrom
feat/nav2-observation-regions-demo
Open

Demo Nav2 scan observations in the layered global map#2
SamuelFoo wants to merge 12 commits into
feat/layered-global-mapfrom
feat/nav2-observation-regions-demo

Conversation

@SamuelFoo

@SamuelFoo SamuelFoo commented Jul 13, 2026

Copy link
Copy Markdown
Owner

New feature implementation

Implemented feature

This PR adds a three-robot Nav2 observation demo for the layered global occupancy map in open-rmf/next_gen_prototype#36.

Each robot converts local laser endpoints into temporary MapRegionUpdate point regions. The layered map server combines all three sources in /map, which is displayed in a separate RViz window.

Implementation description

This PR adds:

  • a scan-to-region publisher with configurable beam stride, update period, range, and TTL
  • three stationary warehouse robots with deterministic nearby obstacles
  • localization-only Nav2 launch support, without planning or control nodes
  • a combined global-map RViz view
  • scan-conversion tests and demo documentation

discourse/3-layered-global-occupancy-map.md documents the committed interface, server behavior, raw-scan demo, tuning controls, and current limitations. Validation covered 13 Rust tests, 3 scan-conversion tests, Python linters, and a headless three-robot Gazebo run.

Next steps

  • Compare raw scan points with downsampled costmap rectangle regions.
  • Evaluate free-space clearing and denser update formats.
  • Keep planning and replanning work outside this PR.

GenAI Use

We follow OSRA's policy on GenAI tools

  • I used a GenAI tool in this PR.
  • I did not use GenAI

Generated-by: GPT-5

@SamuelFoo
SamuelFoo force-pushed the feat/nav2-observation-regions-demo branch 3 times, most recently from 9a0e9c7 to b39d9d9 Compare July 13, 2026 19:09
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
@SamuelFoo
SamuelFoo force-pushed the feat/nav2-observation-regions-demo branch from b39d9d9 to 30c198e Compare July 13, 2026 19:12
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
@SamuelFoo
SamuelFoo force-pushed the feat/nav2-observation-regions-demo branch from 30c198e to e5e80e7 Compare July 13, 2026 19:17
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
@SamuelFoo
SamuelFoo force-pushed the feat/nav2-observation-regions-demo branch from e5e80e7 to 6bc186f Compare July 13, 2026 19:20

@arjo129 arjo129 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge this into your own branch as part of the PR targetting epic/next_gen_base. I tested it and this is some feedback I hve,

from math import cos, isfinite, sin


def scan_obstacle_points(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function needs to be slightly fleshed out. As it stands it currently doesnt do any clearing or a good job of marking either. I strongly urge looking into the Bresenham's Line Algorithm for clearing free space and marking. In fact perhaps we should consider some type of RayCast message as an option as it would make the marking far more reliable and better reflect the nature of an observation from a common sensor like a camera.

This demo combines laser observations from three stationary Nav2 robots in the global `/map`:

```bash
ros2 launch rmf_layered_map_server_demo nav2_observations.launch.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen shots of what to expect would be good. Consider making the scan points more visible in rviz. It took me quite some time to figure out what I was staring at and locate the obstacle.

@SamuelFoo SamuelFoo Jul 16, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an expected-result screenshot to the demo README in 716d553.

I also made the scan contributions easier to distinguish in 41fdf7f: clear-space regions use a lighter tint and render below occupied regions, while occupied regions use a darker tint.

Three robot laser observations in the combined global map

Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
@SamuelFoo
SamuelFoo marked this pull request as ready for review July 15, 2026 22:48
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
@SamuelFoo
SamuelFoo force-pushed the feat/nav2-observation-regions-demo branch from 4b81ea3 to b6d70d6 Compare July 15, 2026 23:51
@SamuelFoo

Copy link
Copy Markdown
Owner Author

Each sampled laser beam now publishes:

  • an UPDATE_CLEAR convex sector from the scan origin to the hit distance, or to the observation limit when there is no return;
  • an UPDATE_OBSTACLE point for a valid hit within the observation range.

The map server now accepts and rasterizes HINT_CONVEX_POLYGON regions. Clear regions are applied before obstacle endpoints, ensuring the measured hit remains occupied. Active obstacle observations remain conservative and take precedence until their TTL expires.

I used one triangular sector per sampled beam instead of expanding each ray into Bresenham point regions, keeping the published region count bounded.

Added tests for scan clearing, no-return rays, patch ordering, convex-region composition, and RViz visualization.

Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
Signed-off-by: SamuelFoo <fooenzesamuel@gmail.com>
@SamuelFoo

Copy link
Copy Markdown
Owner Author

Moving robot demo:

Screen.Recording.2026-07-16.022020.mp4

@arjo129

arjo129 commented Jul 16, 2026

Copy link
Copy Markdown

These visuallizarions are really nice!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants