@viamrobotics/test-widgets 0.7.0 → 0.9.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 +33 -0
- package/dist/client-map.d.ts +30 -30
- package/dist/client-map.js +32 -29
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +22 -0
- package/dist/components/is-moving.svelte +1 -4
- package/dist/components/mutation-section.svelte +1 -1
- package/dist/components/navigation-map/components/obstacle.svelte +2 -1
- package/dist/components/three/capsule-geometry.d.ts +10 -0
- package/dist/components/three/capsule-geometry.js +19 -0
- package/dist/components/three/index.d.ts +1 -0
- package/dist/components/three/index.js +1 -0
- package/dist/components/widgets/arm/arm.svelte +8 -5
- package/dist/components/widgets/arm/get-joint-positions-widget.svelte +36 -0
- package/dist/components/widgets/arm/get-joint-positions-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/arm/is-moving-widget.svelte +20 -0
- package/dist/components/widgets/arm/is-moving-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +9 -5
- package/dist/components/widgets/arm/move-to-position.svelte +31 -3
- package/dist/components/widgets/audio-input/get-properties-widget.svelte +43 -0
- package/dist/components/widgets/audio-input/get-properties-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/audio-output/get-properties-widget.svelte +43 -0
- package/dist/components/widgets/audio-output/get-properties-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/base/is-moving-widget.svelte +20 -0
- package/dist/components/widgets/base/is-moving-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/base/quick-move.svelte +12 -5
- package/dist/components/widgets/camera/live-or-polling-video.svelte +8 -1
- package/dist/components/widgets/do-command/do-command.svelte +21 -7
- package/dist/components/widgets/do-command/do-command.svelte.d.ts +8 -1
- package/dist/components/widgets/encoder/encoder-position-type.d.ts +8 -0
- package/dist/components/widgets/encoder/encoder-position-type.js +20 -0
- package/dist/components/widgets/encoder/encoder.svelte +3 -20
- package/dist/components/widgets/encoder/get-position-widget.svelte +54 -0
- package/dist/components/widgets/encoder/get-position-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gantry/get-position-widget.svelte +43 -0
- package/dist/components/widgets/gantry/get-position-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gantry/is-moving-widget.svelte +20 -0
- package/dist/components/widgets/gantry/is-moving-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/gripper.svelte +1 -1
- package/dist/components/widgets/gripper/is-holding-something.svelte +1 -4
- package/dist/components/widgets/gripper/is-moving-widget.svelte +20 -0
- package/dist/components/widgets/gripper/is-moving-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/motion/component-name-select.svelte +29 -0
- package/dist/components/widgets/motion/component-name-select.svelte.d.ts +9 -0
- package/dist/components/widgets/motion/frame-system-config.d.ts +28 -0
- package/dist/components/widgets/motion/frame-system-config.js +30 -0
- package/dist/components/widgets/motion/motion.svelte +27 -0
- package/dist/components/widgets/motion/motion.svelte.d.ts +7 -0
- package/dist/components/widgets/motion/move-widget.svelte +84 -0
- package/dist/components/widgets/motion/move-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/motion/move.svelte +127 -0
- package/dist/components/widgets/motion/move.svelte.d.ts +14 -0
- package/dist/components/widgets/motion/parse-move-args.d.ts +24 -0
- package/dist/components/widgets/motion/parse-move-args.js +23 -0
- package/dist/components/widgets/motion/parse-pasted-pose.d.ts +10 -0
- package/dist/components/widgets/motion/parse-pasted-pose.js +30 -0
- package/dist/components/widgets/motion/pose-in-frame-input.svelte +168 -0
- package/dist/components/widgets/motion/pose-in-frame-input.svelte.d.ts +10 -0
- package/dist/components/widgets/motor/is-moving-widget.svelte +20 -0
- package/dist/components/widgets/motor/is-moving-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/motor/motor.svelte +2 -8
- package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +38 -0
- package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +38 -0
- package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +38 -0
- package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/movement-sensor/get-position-widget.svelte +38 -0
- package/dist/components/widgets/movement-sensor/get-position-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/navigation/obstacles/meshes.svelte +1 -2
- package/dist/components/widgets/power-sensor/get-current-widget.svelte +38 -0
- package/dist/components/widgets/power-sensor/get-current-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/power-sensor/get-power-widget.svelte +38 -0
- package/dist/components/widgets/power-sensor/get-power-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +38 -0
- package/dist/components/widgets/power-sensor/get-voltage-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/servo/is-moving-widget.svelte +20 -0
- package/dist/components/widgets/servo/is-moving-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/slam/get-position-widget.svelte +38 -0
- package/dist/components/widgets/slam/get-position-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/vision-service/vision-service.svelte +9 -10
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/is-known-resource.d.ts +3 -0
- package/dist/is-known-resource.js +5 -0
- package/dist/pip/context.svelte.d.ts +2 -0
- package/dist/pip/context.svelte.js +48 -20
- package/dist/registry.d.ts +28 -0
- package/dist/registry.js +176 -0
- package/dist/resource-triplet.d.ts +37 -0
- package/dist/resource-triplet.js +37 -0
- package/dist/resource-widget-types.d.ts +21 -0
- package/dist/resource-widget-types.js +1 -0
- package/dist/resource.d.ts +0 -9
- package/dist/resource.js +0 -72
- package/dist/show-resource-widget.d.ts +3 -0
- package/dist/show-resource-widget.js +10 -0
- package/package.json +23 -6
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AudioInClient } from '@viamrobotics/sdk'
|
|
3
|
+
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
|
+
|
|
5
|
+
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import Query from '../../query.svelte'
|
|
7
|
+
|
|
8
|
+
import Properties from './properties.svelte'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
partID: string
|
|
12
|
+
resourceName: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { partID, resourceName }: Props = $props()
|
|
16
|
+
|
|
17
|
+
const client = createResourceClient(
|
|
18
|
+
AudioInClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const query = createResourceQuery(client, 'getProperties', { refetchInterval: 500 })
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<ApiSection
|
|
27
|
+
title="GetProperties"
|
|
28
|
+
description="Audio input properties"
|
|
29
|
+
class="grow"
|
|
30
|
+
>
|
|
31
|
+
<Query
|
|
32
|
+
{query}
|
|
33
|
+
contentCx="h-6"
|
|
34
|
+
>
|
|
35
|
+
{#if query.data !== undefined}
|
|
36
|
+
<Properties
|
|
37
|
+
supportedCodecs={query.data.supportedCodecs}
|
|
38
|
+
sampleRateHz={query.data.sampleRateHz}
|
|
39
|
+
numChannels={query.data.numChannels}
|
|
40
|
+
/>
|
|
41
|
+
{/if}
|
|
42
|
+
</Query>
|
|
43
|
+
</ApiSection>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { AudioOutClient } from '@viamrobotics/sdk'
|
|
3
|
+
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
|
+
|
|
5
|
+
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import Query from '../../query.svelte'
|
|
7
|
+
|
|
8
|
+
import Properties from './properties.svelte'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
partID: string
|
|
12
|
+
resourceName: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { partID, resourceName }: Props = $props()
|
|
16
|
+
|
|
17
|
+
const client = createResourceClient(
|
|
18
|
+
AudioOutClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const query = createResourceQuery(client, 'getProperties', { refetchInterval: 500 })
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<ApiSection
|
|
27
|
+
title="GetProperties"
|
|
28
|
+
description="Audio output properties"
|
|
29
|
+
class="grow"
|
|
30
|
+
>
|
|
31
|
+
<Query
|
|
32
|
+
{query}
|
|
33
|
+
contentCx="h-6"
|
|
34
|
+
>
|
|
35
|
+
{#if query.data !== undefined}
|
|
36
|
+
<Properties
|
|
37
|
+
supportedCodecs={query.data.supportedCodecs}
|
|
38
|
+
sampleRateHz={query.data.sampleRateHz}
|
|
39
|
+
numChannels={query.data.numChannels}
|
|
40
|
+
/>
|
|
41
|
+
{/if}
|
|
42
|
+
</Query>
|
|
43
|
+
</ApiSection>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { BaseClient } from '@viamrobotics/sdk'
|
|
3
|
+
|
|
4
|
+
import IsMoving from '../../is-moving.svelte'
|
|
5
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
partID: string
|
|
9
|
+
resourceName: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { partID, resourceName }: Props = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<IsMoving
|
|
16
|
+
client={BaseClient}
|
|
17
|
+
api={ResourceTriplets.Base}
|
|
18
|
+
{partID}
|
|
19
|
+
{resourceName}
|
|
20
|
+
/>
|
|
@@ -90,8 +90,11 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
// stopImmediatePropagation (not stopPropagation) in the capture phase so movement
|
|
94
|
+
// keys never reach sibling window keydown listeners on the same target — e.g. the
|
|
95
|
+
// config builder's "A" add-resource hotkey. stopPropagation leaves siblings running.
|
|
93
96
|
const onKeydown = (event: KeyboardEvent) => {
|
|
94
|
-
if (!isKeyboardEnabled
|
|
97
|
+
if (!isKeyboardEnabled) {
|
|
95
98
|
return
|
|
96
99
|
}
|
|
97
100
|
|
|
@@ -100,9 +103,13 @@
|
|
|
100
103
|
return
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
event.
|
|
106
|
+
event.stopImmediatePropagation()
|
|
104
107
|
event.preventDefault()
|
|
105
108
|
|
|
109
|
+
if (event.repeat) {
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
|
|
106
113
|
pressedKeys[key] = true
|
|
107
114
|
onKeyChange()
|
|
108
115
|
}
|
|
@@ -117,7 +124,7 @@
|
|
|
117
124
|
return
|
|
118
125
|
}
|
|
119
126
|
|
|
120
|
-
event.
|
|
127
|
+
event.stopImmediatePropagation()
|
|
121
128
|
event.preventDefault()
|
|
122
129
|
|
|
123
130
|
pressedKeys[key] = false
|
|
@@ -132,8 +139,8 @@
|
|
|
132
139
|
</script>
|
|
133
140
|
|
|
134
141
|
<svelte:window
|
|
135
|
-
|
|
136
|
-
|
|
142
|
+
onkeydowncapture={onKeydown}
|
|
143
|
+
onkeyupcapture={onKeyup}
|
|
137
144
|
/>
|
|
138
145
|
|
|
139
146
|
<div class="flex grow flex-col gap-6">
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import Progress from '../../progress.svelte'
|
|
15
15
|
import { formatNumeric } from '../../../format'
|
|
16
16
|
import { useMeasureFps } from '../../../fps.svelte'
|
|
17
|
+
import { usePip } from '../../../pip/context.svelte'
|
|
17
18
|
|
|
18
19
|
import { getBlobForViamDepth, VIAM_DEPTH_MIME_TYPE } from './decode-viam-depth'
|
|
19
20
|
import { pickImageForSource } from './pick-image-for-source'
|
|
@@ -52,7 +53,13 @@
|
|
|
52
53
|
let vfcID = 0
|
|
53
54
|
let liveStreamStart: DOMHighResTimeStamp | undefined
|
|
54
55
|
|
|
56
|
+
const pip = usePip()
|
|
57
|
+
|
|
55
58
|
const setMediaStream = (mediaStream: MediaStream | null) => {
|
|
59
|
+
if (mediaStream) {
|
|
60
|
+
pip.setStream(resourceName, mediaStream)
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
if (videoElement) {
|
|
57
64
|
// TODO(2025-01-31): Remove these function guards.
|
|
58
65
|
// Sentry has some error traces where "cancelVideoFrameCallback is not a function".
|
|
@@ -190,6 +197,7 @@
|
|
|
190
197
|
return () =>
|
|
191
198
|
untrack(() => {
|
|
192
199
|
disableStream().then(() => {
|
|
200
|
+
pip.setStream(resourceName, null)
|
|
193
201
|
setMediaStream(null)
|
|
194
202
|
})
|
|
195
203
|
})
|
|
@@ -301,7 +309,6 @@
|
|
|
301
309
|
}
|
|
302
310
|
|
|
303
311
|
const fps = useMeasureFps()
|
|
304
|
-
|
|
305
312
|
$effect(() => {
|
|
306
313
|
let id: number | undefined
|
|
307
314
|
|
|
@@ -19,9 +19,16 @@
|
|
|
19
19
|
resource: ResourceName
|
|
20
20
|
/** Rendered above the input/output editor row. */
|
|
21
21
|
header?: Snippet<[{ input: string; setInput: (value: string) => void }]>
|
|
22
|
+
/**
|
|
23
|
+
* Optional bindable editor value. Use `bind:input` (including function
|
|
24
|
+
* bindings) to control it from a parent. When unbound, falls back to the
|
|
25
|
+
* widget's persisted local state — assignments still update locally so the
|
|
26
|
+
* editor cannot freeze.
|
|
27
|
+
*/
|
|
28
|
+
input?: string
|
|
22
29
|
}
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
let { partID, resource, header, input = $bindable() }: Props = $props()
|
|
25
32
|
|
|
26
33
|
const client = createDoCommandClient(
|
|
27
34
|
() => resource,
|
|
@@ -37,19 +44,26 @@
|
|
|
37
44
|
|
|
38
45
|
const uid = $props.id()
|
|
39
46
|
|
|
40
|
-
const
|
|
47
|
+
const persisted = $derived(new PersistedState(`${partID}/${getResourceKey(resource)}`, '{\n}'))
|
|
48
|
+
|
|
49
|
+
const displayInput = $derived(input ?? persisted.current ?? '{\n}')
|
|
41
50
|
|
|
42
51
|
let output = $state('')
|
|
43
52
|
|
|
53
|
+
const updateInput = (value: string) => {
|
|
54
|
+
input = value
|
|
55
|
+
persisted.current = value
|
|
56
|
+
}
|
|
57
|
+
|
|
44
58
|
const setInput = (value: string) => {
|
|
45
|
-
|
|
59
|
+
updateInput(value)
|
|
46
60
|
}
|
|
47
61
|
|
|
48
62
|
const execute = async () => {
|
|
49
63
|
try {
|
|
50
64
|
lastErr = null
|
|
51
65
|
output = ''
|
|
52
|
-
const parsedInput = Struct.fromJsonString(
|
|
66
|
+
const parsedInput = Struct.fromJsonString(displayInput)
|
|
53
67
|
const data = await doCommandMutation.mutateAsync([parsedInput])
|
|
54
68
|
output = JSON.stringify(data, null, 2)
|
|
55
69
|
lastErr = null
|
|
@@ -62,7 +76,7 @@
|
|
|
62
76
|
{#if isSupported}
|
|
63
77
|
{#if header}
|
|
64
78
|
<div class="border-b">
|
|
65
|
-
{@render header({ input:
|
|
79
|
+
{@render header({ input: displayInput, setInput })}
|
|
66
80
|
</div>
|
|
67
81
|
{/if}
|
|
68
82
|
<div class="flex flex-row items-center justify-between">
|
|
@@ -71,9 +85,9 @@
|
|
|
71
85
|
<CodeEditor
|
|
72
86
|
label="input"
|
|
73
87
|
language="json"
|
|
74
|
-
value={
|
|
88
|
+
value={displayInput}
|
|
75
89
|
onChange={(nextInput: string) => {
|
|
76
|
-
|
|
90
|
+
updateInput(nextInput)
|
|
77
91
|
}}
|
|
78
92
|
class="h-56 overflow-y-auto"
|
|
79
93
|
errorMessageID={lastErr ? uid : undefined}
|
|
@@ -8,7 +8,14 @@ interface Props {
|
|
|
8
8
|
input: string;
|
|
9
9
|
setInput: (value: string) => void;
|
|
10
10
|
}]>;
|
|
11
|
+
/**
|
|
12
|
+
* Optional bindable editor value. Use `bind:input` (including function
|
|
13
|
+
* bindings) to control it from a parent. When unbound, falls back to the
|
|
14
|
+
* widget's persisted local state — assignments still update locally so the
|
|
15
|
+
* editor cannot freeze.
|
|
16
|
+
*/
|
|
17
|
+
input?: string;
|
|
11
18
|
}
|
|
12
|
-
declare const DoCommand: import("svelte").Component<Props, {}, "">;
|
|
19
|
+
declare const DoCommand: import("svelte").Component<Props, {}, "input">;
|
|
13
20
|
type DoCommand = ReturnType<typeof DoCommand>;
|
|
14
21
|
export default DoCommand;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EncoderPositionType, type EncoderProperties } from '@viamrobotics/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Picks the position type to request from an encoder based on its properties.
|
|
4
|
+
* @param properties - The encoder's reported properties, if loaded.
|
|
5
|
+
* @returns A single-element argument tuple for `getPosition`.
|
|
6
|
+
* @example getEncoderPositionArgs({ angleDegreesSupported: true }) // [EncoderPositionType.ANGLE_DEGREES]
|
|
7
|
+
*/
|
|
8
|
+
export declare const getEncoderPositionArgs: (properties: EncoderProperties | undefined) => [EncoderPositionType];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EncoderPositionType } from '@viamrobotics/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Picks the position type to request from an encoder based on its properties.
|
|
4
|
+
* @param properties - The encoder's reported properties, if loaded.
|
|
5
|
+
* @returns A single-element argument tuple for `getPosition`.
|
|
6
|
+
* @example getEncoderPositionArgs({ angleDegreesSupported: true }) // [EncoderPositionType.ANGLE_DEGREES]
|
|
7
|
+
*/
|
|
8
|
+
export const getEncoderPositionArgs = (properties) => {
|
|
9
|
+
if (!properties) {
|
|
10
|
+
return [EncoderPositionType.UNSPECIFIED];
|
|
11
|
+
}
|
|
12
|
+
const { angleDegreesSupported, ticksCountSupported } = properties;
|
|
13
|
+
if (angleDegreesSupported) {
|
|
14
|
+
return [EncoderPositionType.ANGLE_DEGREES];
|
|
15
|
+
}
|
|
16
|
+
if (ticksCountSupported) {
|
|
17
|
+
return [EncoderPositionType.TICKS_COUNT];
|
|
18
|
+
}
|
|
19
|
+
return [EncoderPositionType.UNSPECIFIED];
|
|
20
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button } from '@viamrobotics/prime-core'
|
|
3
|
-
import { EncoderClient
|
|
3
|
+
import { EncoderClient } from '@viamrobotics/sdk'
|
|
4
4
|
import {
|
|
5
5
|
createResourceClient,
|
|
6
6
|
createResourceMutation,
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import RefetchController from '../../refetch-controller.svelte'
|
|
15
15
|
import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
|
|
16
16
|
|
|
17
|
+
import { getEncoderPositionArgs } from './encoder-position-type'
|
|
17
18
|
import Position from './position.svelte'
|
|
18
19
|
|
|
19
20
|
interface Props {
|
|
@@ -35,24 +36,6 @@
|
|
|
35
36
|
'encoder-view'
|
|
36
37
|
)
|
|
37
38
|
|
|
38
|
-
const getPositionArgs = (properties: EncoderProperties | undefined): [EncoderPositionType] => {
|
|
39
|
-
if (!properties) {
|
|
40
|
-
return [EncoderPositionType.UNSPECIFIED]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const { angleDegreesSupported, ticksCountSupported } = properties
|
|
44
|
-
|
|
45
|
-
if (angleDegreesSupported) {
|
|
46
|
-
return [EncoderPositionType.ANGLE_DEGREES]
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (ticksCountSupported) {
|
|
50
|
-
return [EncoderPositionType.TICKS_COUNT]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return [EncoderPositionType.UNSPECIFIED]
|
|
54
|
-
}
|
|
55
|
-
|
|
56
39
|
const propertiesQuery = createResourceQuery(client, 'getProperties', () => ({
|
|
57
40
|
refetchInterval: refetchInterval.current,
|
|
58
41
|
}))
|
|
@@ -60,7 +43,7 @@
|
|
|
60
43
|
const positionQuery = createResourceQuery(
|
|
61
44
|
client,
|
|
62
45
|
'getPosition',
|
|
63
|
-
() =>
|
|
46
|
+
() => getEncoderPositionArgs(propertiesQuery.data),
|
|
64
47
|
() => ({
|
|
65
48
|
enabled: propertiesQuery.data !== undefined,
|
|
66
49
|
refetchInterval: refetchInterval.current,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { EncoderClient } from '@viamrobotics/sdk'
|
|
3
|
+
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
|
+
|
|
5
|
+
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import Queries from '../../queries.svelte'
|
|
7
|
+
|
|
8
|
+
import { getEncoderPositionArgs } from './encoder-position-type'
|
|
9
|
+
import Position from './position.svelte'
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
partID: string
|
|
13
|
+
resourceName: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { partID, resourceName }: Props = $props()
|
|
17
|
+
|
|
18
|
+
const client = createResourceClient(
|
|
19
|
+
EncoderClient,
|
|
20
|
+
() => partID,
|
|
21
|
+
() => resourceName
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
const propertiesQuery = createResourceQuery(client, 'getProperties', { refetchInterval: 500 })
|
|
25
|
+
|
|
26
|
+
const positionQuery = createResourceQuery(
|
|
27
|
+
client,
|
|
28
|
+
'getPosition',
|
|
29
|
+
() => getEncoderPositionArgs(propertiesQuery.data),
|
|
30
|
+
() => ({
|
|
31
|
+
enabled: propertiesQuery.data !== undefined,
|
|
32
|
+
refetchInterval: 500,
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<ApiSection
|
|
38
|
+
title="GetPosition"
|
|
39
|
+
tooltip="Relative encoders return ticks since last zeroing. Absolute encoders return degrees."
|
|
40
|
+
bottomText="Updates automatically"
|
|
41
|
+
class="grow"
|
|
42
|
+
>
|
|
43
|
+
<Queries queries={[propertiesQuery, positionQuery]}>
|
|
44
|
+
{#if positionQuery.data !== undefined}
|
|
45
|
+
{@const [position, encoderPositionType] = positionQuery.data}
|
|
46
|
+
<div class="font-roboto-mono flex flex-col gap-2 text-sm">
|
|
47
|
+
<Position
|
|
48
|
+
{position}
|
|
49
|
+
{encoderPositionType}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
{/if}
|
|
53
|
+
</Queries>
|
|
54
|
+
</ApiSection>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { GantryClient } from '@viamrobotics/sdk'
|
|
3
|
+
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
|
+
|
|
5
|
+
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import Queries from '../../queries.svelte'
|
|
7
|
+
|
|
8
|
+
import PositionAndLengths from './position-and-lengths.svelte'
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
partID: string
|
|
12
|
+
resourceName: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const { partID, resourceName }: Props = $props()
|
|
16
|
+
|
|
17
|
+
const client = createResourceClient(
|
|
18
|
+
GantryClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const options = { refetchInterval: 500 }
|
|
24
|
+
const positionQuery = createResourceQuery(client, 'getPosition', options)
|
|
25
|
+
const lengthsQuery = createResourceQuery(client, 'getLengths', options)
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<ApiSection
|
|
29
|
+
title="GetPosition"
|
|
30
|
+
bottomText="Updates automatically"
|
|
31
|
+
class="grow"
|
|
32
|
+
>
|
|
33
|
+
<Queries queries={[positionQuery, lengthsQuery]}>
|
|
34
|
+
{@const positions = positionQuery.data}
|
|
35
|
+
{@const lengths = lengthsQuery.data ?? []}
|
|
36
|
+
{#if positions !== undefined}
|
|
37
|
+
<PositionAndLengths
|
|
38
|
+
{positions}
|
|
39
|
+
{lengths}
|
|
40
|
+
/>
|
|
41
|
+
{/if}
|
|
42
|
+
</Queries>
|
|
43
|
+
</ApiSection>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { GantryClient } from '@viamrobotics/sdk'
|
|
3
|
+
|
|
4
|
+
import IsMoving from '../../is-moving.svelte'
|
|
5
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
partID: string
|
|
9
|
+
resourceName: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { partID, resourceName }: Props = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<IsMoving
|
|
16
|
+
client={GantryClient}
|
|
17
|
+
api={ResourceTriplets.Gantry}
|
|
18
|
+
{partID}
|
|
19
|
+
{resourceName}
|
|
20
|
+
/>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { GripperClient } from '@viamrobotics/sdk'
|
|
3
|
+
|
|
4
|
+
import IsMoving from '../../is-moving.svelte'
|
|
5
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
partID: string
|
|
9
|
+
resourceName: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { partID, resourceName }: Props = $props()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<IsMoving
|
|
16
|
+
client={GripperClient}
|
|
17
|
+
api={ResourceTriplets.Gripper}
|
|
18
|
+
{partID}
|
|
19
|
+
{resourceName}
|
|
20
|
+
/>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Label, Select } from '@viamrobotics/prime-core'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value: string
|
|
6
|
+
options: string[]
|
|
7
|
+
label?: string
|
|
8
|
+
onChange: (value: string) => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { value, options, label = 'Component', onChange }: Props = $props()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Label>
|
|
15
|
+
{label}
|
|
16
|
+
|
|
17
|
+
<Select
|
|
18
|
+
slot="input"
|
|
19
|
+
{value}
|
|
20
|
+
on:change={(event) => {
|
|
21
|
+
onChange((event.target as HTMLSelectElement).value)
|
|
22
|
+
}}
|
|
23
|
+
>
|
|
24
|
+
<option value="">Select a component…</option>
|
|
25
|
+
{#each options as name (name)}
|
|
26
|
+
<option value={name}>{name}</option>
|
|
27
|
+
{/each}
|
|
28
|
+
</Select>
|
|
29
|
+
</Label>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
value: string;
|
|
3
|
+
options: string[];
|
|
4
|
+
label?: string;
|
|
5
|
+
onChange: (value: string) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const ComponentNameSelect: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type ComponentNameSelect = ReturnType<typeof ComponentNameSelect>;
|
|
9
|
+
export default ComponentNameSelect;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The subset of a `FrameSystemConfig` entry these helpers read. */
|
|
2
|
+
export interface FrameConfigEntry {
|
|
3
|
+
frame?: {
|
|
4
|
+
referenceFrame?: string;
|
|
5
|
+
poseInObserverFrame?: {
|
|
6
|
+
referenceFrame?: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The components the motion service can `Move` are exactly the frames in the
|
|
12
|
+
* machine's frame system config. `Move` builds a kinematic chain to a frame, so
|
|
13
|
+
* anything with a configured frame is a valid target.
|
|
14
|
+
*
|
|
15
|
+
* @param config - The machine's frame system config, or `undefined` while loading.
|
|
16
|
+
* @returns The non-empty reference frame names, sorted alphabetically.
|
|
17
|
+
*/
|
|
18
|
+
export declare const movableFrameNames: (config: FrameConfigEntry[] | undefined) => string[];
|
|
19
|
+
/**
|
|
20
|
+
* The parent frame a component is attached to in the machine's frame system.
|
|
21
|
+
* A frame's parent is the reference frame of the pose that positions it (its
|
|
22
|
+
* observer frame), so `getPose` and `Move` can be expressed relative to it.
|
|
23
|
+
*
|
|
24
|
+
* @param config - The machine's frame system config, or `undefined` while loading.
|
|
25
|
+
* @param componentName - The component (frame) whose parent to look up.
|
|
26
|
+
* @returns The parent frame name, or `'world'` when there is no configured parent.
|
|
27
|
+
*/
|
|
28
|
+
export declare const parentFrame: (config: FrameConfigEntry[] | undefined, componentName: string) => string;
|