Skip to content

Feature/gui nicegui upgrade map view - #699

Merged
Robert108 merged 8 commits into
devfrom
feature/gui-nicegui-upgrade-map-view
Nov 23, 2026
Merged

Robert108 merged 8 commits into
devfrom
feature/gui-nicegui-upgrade-map-view

Conversation

@Robert108

@Robert108 Robert108 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

GUI: NiceGUI upgrade and satellite map view in the control panel

Reason for PR

ATOS docs have been suggesting using Foxglove for graphical inspection of running scenario. Since Foxglove has moved away from open source development and now requires users to sign-up for accounts, this makes the setup process to use ATOS cumbersome for new users. A simple graphical interface that shows objects and trajectories on a satellite map would fulfill 99% of what foxglove provided for us historically. This PR adds a map box in the ControlPanel view which is fully self-contained.

It does not remove existing foxglove plugins sp it can still be used.

Summary

  • NiceGUI upgrade: 1.4.8 (early 2024) is replaced by NiceGUI 3.19.x on Ubuntu 22.04 / Humble (Python 3.10) and NiceGUI 4.x on Ubuntu 24.04 / Jazzy and newer. Both versions share one API, so there are no version shims.
  • Map view on /control: a resizable satellite map showing the loaded scenario's trajectories, plus a heading-rotated marker for each connected test object.

Breaking for ROS 2 Foxy (Ubuntu 20.04): the GUI is no longer available there. NiceGUI 3.x/4.x needs Python ≥3.10, and Foxy has Python 3.8. ATOS still installs and launches without the GUI. Foxy is end-of-life since May 2023. The Docker image (Humble, Ubuntu 22.04) and native Humble/Jazzy installs get the GUI.

This is stated in:

  • the README;
  • docs/Installation/installation.md, as a note box;
  • docs/Usage/GUI/controlpanel.md;
  • setup_atos.sh --help;
  • a highlighted banner that setup_atos.sh prints at the start and end of an installation on Python <3.10, so it isn't lost in the install output;
  • a warning when ATOS is launched without NiceGUI.

Screenshots

These were taken with the real map view code fed by simulated data. Car's path is the surveyed rural-road lane centre line at AstaZero (conf/conf/rural_road_centerline_ccw.geojson), placed with the GaragePlan origin. Truck's oncoming lane is the same line shifted 3.5 m sideways, and Target crosses the road.

Control panel with the map, fitted to the scenario
1_control_panel_overview

Close-up: markers rotated by heading, on their trajectories
2_closeup_heading_markers

Map settings panel
3_map_settings

Marker styles
4_marker_styles

Trajectory line styles
5_trajectory_styles

Labels off: hover shows speed and heading; a grey marker means no recent monitor data
6_tooltip_and_stale_object

NiceGUI upgrade

  • atos_gui/requirements.txt: the NiceGUI version is chosen by Python version (3.19 on 3.10, 4.x on ≥3.11). The fastapi==0.108.0 pin is gone, and pyproj is added for the map.
  • scripts/installation/requirements.txt: anyio>=4.14.2 on Python ≥3.10, because NiceGUI needs it and shares the venv. The old anyio<4.0 pin stays for Python <3.10.
  • Foxy (Python 3.8):
    • install_deps.sh skips the GUI dependencies.
    • launch_base.py logs a warning and launches ATOS without the GUI when NiceGUI isn't installed.
  • Code moved to the 3.x/4.x API:
    • ui.navigate.to replaces ui.open.
    • Quasar classes replace .tailwind.
    • The auto-index client is removed.
    • The AG Grid in the file picker uses the object form of rowSelection and get_selected_rows().
    • ui.html(..., sanitize=False) for the trusted fleet map markup.
  • Static files: atos_gui/static is now served in normal mode too, not only in fleet mode.

