@viamrobotics/motion-tools 1.15.7 → 1.16.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/dist/buf/common/v1/common_pb.d.ts +38 -0
- package/dist/buf/common/v1/common_pb.js +64 -0
- package/dist/buf/draw/v1/scene_pb.d.ts +6 -2
- package/dist/buf/draw/v1/scene_pb.js +9 -3
- package/dist/components/Entities/Geometry.svelte +1 -1
- package/dist/components/PCD.svelte +4 -1
- package/dist/components/PCD.svelte.d.ts +1 -0
- package/dist/components/SceneProviders.svelte +0 -2
- package/dist/components/{Lasso → Selection}/Debug.svelte +8 -8
- package/dist/components/{Lasso → Selection}/Debug.svelte.d.ts +2 -2
- package/dist/components/Selection/Ellipse.svelte +293 -0
- package/dist/components/Selection/Ellipse.svelte.d.ts +7 -0
- package/dist/components/{Lasso → Selection}/Lasso.svelte +31 -61
- package/dist/components/{Lasso → Selection}/Lasso.svelte.d.ts +1 -0
- package/dist/components/{Lasso → Selection}/Tool.svelte +50 -15
- package/dist/components/{Lasso → Selection}/traits.d.ts +11 -2
- package/dist/components/{Lasso → Selection}/traits.js +7 -2
- package/dist/components/Selection/utils.d.ts +5 -0
- package/dist/components/Selection/utils.js +38 -0
- package/dist/components/Snapshot.svelte +8 -0
- package/dist/components/overlay/RefreshRate.svelte +7 -6
- package/dist/components/overlay/RefreshRate.svelte.d.ts +1 -1
- package/dist/components/overlay/settings/Settings.svelte +16 -8
- package/dist/components/xr/OriginMarker.svelte +94 -17
- package/dist/hooks/useControls.svelte.d.ts +1 -0
- package/dist/hooks/useControls.svelte.js +4 -0
- package/dist/hooks/useGeometries.svelte.js +7 -9
- package/dist/hooks/usePointcloudObjects.svelte.js +7 -6
- package/dist/hooks/usePointclouds.svelte.js +7 -6
- package/dist/hooks/usePose.svelte.js +3 -3
- package/dist/hooks/useSettings.svelte.d.ts +13 -1
- package/dist/hooks/useSettings.svelte.js +13 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/hooks/useMachineSettings.svelte.d.ts +0 -13
- package/dist/hooks/useMachineSettings.svelte.js +0 -58
- /package/dist/components/{Lasso → Selection}/Tool.svelte.d.ts +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { useTask, useThrelte } from '@threlte/core'
|
|
3
3
|
import { Grid, useGamepad } from '@threlte/extras'
|
|
4
|
+
import { Hand, useHand, useXR } from '@threlte/xr'
|
|
4
5
|
import { Group, Quaternion, Vector2, Vector3 } from 'three'
|
|
5
6
|
|
|
6
7
|
import { useAnchors } from './useAnchors.svelte'
|
|
@@ -9,17 +10,20 @@
|
|
|
9
10
|
const origin = useOrigin()
|
|
10
11
|
const anchors = useAnchors()
|
|
11
12
|
|
|
12
|
-
const group = new Group()
|
|
13
13
|
const anchorObject = new Group()
|
|
14
14
|
|
|
15
15
|
const leftPad = useGamepad({ xr: true, hand: 'left' })
|
|
16
16
|
const rightPad = useGamepad({ xr: true, hand: 'right' })
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
let speed = $state(0.05)
|
|
19
19
|
|
|
20
20
|
const vec2 = new Vector2()
|
|
21
21
|
const target = new Vector2()
|
|
22
22
|
|
|
23
|
+
leftPad.squeeze.on('change', () => {
|
|
24
|
+
speed = leftPad.squeeze.pressed ? 0.005 : 0.05
|
|
25
|
+
})
|
|
26
|
+
|
|
23
27
|
leftPad.thumbstick.on('change', ({ value }) => {
|
|
24
28
|
if (typeof value === 'number') {
|
|
25
29
|
return
|
|
@@ -29,6 +33,8 @@
|
|
|
29
33
|
const [x, y, z] = origin.position
|
|
30
34
|
const r = origin.rotation
|
|
31
35
|
|
|
36
|
+
vec2.set(z, r).lerp(target.set(z + vy * speed, r + vx * speed), 0.5)
|
|
37
|
+
|
|
32
38
|
origin.set([x, y, z + vy * speed], r + vx * speed)
|
|
33
39
|
})
|
|
34
40
|
|
|
@@ -56,19 +62,90 @@
|
|
|
56
62
|
anchors.bindAnchorObject(anchor, anchorObject)
|
|
57
63
|
})
|
|
58
64
|
})
|
|
65
|
+
|
|
66
|
+
let startLeftPinchTranslation = new Vector3()
|
|
67
|
+
let leftPinchTranslation = new Vector3()
|
|
68
|
+
let startRightPinchTranslation = new Vector3()
|
|
69
|
+
let rightPinchTranslation = new Vector3()
|
|
70
|
+
|
|
71
|
+
const leftHand = useHand('left')
|
|
72
|
+
const rightHand = useHand('right')
|
|
73
|
+
|
|
74
|
+
let translating = $state(false)
|
|
75
|
+
let rotating = $state(false)
|
|
76
|
+
|
|
77
|
+
const { renderer } = useThrelte()
|
|
78
|
+
const { isPresenting } = useXR()
|
|
79
|
+
|
|
80
|
+
$effect(() => {
|
|
81
|
+
if (!$isPresenting) {
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
renderer.xr.getHand(0).addEventListener('pinchstart', () => {
|
|
85
|
+
if (leftHand.current?.targetRay.position) {
|
|
86
|
+
translating = true
|
|
87
|
+
startLeftPinchTranslation.copy(leftHand.current.targetRay.position)
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
useTask(
|
|
93
|
+
() => {
|
|
94
|
+
if (leftHand.current?.targetRay && translating) {
|
|
95
|
+
leftPinchTranslation
|
|
96
|
+
.copy(leftHand.current.targetRay.position)
|
|
97
|
+
.sub(startLeftPinchTranslation)
|
|
98
|
+
origin.set(leftPinchTranslation.toArray(), origin.rotation)
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
running: () => translating,
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
useTask(
|
|
107
|
+
() => {
|
|
108
|
+
if (rightHand.current?.targetRay && rotating) {
|
|
109
|
+
rightPinchTranslation.copy(rightHand.current.targetRay.position)
|
|
110
|
+
const rotation =
|
|
111
|
+
origin.rotation + rightPinchTranslation.distanceTo(startRightPinchTranslation)
|
|
112
|
+
origin.set(leftPinchTranslation.toArray(), rotation)
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
running: () => rotating,
|
|
117
|
+
}
|
|
118
|
+
)
|
|
59
119
|
</script>
|
|
60
120
|
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
121
|
+
<Grid
|
|
122
|
+
plane="xy"
|
|
123
|
+
fadeDistance={5}
|
|
124
|
+
fadeOrigin={new Vector3()}
|
|
125
|
+
cellSize={0.1}
|
|
126
|
+
cellColor="#fff"
|
|
127
|
+
sectionColor="#fff"
|
|
128
|
+
/>
|
|
129
|
+
|
|
130
|
+
<Hand
|
|
131
|
+
left
|
|
132
|
+
onpinchstart={() => {
|
|
133
|
+
console.log('pinchstart')
|
|
134
|
+
if (leftHand.current?.targetRay.position) {
|
|
135
|
+
translating = true
|
|
136
|
+
startLeftPinchTranslation.copy(leftHand.current.targetRay.position)
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
onpinchend={() => (translating = false)}
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<Hand
|
|
143
|
+
right
|
|
144
|
+
onpinchstart={() => {
|
|
145
|
+
if (rightHand.current?.targetRay.position) {
|
|
146
|
+
rotating = true
|
|
147
|
+
startRightPinchTranslation.copy(rightHand.current.targetRay.position)
|
|
148
|
+
}
|
|
149
|
+
}}
|
|
150
|
+
onpinchend={() => (rotating = false)}
|
|
151
|
+
/>
|
|
@@ -9,6 +9,7 @@ interface CameraControlsContext {
|
|
|
9
9
|
set(current: CameraControlsRef): void;
|
|
10
10
|
setPose(pose: CameraPose, animate?: boolean): void;
|
|
11
11
|
setInitialPose(): void;
|
|
12
|
+
setZoom(zoom: number): void;
|
|
12
13
|
}
|
|
13
14
|
export declare const provideCameraControls: (initialCameraPose: () => CameraPose | undefined) => void;
|
|
14
15
|
export declare const useCameraControls: () => CameraControlsContext;
|
|
@@ -9,6 +9,9 @@ export const provideCameraControls = (initialCameraPose) => {
|
|
|
9
9
|
controls?.setPosition(x, y, z, animate);
|
|
10
10
|
controls?.setLookAt(x, y, z, lookAtX, lookAtY, lookAtZ, animate);
|
|
11
11
|
};
|
|
12
|
+
const setZoom = (zoom) => {
|
|
13
|
+
controls?.zoomTo(zoom);
|
|
14
|
+
};
|
|
12
15
|
const setInitialPose = () => {
|
|
13
16
|
const pose = initialCameraPose();
|
|
14
17
|
setPose(pose ?? { position: [3, 3, 3], lookAt: [0, 0, 0] }, true);
|
|
@@ -28,6 +31,7 @@ export const provideCameraControls = (initialCameraPose) => {
|
|
|
28
31
|
},
|
|
29
32
|
setPose,
|
|
30
33
|
setInitialPose,
|
|
34
|
+
setZoom,
|
|
31
35
|
});
|
|
32
36
|
};
|
|
33
37
|
export const useCameraControls = () => {
|
|
@@ -10,8 +10,8 @@ import { updateGeometryTrait } from '../ecs/traits';
|
|
|
10
10
|
import { createPose } from '../transform';
|
|
11
11
|
import { useEnvironment } from './useEnvironment.svelte';
|
|
12
12
|
import { useLogs } from './useLogs.svelte';
|
|
13
|
-
import { RefreshRates, useMachineSettings } from './useMachineSettings.svelte';
|
|
14
13
|
import { useResourceByName } from './useResourceByName.svelte';
|
|
14
|
+
import { RefreshRates, useSettings } from './useSettings.svelte';
|
|
15
15
|
const key = Symbol('geometries-context');
|
|
16
16
|
const colorUtil = new Color();
|
|
17
17
|
export const provideGeometries = (partID) => {
|
|
@@ -23,18 +23,16 @@ export const provideGeometries = (partID) => {
|
|
|
23
23
|
const cameras = useResourceNames(partID, 'camera');
|
|
24
24
|
const grippers = useResourceNames(partID, 'gripper');
|
|
25
25
|
const gantries = useResourceNames(partID, 'gantry');
|
|
26
|
-
const
|
|
26
|
+
const settings = useSettings();
|
|
27
|
+
const { refreshRates } = $derived(settings.current);
|
|
27
28
|
const armClients = $derived(arms.current.map((arm) => createResourceClient(ArmClient, partID, () => arm.name)));
|
|
28
29
|
const gripperClients = $derived(grippers.current.map((gripper) => createResourceClient(GripperClient, partID, () => gripper.name)));
|
|
29
30
|
const cameraClients = $derived(cameras.current.map((camera) => createResourceClient(CameraClient, partID, () => camera.name)));
|
|
30
31
|
const gantryClients = $derived(gantries.current.map((gantry) => createResourceClient(GantryClient, partID, () => gantry.name)));
|
|
31
|
-
const interval = $derived(refreshRates
|
|
32
|
-
const options = $derived
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
environment.current.viewerMode === 'monitor',
|
|
36
|
-
refetchInterval: interval === RefetchRates.MANUAL ? false : interval,
|
|
37
|
-
};
|
|
32
|
+
const interval = $derived(refreshRates[RefreshRates.poses]);
|
|
33
|
+
const options = $derived({
|
|
34
|
+
enabled: interval !== RefetchRates.OFF && environment.current.viewerMode === 'monitor',
|
|
35
|
+
refetchInterval: interval === RefetchRates.MANUAL ? false : interval,
|
|
38
36
|
});
|
|
39
37
|
const armQueries = $derived(armClients.map((client) => [client.current?.name, createResourceQuery(client, 'getGeometries', () => options)]));
|
|
40
38
|
const gripperQueries = $derived(gripperClients.map((client) => [client.current?.name, createResourceQuery(client, 'getGeometries', () => options)]));
|
|
@@ -9,12 +9,13 @@ import { parsePcdInWorker } from '../lib';
|
|
|
9
9
|
import { createPose } from '../transform';
|
|
10
10
|
import { useEnvironment } from './useEnvironment.svelte';
|
|
11
11
|
import { useLogs } from './useLogs.svelte';
|
|
12
|
-
import { RefreshRates,
|
|
12
|
+
import { RefreshRates, useSettings } from './useSettings.svelte';
|
|
13
13
|
const key = Symbol('pointcloud-object-context');
|
|
14
14
|
export const providePointcloudObjects = (partID) => {
|
|
15
15
|
const world = useWorld();
|
|
16
16
|
const environment = useEnvironment();
|
|
17
|
-
const
|
|
17
|
+
const settings = useSettings();
|
|
18
|
+
const { refreshRates, disabledVisionServices } = $derived(settings.current);
|
|
18
19
|
const services = useResourceNames(partID, 'vision');
|
|
19
20
|
const clients = $derived(services.current.map((service) => createResourceClient(VisionClient, partID, () => service.name)));
|
|
20
21
|
const propQueries = $derived(clients.map((client) => [
|
|
@@ -33,7 +34,7 @@ export const providePointcloudObjects = (partID) => {
|
|
|
33
34
|
fetchedPropQueries &&
|
|
34
35
|
client.current?.name &&
|
|
35
36
|
interval !== RefetchRates.OFF &&
|
|
36
|
-
disabledVisionServices
|
|
37
|
+
disabledVisionServices[client.current?.name] !== true) {
|
|
37
38
|
results.push(client);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -50,13 +51,13 @@ export const providePointcloudObjects = (partID) => {
|
|
|
50
51
|
for (const [name, query] of propQueries) {
|
|
51
52
|
if (name &&
|
|
52
53
|
query.data?.objectPointCloudsSupported === false &&
|
|
53
|
-
disabledVisionServices
|
|
54
|
-
disabledVisionServices
|
|
54
|
+
disabledVisionServices[name] === undefined) {
|
|
55
|
+
disabledVisionServices[name] = true;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
const logs = useLogs();
|
|
59
|
-
const interval = $derived(refreshRates
|
|
60
|
+
const interval = $derived(refreshRates[RefreshRates.vision]);
|
|
60
61
|
const options = $derived({
|
|
61
62
|
enabled: interval !== RefetchRates.OFF,
|
|
62
63
|
refetchInterval: (interval === RefetchRates.MANUAL ? false : interval),
|
|
@@ -7,13 +7,14 @@ import { traits, useWorld } from '../ecs';
|
|
|
7
7
|
import { parsePcdInWorker } from '../loaders/pcd';
|
|
8
8
|
import { useEnvironment } from './useEnvironment.svelte';
|
|
9
9
|
import { useLogs } from './useLogs.svelte';
|
|
10
|
-
import { RefreshRates,
|
|
10
|
+
import { RefreshRates, useSettings } from './useSettings.svelte';
|
|
11
11
|
const key = Symbol('pointcloud-context');
|
|
12
12
|
export const providePointclouds = (partID) => {
|
|
13
13
|
const environment = useEnvironment();
|
|
14
14
|
const world = useWorld();
|
|
15
15
|
const logs = useLogs();
|
|
16
|
-
const
|
|
16
|
+
const settings = useSettings();
|
|
17
|
+
const { refreshRates, disabledCameras } = $derived(settings.current);
|
|
17
18
|
const cameras = useResourceNames(partID, 'camera');
|
|
18
19
|
const clients = $derived(cameras.current.map((camera) => createResourceClient(CameraClient, partID, () => camera.name)));
|
|
19
20
|
const propQueries = $derived(clients.map((client) => [
|
|
@@ -25,14 +26,14 @@ export const providePointclouds = (partID) => {
|
|
|
25
26
|
}),
|
|
26
27
|
]));
|
|
27
28
|
const fetchedPropQueries = $derived(propQueries.every(([, query]) => query.isPending === false));
|
|
28
|
-
const interval = $derived(refreshRates
|
|
29
|
+
const interval = $derived(refreshRates[RefreshRates.pointclouds]);
|
|
29
30
|
const enabledClients = $derived.by(() => {
|
|
30
31
|
const results = [];
|
|
31
32
|
for (const client of clients) {
|
|
32
33
|
if (fetchedPropQueries &&
|
|
33
34
|
client.current?.name &&
|
|
34
35
|
interval !== RefetchRates.OFF &&
|
|
35
|
-
disabledCameras
|
|
36
|
+
disabledCameras[client.current?.name] !== true) {
|
|
36
37
|
results.push(client);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -47,8 +48,8 @@ export const providePointclouds = (partID) => {
|
|
|
47
48
|
*/
|
|
48
49
|
$effect(() => {
|
|
49
50
|
for (const [name, query] of propQueries) {
|
|
50
|
-
if (name && query.data?.supportsPcd === false && disabledCameras
|
|
51
|
-
disabledCameras
|
|
51
|
+
if (name && query.data?.supportsPcd === false && disabledCameras[name] === undefined) {
|
|
52
|
+
disabledCameras[name] = true;
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
});
|
|
@@ -6,15 +6,15 @@ import { RefetchRates } from '../components/overlay/RefreshRate.svelte';
|
|
|
6
6
|
import { useEnvironment } from './useEnvironment.svelte';
|
|
7
7
|
import { useFrames } from './useFrames.svelte';
|
|
8
8
|
import { useLogs } from './useLogs.svelte';
|
|
9
|
-
import { RefreshRates, useMachineSettings } from './useMachineSettings.svelte';
|
|
10
9
|
import { usePartID } from './usePartID.svelte';
|
|
11
10
|
import { useRefetchPoses } from './useRefetchPoses';
|
|
12
11
|
import { useResourceByName } from './useResourceByName.svelte';
|
|
12
|
+
import { RefreshRates, useSettings } from './useSettings.svelte';
|
|
13
13
|
const originFrameComponentTypes = new Set(['arm', 'gantry', 'gripper', 'base']);
|
|
14
14
|
export const usePose = (name, parent) => {
|
|
15
15
|
const environment = useEnvironment();
|
|
16
16
|
const logs = useLogs();
|
|
17
|
-
const
|
|
17
|
+
const settings = useSettings();
|
|
18
18
|
const partID = usePartID();
|
|
19
19
|
const robotClient = useRobotClient(() => partID.current);
|
|
20
20
|
const currentName = $derived(name());
|
|
@@ -25,7 +25,7 @@ export const usePose = (name, parent) => {
|
|
|
25
25
|
const parentResource = $derived(currentParent ? resourceByName.current[currentParent] : undefined);
|
|
26
26
|
const frames = useFrames();
|
|
27
27
|
let pose = $state();
|
|
28
|
-
const interval = $derived(refreshRates
|
|
28
|
+
const interval = $derived(settings.current.refreshRates[RefreshRates.poses]);
|
|
29
29
|
const resolvedParent = $derived(originFrameComponentTypes.has(parentResource?.subtype ?? '') ? `${parent()}_origin` : parent());
|
|
30
30
|
const resolvedName = $derived(originFrameComponentTypes.has(resource?.subtype ?? '') ? `${currentName}_origin` : currentName);
|
|
31
31
|
const query = createRobotQuery(robotClient, 'getPose', () => [resolvedName, resolvedParent ?? 'world', []], () => ({
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
export interface Settings {
|
|
2
2
|
cameraMode: 'orthographic' | 'perspective';
|
|
3
|
+
interactionMode: 'navigate' | 'measure' | 'select';
|
|
4
|
+
refreshRates: {
|
|
5
|
+
poses: number;
|
|
6
|
+
pointclouds: number;
|
|
7
|
+
vision: number;
|
|
8
|
+
};
|
|
9
|
+
disabledCameras: Record<string, boolean>;
|
|
10
|
+
disabledVisionServices: Record<string, boolean>;
|
|
3
11
|
transforming: boolean;
|
|
4
12
|
snapping: boolean;
|
|
5
13
|
transformMode: 'translate' | 'rotate' | 'scale';
|
|
@@ -11,7 +19,6 @@ export interface Settings {
|
|
|
11
19
|
pointColor: string;
|
|
12
20
|
lineWidth: number;
|
|
13
21
|
lineDotSize: number;
|
|
14
|
-
interactionMode: 'navigate' | 'measure' | 'lasso';
|
|
15
22
|
enableMeasureAxisX: boolean;
|
|
16
23
|
enableMeasureAxisY: boolean;
|
|
17
24
|
enableMeasureAxisZ: boolean;
|
|
@@ -45,6 +52,11 @@ interface Context {
|
|
|
45
52
|
isLoaded: boolean;
|
|
46
53
|
merge(value: Settings): void;
|
|
47
54
|
}
|
|
55
|
+
export declare const RefreshRates: {
|
|
56
|
+
readonly poses: "poses";
|
|
57
|
+
readonly pointclouds: "pointclouds";
|
|
58
|
+
readonly vision: "vision";
|
|
59
|
+
};
|
|
48
60
|
export declare const provideSettings: () => Context;
|
|
49
61
|
export declare const useSettings: () => Context;
|
|
50
62
|
export {};
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { get, set } from 'idb-keyval';
|
|
2
2
|
import { getContext, setContext } from 'svelte';
|
|
3
3
|
const key = Symbol('dashboard-context');
|
|
4
|
+
export const RefreshRates = {
|
|
5
|
+
poses: 'poses',
|
|
6
|
+
pointclouds: 'pointclouds',
|
|
7
|
+
vision: 'vision',
|
|
8
|
+
};
|
|
4
9
|
const defaults = () => ({
|
|
5
10
|
cameraMode: 'perspective',
|
|
11
|
+
refreshRates: {
|
|
12
|
+
poses: 1000,
|
|
13
|
+
pointclouds: 5000,
|
|
14
|
+
vision: 1000,
|
|
15
|
+
},
|
|
16
|
+
disabledCameras: {},
|
|
17
|
+
disabledVisionServices: {},
|
|
6
18
|
transforming: false,
|
|
7
19
|
snapping: false,
|
|
8
20
|
transformMode: 'translate',
|
|
@@ -53,7 +65,7 @@ export const provideSettings = () => {
|
|
|
53
65
|
});
|
|
54
66
|
$effect(() => {
|
|
55
67
|
if (isLoaded) {
|
|
56
|
-
set('motion-tools-settings', $state.snapshot(settings));
|
|
68
|
+
set('motion-tools-settings', $state.snapshot({ ...settings, interactionMode: 'navigate' }));
|
|
57
69
|
}
|
|
58
70
|
});
|
|
59
71
|
const context = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as MotionTools } from './components/App.svelte';
|
|
2
|
-
export { default as
|
|
2
|
+
export { default as SelectionTool } from './components/Selection/Tool.svelte';
|
|
3
3
|
export { default as PCD } from './components/PCD.svelte';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default as MotionTools } from './components/App.svelte';
|
|
2
2
|
// Plugins
|
|
3
|
-
export { default as
|
|
3
|
+
export { default as SelectionTool } from './components/Selection/Tool.svelte';
|
|
4
4
|
export { default as PCD } from './components/PCD.svelte';
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
2
|
-
export declare const RefreshRates: {
|
|
3
|
-
readonly poses: "poses";
|
|
4
|
-
readonly pointclouds: "pointclouds";
|
|
5
|
-
};
|
|
6
|
-
type Context = {
|
|
7
|
-
refreshRates: SvelteMap<string, number>;
|
|
8
|
-
disabledCameras: SvelteMap<string, boolean>;
|
|
9
|
-
disabledVisionServices: SvelteMap<string, boolean>;
|
|
10
|
-
};
|
|
11
|
-
export declare const provideMachineSettings: () => void;
|
|
12
|
-
export declare const useMachineSettings: () => Context;
|
|
13
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { get, set } from 'idb-keyval';
|
|
2
|
-
import { getContext, setContext } from 'svelte';
|
|
3
|
-
import { SvelteMap } from 'svelte/reactivity';
|
|
4
|
-
const key = Symbol('polling-rate-context');
|
|
5
|
-
const refreshRatesKey = 'polling-rate';
|
|
6
|
-
const disabledCamerasKey = 'disabled-cameras';
|
|
7
|
-
const disabledVisionServicesKey = 'disabled-vision-services-object-pointcloud';
|
|
8
|
-
export const RefreshRates = {
|
|
9
|
-
poses: 'poses',
|
|
10
|
-
pointclouds: 'pointclouds',
|
|
11
|
-
};
|
|
12
|
-
const setFromEntries = (map, entries) => {
|
|
13
|
-
if (entries) {
|
|
14
|
-
for (const [key, value] of entries) {
|
|
15
|
-
map.set(key, value);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
export const provideMachineSettings = () => {
|
|
20
|
-
const refreshRates = new SvelteMap([
|
|
21
|
-
[RefreshRates.poses, 1000],
|
|
22
|
-
[RefreshRates.pointclouds, -1],
|
|
23
|
-
]);
|
|
24
|
-
const disabledCameras = new SvelteMap();
|
|
25
|
-
const disabledVisionServices = new SvelteMap();
|
|
26
|
-
get(refreshRatesKey).then((entries) => {
|
|
27
|
-
setFromEntries(refreshRates, entries);
|
|
28
|
-
});
|
|
29
|
-
get(disabledCamerasKey).then((entries) => {
|
|
30
|
-
setFromEntries(disabledCameras, entries);
|
|
31
|
-
});
|
|
32
|
-
get(disabledVisionServicesKey).then((entries) => {
|
|
33
|
-
setFromEntries(disabledVisionServices, entries);
|
|
34
|
-
});
|
|
35
|
-
$effect(() => {
|
|
36
|
-
set(refreshRatesKey, [...refreshRates.entries()]);
|
|
37
|
-
});
|
|
38
|
-
$effect(() => {
|
|
39
|
-
set(disabledCamerasKey, [...disabledCameras.entries()]);
|
|
40
|
-
});
|
|
41
|
-
$effect(() => {
|
|
42
|
-
set(disabledVisionServicesKey, [...disabledVisionServices.entries()]);
|
|
43
|
-
});
|
|
44
|
-
setContext(key, {
|
|
45
|
-
get refreshRates() {
|
|
46
|
-
return refreshRates;
|
|
47
|
-
},
|
|
48
|
-
get disabledCameras() {
|
|
49
|
-
return disabledCameras;
|
|
50
|
-
},
|
|
51
|
-
get disabledVisionServices() {
|
|
52
|
-
return disabledVisionServices;
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
export const useMachineSettings = () => {
|
|
57
|
-
return getContext(key);
|
|
58
|
-
};
|
|
File without changes
|