@viamrobotics/motion-tools 0.5.6 → 0.6.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/color.d.ts +18 -13
- package/dist/color.js +20 -14
- package/dist/components/Frame.svelte +10 -3
- package/dist/components/Frame.svelte.d.ts +1 -1
- package/dist/components/Geometry.svelte +1 -1
- package/dist/hooks/useFrames.svelte.js +11 -3
- package/dist/hooks/useGeometries.svelte.js +8 -3
- package/package.json +25 -25
package/dist/color.d.ts
CHANGED
|
@@ -7,18 +7,23 @@ import { Color, type ColorRepresentation } from 'three';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const darkenColor: (value: ColorRepresentation, percent: number) => Color;
|
|
9
9
|
export declare const colors: {
|
|
10
|
-
readonly selected: string;
|
|
11
10
|
readonly default: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
readonly
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
};
|
|
12
|
+
export declare const resourceColors: {
|
|
13
|
+
readonly arm: string;
|
|
14
|
+
readonly camera: string;
|
|
15
|
+
readonly base: string;
|
|
16
|
+
readonly board: string;
|
|
17
|
+
readonly button: string;
|
|
18
|
+
readonly encoder: string;
|
|
19
|
+
readonly gantry: string;
|
|
20
|
+
readonly gripper: string;
|
|
21
|
+
readonly motor: string;
|
|
22
|
+
readonly movement_sensor: string;
|
|
23
|
+
readonly pose_tracker: string;
|
|
24
|
+
readonly power_sensor: string;
|
|
25
|
+
readonly sensor: string;
|
|
26
|
+
readonly servo: string;
|
|
27
|
+
readonly switch: string;
|
|
28
|
+
readonly webcam: string;
|
|
24
29
|
};
|
package/dist/color.js
CHANGED
|
@@ -51,19 +51,25 @@ export const darkenColor = (value, percent) => {
|
|
|
51
51
|
hsl.l = Math.max(0, hsl.l * (1 - percent / 100));
|
|
52
52
|
return new Color().setHSL(hsl.h, hsl.s, hsl.l);
|
|
53
53
|
};
|
|
54
|
+
const darkness = '600';
|
|
54
55
|
export const colors = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
gripper:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
default: oklchToHex(twColors.red[darkness]),
|
|
57
|
+
};
|
|
58
|
+
export const resourceColors = {
|
|
59
|
+
arm: oklchToHex(twColors.amber[darkness]),
|
|
60
|
+
camera: oklchToHex(twColors.blue[darkness]),
|
|
61
|
+
base: oklchToHex(twColors.slate[darkness]),
|
|
62
|
+
board: oklchToHex(twColors.emerald[darkness]),
|
|
63
|
+
button: oklchToHex(twColors.gray[darkness]),
|
|
64
|
+
encoder: oklchToHex(twColors.lime[darkness]),
|
|
65
|
+
gantry: oklchToHex(twColors.purple[darkness]),
|
|
66
|
+
gripper: oklchToHex(twColors.cyan[darkness]),
|
|
67
|
+
motor: oklchToHex(twColors.orange[darkness]),
|
|
68
|
+
movement_sensor: oklchToHex(twColors.indigo[darkness]),
|
|
69
|
+
pose_tracker: oklchToHex(twColors.rose[darkness]),
|
|
70
|
+
power_sensor: oklchToHex(twColors.violet[darkness]),
|
|
71
|
+
sensor: oklchToHex(twColors.teal[darkness]),
|
|
72
|
+
servo: oklchToHex(twColors.yellow[darkness]),
|
|
73
|
+
switch: oklchToHex(twColors.stone[darkness]),
|
|
74
|
+
webcam: oklchToHex(twColors.sky[darkness]),
|
|
69
75
|
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { Color, type Object3D } from 'three'
|
|
3
|
+
|
|
4
|
+
const colorUtil = new Color()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
1
7
|
<script lang="ts">
|
|
2
8
|
import type { Snippet } from 'svelte'
|
|
3
|
-
import type { Object3D } from 'three'
|
|
4
9
|
import type { WorldObject } from '../WorldObject'
|
|
5
10
|
import { useObjectEvents } from '../hooks/useObjectEvents.svelte'
|
|
6
11
|
import Geometry from './Geometry.svelte'
|
|
@@ -20,13 +25,15 @@
|
|
|
20
25
|
|
|
21
26
|
const selected = useSelected()
|
|
22
27
|
const events = useObjectEvents(() => uuid)
|
|
28
|
+
|
|
29
|
+
const color = $derived(rest.metadata.color ?? colors.default)
|
|
23
30
|
</script>
|
|
24
31
|
|
|
25
32
|
<Geometry
|
|
26
33
|
{uuid}
|
|
27
34
|
color={selected.current === uuid
|
|
28
|
-
? `#${darkenColor(
|
|
29
|
-
:
|
|
35
|
+
? `#${darkenColor(color, 75).getHexString()}`
|
|
36
|
+
: `#${colorUtil.set(color).getHexString()}`}
|
|
30
37
|
{...events}
|
|
31
38
|
{...rest}
|
|
32
39
|
/>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { getContext, setContext, untrack } from 'svelte';
|
|
2
|
-
import { useRobotClient, createRobotQuery, useMachineStatus } from '@viamrobotics/svelte-sdk';
|
|
2
|
+
import { useRobotClient, createRobotQuery, useMachineStatus, useResourceNames, } from '@viamrobotics/svelte-sdk';
|
|
3
3
|
import { WorldObject } from '../WorldObject';
|
|
4
4
|
import { useRefreshRates } from './useRefreshRates.svelte';
|
|
5
5
|
import { observe } from '@threlte/core';
|
|
6
6
|
import { useLogs } from './useLogs.svelte';
|
|
7
|
+
import { resourceColors } from '../color';
|
|
7
8
|
const key = Symbol('frames-context');
|
|
8
9
|
export const provideFrames = (partID) => {
|
|
10
|
+
const resourceNames = useResourceNames(partID);
|
|
9
11
|
const client = useRobotClient(partID);
|
|
10
12
|
const machineStatus = useMachineStatus(partID);
|
|
11
13
|
const logs = useLogs();
|
|
@@ -28,9 +30,15 @@ export const provideFrames = (partID) => {
|
|
|
28
30
|
return objects;
|
|
29
31
|
}
|
|
30
32
|
for (const { frame } of query.current.data ?? []) {
|
|
31
|
-
if (frame) {
|
|
32
|
-
|
|
33
|
+
if (frame === undefined) {
|
|
34
|
+
continue;
|
|
33
35
|
}
|
|
36
|
+
const resourceName = resourceNames.current.find((item) => item.name === frame.referenceFrame);
|
|
37
|
+
objects.push(new WorldObject(frame.referenceFrame ? frame.referenceFrame : 'Unnamed frame', frame.poseInObserverFrame?.pose, frame.poseInObserverFrame?.referenceFrame, frame.physicalObject?.geometryType, resourceName
|
|
38
|
+
? {
|
|
39
|
+
color: resourceColors[resourceName.subtype],
|
|
40
|
+
}
|
|
41
|
+
: undefined));
|
|
34
42
|
}
|
|
35
43
|
return objects;
|
|
36
44
|
});
|
|
@@ -7,13 +7,15 @@ import { useRefreshRates } from './useRefreshRates.svelte';
|
|
|
7
7
|
import { WorldObject } from '../WorldObject';
|
|
8
8
|
import { usePersistentUUIDs } from './usePersistentUUIDs.svelte';
|
|
9
9
|
import { useLogs } from './useLogs.svelte';
|
|
10
|
+
import { resourceColors } from '../color';
|
|
10
11
|
const key = Symbol('geometries-context');
|
|
11
12
|
export const provideGeometries = (partID) => {
|
|
12
|
-
const
|
|
13
|
-
const refreshRates = useRefreshRates();
|
|
13
|
+
const resourceNames = useResourceNames(partID);
|
|
14
14
|
const arms = useResourceNames(partID, 'arm');
|
|
15
15
|
const cameras = useResourceNames(partID, 'camera');
|
|
16
16
|
const grippers = useResourceNames(partID, 'gripper');
|
|
17
|
+
const logs = useLogs();
|
|
18
|
+
const refreshRates = useRefreshRates();
|
|
17
19
|
const armClients = $derived(arms.current.map((arm) => createResourceClient(ArmClient, partID, () => arm.name)));
|
|
18
20
|
const gripperClients = $derived(grippers.current.map((gripper) => createResourceClient(GripperClient, partID, () => gripper.name)));
|
|
19
21
|
const cameraClients = $derived(cameras.current.map((camera) => createResourceClient(CameraClient, partID, () => camera.name)));
|
|
@@ -45,7 +47,10 @@ export const provideGeometries = (partID) => {
|
|
|
45
47
|
if (!query.data)
|
|
46
48
|
continue;
|
|
47
49
|
for (const { center, label, geometryType } of query.data.geometries) {
|
|
48
|
-
|
|
50
|
+
const resourceName = resourceNames.current.find((item) => item.name === query.data.name);
|
|
51
|
+
results.push(new WorldObject(label ? label : 'Unnamed geometry', center, query.data.name, geometryType, resourceName
|
|
52
|
+
? { color: resourceColors[resourceName.subtype] }
|
|
53
|
+
: undefined));
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
updateUUIDs(results);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viamrobotics/motion-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Motion visualization with Viam",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -11,38 +11,38 @@
|
|
|
11
11
|
"@changesets/cli": "2.29.5",
|
|
12
12
|
"@dimforge/rapier3d-compat": "0.17.3",
|
|
13
13
|
"@eslint/compat": "1.3.1",
|
|
14
|
-
"@eslint/js": "9.
|
|
15
|
-
"@playwright/test": "1.
|
|
16
|
-
"@sentry/sveltekit": "9.
|
|
17
|
-
"@skeletonlabs/skeleton": "3.1.
|
|
18
|
-
"@skeletonlabs/skeleton-svelte": "1.
|
|
14
|
+
"@eslint/js": "9.31.0",
|
|
15
|
+
"@playwright/test": "1.54.1",
|
|
16
|
+
"@sentry/sveltekit": "9.39.0",
|
|
17
|
+
"@skeletonlabs/skeleton": "3.1.7",
|
|
18
|
+
"@skeletonlabs/skeleton-svelte": "1.3.0",
|
|
19
19
|
"@sveltejs/adapter-static": "3.0.8",
|
|
20
|
-
"@sveltejs/kit": "2.
|
|
21
|
-
"@sveltejs/package": "2.
|
|
22
|
-
"@sveltejs/vite-plugin-svelte": "
|
|
20
|
+
"@sveltejs/kit": "2.24.0",
|
|
21
|
+
"@sveltejs/package": "2.4.0",
|
|
22
|
+
"@sveltejs/vite-plugin-svelte": "6.1.0",
|
|
23
23
|
"@tailwindcss/forms": "0.5.10",
|
|
24
24
|
"@tailwindcss/vite": "4.1.11",
|
|
25
|
-
"@tanstack/svelte-query": "5.
|
|
26
|
-
"@tanstack/svelte-query-devtools": "5.
|
|
25
|
+
"@tanstack/svelte-query": "5.83.0",
|
|
26
|
+
"@tanstack/svelte-query-devtools": "5.83.0",
|
|
27
27
|
"@testing-library/jest-dom": "6.6.3",
|
|
28
28
|
"@testing-library/svelte": "5.2.8",
|
|
29
|
-
"@threlte/core": "8.1.
|
|
29
|
+
"@threlte/core": "8.1.3",
|
|
30
30
|
"@threlte/extras": "9.4.2",
|
|
31
31
|
"@threlte/rapier": "3.1.4",
|
|
32
32
|
"@threlte/xr": "1.0.8",
|
|
33
33
|
"@types/bun": "1.2.18",
|
|
34
34
|
"@types/lodash-es": "4.17.12",
|
|
35
|
-
"@types/three": "0.178.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
37
|
-
"@typescript-eslint/parser": "8.
|
|
35
|
+
"@types/three": "0.178.1",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "8.37.0",
|
|
37
|
+
"@typescript-eslint/parser": "8.37.0",
|
|
38
38
|
"@viamrobotics/prime-core": "0.1.5",
|
|
39
39
|
"@viamrobotics/sdk": "0.46.0",
|
|
40
|
-
"@viamrobotics/svelte-sdk": "0.4.
|
|
40
|
+
"@viamrobotics/svelte-sdk": "0.4.3",
|
|
41
41
|
"@vitejs/plugin-basic-ssl": "2.1.0",
|
|
42
|
-
"@zag-js/svelte": "1.18.
|
|
43
|
-
"@zag-js/tree-view": "1.18.
|
|
44
|
-
"camera-controls": "
|
|
45
|
-
"eslint": "9.
|
|
42
|
+
"@zag-js/svelte": "1.18.3",
|
|
43
|
+
"@zag-js/tree-view": "1.18.3",
|
|
44
|
+
"camera-controls": "3.1.0",
|
|
45
|
+
"eslint": "9.31.0",
|
|
46
46
|
"eslint-config-prettier": "10.1.5",
|
|
47
47
|
"eslint-plugin-svelte": "3.10.1",
|
|
48
48
|
"globals": "16.3.0",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"lucide-svelte": "0.525.0",
|
|
53
53
|
"prettier": "3.6.2",
|
|
54
54
|
"prettier-plugin-svelte": "3.4.0",
|
|
55
|
-
"prettier-plugin-tailwindcss": "0.6.
|
|
55
|
+
"prettier-plugin-tailwindcss": "0.6.14",
|
|
56
56
|
"publint": "0.3.12",
|
|
57
|
-
"runed": "0.
|
|
58
|
-
"svelte": "5.
|
|
57
|
+
"runed": "0.31.0",
|
|
58
|
+
"svelte": "5.36.1",
|
|
59
59
|
"svelte-check": "4.2.2",
|
|
60
60
|
"svelte-virtuallists": "1.4.2",
|
|
61
61
|
"tailwindcss": "4.1.11",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"threlte-uikit": "1.2.0",
|
|
64
64
|
"tsx": "4.20.3",
|
|
65
65
|
"typescript": "5.8.3",
|
|
66
|
-
"typescript-eslint": "8.
|
|
66
|
+
"typescript-eslint": "8.37.0",
|
|
67
67
|
"vite": "6.3.5",
|
|
68
|
-
"vite-plugin-devtools-json": "0.
|
|
68
|
+
"vite-plugin-devtools-json": "0.3.0",
|
|
69
69
|
"vite-plugin-mkcert": "1.17.8",
|
|
70
70
|
"vitest": "3.2.4"
|
|
71
71
|
},
|