Map view

  • Base maps:
    • Esri World Imagery, which needs no API key (attribution is shown).
    • OpenStreetMap.
    • A custom tile URL, for offline sites or a local tile server.
  • Fit to available imagery: Esri imagery depth varies by location (zoom 18 at AstaZero). The map asks Esri's tile-map service how deep imagery goes over the scenario. Fits never zoom past that, and zooming further scales the deepest real imagery up instead of showing "Map data not yet available" tiles.
  • Trajectories: taken from /atos/object_<id>/path. They load once ObjectControl reaches INITIALIZED and reload on every new Init.
  • Objects:
    • Taken from /atos/object_monitor, filtered by /atos/connected_object_ids.
    • Each marker is rotated by the reported heading and turns grey after 2 s without monitor data.
  • Geographic accuracy:
    • Positions are converted with the same PROJ transverse Mercator definition EsminiAdapter uses, so overlays are exact. gnss_path/gnss_fix use a flat-earth approximation that is off by roughly 2–3 m per km.
    • Headings (ENU yaw) are converted to true bearings, including meridian convergence.
  • Robustness:
    • get_test_origin is only called once ATOS is INITIALIZED, with a timeout. The service waits indefinitely when no origin is set.
    • The map uses its own callback group, so it doesn't stall the existing state polling.
    • A scenario without <geoReference> shows a message instead of guessing a position.
  • Settings:
    • Trajectory width, line style (solid/dashed/dotted/dash-dot) and opacity.
    • Marker size and style (arrow, chevron, vehicle, circle with heading line) and labels.
    • A colour per object.
    • Base map, "Fit to scenario" and "Follow object".
    • Settings persist on the ATOS host via app.storage.general. The map size is remembered per browser.
  • HiDPI: the map is drawn as one compositing layer. Otherwise Chrome leaves hairline gaps between tile rows on 2× screens.
  • Docs: docs/Usage/GUI/controlpanel.md gains Requirements and Map view sections.

Tests

  • New tests: 23 pytest tests in atos_gui/test/.
    • Geodesy: round trip against forward tmerc, axes, yaw→bearing, the sign of meridian convergence, marker heading matching the drawn line, and comparison with the flat-earth approximation.
    • MapDataSource against a fake node: load order, origin timeout and retry, path received before the origin, connected and stale filtering, re-init, and a missing geo-reference.
  • Running under colcon test:
    • python3-pyproj is a rosdep dependency, because colcon test runs outside the venv.
    • pytest is declared as a test extra in setup.py; without it, colcon ran 0 tests.

Testing done

Target Result
colcon test --packages-select atos_gui in ros:humble (Python 3.10, apt pyproj 3.3.0, pytest 6.2.5) 23 passed
Same in ros:jazzy-ros-base-noble (Python 3.12, pyproj 3.6.1) 23 passed
Same in ros:lyrical-ros-base-resolute (Python 3.14, pyproj 3.7.2, numpy 2.3) 23 passed
pip resolution of the venv requirements, Python 3.10 / 3.12 / 3.13 / 3.14 Resolves: NiceGUI 3.19.0 on 3.10, 4.0.0 on the others
Headless Chrome with fake data, NiceGUI 3.19 (Python 3.10) and 4.0 (Python 3.12, 3.14) No console errors; markers within 0.5 px of their line; heading within 0.33° of the drawn line direction; fit capped at zoom 18 at AstaZero

Manual tests performed:
A full ATOS run was tested with the GaragePlan scenario and a virtual test object.

  1. Init GaragePlan: the trajectories lies on expected location in the imagery (visual check)
  2. Connected the ISO 22133 object simulator and started it: the marker followed its trajectory and pointed the way it's moving.

Notes for reviewers

  • anyio pin: anyio<4.0 came in with 47ff9fc, which gives no reason. anyio 4.16 with the pinned pytest 7.4 works, and launch_pytest uses asyncio directly. Please let the docker-compose integration test confirm it.
  • Where settings are saved: NiceGUI writes app.storage.general to .nicegui/ in the GUI process's working directory, which is now in .gitignore. Makes user changes persistent.
  • Esri imagery: used without a key under Esri's attribution requirement. The tile-map availability check is one small request per zoom level after each Init.

🤖 Mostly Generated with Claude Code

