@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.
Files changed (104) hide show
  1. package/README.md +1 -1
  2. package/dist/api-docs-href.d.ts +8 -0
  3. package/dist/api-docs-href.js +17 -0
  4. package/dist/client-map.d.ts +30 -30
  5. package/dist/client-map.js +32 -29
  6. package/dist/components/angle-unit-toggle.svelte +1 -4
  7. package/dist/components/api-section.svelte +21 -23
  8. package/dist/components/api-section.svelte.d.ts +2 -0
  9. package/dist/components/index.d.ts +21 -0
  10. package/dist/components/index.js +21 -0
  11. package/dist/components/is-moving.svelte +4 -5
  12. package/dist/components/is-moving.svelte.d.ts +1 -0
  13. package/dist/components/mutation-section.svelte +20 -23
  14. package/dist/components/mutation-section.svelte.d.ts +2 -0
  15. package/dist/components/section-title.svelte +63 -0
  16. package/dist/components/section-title.svelte.d.ts +14 -0
  17. package/dist/components/widgets/arm/arm.svelte +25 -29
  18. package/dist/components/widgets/arm/get-joint-positions-widget.svelte +36 -0
  19. package/dist/components/widgets/arm/get-joint-positions-widget.svelte.d.ts +7 -0
  20. package/dist/components/widgets/arm/is-moving-widget.svelte +20 -0
  21. package/dist/components/widgets/arm/is-moving-widget.svelte.d.ts +7 -0
  22. package/dist/components/widgets/arm/joint-position-editor.svelte +89 -0
  23. package/dist/components/widgets/arm/joint-position-editor.svelte.d.ts +11 -0
  24. package/dist/components/widgets/arm/joint-position-quick-move.svelte +85 -0
  25. package/dist/components/widgets/arm/joint-position-quick-move.svelte.d.ts +9 -0
  26. package/dist/components/widgets/arm/joint-position-slider.svelte +36 -0
  27. package/dist/components/widgets/arm/joint-position-slider.svelte.d.ts +9 -0
  28. package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +9 -5
  29. package/dist/components/widgets/arm/move-to-joint-positions.svelte +73 -127
  30. package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +1 -0
  31. package/dist/components/widgets/arm/move-to-position.svelte +31 -3
  32. package/dist/components/widgets/audio-input/audio-input.svelte +2 -0
  33. package/dist/components/widgets/audio-input/get-properties-widget.svelte +43 -0
  34. package/dist/components/widgets/audio-input/get-properties-widget.svelte.d.ts +7 -0
  35. package/dist/components/widgets/audio-output/audio-output.svelte +2 -0
  36. package/dist/components/widgets/audio-output/get-properties-widget.svelte +43 -0
  37. package/dist/components/widgets/audio-output/get-properties-widget.svelte.d.ts +7 -0
  38. package/dist/components/widgets/base/base.svelte +9 -1
  39. package/dist/components/widgets/base/is-moving-widget.svelte +20 -0
  40. package/dist/components/widgets/base/is-moving-widget.svelte.d.ts +7 -0
  41. package/dist/components/widgets/base/quick-move.svelte +12 -5
  42. package/dist/components/widgets/camera/camera.svelte +156 -142
  43. package/dist/components/widgets/camera/live-or-polling-video.svelte +9 -1
  44. package/dist/components/widgets/discovery/discovery.svelte +1 -0
  45. package/dist/components/widgets/encoder/encoder-position-type.d.ts +8 -0
  46. package/dist/components/widgets/encoder/encoder-position-type.js +20 -0
  47. package/dist/components/widgets/encoder/encoder.svelte +5 -20
  48. package/dist/components/widgets/encoder/get-position-widget.svelte +54 -0
  49. package/dist/components/widgets/encoder/get-position-widget.svelte.d.ts +7 -0
  50. package/dist/components/widgets/gantry/gantry.svelte +28 -5
  51. package/dist/components/widgets/gantry/get-position-widget.svelte +43 -0
  52. package/dist/components/widgets/gantry/get-position-widget.svelte.d.ts +7 -0
  53. package/dist/components/widgets/gantry/is-moving-widget.svelte +20 -0
  54. package/dist/components/widgets/gantry/is-moving-widget.svelte.d.ts +7 -0
  55. package/dist/components/widgets/generic/generic.svelte +8 -1
  56. package/dist/components/widgets/gripper/gripper.svelte +11 -5
  57. package/dist/components/widgets/gripper/is-holding-something.svelte +2 -4
  58. package/dist/components/widgets/gripper/is-moving-widget.svelte +20 -0
  59. package/dist/components/widgets/gripper/is-moving-widget.svelte.d.ts +7 -0
  60. package/dist/components/widgets/input-controller/input-controller.svelte +2 -1
  61. package/dist/components/widgets/motor/is-moving-widget.svelte +20 -0
  62. package/dist/components/widgets/motor/is-moving-widget.svelte.d.ts +7 -0
  63. package/dist/components/widgets/motor/motor.svelte +13 -9
  64. package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +38 -0
  65. package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte.d.ts +7 -0
  66. package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +38 -0
  67. package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte.d.ts +7 -0
  68. package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +38 -0
  69. package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte.d.ts +7 -0
  70. package/dist/components/widgets/movement-sensor/get-position-widget.svelte +38 -0
  71. package/dist/components/widgets/movement-sensor/get-position-widget.svelte.d.ts +7 -0
  72. package/dist/components/widgets/movement-sensor/movement-sensor.svelte +53 -26
  73. package/dist/components/widgets/power-sensor/get-current-widget.svelte +38 -0
  74. package/dist/components/widgets/power-sensor/get-current-widget.svelte.d.ts +7 -0
  75. package/dist/components/widgets/power-sensor/get-power-widget.svelte +38 -0
  76. package/dist/components/widgets/power-sensor/get-power-widget.svelte.d.ts +7 -0
  77. package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +38 -0
  78. package/dist/components/widgets/power-sensor/get-voltage-widget.svelte.d.ts +7 -0
  79. package/dist/components/widgets/power-sensor/power-sensor.svelte +4 -0
  80. package/dist/components/widgets/sensor/sensor.svelte +1 -0
  81. package/dist/components/widgets/servo/is-moving-widget.svelte +20 -0
  82. package/dist/components/widgets/servo/is-moving-widget.svelte.d.ts +7 -0
  83. package/dist/components/widgets/servo/servo.svelte +10 -2
  84. package/dist/components/widgets/slam/get-position-widget.svelte +38 -0
  85. package/dist/components/widgets/slam/get-position-widget.svelte.d.ts +7 -0
  86. package/dist/components/widgets/slam/move-on-map.svelte +4 -1
  87. package/dist/components/widgets/slam/slam.svelte +4 -1
  88. package/dist/components/widgets/vision-service/context.svelte.d.ts +1 -0
  89. package/dist/components/widgets/vision-service/context.svelte.js +7 -0
  90. package/dist/components/widgets/vision-service/detection-row.svelte +38 -0
  91. package/dist/components/widgets/vision-service/detection-row.svelte.d.ts +8 -0
  92. package/dist/components/widgets/vision-service/detection.svelte +7 -4
  93. package/dist/components/widgets/vision-service/legend.svelte +14 -11
  94. package/dist/components/widgets/vision-service/vision-service.svelte +9 -10
  95. package/dist/index.d.ts +5 -1
  96. package/dist/index.js +6 -1
  97. package/dist/pip/context.svelte.d.ts +2 -0
  98. package/dist/pip/context.svelte.js +48 -20
  99. package/dist/resource-triplet.d.ts +37 -0
  100. package/dist/resource-triplet.js +37 -0
  101. package/dist/resource-widget.js +187 -0
  102. package/dist/resource.d.ts +0 -9
  103. package/dist/resource.js +0 -72
  104. 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
