@viamrobotics/test-widgets 0.6.1 → 0.7.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/README.md +1 -1
- package/dist/api-docs-href.d.ts +8 -0
- package/dist/api-docs-href.js +17 -0
- package/dist/components/angle-unit-toggle.svelte +1 -4
- package/dist/components/api-section.svelte +21 -23
- package/dist/components/api-section.svelte.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/is-moving.svelte +3 -1
- package/dist/components/is-moving.svelte.d.ts +1 -0
- package/dist/components/mutation-section.svelte +19 -22
- package/dist/components/mutation-section.svelte.d.ts +2 -0
- package/dist/components/section-title.svelte +63 -0
- package/dist/components/section-title.svelte.d.ts +14 -0
- package/dist/components/widgets/arm/arm.svelte +17 -24
- package/dist/components/widgets/arm/joint-position-editor.svelte +89 -0
- package/dist/components/widgets/arm/joint-position-editor.svelte.d.ts +11 -0
- package/dist/components/widgets/arm/joint-position-quick-move.svelte +85 -0
- package/dist/components/widgets/arm/joint-position-quick-move.svelte.d.ts +9 -0
- package/dist/components/widgets/arm/joint-position-slider.svelte +36 -0
- package/dist/components/widgets/arm/joint-position-slider.svelte.d.ts +9 -0
- package/dist/components/widgets/arm/move-to-joint-positions.svelte +73 -127
- package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +1 -0
- package/dist/components/widgets/audio-input/audio-input.svelte +2 -0
- package/dist/components/widgets/audio-output/audio-output.svelte +2 -0
- package/dist/components/widgets/base/base.svelte +9 -1
- package/dist/components/widgets/camera/camera.svelte +156 -142
- package/dist/components/widgets/camera/live-or-polling-video.svelte +1 -0
- package/dist/components/widgets/discovery/discovery.svelte +1 -0
- package/dist/components/widgets/encoder/encoder.svelte +2 -0
- package/dist/components/widgets/gantry/gantry.svelte +28 -5
- package/dist/components/widgets/generic/generic.svelte +8 -1
- package/dist/components/widgets/gripper/gripper.svelte +11 -5
- package/dist/components/widgets/gripper/is-holding-something.svelte +1 -0
- package/dist/components/widgets/input-controller/input-controller.svelte +2 -1
- package/dist/components/widgets/motor/motor.svelte +11 -1
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +53 -26
- package/dist/components/widgets/power-sensor/power-sensor.svelte +4 -0
- package/dist/components/widgets/sensor/sensor.svelte +1 -0
- package/dist/components/widgets/servo/servo.svelte +10 -2
- package/dist/components/widgets/slam/move-on-map.svelte +4 -1
- package/dist/components/widgets/slam/slam.svelte +4 -1
- package/dist/components/widgets/vision-service/context.svelte.d.ts +1 -0
- package/dist/components/widgets/vision-service/context.svelte.js +7 -0
- package/dist/components/widgets/vision-service/detection-row.svelte +38 -0
- package/dist/components/widgets/vision-service/detection-row.svelte.d.ts +8 -0
- package/dist/components/widgets/vision-service/detection.svelte +7 -4
- package/dist/components/widgets/vision-service/legend.svelte +14 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -2
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
import ReadingsList from '../../readings-list.svelte'
|
|
10
10
|
import RefetchController from '../../refetch-controller.svelte'
|
|
11
11
|
import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
|
|
12
|
+
import SectionTitle from '../../section-title.svelte'
|
|
13
|
+
|
|
14
|
+
const MS_API = 'rdk:component:movement_sensor'
|
|
12
15
|
|
|
13
16
|
import Accuracy from './accuracy.svelte'
|
|
14
17
|
import CompassHeading from './compass-heading.svelte'
|
|
@@ -104,7 +107,10 @@
|
|
|
104
107
|
<div class="flex w-full flex-col gap-5 py-4 pr-6 pl-4 lg:w-1/4">
|
|
105
108
|
{#if propertiesQuery.data?.positionSupported}
|
|
106
109
|
<div class="flex flex-col gap-2">
|
|
107
|
-
<
|
|
110
|
+
<SectionTitle
|
|
111
|
+
title="GetPosition"
|
|
112
|
+
api={MS_API}
|
|
113
|
+
/>
|
|
108
114
|
<Query
|
|
109
115
|
query={positionQuery}
|
|
110
116
|
contentCx="h-6"
|
|
@@ -118,9 +124,13 @@
|
|
|
118
124
|
|
|
119
125
|
{#if propertiesQuery.data?.orientationSupported}
|
|
120
126
|
<div class="flex flex-col gap-2">
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
|
|
127
|
+
<SectionTitle
|
|
128
|
+
title="GetOrientation"
|
|
129
|
+
api={MS_API}
|
|
130
|
+
>
|
|
131
|
+
{#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(º)</span
|
|
132
|
+
>{/snippet}
|
|
133
|
+
</SectionTitle>
|
|
124
134
|
<Query
|
|
125
135
|
query={orientationQuery}
|
|
126
136
|
contentCx="h-6"
|
|
@@ -134,9 +144,13 @@
|
|
|
134
144
|
|
|
135
145
|
{#if propertiesQuery.data?.compassHeadingSupported}
|
|
136
146
|
<div class="flex flex-col gap-2">
|
|
137
|
-
<
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
<SectionTitle
|
|
148
|
+
title="GetCompassHeading"
|
|
149
|
+
api={MS_API}
|
|
150
|
+
>
|
|
151
|
+
{#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(º)</span
|
|
152
|
+
>{/snippet}
|
|
153
|
+
</SectionTitle>
|
|
140
154
|
<Query
|
|
141
155
|
query={compassHeadingQuery}
|
|
142
156
|
contentCx="h-6"
|
|
@@ -152,9 +166,13 @@
|
|
|
152
166
|
<div class="flex w-full flex-col gap-5 p-4 lg:w-1/4">
|
|
153
167
|
{#if propertiesQuery.data?.angularVelocitySupported}
|
|
154
168
|
<div class="flex flex-col gap-2">
|
|
155
|
-
<
|
|
156
|
-
|
|
157
|
-
|
|
169
|
+
<SectionTitle
|
|
170
|
+
title="GetAngularVelocity"
|
|
171
|
+
api={MS_API}
|
|
172
|
+
>
|
|
173
|
+
{#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(º/s)</span
|
|
174
|
+
>{/snippet}
|
|
175
|
+
</SectionTitle>
|
|
158
176
|
<Query
|
|
159
177
|
query={angularVelocityQuery}
|
|
160
178
|
contentCx="h-6"
|
|
@@ -168,9 +186,13 @@
|
|
|
168
186
|
|
|
169
187
|
{#if propertiesQuery.data?.linearVelocitySupported}
|
|
170
188
|
<div class="flex flex-col gap-2">
|
|
171
|
-
<
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
<SectionTitle
|
|
190
|
+
title="GetLinearVelocity"
|
|
191
|
+
api={MS_API}
|
|
192
|
+
>
|
|
193
|
+
{#snippet suffix()}<span class="text-subtle-2 text-xs font-normal">(m/s)</span
|
|
194
|
+
>{/snippet}
|
|
195
|
+
</SectionTitle>
|
|
174
196
|
<Query
|
|
175
197
|
query={linearVelocityQuery}
|
|
176
198
|
contentCx="h-6"
|
|
@@ -184,11 +206,14 @@
|
|
|
184
206
|
|
|
185
207
|
{#if propertiesQuery.data?.linearAccelerationSupported}
|
|
186
208
|
<div class="flex flex-col gap-2">
|
|
187
|
-
<
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
209
|
+
<SectionTitle
|
|
210
|
+
title="GetLinearAcceleration"
|
|
211
|
+
api={MS_API}
|
|
212
|
+
>
|
|
213
|
+
{#snippet suffix()}<span class="text-subtle-2 text-xs font-normal"
|
|
214
|
+
>(m/s<sup>2</sup>)</span
|
|
215
|
+
>{/snippet}
|
|
216
|
+
</SectionTitle>
|
|
192
217
|
<Query
|
|
193
218
|
query={linearAccelerationQuery}
|
|
194
219
|
contentCx="h-6"
|
|
@@ -201,7 +226,10 @@
|
|
|
201
226
|
{/if}
|
|
202
227
|
|
|
203
228
|
<div class="flex flex-col gap-2">
|
|
204
|
-
<
|
|
229
|
+
<SectionTitle
|
|
230
|
+
title="GetAccuracy"
|
|
231
|
+
api={MS_API}
|
|
232
|
+
/>
|
|
205
233
|
<Query
|
|
206
234
|
query={accuracyQuery}
|
|
207
235
|
contentCx="h-6"
|
|
@@ -226,13 +254,12 @@
|
|
|
226
254
|
class="flex flex-col gap-4 p-4"
|
|
227
255
|
aria-labelledby={headingID}
|
|
228
256
|
>
|
|
229
|
-
<div>
|
|
230
|
-
<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
</h3>
|
|
257
|
+
<div class="flex flex-col gap-0.5">
|
|
258
|
+
<SectionTitle
|
|
259
|
+
title="GetReadings"
|
|
260
|
+
api={MS_API}
|
|
261
|
+
headingId={headingID}
|
|
262
|
+
/>
|
|
236
263
|
<p class="text-subtle-2 text-xs">Get all the measurements and data from the sensor</p>
|
|
237
264
|
</div>
|
|
238
265
|
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
<div class="grid w-full grid-cols-3 divide-x">
|
|
67
67
|
<ApiSection
|
|
68
68
|
title="GetCurrent"
|
|
69
|
+
api="rdk:component:power_sensor"
|
|
69
70
|
class="pb-5"
|
|
70
71
|
>
|
|
71
72
|
<Query
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
</ApiSection>
|
|
80
81
|
<ApiSection
|
|
81
82
|
title="GetVoltage"
|
|
83
|
+
api="rdk:component:power_sensor"
|
|
82
84
|
class="pb-5"
|
|
83
85
|
>
|
|
84
86
|
<Query
|
|
@@ -92,6 +94,7 @@
|
|
|
92
94
|
</ApiSection>
|
|
93
95
|
<ApiSection
|
|
94
96
|
title="GetPower"
|
|
97
|
+
api="rdk:component:power_sensor"
|
|
95
98
|
class="pb-5"
|
|
96
99
|
>
|
|
97
100
|
<Query
|
|
@@ -107,6 +110,7 @@
|
|
|
107
110
|
|
|
108
111
|
<ApiSection
|
|
109
112
|
title="GetReadings"
|
|
113
|
+
api="rdk:component:power_sensor"
|
|
110
114
|
description="Get all the measurements and data that this power sensor provides"
|
|
111
115
|
>
|
|
112
116
|
<Switch
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
<div class="grid grow grid-cols-3 divide-x">
|
|
53
53
|
<ApiSection
|
|
54
54
|
title="GetPosition"
|
|
55
|
+
api="rdk:component:servo"
|
|
55
56
|
bottomText="Updates automatically"
|
|
56
57
|
>
|
|
57
58
|
<Query query={positionQuery}>
|
|
@@ -65,7 +66,10 @@
|
|
|
65
66
|
{/if}
|
|
66
67
|
</Query>
|
|
67
68
|
</ApiSection>
|
|
68
|
-
<ApiSection
|
|
69
|
+
<ApiSection
|
|
70
|
+
title="Move"
|
|
71
|
+
api="rdk:component:servo"
|
|
72
|
+
>
|
|
69
73
|
<Query query={positionQuery}>
|
|
70
74
|
{#if positionQuery.data !== undefined}
|
|
71
75
|
<Move
|
|
@@ -92,7 +96,10 @@
|
|
|
92
96
|
</ApiSection>
|
|
93
97
|
</div>
|
|
94
98
|
<div class="ml-auto flex w-full max-w-40 flex-col divide-y">
|
|
95
|
-
<ApiSection
|
|
99
|
+
<ApiSection
|
|
100
|
+
title="Stop"
|
|
101
|
+
api="rdk:component:servo"
|
|
102
|
+
>
|
|
96
103
|
<StopButton
|
|
97
104
|
error={stopMutation.error}
|
|
98
105
|
onStop={() => {
|
|
@@ -102,6 +109,7 @@
|
|
|
102
109
|
</ApiSection>
|
|
103
110
|
<IsMoving
|
|
104
111
|
client={ServoClient}
|
|
112
|
+
api="rdk:component:servo"
|
|
105
113
|
{partID}
|
|
106
114
|
{resourceName}
|
|
107
115
|
/>
|
|
@@ -16,6 +16,7 @@ export interface DetectionsContext {
|
|
|
16
16
|
readonly current: Detection[];
|
|
17
17
|
readonly byLabel: Record<string, DetectionGroup>;
|
|
18
18
|
readonly hovered: SvelteSet<string>;
|
|
19
|
+
selected: string | null;
|
|
19
20
|
}
|
|
20
21
|
export declare const DETECTIONS_CONTEXT_KEY: unique symbol;
|
|
21
22
|
export declare const createDetectionContext: (getDetections: () => DetectionPb[]) => DetectionsContext;
|
|
@@ -29,6 +29,7 @@ export const createDetectionContext = (getDetections) => {
|
|
|
29
29
|
const detections = $derived(addIdsToDetections(getDetections()));
|
|
30
30
|
const detectionsByLabel = $derived(categorize(detections));
|
|
31
31
|
const hovered = new SvelteSet();
|
|
32
|
+
let selected = $state(null);
|
|
32
33
|
const context = {
|
|
33
34
|
get current() {
|
|
34
35
|
return detections;
|
|
@@ -37,6 +38,12 @@ export const createDetectionContext = (getDetections) => {
|
|
|
37
38
|
return detectionsByLabel;
|
|
38
39
|
},
|
|
39
40
|
hovered,
|
|
41
|
+
get selected() {
|
|
42
|
+
return selected;
|
|
43
|
+
},
|
|
44
|
+
set selected(value) {
|
|
45
|
+
selected = value;
|
|
46
|
+
},
|
|
40
47
|
};
|
|
41
48
|
return context;
|
|
42
49
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Detection } from './context.svelte.js'
|
|
3
|
+
|
|
4
|
+
import { useDetections } from './context.svelte.js'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
detection: Detection
|
|
8
|
+
label: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { detection, label }: Props = $props()
|
|
12
|
+
|
|
13
|
+
const context = useDetections()
|
|
14
|
+
|
|
15
|
+
let node: HTMLElement | undefined
|
|
16
|
+
|
|
17
|
+
$effect(() => {
|
|
18
|
+
if (context.selected === detection.id && node) {
|
|
19
|
+
node.scrollIntoView({ block: 'nearest' })
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<button
|
|
25
|
+
bind:this={node}
|
|
26
|
+
class={[
|
|
27
|
+
'hover:bg-light w-full py-1 pl-11 text-left',
|
|
28
|
+
(context.hovered.has(detection.id) || context.selected === detection.id) && 'bg-light',
|
|
29
|
+
]}
|
|
30
|
+
onpointerenter={() => context.hovered.add(detection.id)}
|
|
31
|
+
onpointerleave={() => context.hovered.delete(detection.id)}
|
|
32
|
+
onclick={() => {
|
|
33
|
+
context.selected = context.selected === detection.id ? null : detection.id
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
{label}
|
|
37
|
+
<span class="text-subtle-2 pl-1">{detection.confidence}%</span>
|
|
38
|
+
</button>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Detection } from './context.svelte.ts';
|
|
2
|
+
interface Props {
|
|
3
|
+
detection: Detection;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
declare const DetectionRow: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type DetectionRow = ReturnType<typeof DetectionRow>;
|
|
8
|
+
export default DetectionRow;
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
|
|
24
24
|
let hovering = $state(false)
|
|
25
25
|
|
|
26
|
+
const isSelected = $derived(context.selected === detection.id)
|
|
27
|
+
const isActive = $derived(isSelected || context.hovered.has(detection.id))
|
|
28
|
+
|
|
26
29
|
// These are ballparking, but seem good enough for nearly all cases
|
|
27
30
|
const isDetectionNearTop = $derived(factoredyMin < 30)
|
|
28
31
|
const isDetectionNearRight = $derived(factoredxMin > $size.width * 0.66)
|
|
@@ -32,10 +35,7 @@
|
|
|
32
35
|
positionType="absolute"
|
|
33
36
|
positionLeft={factoredxMin}
|
|
34
37
|
positionTop={factoredyMin}
|
|
35
|
-
borderColor=
|
|
36
|
-
hover={{
|
|
37
|
-
borderColor: detection.color,
|
|
38
|
-
}}
|
|
38
|
+
borderColor={isActive ? detection.color : '#aaa'}
|
|
39
39
|
borderWidth={2}
|
|
40
40
|
width={factoredxMax - factoredxMin}
|
|
41
41
|
height={factoredyMax - factoredyMin}
|
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
context.hovered.delete(detection.id)
|
|
48
48
|
hovering = false
|
|
49
49
|
}}
|
|
50
|
+
onclick={() => {
|
|
51
|
+
context.selected = context.selected === detection.id ? null : detection.id
|
|
52
|
+
}}
|
|
50
53
|
>
|
|
51
54
|
{#if hovering}
|
|
52
55
|
<Text
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { SvelteSet } from 'svelte/reactivity'
|
|
6
6
|
|
|
7
7
|
import { useDetections } from './context.svelte'
|
|
8
|
+
import DetectionRow from './detection-row.svelte'
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
classifications?: Classification[]
|
|
@@ -46,6 +47,16 @@
|
|
|
46
47
|
}
|
|
47
48
|
})
|
|
48
49
|
|
|
50
|
+
$effect.pre(() => {
|
|
51
|
+
if (context.selected === undefined) return
|
|
52
|
+
for (const [label, { detections }] of Object.entries(context.byLabel)) {
|
|
53
|
+
if (detections.some((d) => d.id === context.selected)) {
|
|
54
|
+
expandedLabels.add(label)
|
|
55
|
+
break
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
|
|
49
60
|
const compareConfidence = (a: Classification, b: Classification) => {
|
|
50
61
|
return b.confidence - a.confidence
|
|
51
62
|
}
|
|
@@ -113,18 +124,10 @@
|
|
|
113
124
|
<ul>
|
|
114
125
|
{#each detections as detection (detection.id)}
|
|
115
126
|
<li>
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
detection.id
|
|
119
|
-
)
|
|
120
|
-
? 'bg-light'
|
|
121
|
-
: ''}"
|
|
122
|
-
onpointerenter={() => context.hovered.add(detection.id)}
|
|
123
|
-
onpointerleave={() => context.hovered.delete(detection.id)}
|
|
124
|
-
>
|
|
127
|
+
<DetectionRow
|
|
128
|
+
{detection}
|
|
125
129
|
{label}
|
|
126
|
-
|
|
127
|
-
</button>
|
|
130
|
+
/>
|
|
128
131
|
</li>
|
|
129
132
|
{/each}
|
|
130
133
|
</ul>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createAddImageToDatasetContext, type ImageData, useAddImageToDataset, } from './add-image-to-dataset';
|
|
2
|
+
export { apiDocsHref } from './api-docs-href';
|
|
2
3
|
export { clientForResource } from './client-map';
|
|
3
4
|
export * from './components';
|
|
4
5
|
export { getResourceAPI } from './get-resource-api';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createAddImageToDatasetContext, useAddImageToDataset, } from './add-image-to-dataset';
|
|
2
|
+
export { apiDocsHref } from './api-docs-href';
|
|
2
3
|
export { clientForResource } from './client-map';
|
|
3
4
|
export * from './components';
|
|
4
5
|
export { getResourceAPI } from './get-resource-api';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viamrobotics/test-widgets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"prettier-plugin-tailwindcss": "^0.7.4",
|
|
91
91
|
"publint": "^0.3.18",
|
|
92
92
|
"runed": "^0.37.1",
|
|
93
|
-
"svelte": "^5.
|
|
93
|
+
"svelte": "^5.56.3",
|
|
94
94
|
"svelte-check": "^4.4.6",
|
|
95
95
|
"svelte-splitpanes": "^8.0.12",
|
|
96
96
|
"tailwind-merge": "^3.5.0",
|
|
@@ -109,6 +109,9 @@
|
|
|
109
109
|
"engines": {
|
|
110
110
|
"node": ">=22.12.0"
|
|
111
111
|
},
|
|
112
|
+
"dependencies": {
|
|
113
|
+
"svelte-tweakpane-ui": "^1.5.17"
|
|
114
|
+
},
|
|
112
115
|
"scripts": {
|
|
113
116
|
"dev": "vite dev",
|
|
114
117
|
"build": "vite build && pnpm prepack",
|