Robert108 and others added 3 commits November 9, 2026 10:24
NiceGUI 1.4.8 is replaced by NiceGUI 3.19.x on Python 3.10 (Ubuntu 22.04,
ROS 2 Humble) and NiceGUI 4.x on Python >= 3.11 (Ubuntu 24.04 Jazzy and
newer). Both share one API, so no compatibility shims are needed. On
Python < 3.10 (ROS 2 Foxy) the GUI dependencies are skipped and the launch
files start ATOS without the GUI.

- Port to the NiceGUI 3/4 API: ui.navigate.to, Quasar classes instead of
  .tailwind, no auto-index client, AG Grid object rowSelection and
  get_selected_rows(), sanitize=False for trusted ui.html markup.
- anyio >= 4.14.2 in the shared venv on Python >= 3.10 (required by NiceGUI).
- Serve atos_gui/static in normal mode as well as fleet mode.

Map view on /control:
- Esri World Imagery (no API key), OpenStreetMap or a custom tile URL.
  Resizable, and fits never zoom past the deepest available imagery.
- Scenario trajectories (/atos/object_<id>/path) loaded after Init, and
  connected objects (/atos/object_monitor) drawn as heading-rotated markers
  that turn grey when monitor data stops.
- Exact local frame -> WGS84 conversion with the same PROJ tmerc definition
  as EsminiAdapter. Headings are converted to true bearings, including
  meridian convergence.
- User settings for trajectory width/style/opacity, marker size/style,
  labels and per-object colours, persisted on the ATOS host.

Tests: 23 pytest tests for the geodesy and the ROS data source. They run
under colcon test (pyproj from rosdep, pytest declared as a test extra).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The GUI needs Python >= 3.10, so Ubuntu 20.04 / ROS 2 Foxy installs ATOS
without it. Say so in the README, the installation docs and
setup_atos.sh --help. setup_atos.sh now prints a highlighted notice at the
start and end of the installation, so it isn't lost in the install output.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the map sits at a fractional page offset, Chrome snapped each tile to
device pixels on its own, leaving a light line between tile rows at 2x
scaling. Compositing the map element as one layer removes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Robert108
Robert108 requested a balanced review from Copilot November 9, 2026 17:14

Copilot AI 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.

Copilot review overview

No open issues 🎉

Review effort: Balanced

Robert108 and others added 2 commits November 9, 2026 11:18
- Merge the license header and module description into one docstring, so
  imports are at the top of the module (E402).
- configpanel: type(x) is not T instead of != (E721), same semantics.
- controlpanel: import GetObjectControlState instead of * (F403/F405).
- map_data: drop unused rclpy import (F401); ruff import order and format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anyio 4 (required by NiceGUI) registers a pytest plugin that imports
_pytest.scope, added in pytest 7.0. The venv uses --system-site-packages,
and Ubuntu 22.04's system pytest 6.2.5 satisfied the old pin, so the
integration test (python3 -m pytest in the venv) failed at start-up with
"No module named '_pytest.scope'". Require pytest >= 7.0 (still < 7.5)
on Python >= 3.10 so pip installs 7.4.4 into the venv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Robert108 and others added 3 commits November 9, 2026 15:50
- The settings pane is toggled from a "Map settings" button in the map
  header and only takes space while open; closed, the map uses the full
  width.
- Only a drag of the resize handle is remembered, and the width is stored
  as a percentage of the available width. Window resizes no longer get
  persisted as a fixed pixel width that kept the map small after the
  window grew again, also across reloads. The storage key changes so the
  old pixel sizes are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New "Show origin and x/y axes" map setting, off by default and saved on
  the ATOS host like the other settings. It draws a crosshair at the test
  origin with the local frame's x (east) and y (north) axes; hovering it
  shows the origin's latitude and longitude. The marker follows origin
  changes after a new Init and is cleared on reset.
- Docs: describe the new setting, the Map settings pane and the map
  following the window width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@samuelthoren
samuelthoren marked this pull request as ready for review November 23, 2026 13:05
@Robert108
Robert108 merged commit b372a85 into dev Nov 23, 2026
7 checks passed
@Robert108
Robert108 deleted the feature/gui-nicegui-upgrade-map-view branch November 23, 2026 13:57
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.

4 participants