+ />
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const IsMovingWidget: import("svelte").Component<Props, {}, "">;
6
+ type IsMovingWidget = ReturnType<typeof IsMovingWidget>;
7
+ export default IsMovingWidget;
@@ -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
- <h3 class="font-semibold">DoCommand</h3>
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
- class="gap-3 pr-0"
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
- class="gap-3 pl-0"
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="ml-auto flex w-full max-w-40 flex-col divide-y">
54
- <ApiSection title="Stop">
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,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const IsMovingWidget: import("svelte").Component<Props, {}, "">;
6
+ type IsMovingWidget = ReturnType<typeof IsMovingWidget>;
7
+ export default IsMovingWidget;
@@ -54,7 +54,8 @@
54
54
  </div>
55
55
 
56
56
  <ApiSection
57
- title="GetReadings"
57
+ title="GetEvents"
58
+ api="rdk:component:input_controller"
58
59
  class="relative"
59
60
  >
60
61
  <Query
@@ -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
+ />
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const IsMovingWidget: import("svelte").Component<Props, {}, "">;
6
+ type IsMovingWidget = ReturnType<typeof IsMovingWidget>;
7
+ export default IsMovingWidget;
@@ -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 title="Stop">
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,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const GetAccuracyWidget: import("svelte").Component<Props, {}, "">;
6
+ type GetAccuracyWidget = ReturnType<typeof GetAccuracyWidget>;
7
+ export default GetAccuracyWidget;
@@ -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,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const GetCompassHeadingWidget: import("svelte").Component<Props, {}, "">;
6
+ type GetCompassHeadingWidget = ReturnType<typeof GetCompassHeadingWidget>;
7
+ export default GetCompassHeadingWidget;
@@ -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,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const GetOrientationWidget: import("svelte").Component<Props, {}, "">;
6
+ type GetOrientationWidget = ReturnType<typeof GetOrientationWidget>;
7
+ export default GetOrientationWidget;
@@ -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,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const GetPositionWidget: import("svelte").Component<Props, {}, "">;
6
+ type GetPositionWidget = ReturnType<typeof GetPositionWidget>;
7
+ export default GetPositionWidget;
@@ -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
- <h3 class="font-semibold">GetPosition</h3>
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
- <h3 class="font-semibold">
122
- GetOrientation <span class="text-subtle-2 font-normal">(º)</span>
123
- </h3>
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
- <h3 class="font-semibold">
138
- GetCompassHeading <span class="text-subtle-2 font-normal">(º)</span>
139
- </h3>
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
- <h3 class="font-semibold">
156
- GetAngularVelocity <span class="text-subtle-2 font-normal">(º/s)</span>
157
- </h3>
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
- <h3 class="font-semibold">
172
- GetLinearVelocity <span class="text-subtle-2 font-normal">(m/s)</span>
173
- </h3>
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
- <h3 class="font-semibold">
188
- GetLinearAcceleration <span class="text-subtle-2 font-normal"
189
- >(m/s<sup>2</sup>)</span
190
- >
191
- </h3>
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
- <h3 class="font-semibold">GetAccuracy</h3>
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
- <h3
231
- id={headingID}
232
- class="pb-1.5 font-semibold"
233
- >
234
- GetReadings
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>
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ partID: string;
3
+ resourceName: string;
4
+ }
5
+ declare const GetCurrentWidget: import("svelte").Component<Props, {}, "">;
6
+ type GetCurrentWidget = ReturnType<typeof GetCurrentWidget>;
7
+ export default GetCurrentWidget;