Skip to content

feat(ui): localization-aware map view and auto nav-done state transition#128

Closed
xiaolefang-dm wants to merge 13 commits intomainfrom
feat/poi-nav-auto-done
Closed

feat(ui): localization-aware map view and auto nav-done state transition#128
xiaolefang-dm wants to merge 13 commits intomainfrom
feat/poi-nav-auto-done

Conversation

@xiaolefang-dm
Copy link
Copy Markdown
Contributor

  • Fix _on_relocalization — backend now stores map_pose when relocalization message arrives; previously only set _localized = True, so the PiP map had no robot position to draw
  • Auto nav-done — map_node.py publishes /mapping/nav_done when all POIs are visited; backend subscribes and transitions state from navigation → idle, which also clears the active POI list in the frontend

after localizatin robot position to draw:

1.mov

auto nav-done:

2.mov

xiaolefang and others added 13 commits April 30, 2026 09:58
map_node publishes Bool(True) to /mapping/nav_done once all POIs
are reached (guarded by _nav_completed flag to avoid repeat fires);
BackendNode subscribes and transitions state back to idle so the
frontend POI button restores automatically without manual cancel.
_nav_completed resets when new POIs arrive via pois_callback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Capture Navigator before await to avoid stale context; replace
whenData (which doesn't await the returned future) with direct
valueOrNull call so the async close actually runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add _MapToggleButton to switch between Local and Global map views when localized
- Show selected POIs on global map after Go; clear them when nav ends or is cancelled
- Add robot footprint rectangle (0.7m × 0.3m, Go2 config) to local planning view
  mirroring /planning/footprint topic data

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
_on_relocalization now stores the pose dict so the PiP map
can show the robot arrow immediately after localization,
without waiting for POI navigation to start.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Increase stroke width 1.5→2.5 and fill opacity for better
contrast on dark background.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously footprint was drawn before the arrow and got covered
by the white fill. Now draws after as a yellow outline-only,
always visible regardless of zoom level.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: at default 10m grid scale (40px/m), footprint
fl=0.35m×40=14px coincided exactly with arrow tip=14px,
making the rectangle completely hidden behind the arrow.

Fix: use max(world_scale, min_pixels) so footprint always
clearly surrounds the arrow (min 22px front, 18px rear, 12px half-w).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously drew a hardcoded rectangle (wrong). Now:
- node_manager subscribes to /planning/footprint (PointCloud)
- extracts x,y points and includes in planning snapshot
- PlanningState.footprint parsed from WS payload
- LocalPlanningPainter draws the actual footprint polygon
  using same world→canvas transform as trajectory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unused pose param from _PoiButton / _PoiSheet
- Remove showFootprint toggle (footprint always drawn when data present)
- Hide _LayerTogglePanel when global map view is active

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both features did not work reliably. Clean slate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass activeNavPois from _CameraPanel to _MapPip so selected
POIs appear as markers on the picture-in-picture map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

cloc github.com/AlDanial/cloc v 2.04 T=0.14 s (302.6 files/s, 44537.6 lines/s)
Language files blank comment code
Python 13 613 262 3405
Markdown 4 155 6 426
C++ 4 60 38 409
Bourne Shell 15 41 9 272
Dockerfile 1 30 29 191
JSON 2 8 0 58
TOML 1 4 0 57
make 1 18 15 55
CMake 1 4 0 17
-------- -------- -------- -------- --------
SUM: 42 933 359 4890

@xiaolefang-dm xiaolefang-dm requested a review from dvorak0 April 30, 2026 04:29
@dvorak0
Copy link
Copy Markdown
Member

dvorak0 commented Apr 30, 2026

@xiaolefang-dm it's cool to have something I want for long time. We need /mapping/nav_progress. Would you like to finish it? instead of only having the binary signal of "nav_done".

I'm not very sure how to do it. It would be great if we could publish:

  1. Which POI are we heading to?
  2. how long do we need to finish the whole task. We might publish percentage/progress, and the upper layer(app layer) could have some kind of estimation on on the left time to finish.

@xiaolefang-dm
Copy link
Copy Markdown
Contributor Author

xiaolefang-dm commented Apr 30, 2026

@xiaolefang-dm it's cool to have something I want for long time. We need /mapping/nav_progress. Would you like to finish it? instead of only having the binary signal of "nav_done".

I'm not very sure how to do it. It would be great if we could publish:

  1. Which POI are we heading to?
  2. how long do we need to finish the whole task. We might publish percentage/progress, and the upper layer(app layer) could have some kind of estimation on on the left time to finish.

@dvorak0

1 its easy to do
2 worth to consider, what jump out my head firstly:
(1) total = len(poses); percent = visted/total, that would be our progress percentage
(2) eastimate remaining time: avg_per_pose * remaining, avg value would be dynamic, so it is kinda rough

@dvorak0
Copy link
Copy Markdown
Member

dvorak0 commented Apr 30, 2026

@xiaolefang-dm cool, let's go for it.

@dvorak0 dvorak0 closed this Apr 30, 2026
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