@viamrobotics/motion-tools 1.15.7 → 1.15.8
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/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/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 +12 -0
- package/package.json +1 -1
- package/dist/hooks/useMachineSettings.svelte.d.ts +0 -13
- package/dist/hooks/useMachineSettings.svelte.js +0 -58
|
@@ -668,6 +668,44 @@ export declare class DoCommandResponse extends Message<DoCommandResponse> {
|
|
|
668
668
|
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): DoCommandResponse;
|
|
669
669
|
static equals(a: DoCommandResponse | PlainMessage<DoCommandResponse> | undefined, b: DoCommandResponse | PlainMessage<DoCommandResponse> | undefined): boolean;
|
|
670
670
|
}
|
|
671
|
+
/**
|
|
672
|
+
* GetStatusRequest represents a generic GetStatus input
|
|
673
|
+
*
|
|
674
|
+
* @generated from message viam.common.v1.GetStatusRequest
|
|
675
|
+
*/
|
|
676
|
+
export declare class GetStatusRequest extends Message<GetStatusRequest> {
|
|
677
|
+
/**
|
|
678
|
+
* @generated from field: string name = 1;
|
|
679
|
+
*/
|
|
680
|
+
name: string;
|
|
681
|
+
constructor(data?: PartialMessage<GetStatusRequest>);
|
|
682
|
+
static readonly runtime: typeof proto3;
|
|
683
|
+
static readonly typeName = "viam.common.v1.GetStatusRequest";
|
|
684
|
+
static readonly fields: FieldList;
|
|
685
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetStatusRequest;
|
|
686
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetStatusRequest;
|
|
687
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetStatusRequest;
|
|
688
|
+
static equals(a: GetStatusRequest | PlainMessage<GetStatusRequest> | undefined, b: GetStatusRequest | PlainMessage<GetStatusRequest> | undefined): boolean;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* GetStatusResponse represents a generic GetStatus output
|
|
692
|
+
*
|
|
693
|
+
* @generated from message viam.common.v1.GetStatusResponse
|
|
694
|
+
*/
|
|
695
|
+
export declare class GetStatusResponse extends Message<GetStatusResponse> {
|
|
696
|
+
/**
|
|
697
|
+
* @generated from field: google.protobuf.Struct result = 1;
|
|
698
|
+
*/
|
|
699
|
+
result?: Struct;
|
|
700
|
+
constructor(data?: PartialMessage<GetStatusResponse>);
|
|
701
|
+
static readonly runtime: typeof proto3;
|
|
702
|
+
static readonly typeName = "viam.common.v1.GetStatusResponse";
|
|
703
|
+
static readonly fields: FieldList;
|
|
704
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetStatusResponse;
|
|
705
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetStatusResponse;
|
|
706
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetStatusResponse;
|
|
707
|
+
static equals(a: GetStatusResponse | PlainMessage<GetStatusResponse> | undefined, b: GetStatusResponse | PlainMessage<GetStatusResponse> | undefined): boolean;
|
|
708
|
+
}
|
|
671
709
|
/**
|
|
672
710
|
* @generated from message viam.common.v1.GetKinematicsRequest
|
|
673
711
|
*/
|
|
@@ -968,6 +968,70 @@ export class DoCommandResponse extends Message {
|
|
|
968
968
|
return proto3.util.equals(DoCommandResponse, a, b);
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
+
/**
|
|
972
|
+
* GetStatusRequest represents a generic GetStatus input
|
|
973
|
+
*
|
|
974
|
+
* @generated from message viam.common.v1.GetStatusRequest
|
|
975
|
+
*/
|
|
976
|
+
export class GetStatusRequest extends Message {
|
|
977
|
+
/**
|
|
978
|
+
* @generated from field: string name = 1;
|
|
979
|
+
*/
|
|
980
|
+
name = "";
|
|
981
|
+
constructor(data) {
|
|
982
|
+
super();
|
|
983
|
+
proto3.util.initPartial(data, this);
|
|
984
|
+
}
|
|
985
|
+
static runtime = proto3;
|
|
986
|
+
static typeName = "viam.common.v1.GetStatusRequest";
|
|
987
|
+
static fields = proto3.util.newFieldList(() => [
|
|
988
|
+
{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
989
|
+
]);
|
|
990
|
+
static fromBinary(bytes, options) {
|
|
991
|
+
return new GetStatusRequest().fromBinary(bytes, options);
|
|
992
|
+
}
|
|
993
|
+
static fromJson(jsonValue, options) {
|
|
994
|
+
return new GetStatusRequest().fromJson(jsonValue, options);
|
|
995
|
+
}
|
|
996
|
+
static fromJsonString(jsonString, options) {
|
|
997
|
+
return new GetStatusRequest().fromJsonString(jsonString, options);
|
|
998
|
+
}
|
|
999
|
+
static equals(a, b) {
|
|
1000
|
+
return proto3.util.equals(GetStatusRequest, a, b);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* GetStatusResponse represents a generic GetStatus output
|
|
1005
|
+
*
|
|
1006
|
+
* @generated from message viam.common.v1.GetStatusResponse
|
|
1007
|
+
*/
|
|
1008
|
+
export class GetStatusResponse extends Message {
|
|
1009
|
+
/**
|
|
1010
|
+
* @generated from field: google.protobuf.Struct result = 1;
|
|
1011
|
+
*/
|
|
1012
|
+
result;
|
|
1013
|
+
constructor(data) {
|
|
1014
|
+
super();
|
|
1015
|
+
proto3.util.initPartial(data, this);
|
|
1016
|
+
}
|
|
1017
|
+
static runtime = proto3;
|
|
1018
|
+
static typeName = "viam.common.v1.GetStatusResponse";
|
|
1019
|
+
static fields = proto3.util.newFieldList(() => [
|
|
1020
|
+
{ no: 1, name: "result", kind: "message", T: Struct },
|
|
1021
|
+
]);
|
|
1022
|
+
static fromBinary(bytes, options) {
|
|
1023
|
+
return new GetStatusResponse().fromBinary(bytes, options);
|
|
1024
|
+
}
|
|
1025
|
+
static fromJson(jsonValue, options) {
|
|
1026
|
+
return new GetStatusResponse().fromJson(jsonValue, options);
|
|
1027
|
+
}
|
|
1028
|
+
static fromJsonString(jsonString, options) {
|
|
1029
|
+
return new GetStatusResponse().fromJsonString(jsonString, options);
|
|
1030
|
+
}
|
|
1031
|
+
static equals(a, b) {
|
|
1032
|
+
return proto3.util.equals(GetStatusResponse, a, b);
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
971
1035
|
/**
|
|
972
1036
|
* @generated from message viam.common.v1.GetKinematicsRequest
|
|
973
1037
|
*/
|
|
@@ -52,11 +52,15 @@ export declare enum RenderShapes {
|
|
|
52
52
|
NURBS = 5
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* for orthographic camera props
|
|
56
|
-
*
|
|
57
55
|
* @generated from message draw.v1.OrthographicCamera
|
|
58
56
|
*/
|
|
59
57
|
export declare class OrthographicCamera extends Message<OrthographicCamera> {
|
|
58
|
+
/**
|
|
59
|
+
* for orthographic camera props
|
|
60
|
+
*
|
|
61
|
+
* @generated from field: optional float zoom = 1;
|
|
62
|
+
*/
|
|
63
|
+
zoom?: number;
|
|
60
64
|
constructor(data?: PartialMessage<OrthographicCamera>);
|
|
61
65
|
static readonly runtime: typeof proto3;
|
|
62
66
|
static readonly typeName = "draw.v1.OrthographicCamera";
|
|
@@ -73,18 +73,24 @@ proto3.util.setEnumType(RenderShapes, "draw.v1.RenderShapes", [
|
|
|
73
73
|
{ no: 5, name: "RENDER_SHAPES_NURBS" },
|
|
74
74
|
]);
|
|
75
75
|
/**
|
|
76
|
-
* for orthographic camera props
|
|
77
|
-
*
|
|
78
76
|
* @generated from message draw.v1.OrthographicCamera
|
|
79
77
|
*/
|
|
80
78
|
export class OrthographicCamera extends Message {
|
|
79
|
+
/**
|
|
80
|
+
* for orthographic camera props
|
|
81
|
+
*
|
|
82
|
+
* @generated from field: optional float zoom = 1;
|
|
83
|
+
*/
|
|
84
|
+
zoom;
|
|
81
85
|
constructor(data) {
|
|
82
86
|
super();
|
|
83
87
|
proto3.util.initPartial(data, this);
|
|
84
88
|
}
|
|
85
89
|
static runtime = proto3;
|
|
86
90
|
static typeName = "draw.v1.OrthographicCamera";
|
|
87
|
-
static fields = proto3.util.newFieldList(() => [
|
|
91
|
+
static fields = proto3.util.newFieldList(() => [
|
|
92
|
+
{ no: 1, name: "zoom", kind: "scalar", T: 2 /* ScalarType.FLOAT */, opt: true },
|
|
93
|
+
]);
|
|
88
94
|
static fromBinary(bytes, options) {
|
|
89
95
|
return new OrthographicCamera().fromBinary(bytes, options);
|
|
90
96
|
}
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
data: Uint8Array
|
|
10
10
|
name?: string
|
|
11
11
|
renderOrder?: number
|
|
12
|
+
oncreate?: (positions: Float32Array, colors: Uint8Array | null) => void
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
let { data, name, renderOrder }: Props = $props()
|
|
15
|
+
let { data, name, renderOrder, oncreate }: Props = $props()
|
|
15
16
|
|
|
16
17
|
const world = useWorld()
|
|
17
18
|
|
|
@@ -32,6 +33,8 @@
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
entity = world.spawn(...entityTraits)
|
|
36
|
+
|
|
37
|
+
oncreate?.(positions, colors)
|
|
35
38
|
})
|
|
36
39
|
|
|
37
40
|
return () => {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
import { provideGeometries } from '../hooks/useGeometries.svelte'
|
|
17
17
|
import { provideLinkedEntities } from '../hooks/useLinked.svelte'
|
|
18
18
|
import { provideLogs } from '../hooks/useLogs.svelte'
|
|
19
|
-
import { provideMachineSettings } from '../hooks/useMachineSettings.svelte'
|
|
20
19
|
import { usePartID } from '../hooks/usePartID.svelte'
|
|
21
20
|
import { providePointcloudObjects } from '../hooks/usePointcloudObjects.svelte'
|
|
22
21
|
import { providePointclouds } from '../hooks/usePointclouds.svelte'
|
|
@@ -37,7 +36,6 @@
|
|
|
37
36
|
|
|
38
37
|
provideCameraControls(() => cameraPose)
|
|
39
38
|
provideTransformControls()
|
|
40
|
-
provideMachineSettings()
|
|
41
39
|
provideLogs()
|
|
42
40
|
|
|
43
41
|
provideOrigin()
|
|
@@ -66,6 +66,14 @@ Renders a Snapshot protobuf by spawning its transforms and drawings as entities
|
|
|
66
66
|
position: [x * 0.001, y * 0.001, z * 0.001],
|
|
67
67
|
lookAt: [lx * 0.001, ly * 0.001, lz * 0.001],
|
|
68
68
|
})
|
|
69
|
+
|
|
70
|
+
if (sceneCamera.cameraType.case === 'orthographicCamera') {
|
|
71
|
+
const orthographicCamera = sceneCamera.cameraType.value as { zoom?: number }
|
|
72
|
+
const zoom = orthographicCamera.zoom
|
|
73
|
+
if (zoom !== undefined) {
|
|
74
|
+
cameraControls.setZoom(zoom)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
69
77
|
}
|
|
70
78
|
})
|
|
71
79
|
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
import { IconButton, Select } from '@viamrobotics/prime-core'
|
|
22
22
|
|
|
23
|
-
import {
|
|
23
|
+
import { useSettings } from '../../hooks/useSettings.svelte'
|
|
24
24
|
|
|
25
25
|
interface Props {
|
|
26
|
-
id:
|
|
26
|
+
id: 'poses' | 'pointclouds' | 'vision'
|
|
27
27
|
label: string
|
|
28
28
|
allowLive?: boolean
|
|
29
29
|
onManualRefetch: () => void
|
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
|
|
33
33
|
let { id, label, allowLive = false, onManualRefetch, children }: Props = $props()
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
const
|
|
35
|
+
const settings = useSettings()
|
|
36
|
+
const { refreshRates } = $derived(settings.current)
|
|
37
|
+
const rate = $derived(refreshRates[id] ?? RefetchRates.MANUAL)
|
|
37
38
|
</script>
|
|
38
39
|
|
|
39
40
|
<label class="flex flex-col gap-1">
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
onchange={(event: InputEvent) => {
|
|
49
50
|
if (event.target instanceof HTMLSelectElement) {
|
|
50
51
|
const { value } = event.target
|
|
51
|
-
refreshRates
|
|
52
|
+
refreshRates[id] = Number.parseInt(value, 10)
|
|
52
53
|
}
|
|
53
54
|
}}
|
|
54
55
|
value={String(rate)}
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
variant="secondary"
|
|
88
89
|
cx="border-light border"
|
|
89
90
|
onclick={() => {
|
|
90
|
-
refreshRates
|
|
91
|
+
refreshRates[id] = RefetchRates.MANUAL
|
|
91
92
|
}}
|
|
92
93
|
/>
|
|
93
94
|
{/if}
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
import DashboardButton from '../dashboard/Button.svelte'
|
|
10
10
|
import XRControllerSettings from '../../xr/XRControllerSettings.svelte'
|
|
11
11
|
import { useGeometries } from '../../../hooks/useGeometries.svelte'
|
|
12
|
-
import { RefreshRates, useMachineSettings } from '../../../hooks/useMachineSettings.svelte'
|
|
13
12
|
import { usePartID } from '../../../hooks/usePartID.svelte'
|
|
13
|
+
import { usePointcloudObjects } from '../../../hooks/usePointcloudObjects.svelte'
|
|
14
14
|
import { usePointClouds } from '../../../hooks/usePointclouds.svelte'
|
|
15
15
|
import { useRefetchPoses } from '../../../hooks/useRefetchPoses'
|
|
16
|
-
import { useSettings } from '../../../hooks/useSettings.svelte'
|
|
16
|
+
import { RefreshRates, useSettings } from '../../../hooks/useSettings.svelte'
|
|
17
17
|
import { useWeblabs, WEBLABS_EXPERIMENTS } from '../../../hooks/useWeblabs.svelte'
|
|
18
18
|
|
|
19
19
|
import FloatingPanel from '../FloatingPanel.svelte'
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
const cameras = useResourceNames(() => partID.current, 'camera')
|
|
27
27
|
const visionServices = useResourceNames(() => partID.current, 'vision')
|
|
28
28
|
const settings = useSettings()
|
|
29
|
-
const { disabledCameras, disabledVisionServices } =
|
|
29
|
+
const { disabledCameras, disabledVisionServices } = $derived(settings.current)
|
|
30
30
|
const geometries = useGeometries()
|
|
31
31
|
const pointclouds = usePointClouds()
|
|
32
|
+
const pointcloudObjects = usePointcloudObjects()
|
|
32
33
|
const { refetchPoses } = useRefetchPoses()
|
|
33
34
|
const weblabs = useWeblabs()
|
|
34
35
|
const knownWeblabs = Object.keys(WEBLABS_EXPERIMENTS)
|
|
@@ -87,11 +88,18 @@
|
|
|
87
88
|
/>
|
|
88
89
|
<RefreshRate
|
|
89
90
|
id={RefreshRates.pointclouds}
|
|
90
|
-
label="Pointclouds"
|
|
91
|
+
label="Pointclouds from cameras"
|
|
91
92
|
onManualRefetch={() => {
|
|
92
93
|
pointclouds.refetch()
|
|
93
94
|
}}
|
|
94
95
|
/>
|
|
96
|
+
<RefreshRate
|
|
97
|
+
id={RefreshRates.vision}
|
|
98
|
+
label="Vision service pointcloud segments and objects"
|
|
99
|
+
onManualRefetch={() => {
|
|
100
|
+
pointcloudObjects.refetch()
|
|
101
|
+
}}
|
|
102
|
+
/>
|
|
95
103
|
</div>
|
|
96
104
|
{/snippet}
|
|
97
105
|
|
|
@@ -126,9 +134,9 @@
|
|
|
126
134
|
<div class="flex items-center justify-between py-0.5 text-xs">
|
|
127
135
|
{camera.name}
|
|
128
136
|
<Switch
|
|
129
|
-
on={disabledCameras
|
|
137
|
+
on={disabledCameras[camera.name] !== true}
|
|
130
138
|
on:change={(event) => {
|
|
131
|
-
disabledCameras
|
|
139
|
+
disabledCameras[camera.name] = !event.detail
|
|
132
140
|
}}
|
|
133
141
|
/>
|
|
134
142
|
</div>
|
|
@@ -146,9 +154,9 @@
|
|
|
146
154
|
<div class="flex items-center justify-between py-0.5">
|
|
147
155
|
{visionService.name}
|
|
148
156
|
<Switch
|
|
149
|
-
on={disabledVisionServices
|
|
157
|
+
on={disabledVisionServices[visionService.name] !== true}
|
|
150
158
|
on:change={(event) => {
|
|
151
|
-
disabledVisionServices
|
|
159
|
+
disabledVisionServices[visionService.name] = !event.detail
|
|
152
160
|
}}
|
|
153
161
|
/>
|
|
154
162
|
</div>
|
|
@@ -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' | 'lasso';
|
|
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',
|
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
|
-
};
|