@viamrobotics/test-widgets 0.7.0 → 0.8.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/client-map.d.ts +30 -30
- package/dist/client-map.js +32 -29
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.js +20 -0
- package/dist/components/is-moving.svelte +1 -4
- package/dist/components/mutation-section.svelte +1 -1
- 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/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/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/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 +4 -1
- package/dist/index.js +5 -1
- package/dist/pip/context.svelte.d.ts +2 -0
- package/dist/pip/context.svelte.js +48 -20
- package/dist/resource-triplet.d.ts +37 -0
- package/dist/resource-triplet.js +37 -0
- package/dist/resource-widget.js +187 -0
- package/dist/resource.d.ts +0 -9
- package/dist/resource.js +0 -72
- package/package.json +3 -3
|
@@ -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
|
|
|
@@ -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,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MotorClient } 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={MotorClient}
|
|
17
|
+
api={ResourceTriplets.Motor}
|
|
18
|
+
{partID}
|
|
19
|
+
{resourceName}
|
|
20
|
+
/>
|
|
@@ -148,10 +148,7 @@
|
|
|
148
148
|
Stepper motors will report ”true” if they are being powered while holding
|
|
149
149
|
a position and while they are turning."
|
|
150
150
|
>
|
|
151
|
-
<Query
|
|
152
|
-
contentCx="h-4"
|
|
153
|
-
query={isPoweredQuery}
|
|
154
|
-
>
|
|
151
|
+
<Query query={isPoweredQuery}>
|
|
155
152
|
{#if isPoweredQuery.data !== undefined}
|
|
156
153
|
{@const [isPowered, powerPct] = isPoweredQuery.data}
|
|
157
154
|
<span class="font-roboto-mono flex flex-row gap-1 text-xs">
|
|
@@ -171,10 +168,7 @@
|
|
|
171
168
|
class="gap-3 p-0"
|
|
172
169
|
tooltip="Reports the position of an encoded motor in revolutions from zero/home."
|
|
173
170
|
>
|
|
174
|
-
<Query
|
|
175
|
-
contentCx=""
|
|
176
|
-
query={positionQuery}
|
|
177
|
-
>
|
|
171
|
+
<Query query={positionQuery}>
|
|
178
172
|
<p class="font-roboto-mono text-default text-xs">
|
|
179
173
|
{formatNumeric(positionQuery.data, 4)}
|
|
180
174
|
</p>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MovementSensorClient } 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 Accuracy from './accuracy.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
|
+
MovementSensorClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const query = createResourceQuery(client, 'getAccuracy', { refetchInterval: 500 })
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<ApiSection
|
|
27
|
+
title="GetAccuracy"
|
|
28
|
+
class="grow"
|
|
29
|
+
>
|
|
30
|
+
<Query
|
|
31
|
+
{query}
|
|
32
|
+
contentCx="h-6"
|
|
33
|
+
>
|
|
34
|
+
{#if query.data !== undefined}
|
|
35
|
+
<Accuracy data={query.data} />
|
|
36
|
+
{/if}
|
|
37
|
+
</Query>
|
|
38
|
+
</ApiSection>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MovementSensorClient } 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 CompassHeading from './compass-heading.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
|
+
MovementSensorClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const query = createResourceQuery(client, 'getCompassHeading', { refetchInterval: 500 })
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<ApiSection
|
|
27
|
+
title="GetCompassHeading"
|
|
28
|
+
class="grow"
|
|
29
|
+
>
|
|
30
|
+
<Query
|
|
31
|
+
{query}
|
|
32
|
+
contentCx="h-6"
|
|
33
|
+
>
|
|
34
|
+
{#if query.data !== undefined}
|
|
35
|
+
<CompassHeading data={query.data} />
|
|
36
|
+
{/if}
|
|
37
|
+
</Query>
|
|
38
|
+
</ApiSection>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MovementSensorClient } 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 Orientation from './orientation.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
|
+
MovementSensorClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const query = createResourceQuery(client, 'getOrientation', { refetchInterval: 500 })
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<ApiSection
|
|
27
|
+
title="GetOrientation"
|
|
28
|
+
class="grow"
|
|
29
|
+
>
|
|
30
|
+
<Query
|
|
31
|
+
{query}
|
|
32
|
+
contentCx="h-6"
|
|
33
|
+
>
|
|
34
|
+
{#if query.data !== undefined}
|
|
35
|
+
<Orientation data={query.data} />
|
|
36
|
+
{/if}
|
|
37
|
+
</Query>
|
|
38
|
+
</ApiSection>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MovementSensorClient } 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 Position from './position.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
|
+
MovementSensorClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const query = createResourceQuery(client, 'getPosition', { refetchInterval: 500 })
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<ApiSection
|
|
27
|
+
title="GetPosition"
|
|
28
|
+
class="grow"
|
|
29
|
+
>
|
|
30
|
+
<Query
|
|
31
|
+
{query}
|
|
32
|
+
contentCx="h-6"
|
|
33
|
+
>
|
|
34
|
+
{#if query.data !== undefined}
|
|
35
|
+
<Position data={query.data} />
|
|
36
|
+
{/if}
|
|
37
|
+
</Query>
|
|
38
|
+
</ApiSection>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PowerSensorClient } 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 CurrentReading from './current-reading.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
|
+
PowerSensorClient,
|
|
19
|
+
() => partID,
|
|
20
|
+
() => resourceName
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const query = createResourceQuery(client, 'getCurrent', { refetchInterval: 500 })
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<ApiSection
|
|
27
|
+
title="GetCurrent"
|
|
28
|
+
class="grow"
|
|
29
|
+
>
|
|
30
|
+
<Query
|
|
31
|
+
{query}
|
|
32
|
+
contentCx="h-6"
|
|
33
|
+
>
|
|
34
|
+
{#if query.data !== undefined}
|
|
35
|
+
<CurrentReading data={query.data} />
|
|
36
|
+
{/if}
|
|
37
|
+
</Query>
|
|
38
|
+
</ApiSection>
|