@viamrobotics/test-widgets 0.6.1 → 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/README.md +1 -1
- package/dist/api-docs-href.d.ts +8 -0
- package/dist/api-docs-href.js +17 -0
- package/dist/client-map.d.ts +30 -30
- package/dist/client-map.js +32 -29
- 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 +21 -0
- package/dist/components/index.js +21 -0
- package/dist/components/is-moving.svelte +4 -5
- package/dist/components/is-moving.svelte.d.ts +1 -0
- package/dist/components/mutation-section.svelte +20 -23
- 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 +25 -29
- 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/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-widget.svelte +9 -5
- 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/arm/move-to-position.svelte +31 -3
- package/dist/components/widgets/audio-input/audio-input.svelte +2 -0
- 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/audio-output.svelte +2 -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/base.svelte +9 -1
- 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/camera.svelte +156 -142
- package/dist/components/widgets/camera/live-or-polling-video.svelte +9 -1
- package/dist/components/widgets/discovery/discovery.svelte +1 -0
- 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 +5 -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/gantry.svelte +28 -5
- 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/generic/generic.svelte +8 -1
- package/dist/components/widgets/gripper/gripper.svelte +11 -5
- package/dist/components/widgets/gripper/is-holding-something.svelte +2 -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/input-controller/input-controller.svelte +2 -1
- 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 +13 -9
- 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/movement-sensor/movement-sensor.svelte +53 -26
- 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/power-sensor/power-sensor.svelte +4 -0
- package/dist/components/widgets/sensor/sensor.svelte +1 -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/servo/servo.svelte +10 -2
- 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/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/components/widgets/vision-service/vision-service.svelte +9 -10
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -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 +7 -4
|
@@ -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
|
+
/>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { ResourceName } from '@viamrobotics/sdk'
|
|
3
3
|
|
|
4
|
+
import SectionTitle from '../../section-title.svelte'
|
|
5
|
+
|
|
4
6
|
import DoCommand from '../do-command/do-command.svelte'
|
|
5
7
|
|
|
6
8
|
interface Props {
|
|
@@ -11,6 +13,8 @@
|
|
|
11
13
|
|
|
12
14
|
const { partID, resourceName, isComponent }: Props = $props()
|
|
13
15
|
|
|
16
|
+
const api = $derived(`rdk:${isComponent ? 'component' : 'service'}:generic`)
|
|
17
|
+
|
|
14
18
|
const genericResourceName = $derived<ResourceName>({
|
|
15
19
|
namespace: 'rdk',
|
|
16
20
|
type: isComponent ? 'component' : 'service',
|
|
@@ -20,7 +24,10 @@
|
|
|
20
24
|
</script>
|
|
21
25
|
|
|
22
26
|
<div class="flex flex-col py-2 pl-4">
|
|
23
|
-
<
|
|
27
|
+
<SectionTitle
|
|
28
|
+
title="DoCommand"
|
|
29
|
+
{api}
|
|
30
|
+
/>
|
|
24
31
|
</div>
|
|
25
32
|
|
|
26
33
|
{#key genericResourceName}
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
<ConnectionStatus {partID}>
|
|
31
31
|
{#snippet connected()}
|
|
32
32
|
<div class="flex flex-row divide-x">
|
|
33
|
-
<span class="flex flex-row gap-4">
|
|
33
|
+
<span class="flex grow flex-row gap-4">
|
|
34
34
|
<ApiSection
|
|
35
35
|
title="Open"
|
|
36
|
-
|
|
36
|
+
api="rdk:component:gripper"
|
|
37
|
+
class="grow-0 gap-3 pr-0"
|
|
37
38
|
>
|
|
38
39
|
<Open
|
|
39
40
|
{partID}
|
|
@@ -42,7 +43,8 @@
|
|
|
42
43
|
</ApiSection>
|
|
43
44
|
<ApiSection
|
|
44
45
|
title="Grab"
|
|
45
|
-
|
|
46
|
+
api="rdk:component:gripper"
|
|
47
|
+
class="grow-0 gap-3 pl-0"
|
|
46
48
|
>
|
|
47
49
|
<Grab
|
|
48
50
|
{partID}
|
|
@@ -50,8 +52,11 @@
|
|
|
50
52
|
/>
|
|
51
53
|
</ApiSection>
|
|
52
54
|
</span>
|
|
53
|
-
<div class="
|
|
54
|
-
<ApiSection
|
|
55
|
+
<div class="flex flex-col divide-y">
|
|
56
|
+
<ApiSection
|
|
57
|
+
title="Stop"
|
|
58
|
+
api="rdk:component:gripper"
|
|
59
|
+
>
|
|
55
60
|
<StopButton
|
|
56
61
|
error={stopMutation.error}
|
|
57
62
|
onStop={() => {
|
|
@@ -61,6 +66,7 @@
|
|
|
61
66
|
</ApiSection>
|
|
62
67
|
<IsMoving
|
|
63
68
|
client={GripperClient}
|
|
69
|
+
api="rdk:component:gripper"
|
|
64
70
|
{partID}
|
|
65
71
|
{resourceName}
|
|
66
72
|
/>
|
|
@@ -30,13 +30,11 @@
|
|
|
30
30
|
|
|
31
31
|
<ApiSection
|
|
32
32
|
title="IsHoldingSomething"
|
|
33
|
+
api="rdk:component:gripper"
|
|
33
34
|
bottomText="Updates automatically"
|
|
34
35
|
class="grow"
|
|
35
36
|
>
|
|
36
|
-
<Query
|
|
37
|
-
{query}
|
|
38
|
-
contentCx="h-5"
|
|
39
|
-
>
|
|
37
|
+
<Query {query}>
|
|
40
38
|
<div class="flex items-center gap-2">
|
|
41
39
|
{#if query.data !== undefined}
|
|
42
40
|
{#if query.data}
|
|
@@ -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
|
+
/>
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
</MutationSection>
|
|
87
87
|
<MutationSection
|
|
88
88
|
title="SetPower"
|
|
89
|
+
api="rdk:component:motor"
|
|
89
90
|
description="Move continuously"
|
|
90
91
|
lastError={setPowerMutation.error}
|
|
91
92
|
>
|
|
@@ -94,6 +95,7 @@
|
|
|
94
95
|
{#if propertiesQuery.data?.positionReporting}
|
|
95
96
|
<MutationSection
|
|
96
97
|
title="SetRPM"
|
|
98
|
+
api="rdk:component:motor"
|
|
97
99
|
description="Move indefinitely at a specified speed."
|
|
98
100
|
lastError={setRPMMutation.error}
|
|
99
101
|
>
|
|
@@ -101,6 +103,7 @@
|
|
|
101
103
|
</MutationSection>
|
|
102
104
|
<MutationSection
|
|
103
105
|
title="GoFor"
|
|
106
|
+
api="rdk:component:motor"
|
|
104
107
|
description="Move a specified number of revolutions"
|
|
105
108
|
lastError={goForMutation.error}
|
|
106
109
|
>
|
|
@@ -108,6 +111,7 @@
|
|
|
108
111
|
</MutationSection>
|
|
109
112
|
<MutationSection
|
|
110
113
|
title="GoTo"
|
|
114
|
+
api="rdk:component:motor"
|
|
111
115
|
description="Turn to a specified position"
|
|
112
116
|
lastError={goToMutation.error}
|
|
113
117
|
>
|
|
@@ -117,7 +121,10 @@
|
|
|
117
121
|
</div>
|
|
118
122
|
|
|
119
123
|
<div class="ml-auto flex w-full max-w-1/2 flex-col divide-y sm:max-w-1/3">
|
|
120
|
-
<ApiSection
|
|
124
|
+
<ApiSection
|
|
125
|
+
title="Stop"
|
|
126
|
+
api="rdk:component:motor"
|
|
127
|
+
>
|
|
121
128
|
<StopButton
|
|
122
129
|
error={stopMutation.error}
|
|
123
130
|
onStop={() => {
|
|
@@ -127,22 +134,21 @@
|
|
|
127
134
|
</ApiSection>
|
|
128
135
|
<IsMoving
|
|
129
136
|
client={MotorClient}
|
|
137
|
+
api="rdk:component:motor"
|
|
130
138
|
{partID}
|
|
131
139
|
{resourceName}
|
|
132
140
|
>
|
|
133
141
|
<div class="flex flex-col gap-6 pt-2">
|
|
134
142
|
<ApiSection
|
|
135
143
|
title="IsPowered"
|
|
144
|
+
api="rdk:component:motor"
|
|
136
145
|
class="gap-3 p-0"
|
|
137
146
|
tooltip="Returns whether or not the motor is running and the current portion of max power.
|
|
138
147
|
|
|
139
148
|
Stepper motors will report ”true” if they are being powered while holding
|
|
140
149
|
a position and while they are turning."
|
|
141
150
|
>
|
|
142
|
-
<Query
|
|
143
|
-
contentCx="h-4"
|
|
144
|
-
query={isPoweredQuery}
|
|
145
|
-
>
|
|
151
|
+
<Query query={isPoweredQuery}>
|
|
146
152
|
{#if isPoweredQuery.data !== undefined}
|
|
147
153
|
{@const [isPowered, powerPct] = isPoweredQuery.data}
|
|
148
154
|
<span class="font-roboto-mono flex flex-row gap-1 text-xs">
|
|
@@ -158,13 +164,11 @@
|
|
|
158
164
|
{#if propertiesQuery.data?.positionReporting === true}
|
|
159
165
|
<ApiSection
|
|
160
166
|
title="GetPosition"
|
|
167
|
+
api="rdk:component:motor"
|
|
161
168
|
class="gap-3 p-0"
|
|
162
169
|
tooltip="Reports the position of an encoded motor in revolutions from zero/home."
|
|
163
170
|
>
|
|
164
|
-
<Query
|
|
165
|
-
contentCx=""
|
|
166
|
-
query={positionQuery}
|
|
167
|
-
>
|
|
171
|
+
<Query query={positionQuery}>
|
|
168
172
|
<p class="font-roboto-mono text-default text-xs">
|
|
169
173
|
{formatNumeric(positionQuery.data, 4)}
|
|
170
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>
|
|
@@ -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
|
|
|
@@ -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>
|