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.

View modes: the view_mode trait (ViewMode) picks how the Cesium camera moves, and a three-button control in the stage’s top-left corner sets the same trait.

  • 'follow' (the default) tracks the drone from the CZML viewFrom offset (Cesium Viewer.trackedEntity).

  • 'free' stops the tracking. The camera stays where it is, and the user drags it.

  • 'onboard' looks through the drone’s mission camera. On every clock tick the widget places the Cesium camera at the mission camera’s position on the drone and points it along the mission camera’s boresight (the optical axis). User camera input is off in this mode.

The onboard_camera trait holds the mission camera: the attribute names of the DeepScout program’s ScoutParts::F450Kit::Camera part. x/y/z are metres from the airframe origin in the geometry frame (+x forward, +y up, +z right). azimuth yaws the boresight left of the nose and elevation pitches it above the horizon, in degrees. fieldOfView (degrees) is the angle of the Cesium frustum across the wider dimension of the stage. The drone’s attitude comes from the baked CZML orientation. A track baked without a mesh carries no orientation, so the onboard view then faces north from the drone’s position.

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. Track heights are above ground (the CZML RELATIVE_TO_GROUND height reference), so the drone takes off from the drawn surface with or without terrain.

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_BASES derives from this alias, so the two cannot drift

alias of Literal[‘satellite’, ‘plain’, ‘osm’]

longeron.widgets.mission3d.ViewMode

how the Cesium camera moves: the user’s own camera, tracking the drone from the CZML viewFrom offset, or riding the drone’s mission camera

alias of Literal[‘free’, ‘follow’, ‘onboard’]

longeron.widgets.mission3d.mission_viewer(track, *, mesh=None, model_scale=1.0, label=None, height_px=480, imagery='satellite', ion_token='')[source]

Fly track on 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 (a longeron.analysis.geometry mesh dict) to fly the airframe’s own geometry as a glTF model at model_scale times true size, flown with the multirotor attitude (yaw along the track heading, props level in vertical phases, the track’s tilt_deg forward tilt in cruise); without a mesh the drone is a point. imagery picks the tokenless base: 'satellite' (Esri World Imagery, the default), 'plain' (a neutral dark globe, no tiles), or 'osm' (OpenStreetMap streets); ion_token upgrades to Cesium World Terrain + imagery regardless. Click the drone (or a waypoint pin) to report its CZML id on picked_json; drive or observe the playhead through the bidirectional time trait. Assign a new JSON string to czml_json to swap the mission in place. Set view_mode to 'onboard' and onboard_camera to the craft’s mission camera to fly the mission as that camera sees it (see the module docstring).

Return type:

AnyWidget