Mission viewer¶
Requires the viz extra (pip install "longeron[viz]").
The track/CZML synthesis this widget plays lives in longeron.analysis.mission3d.
Fly a MissionTrack on a CesiumJS globe (anywidget).
mission_viewer() renders a
MissionTrack’s baked CZML document
on a Cesium Viewer: a grey planned-route polyline, small waypoint
pins, and a drone entity that flies the samples with an orange trail,
its label following the ACTIVE STATE name through the mission. The
track synthesis itself – waypoints, state-machine timelines, CZML and
glTF baking – lives in longeron.analysis.mission3d: it is
analysis, deterministic and testable without a browser.
The camera tracks the drone with an offset sized from the route (CZML
viewFrom). Cesium’s native timeline + animation dial are the
mission-playback UI (play/pause/scrub); the chrome that needs Cesium
ion (base-layer picker, geocoder) stays off. Clicking the drone (or
any mission entity) reports its CZML id on the picked_json trait –
the same pick seam as longeron.widgets.viewer3d – and the
bidirectional time trait (seconds past the track epoch) lets kernel
code scrub or follow the playhead. The playing / rate /
drift_s traits are the time seam’s Cesium bridge
(longeron.widgets.link_time()): playing mirrors the Cesium
dial (clock.shouldAnimate) both ways, rate mirrors the
multiplier, and while the dial animates a kernel seek inside
drift_s (scaled by the multiplier) is treated as peer integration
and ignored – the bounded-drift reconciliation that keeps the clock
and the dial from fighting; a paused viewer converges exactly (echo
tolerance 1e-3). The stage keeps a fixed explicit height
(height_px, default 480) at 98% width, so it never overflows a
notebook cell or the sidebar.
No Cesium ion token is required: every imagery base is tokenless
on the plain WGS84 ellipsoid. The default 'satellite' is Esri
World Imagery – the keyless ArcGIS Online World_Imagery tile
service, acceptable for light development/demo use with the attribution
the widget’s credit bar shows (heavy or production use should bring an
ArcGIS API key or a Cesium ion token instead); 'plain' draws no
imagery at all – a neutral dark-slate globe on which the route, trail,
and model read cleanly; 'osm' is OpenStreetMap street tiles.
Passing ion_token= upgrades to Cesium World Terrain + imagery
regardless of imagery.
Offline tradeoff: the front-end loads CesiumJS (~6 MB plus workers and
assets) from the pinned jsDelivr CDN at view time – the same judgment
as longeron.widgets.viewer3d’s three.js (~630 kB was already too
big to vendor; Cesium is ~10x that, a fortiori). On an offline
front-end the widget degrades to a printed notice instead of a globe,
and a later re-render retries the load. This is also why there is no
browser-tier test for this widget: rendering truth would hard-depend on
live CDN access (see tests/test_mission3d.py).
Requires the viz extra for anywidget:
pip install "longeron[viz]".
- longeron.widgets.mission3d.CESIUM_BASE_URL = 'https://cdn.jsdelivr.net/npm/cesium@1.144.0/Build/Cesium/'¶
workers/assets/widgets resolve against this base (window.CESIUM_BASE_URL)
- longeron.widgets.mission3d.CESIUM_VERSION = '1.144.0'¶
pinned CDN release (monthly Cesium train); bump deliberately, with the evidence capture re-run – never float a latest tag
- longeron.widgets.mission3d.Imagery¶
the imagery bases mission_viewer accepts (all tokenless): Esri World Imagery, a neutral dark globe with no tiles at all, or OpenStreetMap streets –
_IMAGERY_BASESderives from this alias, so the two cannot driftalias of
Literal[‘satellite’, ‘plain’, ‘osm’]
- longeron.widgets.mission3d.mission_viewer(track, *, mesh=None, model_scale=1.0, label=None, height_px=480, imagery='satellite', ion_token='')[source]¶
Fly
trackon a Cesium globe in the notebook.The viewer starts paused at the track epoch with the camera tracking the drone; Cesium’s native timeline and animation dial play, pause, scrub, and re-speed the mission. Pass
mesh(alongeron.analysis.geometrymesh dict) to fly the airframe’s own geometry as a glTF model atmodel_scaletimes true size, flown with the multirotor attitude (yaw along the track heading, props level in vertical phases, the track’stilt_degforward tilt in cruise); without a mesh the drone is a point.imagerypicks the tokenless base:'satellite'(Esri World Imagery, the default),'plain'(a neutral dark globe, no tiles), or'osm'(OpenStreetMap streets);ion_tokenupgrades to Cesium World Terrain + imagery regardless. Click the drone (or a waypoint pin) to report its CZML id onpicked_json; drive or observe the playhead through the bidirectionaltimetrait. Assign a new JSON string toczml_jsonto swap the mission in place.- Return type:
AnyWidget