@blueharford/scrypted-spatial-awareness 0.6.2 → 0.6.3
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/dist/main.nodejs.js +1 -1
- package/dist/main.nodejs.js.map +1 -1
- package/dist/plugin.zip +0 -0
- package/out/main.nodejs.js +18 -4
- package/out/main.nodejs.js.map +1 -1
- package/out/plugin.zip +0 -0
- package/package.json +1 -1
- package/src/main.ts +21 -4
package/dist/plugin.zip
CHANGED
|
Binary file
|
package/out/main.nodejs.js
CHANGED
|
@@ -40227,9 +40227,21 @@ class SpatialAwarenessPlugin extends sdk_1.ScryptedDeviceBase {
|
|
|
40227
40227
|
// Calculate position for the landmark WITHIN the camera's field of view
|
|
40228
40228
|
let position = suggestion.landmark.position;
|
|
40229
40229
|
if (!position || (position.x === 0 && position.y === 0)) {
|
|
40230
|
-
//
|
|
40231
|
-
|
|
40232
|
-
|
|
40230
|
+
// Debug logging
|
|
40231
|
+
this.console.log(`[Discovery] Processing landmark "${suggestion.landmark.name}"`);
|
|
40232
|
+
this.console.log(`[Discovery] visibleFromCameras: ${JSON.stringify(suggestion.landmark.visibleFromCameras)}`);
|
|
40233
|
+
this.console.log(`[Discovery] Available cameras: ${topology.cameras.map(c => `${c.name}(${c.deviceId})`).join(', ')}`);
|
|
40234
|
+
// Find a camera that can see this landmark - use flexible matching (deviceId, name, or case-insensitive)
|
|
40235
|
+
const visibleCameraRef = suggestion.landmark.visibleFromCameras?.[0];
|
|
40236
|
+
const camera = visibleCameraRef ? topology.cameras.find(c => c.deviceId === visibleCameraRef ||
|
|
40237
|
+
c.name === visibleCameraRef ||
|
|
40238
|
+
c.name.toLowerCase() === visibleCameraRef.toLowerCase()) : null;
|
|
40239
|
+
if (camera) {
|
|
40240
|
+
this.console.log(`[Discovery] Matched camera: ${camera.name}, position: ${JSON.stringify(camera.floorPlanPosition)}, fov: ${JSON.stringify(camera.fov)}`);
|
|
40241
|
+
}
|
|
40242
|
+
else {
|
|
40243
|
+
this.console.warn(`[Discovery] No camera matched for "${visibleCameraRef}"`);
|
|
40244
|
+
}
|
|
40233
40245
|
if (camera?.floorPlanPosition) {
|
|
40234
40246
|
// Get camera's FOV direction and range (cast to any for flexible access)
|
|
40235
40247
|
const fov = (camera.fov || { mode: 'simple', angle: 90, direction: 0, range: 80 });
|
|
@@ -40237,7 +40249,9 @@ class SpatialAwarenessPlugin extends sdk_1.ScryptedDeviceBase {
|
|
|
40237
40249
|
const range = fov.range || 80;
|
|
40238
40250
|
const fovAngle = fov.angle || 90;
|
|
40239
40251
|
// Count existing landmarks from this camera to spread them out
|
|
40240
|
-
const
|
|
40252
|
+
const cameraDeviceId = camera.deviceId;
|
|
40253
|
+
const existingFromCamera = (topology.landmarks || []).filter(l => l.visibleFromCameras?.includes(cameraDeviceId) ||
|
|
40254
|
+
l.visibleFromCameras?.includes(camera.name)).length;
|
|
40241
40255
|
// Calculate position in front of camera within its FOV
|
|
40242
40256
|
// Convert direction to radians (0 = up/north, 90 = right/east)
|
|
40243
40257
|
const dirRad = (direction - 90) * Math.PI / 180;
|