@viamrobotics/motion-tools 0.3.4 → 0.3.6
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/components/App.svelte +1 -1
- package/dist/components/Tree/Drawer.svelte +3 -2
- package/dist/components/Tree/Drawer.svelte.d.ts +1 -0
- package/dist/components/Tree/Settings.svelte +4 -1
- package/dist/components/Tree/Tree.svelte +10 -1
- package/dist/components/{XR.svelte → xr/XR.svelte} +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useFrames.svelte.js +1 -1
- package/dist/hooks/useGeometries.svelte.js +8 -6
- package/dist/hooks/useMotionClient.svelte.js +1 -0
- package/dist/hooks/usePersistentUUIDs.svelte.js +5 -6
- package/dist/hooks/usePointclouds.svelte.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +10 -10
- package/dist/hooks/useConnectionConfigs.svelte.d.ts +0 -20
- package/dist/hooks/useConnectionConfigs.svelte.js +0 -59
- /package/dist/components/{XR.svelte.d.ts → xr/XR.svelte.d.ts} +0 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import SceneProviders from './SceneProviders.svelte'
|
|
9
9
|
import DomPortal from './DomPortal.svelte'
|
|
10
10
|
import { PersistedState } from 'runed'
|
|
11
|
-
import XR from './XR.svelte'
|
|
11
|
+
import XR from './xr/XR.svelte'
|
|
12
12
|
import { World } from '@threlte/rapier'
|
|
13
13
|
import { createPartIDContext } from '../hooks/usePartID.svelte'
|
|
14
14
|
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
7
|
name: string
|
|
8
|
+
defaultOpen?: boolean
|
|
8
9
|
children: Snippet
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
let { name, children }: Props = $props()
|
|
12
|
+
let { name, children, defaultOpen = false }: Props = $props()
|
|
12
13
|
|
|
13
|
-
const expanded = $derived(new PersistedState(`${name}-expanded`,
|
|
14
|
+
const expanded = $derived(new PersistedState(`${name}-expanded`, defaultOpen))
|
|
14
15
|
</script>
|
|
15
16
|
|
|
16
17
|
<button
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
>
|
|
154
154
|
{#if rootChildren.length === 0}
|
|
155
155
|
<p class="text-subtle-2 px-2 py-4">No objects displayed</p>
|
|
156
|
-
{:else}
|
|
156
|
+
{:else if rootChildren.length > 200}
|
|
157
157
|
<VirtualList
|
|
158
158
|
class="w-full"
|
|
159
159
|
style="height:{Math.min(8, Math.max(rootChildren.length, 5)) * 32}px;"
|
|
@@ -163,6 +163,15 @@
|
|
|
163
163
|
{@render treeNode({ node: item, indexPath: [Number(index)], api })}
|
|
164
164
|
{/snippet}
|
|
165
165
|
</VirtualList>
|
|
166
|
+
{:else}
|
|
167
|
+
<div
|
|
168
|
+
style="height:{Math.min(8, Math.max(rootChildren.length, 5)) * 32}px;"
|
|
169
|
+
class="overflow-auto"
|
|
170
|
+
>
|
|
171
|
+
{#each rootChildren as node, index (node.id)}
|
|
172
|
+
{@render treeNode({ node, indexPath: [Number(index)], api })}
|
|
173
|
+
{/each}
|
|
174
|
+
</div>
|
|
166
175
|
{/if}
|
|
167
176
|
</div>
|
|
168
177
|
</div>
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { provideConnectionConfigs, useConnectionConfigs, useActiveConnectionConfig, } from './useConnectionConfigs.svelte';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
@@ -29,7 +29,7 @@ export const provideFrames = (partID) => {
|
|
|
29
29
|
}
|
|
30
30
|
for (const { frame } of query.current.data ?? []) {
|
|
31
31
|
if (frame) {
|
|
32
|
-
objects.push(new WorldObject(frame.referenceFrame, frame.poseInObserverFrame?.pose, frame.poseInObserverFrame?.referenceFrame, frame.physicalObject?.geometryType));
|
|
32
|
+
objects.push(new WorldObject(frame.referenceFrame ?? 'Unnamed frame', frame.poseInObserverFrame?.pose, frame.poseInObserverFrame?.referenceFrame, frame.physicalObject?.geometryType));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
return objects;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArmClient, CameraClient, Geometry } from '@viamrobotics/sdk';
|
|
1
|
+
import { ArmClient, CameraClient, Geometry, GripperClient } from '@viamrobotics/sdk';
|
|
2
2
|
import { createQueries, queryOptions } from '@tanstack/svelte-query';
|
|
3
3
|
import { createResourceClient, useResourceNames } from '@viamrobotics/svelte-sdk';
|
|
4
4
|
import { setContext, getContext } from 'svelte';
|
|
@@ -8,15 +8,17 @@ import { WorldObject } from '../WorldObject';
|
|
|
8
8
|
import { usePersistentUUIDs } from './usePersistentUUIDs.svelte';
|
|
9
9
|
import { useLogs } from './useLogs.svelte';
|
|
10
10
|
const key = Symbol('geometries-context');
|
|
11
|
+
let index = 0;
|
|
11
12
|
export const provideGeometries = (partID) => {
|
|
12
13
|
const logs = useLogs();
|
|
13
14
|
const refreshRates = useRefreshRates();
|
|
14
15
|
const arms = useResourceNames(partID, 'arm');
|
|
15
16
|
const cameras = useResourceNames(partID, 'camera');
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const grippers = useResourceNames(partID, 'gripper');
|
|
18
|
+
const armClients = $derived(arms.current.map((arm) => createResourceClient(ArmClient, partID, () => arm.name)));
|
|
19
|
+
const gripperClients = $derived(grippers.current.map((gripper) => createResourceClient(GripperClient, partID, () => gripper.name)));
|
|
20
|
+
const cameraClients = $derived(cameras.current.map((camera) => createResourceClient(CameraClient, partID, () => camera.name)));
|
|
21
|
+
const clients = $derived([...armClients, ...gripperClients, ...cameraClients]);
|
|
20
22
|
if (!refreshRates.has('Geometries')) {
|
|
21
23
|
refreshRates.set('Geometries', 1000);
|
|
22
24
|
}
|
|
@@ -44,7 +46,7 @@ export const provideGeometries = (partID) => {
|
|
|
44
46
|
if (!query.data)
|
|
45
47
|
continue;
|
|
46
48
|
for (const { center, label, geometryType } of query.data.geometries) {
|
|
47
|
-
results.push(new WorldObject(label
|
|
49
|
+
results.push(new WorldObject(label ? label : `Unnamed geometry ${++index}`, center, query.data.name, geometryType));
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
updateUUIDs(results);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export const usePersistentUUIDs = () => {
|
|
2
2
|
const uuids = new Map();
|
|
3
3
|
const updateUUIDs = (objects) => {
|
|
4
|
-
if (uuids.size === 0) {
|
|
5
|
-
for (const object of objects) {
|
|
6
|
-
uuids.set(object.name, object.uuid);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
4
|
for (const object of objects) {
|
|
10
|
-
|
|
5
|
+
const ref = `${object.referenceFrame}-${object.name}`;
|
|
6
|
+
if (uuids.has(ref) === false) {
|
|
7
|
+
uuids.set(ref, object.uuid);
|
|
8
|
+
}
|
|
9
|
+
object.uuid = uuids.get(ref) ?? object.uuid;
|
|
11
10
|
}
|
|
12
11
|
};
|
|
13
12
|
return { uuids, updateUUIDs };
|
|
@@ -14,7 +14,7 @@ export const providePointclouds = (partID) => {
|
|
|
14
14
|
const refreshRates = useRefreshRates();
|
|
15
15
|
const cameras = useResourceNames(partID, 'camera');
|
|
16
16
|
if (!refreshRates.has('Pointclouds')) {
|
|
17
|
-
refreshRates.set('Pointclouds',
|
|
17
|
+
refreshRates.set('Pointclouds', -1);
|
|
18
18
|
}
|
|
19
19
|
const clients = $derived(cameras.current.map((camera) => createResourceClient(CameraClient, partID, () => camera.name)));
|
|
20
20
|
const options = $derived(clients.map((cameraClient) => {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viamrobotics/motion-tools",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Motion visualization with Viam",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"@sveltejs/package": "^2.3.11",
|
|
21
21
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
|
22
22
|
"@tailwindcss/forms": "^0.5.10",
|
|
23
|
-
"@tailwindcss/vite": "^4.1.
|
|
24
|
-
"@tanstack/svelte-query": "^5.
|
|
25
|
-
"@tanstack/svelte-query-devtools": "^5.
|
|
23
|
+
"@tailwindcss/vite": "^4.1.8",
|
|
24
|
+
"@tanstack/svelte-query": "^5.79.0",
|
|
25
|
+
"@tanstack/svelte-query-devtools": "^5.79.0",
|
|
26
26
|
"@testing-library/jest-dom": "^6.6.3",
|
|
27
27
|
"@testing-library/svelte": "^5.2.8",
|
|
28
28
|
"@threlte/core": "^8.0.4",
|
|
29
29
|
"@threlte/extras": "^9.2.1",
|
|
30
30
|
"@threlte/rapier": "^3.1.4",
|
|
31
31
|
"@threlte/xr": "^1.0.5",
|
|
32
|
-
"@types/bun": "^1.2.
|
|
32
|
+
"@types/bun": "^1.2.15",
|
|
33
33
|
"@types/lodash-es": "^4.17.12",
|
|
34
34
|
"@types/three": "^0.176.0",
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
36
|
-
"@typescript-eslint/parser": "^8.
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.33.0",
|
|
36
|
+
"@typescript-eslint/parser": "^8.33.0",
|
|
37
37
|
"@viamrobotics/prime-core": "^0.1.5",
|
|
38
38
|
"@viamrobotics/sdk": "0.42.0",
|
|
39
39
|
"@viamrobotics/svelte-sdk": "0.1.4",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
|
56
56
|
"publint": "^0.3.12",
|
|
57
57
|
"runed": "^0.28.0",
|
|
58
|
-
"svelte": "5.33.
|
|
58
|
+
"svelte": "5.33.8",
|
|
59
59
|
"svelte-check": "^4.2.1",
|
|
60
60
|
"svelte-virtuallists": "^1.4.2",
|
|
61
|
-
"tailwindcss": "^4.1.
|
|
61
|
+
"tailwindcss": "^4.1.8",
|
|
62
62
|
"three": "^0.176.0",
|
|
63
63
|
"threlte-uikit": "^1.0.0",
|
|
64
64
|
"tsx": "^4.19.4",
|
|
65
65
|
"typescript": "^5.8.3",
|
|
66
|
-
"typescript-eslint": "^8.
|
|
66
|
+
"typescript-eslint": "^8.33.0",
|
|
67
67
|
"vite": "^6.3.5",
|
|
68
68
|
"vite-plugin-mkcert": "^1.17.8",
|
|
69
69
|
"vitest": "^3.1.4"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface ConnectionConfig {
|
|
2
|
-
host: string;
|
|
3
|
-
partId: string;
|
|
4
|
-
apiKeyId: string;
|
|
5
|
-
apiKeyValue: string;
|
|
6
|
-
signalingAddress: string;
|
|
7
|
-
}
|
|
8
|
-
interface Context {
|
|
9
|
-
current: ConnectionConfig[];
|
|
10
|
-
add: () => void;
|
|
11
|
-
remove: (index: number) => void;
|
|
12
|
-
isEnvConfig: (config: ConnectionConfig) => boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare const provideConnectionConfigs: () => void;
|
|
15
|
-
export declare const useConnectionConfigs: () => Context;
|
|
16
|
-
export declare const useActiveConnectionConfig: () => {
|
|
17
|
-
readonly current: ConnectionConfig | undefined;
|
|
18
|
-
set(index: number | undefined): void;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { get, set } from 'idb-keyval';
|
|
2
|
-
import { PersistedState } from 'runed';
|
|
3
|
-
import { getContext, setContext } from 'svelte';
|
|
4
|
-
import { envConfigs } from '../../routes/lib/configs';
|
|
5
|
-
import { isEqual } from 'lodash-es';
|
|
6
|
-
const key = Symbol('connection-config-context');
|
|
7
|
-
const activeConfig = new PersistedState('active-connection-config', 0);
|
|
8
|
-
export const provideConnectionConfigs = () => {
|
|
9
|
-
let connectionConfigs = $state([]);
|
|
10
|
-
get('connection-configs').then((response) => {
|
|
11
|
-
if (Array.isArray(response)) {
|
|
12
|
-
connectionConfigs = response;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
$effect(() => {
|
|
16
|
-
set('connection-configs', $state.snapshot(connectionConfigs));
|
|
17
|
-
});
|
|
18
|
-
const merged = $derived([...envConfigs, ...connectionConfigs]);
|
|
19
|
-
const add = () => {
|
|
20
|
-
connectionConfigs.push({
|
|
21
|
-
host: '',
|
|
22
|
-
partId: '',
|
|
23
|
-
apiKeyId: '',
|
|
24
|
-
apiKeyValue: '',
|
|
25
|
-
signalingAddress: '',
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
const remove = (index) => {
|
|
29
|
-
connectionConfigs.splice(index - envConfigs.length, 1);
|
|
30
|
-
};
|
|
31
|
-
const isEnvConfig = (config) => {
|
|
32
|
-
return envConfigs.some((value) => isEqual(config, value));
|
|
33
|
-
};
|
|
34
|
-
setContext(key, {
|
|
35
|
-
get current() {
|
|
36
|
-
return merged;
|
|
37
|
-
},
|
|
38
|
-
add,
|
|
39
|
-
remove,
|
|
40
|
-
isEnvConfig,
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
export const useConnectionConfigs = () => {
|
|
44
|
-
return getContext(key);
|
|
45
|
-
};
|
|
46
|
-
export const useActiveConnectionConfig = () => {
|
|
47
|
-
const connectionConfigs = useConnectionConfigs();
|
|
48
|
-
return {
|
|
49
|
-
get current() {
|
|
50
|
-
if (activeConfig.current === -1) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
return connectionConfigs.current.at(activeConfig.current);
|
|
54
|
-
},
|
|
55
|
-
set(index) {
|
|
56
|
-
activeConfig.current = index ?? -1;
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
};
|
|
File without changes
|