drone-path-engine 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -10
- package/dist/renderer/boot.d.ts +0 -1
- package/dist/renderer/boot.js +1 -1
- package/dist/renderer/dom.d.ts +2 -13
- package/dist/renderer/dom.js +2 -17
- package/dist/renderer/scene.d.ts +0 -3
- package/dist/renderer/scene.js +9 -27
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
# drone-path-engine
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Generate flight-path map overlay videos from DJI recordings in your own Node.js
|
|
4
|
+
application. The engine plans outputs, fetches and caches map tiles, and renders
|
|
5
|
+
maps in Chromium before encoding the video with FFmpeg.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
Requires Node.js 24 or later. To render video, you also need FFmpeg, FFprobe,
|
|
10
|
+
a Chromium browser such as Chrome or Edge, and internet access for uncached
|
|
11
|
+
map tiles.
|
|
6
12
|
|
|
7
13
|
```sh
|
|
8
14
|
npm install drone-path-engine
|
|
9
15
|
```
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
## Render a map video
|
|
18
|
+
|
|
19
|
+
Render a topographic overlay for a DJI recording with embedded CAM-meta
|
|
20
|
+
telemetry or a matching SRT sidecar:
|
|
12
21
|
|
|
13
22
|
```js
|
|
14
23
|
import { DEFAULT_CONFIG } from 'drone-path-engine/config';
|
|
15
24
|
import { runBatch } from 'drone-path-engine/pipeline';
|
|
25
|
+
|
|
26
|
+
const config = { ...DEFAULT_CONFIG, style: 'topo', outDir: './out' };
|
|
27
|
+
const result = await runBatch(['flight.mp4'], config, console.error, console.log);
|
|
28
|
+
if (result.failed > 0) process.exitCode = 1;
|
|
16
29
|
```
|
|
17
30
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
This writes `out/flight_map.mp4`. The callbacks receive progress messages and
|
|
32
|
+
per-recording results, respectively.
|
|
33
|
+
|
|
34
|
+
## TypeScript
|
|
35
|
+
|
|
36
|
+
Each module ships TypeScript declarations.
|
|
21
37
|
|
|
22
38
|
Install `@types/node` for your Node.js major version. In TypeScript 6, list
|
|
23
39
|
`node` in `compilerOptions.types` to load the Node declarations.
|
|
@@ -31,6 +47,11 @@ Install `@types/node` for your Node.js major version. In TypeScript 6, list
|
|
|
31
47
|
}
|
|
32
48
|
```
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
the
|
|
50
|
+
## Learn more
|
|
51
|
+
|
|
52
|
+
Use the [`drone-path` CLI](https://www.npmjs.com/package/drone-path) to render
|
|
53
|
+
without writing code. See
|
|
54
|
+
[Getting started](https://github.com/MrManny/drone-path/blob/main/docs/user/getting-started.md)
|
|
55
|
+
for browser and FFmpeg setup, and the
|
|
56
|
+
[CLI guide](https://github.com/MrManny/drone-path/blob/main/docs/user/cli.md)
|
|
57
|
+
for examples of render options.
|
package/dist/renderer/boot.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { LeafletApi, Scene, SceneData } from './scene.js';
|
|
2
2
|
import type { TrackPickHandlers } from './trackpicker.js';
|
|
3
3
|
export declare function bootScene(host: HTMLElement, data: SceneData, L: LeafletApi, opts?: {
|
|
4
|
-
hudHost?: HTMLElement;
|
|
5
4
|
trackPick?: TrackPickHandlers;
|
|
6
5
|
}): Scene;
|
package/dist/renderer/boot.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createScene } from './scene.js';
|
|
2
2
|
export function bootScene(host, data, L, opts) {
|
|
3
|
-
const scene = createScene(host, data, { L,
|
|
3
|
+
const scene = createScene(host, data, { L, trackPick: opts?.trackPick });
|
|
4
4
|
let disposed = false;
|
|
5
5
|
let rafId;
|
|
6
6
|
const baseDispose = scene.dispose.bind(scene);
|
package/dist/renderer/dom.d.ts
CHANGED
|
@@ -8,19 +8,8 @@ export declare const EXPORT_HUD_LABELS: {
|
|
|
8
8
|
readonly speed: "SPD";
|
|
9
9
|
};
|
|
10
10
|
export declare function hudMarkup(hud: HudLayout): string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
* shape never depends on settings; a disabled chip keeps its column and shows
|
|
14
|
-
* the dimmed "--" placeholder instead of a value. The ids and .num/.unit spans
|
|
15
|
-
* match the export HUD contract, so the scene's value queries work for both.
|
|
16
|
-
*/
|
|
17
|
-
export interface StripLabels {
|
|
18
|
-
speed: string;
|
|
19
|
-
altitude: string;
|
|
20
|
-
}
|
|
21
|
-
export declare function stripReadoutMarkup(hud: HudLayout, labels?: StripLabels): string;
|
|
22
|
-
/** A null hud keeps the chips out of the map frame: the caller mounts them in
|
|
23
|
-
a strip outside the map image instead. */
|
|
11
|
+
/** A null hud keeps the chips out of the map frame: the caller renders its own
|
|
12
|
+
readout outside the map image instead. */
|
|
24
13
|
export declare function mapMarkup(hud: HudLayout | null, attribution: string): string;
|
|
25
14
|
/** Attribution links are on-screen credits, not controls: keyboard skips them. */
|
|
26
15
|
export declare function quietAttributionLinks(attr: HTMLElement): void;
|
package/dist/renderer/dom.js
CHANGED
|
@@ -130,23 +130,8 @@ export function hudMarkup(hud) {
|
|
|
130
130
|
}
|
|
131
131
|
return chips.map((chip) => ` ${chip}`).join('\n');
|
|
132
132
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
export function stripReadoutMarkup(hud, labels) {
|
|
137
|
-
const column = (id, label, unit, live) => `<div class="map-readout${live ? '' : ' map-readout-off'}" id="chip-${id}">` +
|
|
138
|
-
`<span class="label">${escapeText(label)}</span>` +
|
|
139
|
-
`<span class="value"><span class="num">--</span><span class="unit">${unit}</span></span>` +
|
|
140
|
-
`</div>`;
|
|
141
|
-
return [
|
|
142
|
-
column('speed', labels?.speed ?? 'Speed', 'm/s', hud.speed),
|
|
143
|
-
column('alt', labels?.altitude ?? 'Altitude', 'm', hud.alt),
|
|
144
|
-
]
|
|
145
|
-
.map((col) => ` ${col}`)
|
|
146
|
-
.join('\n');
|
|
147
|
-
}
|
|
148
|
-
/** A null hud keeps the chips out of the map frame: the caller mounts them in
|
|
149
|
-
a strip outside the map image instead. */
|
|
133
|
+
/** A null hud keeps the chips out of the map frame: the caller renders its own
|
|
134
|
+
readout outside the map image instead. */
|
|
150
135
|
export function mapMarkup(hud, attribution) {
|
|
151
136
|
const hudBlock = hud === null ? '' : `<div id="hud">
|
|
152
137
|
${hudMarkup(hud)}
|
package/dist/renderer/scene.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { HudLayout, MapStyle, ViewMode } from '../config.js';
|
|
2
2
|
import type { LatLon } from 'drone-path-core/geo';
|
|
3
|
-
import type { StripLabels } from './dom.js';
|
|
4
3
|
import type * as Leaflet from 'leaflet';
|
|
5
4
|
import type { FrameChannels } from 'drone-path-core/telemetry-math';
|
|
6
5
|
import type { TrackPickHandlers } from './trackpicker.js';
|
|
@@ -19,7 +18,6 @@ export interface SceneData extends FrameChannels {
|
|
|
19
18
|
/** Whether this viewer draws the in-frame HUD pills; a caller that overlays
|
|
20
19
|
its own toggles (the Map appearance preview) sets this to false. */
|
|
21
20
|
hudPills?: boolean;
|
|
22
|
-
stripLabels?: StripLabels;
|
|
23
21
|
trailLat: number[];
|
|
24
22
|
trailLon: number[];
|
|
25
23
|
trailFrame: number[];
|
|
@@ -33,6 +31,5 @@ export interface Scene {
|
|
|
33
31
|
}
|
|
34
32
|
export declare function createScene(host: HTMLElement, firstData: SceneData, deps: {
|
|
35
33
|
L: LeafletApi;
|
|
36
|
-
hudHost?: HTMLElement;
|
|
37
34
|
trackPick?: TrackPickHandlers;
|
|
38
35
|
}): Scene;
|
package/dist/renderer/scene.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TILE_SOURCES } from './tilesources.js';
|
|
2
|
-
import { droneMarkerMarkup, el, hudMarkup, mapMarkup, quietAttributionLinks, sceneCss
|
|
2
|
+
import { droneMarkerMarkup, el, hudMarkup, mapMarkup, quietAttributionLinks, sceneCss } from './dom.js';
|
|
3
3
|
import { computeScale, metersPerPixel, scaleBarMeters } from './framemath.js';
|
|
4
4
|
import { themeFor } from './theme.js';
|
|
5
5
|
import { createTrailController } from './trail.js';
|
|
@@ -61,29 +61,22 @@ class SceneState {
|
|
|
61
61
|
headingChip = null;
|
|
62
62
|
altChip = null;
|
|
63
63
|
speedChip = null;
|
|
64
|
-
/** Chip container
|
|
64
|
+
/** Chip container inside the map frame for exports. */
|
|
65
65
|
hudRoot;
|
|
66
|
-
/** External strips get the column markup; the export frame keeps its pills. */
|
|
67
|
-
externalHud;
|
|
68
66
|
curIdx = 0;
|
|
69
67
|
disposed = false;
|
|
70
68
|
picker = null;
|
|
71
|
-
constructor(host, firstData, L,
|
|
69
|
+
constructor(host, firstData, L, trackPick) {
|
|
72
70
|
this.host = host;
|
|
73
71
|
this.data = firstData;
|
|
74
72
|
this.L = L;
|
|
75
73
|
host.classList.add(this.scopeClass);
|
|
76
74
|
this.styleEl = document.createElement('style');
|
|
77
75
|
document.head.appendChild(this.styleEl);
|
|
78
|
-
|
|
79
|
-
// strip host or gets the in-frame export HUD (unless hudPills is false),
|
|
80
|
-
// never a mix of the two.
|
|
81
|
-
const externalHud = hudHost !== undefined;
|
|
82
|
-
const suppressHud = externalHud || firstData.hudPills === false;
|
|
76
|
+
const suppressHud = firstData.hudPills === false;
|
|
83
77
|
host.innerHTML = mapMarkup(suppressHud ? null : firstData.hud, firstData.attribution);
|
|
84
78
|
this.frameEl = el(host, '#map-frame');
|
|
85
|
-
this.hudRoot =
|
|
86
|
-
this.externalHud = externalHud;
|
|
79
|
+
this.hudRoot = host.querySelector('#hud');
|
|
87
80
|
this.attrEl = el(host, '#attr');
|
|
88
81
|
this.applyChrome();
|
|
89
82
|
this.mapEl = el(host, '#map');
|
|
@@ -304,15 +297,8 @@ class SceneState {
|
|
|
304
297
|
this.picker?.invalidate();
|
|
305
298
|
}
|
|
306
299
|
rebuildHud() {
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
// overlays its own pills draws none of its own (#283).
|
|
310
|
-
if (this.externalHud) {
|
|
311
|
-
if (this.hudRoot) {
|
|
312
|
-
this.hudRoot.innerHTML = stripReadoutMarkup(this.data.hud, this.data.stripLabels);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
else if (this.data.hudPills === false) {
|
|
300
|
+
// A scene whose caller overlays its own pills draws none of its own (#283).
|
|
301
|
+
if (this.data.hudPills === false) {
|
|
316
302
|
this.hudRoot?.remove();
|
|
317
303
|
this.hudRoot = null;
|
|
318
304
|
}
|
|
@@ -376,8 +362,6 @@ class SceneState {
|
|
|
376
362
|
if (!chip)
|
|
377
363
|
return;
|
|
378
364
|
setChipText(chip.querySelector('.num'), value, format);
|
|
379
|
-
if (this.externalHud)
|
|
380
|
-
chip.classList.toggle('map-readout-off', isMissing(value));
|
|
381
365
|
}
|
|
382
366
|
setFrame(i) {
|
|
383
367
|
this.curIdx = i;
|
|
@@ -427,9 +411,7 @@ class SceneState {
|
|
|
427
411
|
if (lookChanged || trailChanged || trackChanged)
|
|
428
412
|
this.rebuildDecor();
|
|
429
413
|
if (!hudEq(prev.hud, next.hud) ||
|
|
430
|
-
next.hudPills !== prev.hudPills
|
|
431
|
-
next.stripLabels?.speed !== prev.stripLabels?.speed ||
|
|
432
|
-
next.stripLabels?.altitude !== prev.stripLabels?.altitude)
|
|
414
|
+
next.hudPills !== prev.hudPills)
|
|
433
415
|
this.rebuildHud();
|
|
434
416
|
this.layoutMap();
|
|
435
417
|
this.curIdx = Math.max(0, Math.min(this.curIdx, this.latlngs.length - 1));
|
|
@@ -447,5 +429,5 @@ class SceneState {
|
|
|
447
429
|
}
|
|
448
430
|
}
|
|
449
431
|
export function createScene(host, firstData, deps) {
|
|
450
|
-
return new SceneState(host, firstData, deps.L, deps.
|
|
432
|
+
return new SceneState(host, firstData, deps.L, deps.trackPick);
|
|
451
433
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drone-path-engine",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Plan and render flight-path map overlays from drone telemetry.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@types/leaflet": "^1.9.23",
|
|
44
|
-
"drone-path-core": "^2.
|
|
44
|
+
"drone-path-core": "^2.2.0",
|
|
45
45
|
"leaflet": "^1.9.4",
|
|
46
46
|
"p-queue": "^10.0.0",
|
|
47
|
-
"playwright-core": "^1.65.
|
|
47
|
+
"playwright-core": "^1.65.2",
|
|
48
48
|
"zod": "^4.6.7"
|
|
49
49
|
}
|
|
50
50
|
}
|