@viamrobotics/test-widgets 0.16.0 → 0.17.1
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/components/api-section.svelte +58 -50
- package/dist/components/api-section.svelte.d.ts +24 -11
- package/dist/components/content-rect.svelte +6 -0
- package/dist/components/content-rect.svelte.d.ts +1 -0
- package/dist/components/error.svelte +9 -0
- package/dist/components/error.svelte.d.ts +6 -0
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +4 -2
- package/dist/components/is-moving.svelte +26 -34
- package/dist/components/is-moving.svelte.d.ts +4 -5
- package/dist/components/progress.svelte +1 -0
- package/dist/components/queries.svelte +7 -0
- package/dist/components/queries.svelte.d.ts +4 -0
- package/dist/components/query.svelte +7 -0
- package/dist/components/query.svelte.d.ts +4 -0
- package/dist/components/section/index.d.ts +2 -0
- package/dist/components/section/index.js +2 -0
- package/dist/components/section/section-error-reporter.d.ts +8 -0
- package/dist/components/section/section-error-reporter.js +7 -0
- package/dist/components/section/section-error.svelte +36 -0
- package/dist/components/section/section-error.svelte.d.ts +9 -0
- package/dist/components/section/section-errors.svelte +132 -5
- package/dist/components/section/section.svelte +7 -1
- package/dist/components/section/section.svelte.d.ts +3 -0
- package/dist/components/section/use-section-errors.svelte.d.ts +1 -0
- package/dist/components/section/use-section-errors.svelte.js +11 -1
- package/dist/components/stop-button.svelte +1 -5
- package/dist/components/stop-button.svelte.d.ts +0 -1
- package/dist/components/stop.svelte +2 -2
- package/dist/components/widgets/arm/arm.svelte +24 -32
- package/dist/components/widgets/arm/get-joint-positions-widget.svelte +9 -8
- package/dist/components/widgets/arm/manual-mode-widget.svelte +13 -4
- package/dist/components/widgets/arm/manual-mode.svelte +1 -5
- package/dist/components/widgets/arm/manual-mode.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/move-to-joint-positions-widget.svelte +10 -4
- package/dist/components/widgets/arm/move-to-joint-positions.svelte +1 -11
- package/dist/components/widgets/arm/move-to-joint-positions.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/move-to-position-control.svelte +22 -18
- package/dist/components/widgets/arm/move-to-position.svelte +0 -4
- package/dist/components/widgets/arm/move-to-position.svelte.d.ts +0 -1
- package/dist/components/widgets/arm/quick-move-widget.svelte +10 -4
- package/dist/components/widgets/arm/quick-move.svelte +1 -4
- package/dist/components/widgets/arm/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/audio-input/audio-input.svelte +76 -74
- package/dist/components/widgets/audio-input/get-properties-widget.svelte +15 -15
- package/dist/components/widgets/audio-output/audio-output.svelte +83 -81
- package/dist/components/widgets/audio-output/get-properties-widget.svelte +15 -15
- package/dist/components/widgets/base/base.svelte +70 -37
- package/dist/components/widgets/base/move-straight-widget.svelte +16 -4
- package/dist/components/widgets/base/quick-move-widget.svelte +25 -9
- package/dist/components/widgets/base/set-power-widget.svelte +20 -8
- package/dist/components/widgets/base/set-velocity-widget.svelte +20 -8
- package/dist/components/widgets/base/spin-widget.svelte +20 -8
- package/dist/components/widgets/board/read-write-pins.svelte +2 -2
- package/dist/components/widgets/button/push.svelte +2 -2
- package/dist/components/widgets/camera/camera.svelte +15 -23
- package/dist/components/widgets/camera/live-or-polling-video.svelte +12 -9
- package/dist/components/widgets/custom-control/__tests__/__fixtures__/with-sibling.svelte +10 -0
- package/dist/components/widgets/custom-control/control-frame.svelte +60 -0
- package/dist/components/widgets/custom-control/control-frame.svelte.d.ts +10 -0
- package/dist/components/widgets/custom-control/create-control-host.svelte.d.ts +19 -0
- package/dist/components/widgets/custom-control/create-control-host.svelte.js +28 -0
- package/dist/components/widgets/custom-control/custom-control.d.ts +35 -0
- package/dist/components/widgets/custom-control/custom-control.js +85 -0
- package/dist/components/widgets/custom-control/custom-control.svelte +45 -0
- package/dist/components/widgets/custom-control/custom-control.svelte.d.ts +14 -0
- package/dist/components/widgets/discovery/discovery.svelte +10 -15
- package/dist/components/widgets/encoder/encoder.svelte +20 -18
- package/dist/components/widgets/encoder/get-position-widget.svelte +18 -15
- package/dist/components/widgets/gantry/gantry.svelte +50 -74
- package/dist/components/widgets/gantry/get-position-widget.svelte +14 -13
- package/dist/components/widgets/gantry/home.svelte +21 -10
- package/dist/components/widgets/gantry/move-to-position-widget.svelte +2 -1
- package/dist/components/widgets/gantry/move-to-position.svelte +1 -4
- package/dist/components/widgets/gantry/move-to-position.svelte.d.ts +0 -1
- package/dist/components/widgets/gantry/quick-move-widget.svelte +2 -1
- package/dist/components/widgets/gantry/quick-move.svelte +1 -5
- package/dist/components/widgets/gantry/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/generic/generic.svelte +7 -5
- package/dist/components/widgets/gripper/grab-widget.svelte +26 -0
- package/dist/components/widgets/gripper/grab-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/grab.svelte +3 -19
- package/dist/components/widgets/gripper/grab.svelte.d.ts +1 -2
- package/dist/components/widgets/gripper/gripper.svelte +10 -12
- package/dist/components/widgets/gripper/is-holding-something.svelte +18 -19
- package/dist/components/widgets/gripper/open-widget.svelte +26 -0
- package/dist/components/widgets/gripper/open-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/open.svelte +3 -19
- package/dist/components/widgets/gripper/open.svelte.d.ts +1 -2
- package/dist/components/widgets/input-controller/input-controller.svelte +7 -14
- package/dist/components/widgets/input-controller/webgamepad.svelte +2 -2
- package/dist/components/widgets/motion/motion.svelte +27 -35
- package/dist/components/widgets/motion/move-widget.svelte +32 -12
- package/dist/components/widgets/motion/move-widget.svelte.d.ts +6 -0
- package/dist/components/widgets/motion/move.svelte +1 -13
- package/dist/components/widgets/motion/move.svelte.d.ts +0 -1
- package/dist/components/widgets/motor/go-for-view.svelte +16 -8
- package/dist/components/widgets/motor/go-to-view.svelte +12 -4
- package/dist/components/widgets/motor/motor.svelte +88 -54
- package/dist/components/widgets/motor/quick-move-widget.svelte +16 -8
- package/dist/components/widgets/motor/set-power-widget.svelte +12 -4
- package/dist/components/widgets/motor/set-rpm-widget.svelte +12 -4
- package/dist/components/widgets/movement-sensor/get-accuracy-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-compass-heading-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-orientation-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/get-position-widget.svelte +7 -10
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +55 -56
- package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +2 -1
- package/dist/components/widgets/power-sensor/get-current-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/get-power-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/get-voltage-widget.svelte +7 -10
- package/dist/components/widgets/power-sensor/power-sensor.svelte +26 -38
- package/dist/components/widgets/sensor/sensor.svelte +5 -10
- package/dist/components/widgets/servo/move-widget.svelte +2 -1
- package/dist/components/widgets/servo/move.svelte +1 -4
- package/dist/components/widgets/servo/move.svelte.d.ts +0 -1
- package/dist/components/widgets/servo/quick-move-widget.svelte +2 -1
- package/dist/components/widgets/servo/quick-move.svelte +1 -5
- package/dist/components/widgets/servo/quick-move.svelte.d.ts +0 -1
- package/dist/components/widgets/servo/servo.svelte +44 -33
- package/dist/components/widgets/slam/get-position-widget.svelte +7 -10
- package/dist/components/widgets/slam/move-on-map.svelte +6 -5
- package/dist/components/widgets/slam/move-on-map.svelte.d.ts +2 -1
- package/dist/components/widgets/slam/slam.svelte +64 -79
- package/dist/components/widgets/switch/position.svelte +2 -2
- package/package.json +3 -2
- package/dist/components/mutation-section.svelte +0 -75
- package/dist/components/mutation-section.svelte.d.ts +0 -18
- package/dist/components/mutation-view.svelte +0 -29
- package/dist/components/mutation-view.svelte.d.ts +0 -10
- package/dist/components/section-title.svelte +0 -65
- package/dist/components/section-title.svelte.d.ts +0 -15
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
|
-
import
|
|
6
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
7
7
|
|
|
8
8
|
import CurrentReading from './current-reading.svelte'
|
|
9
9
|
|
|
@@ -24,15 +24,12 @@
|
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<ApiSection
|
|
27
|
-
|
|
27
|
+
queries={[query]}
|
|
28
|
+
method="GetCurrent"
|
|
29
|
+
api={ResourceTriplets.PowerSensor}
|
|
28
30
|
class="grow flex-col gap-4"
|
|
29
31
|
>
|
|
30
|
-
|
|
31
|
-
{query}
|
|
32
|
-
|
|
33
|
-
>
|
|
34
|
-
{#if query.data !== undefined}
|
|
35
|
-
<CurrentReading data={query.data} />
|
|
36
|
-
{/if}
|
|
37
|
-
</Query>
|
|
32
|
+
{#if query.data !== undefined}
|
|
33
|
+
<CurrentReading data={query.data} />
|
|
34
|
+
{/if}
|
|
38
35
|
</ApiSection>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
|
-
import
|
|
6
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
7
7
|
|
|
8
8
|
import PowerReading from './power-reading.svelte'
|
|
9
9
|
|
|
@@ -24,15 +24,12 @@
|
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<ApiSection
|
|
27
|
-
|
|
27
|
+
queries={[query]}
|
|
28
|
+
method="GetPower"
|
|
29
|
+
api={ResourceTriplets.PowerSensor}
|
|
28
30
|
class="grow flex-col gap-4"
|
|
29
31
|
>
|
|
30
|
-
|
|
31
|
-
{query}
|
|
32
|
-
|
|
33
|
-
>
|
|
34
|
-
{#if query.data !== undefined}
|
|
35
|
-
<PowerReading data={query.data} />
|
|
36
|
-
{/if}
|
|
37
|
-
</Query>
|
|
32
|
+
{#if query.data !== undefined}
|
|
33
|
+
<PowerReading data={query.data} />
|
|
34
|
+
{/if}
|
|
38
35
|
</ApiSection>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
|
-
import
|
|
6
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
7
7
|
|
|
8
8
|
import VoltageReading from './voltage-reading.svelte'
|
|
9
9
|
|
|
@@ -24,15 +24,12 @@
|
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<ApiSection
|
|
27
|
-
|
|
27
|
+
queries={[query]}
|
|
28
|
+
method="GetVoltage"
|
|
29
|
+
api={ResourceTriplets.PowerSensor}
|
|
28
30
|
class="grow flex-col gap-4"
|
|
29
31
|
>
|
|
30
|
-
|
|
31
|
-
{query}
|
|
32
|
-
|
|
33
|
-
>
|
|
34
|
-
{#if query.data !== undefined}
|
|
35
|
-
<VoltageReading data={query.data} />
|
|
36
|
-
{/if}
|
|
37
|
-
</Query>
|
|
32
|
+
{#if query.data !== undefined}
|
|
33
|
+
<VoltageReading data={query.data} />
|
|
34
|
+
{/if}
|
|
38
35
|
</ApiSection>
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
import ApiSection from '../../api-section.svelte'
|
|
8
8
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
9
|
-
import Query from '../../query.svelte'
|
|
10
9
|
import ReadingsList from '../../readings-list.svelte'
|
|
11
10
|
import RefetchController from '../../refetch-controller.svelte'
|
|
12
11
|
import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
|
|
12
|
+
import { Section } from '../../section'
|
|
13
13
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
14
14
|
|
|
15
15
|
import CurrentReading from './current-reading.svelte'
|
|
@@ -67,56 +67,49 @@
|
|
|
67
67
|
<div class="@container">
|
|
68
68
|
<div class="grid w-full grid-cols-1 divide-y @2xl:grid-cols-3 @2xl:divide-x @2xl:divide-y-0">
|
|
69
69
|
<ApiSection
|
|
70
|
-
|
|
70
|
+
queries={[currentQuery]}
|
|
71
|
+
method="GetCurrent"
|
|
71
72
|
api={ResourceTriplets.PowerSensor}
|
|
72
73
|
class="grow flex-col gap-4 pb-5"
|
|
73
74
|
>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
>
|
|
78
|
-
{#if currentQuery.data !== undefined}
|
|
79
|
-
<CurrentReading data={currentQuery.data} />
|
|
80
|
-
{/if}
|
|
81
|
-
</Query>
|
|
75
|
+
{#if currentQuery.data !== undefined}
|
|
76
|
+
<CurrentReading data={currentQuery.data} />
|
|
77
|
+
{/if}
|
|
82
78
|
</ApiSection>
|
|
83
79
|
<ApiSection
|
|
84
|
-
|
|
80
|
+
queries={[voltageQuery]}
|
|
81
|
+
method="GetVoltage"
|
|
85
82
|
api={ResourceTriplets.PowerSensor}
|
|
86
83
|
class="grow flex-col gap-4 pb-5"
|
|
87
84
|
>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
>
|
|
92
|
-
{#if voltageQuery.data !== undefined}
|
|
93
|
-
<VoltageReading data={voltageQuery.data} />
|
|
94
|
-
{/if}
|
|
95
|
-
</Query>
|
|
85
|
+
{#if voltageQuery.data !== undefined}
|
|
86
|
+
<VoltageReading data={voltageQuery.data} />
|
|
87
|
+
{/if}
|
|
96
88
|
</ApiSection>
|
|
97
89
|
<ApiSection
|
|
98
|
-
|
|
90
|
+
queries={[powerQuery]}
|
|
91
|
+
method="GetPower"
|
|
99
92
|
api={ResourceTriplets.PowerSensor}
|
|
100
93
|
class="grow flex-col gap-4 pb-5"
|
|
101
94
|
>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
>
|
|
106
|
-
{#if powerQuery.data !== undefined}
|
|
107
|
-
<PowerReading data={powerQuery.data} />
|
|
108
|
-
{/if}
|
|
109
|
-
</Query>
|
|
95
|
+
{#if powerQuery.data !== undefined}
|
|
96
|
+
<PowerReading data={powerQuery.data} />
|
|
97
|
+
{/if}
|
|
110
98
|
</ApiSection>
|
|
111
99
|
</div>
|
|
112
100
|
</div>
|
|
113
101
|
|
|
114
102
|
<ApiSection
|
|
103
|
+
queries={[readingsQuery]}
|
|
115
104
|
class="grow flex-col gap-4"
|
|
116
|
-
|
|
105
|
+
method="GetReadings"
|
|
117
106
|
api={ResourceTriplets.PowerSensor}
|
|
118
|
-
description="Get all the measurements and data that this power sensor provides"
|
|
119
107
|
>
|
|
108
|
+
{#snippet subheading()}
|
|
109
|
+
<Section.Text>
|
|
110
|
+
Get all the measurements and data that this power sensor provides
|
|
111
|
+
</Section.Text>
|
|
112
|
+
{/snippet}
|
|
120
113
|
<Switch
|
|
121
114
|
bind:on={isGetReadingsEnabled}
|
|
122
115
|
cx="text-subtle-2"
|
|
@@ -127,14 +120,9 @@
|
|
|
127
120
|
transition:slide={{ duration: 150 }}
|
|
128
121
|
class="pt-2"
|
|
129
122
|
>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
>
|
|
134
|
-
{#if readingsQuery.data !== undefined}
|
|
135
|
-
<ReadingsList data={readingsQuery.data} />
|
|
136
|
-
{/if}
|
|
137
|
-
</Query>
|
|
123
|
+
{#if readingsQuery.data !== undefined}
|
|
124
|
+
<ReadingsList data={readingsQuery.data} />
|
|
125
|
+
{/if}
|
|
138
126
|
</div>
|
|
139
127
|
{/if}
|
|
140
128
|
</ApiSection>
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
6
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
7
|
-
import Query from '../../query.svelte'
|
|
8
7
|
import ReadingsList from '../../readings-list.svelte'
|
|
9
8
|
import RefetchController from '../../refetch-controller.svelte'
|
|
10
9
|
import { createRefetchIntervalStore } from '../../refetch-interval-store.svelte'
|
|
@@ -44,18 +43,14 @@
|
|
|
44
43
|
</div>
|
|
45
44
|
|
|
46
45
|
<ApiSection
|
|
47
|
-
|
|
46
|
+
queries={[readingsQuery]}
|
|
47
|
+
method="GetReadings"
|
|
48
48
|
api={ResourceTriplets.Sensor}
|
|
49
49
|
class="relative grow flex-col gap-4"
|
|
50
50
|
>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
>
|
|
55
|
-
{#if readingsQuery.data !== undefined}
|
|
56
|
-
<ReadingsList data={readingsQuery.data} />
|
|
57
|
-
{/if}
|
|
58
|
-
</Query>
|
|
51
|
+
{#if readingsQuery.data !== undefined}
|
|
52
|
+
<ReadingsList data={readingsQuery.data} />
|
|
53
|
+
{/if}
|
|
59
54
|
</ApiSection>
|
|
60
55
|
{/snippet}
|
|
61
56
|
</ConnectionStatus>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
} from '@viamrobotics/svelte-sdk'
|
|
8
8
|
|
|
9
9
|
import Query from '../../query.svelte'
|
|
10
|
+
import { Section } from '../../section'
|
|
10
11
|
|
|
11
12
|
import Move from './move.svelte'
|
|
12
13
|
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
<Move
|
|
39
40
|
currentPosition={positionQuery.data}
|
|
40
41
|
{moveTo}
|
|
41
|
-
lastError={moveMutation.error}
|
|
42
42
|
/>
|
|
43
43
|
{/if}
|
|
44
44
|
</Query>
|
|
45
|
+
<Section.Error error={moveMutation.error} />
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button, Icon, Label, NumericInput, Tooltip } from '@viamrobotics/prime-core'
|
|
3
3
|
|
|
4
|
-
import ErrorDisplay from '../../error.svelte'
|
|
5
4
|
import { numberValueFromEvent } from '../../../event-handlers'
|
|
6
5
|
|
|
7
6
|
interface Props {
|
|
8
7
|
currentPosition: number
|
|
9
8
|
moveTo: (angle: number) => void
|
|
10
|
-
lastError: Error | null
|
|
11
9
|
}
|
|
12
10
|
|
|
13
|
-
const { currentPosition, moveTo
|
|
11
|
+
const { currentPosition, moveTo }: Props = $props()
|
|
14
12
|
|
|
15
13
|
let desiredAngle = $state(0)
|
|
16
14
|
|
|
@@ -99,4 +97,3 @@
|
|
|
99
97
|
Execute
|
|
100
98
|
</Button>
|
|
101
99
|
</div>
|
|
102
|
-
<ErrorDisplay {lastError} />
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
} from '@viamrobotics/svelte-sdk'
|
|
8
8
|
|
|
9
9
|
import Query from '../../query.svelte'
|
|
10
|
+
import { Section } from '../../section'
|
|
10
11
|
|
|
11
12
|
import QuickMove from './quick-move.svelte'
|
|
12
13
|
|
|
@@ -38,7 +39,7 @@
|
|
|
38
39
|
<QuickMove
|
|
39
40
|
currentPosition={positionQuery.data}
|
|
40
41
|
moveTo={quickMoveTo}
|
|
41
|
-
lastError={quickMoveMutation.error}
|
|
42
42
|
/>
|
|
43
43
|
{/if}
|
|
44
44
|
</Query>
|
|
45
|
+
<Section.Error error={quickMoveMutation.error} />
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button } from '@viamrobotics/prime-core'
|
|
3
3
|
|
|
4
|
-
import ErrorDisplay from '../../error.svelte'
|
|
5
|
-
|
|
6
4
|
interface Props {
|
|
7
5
|
currentPosition: number
|
|
8
6
|
moveTo: (angle: number) => void
|
|
9
|
-
lastError: Error | null
|
|
10
7
|
}
|
|
11
8
|
|
|
12
|
-
const { currentPosition, moveTo
|
|
9
|
+
const { currentPosition, moveTo }: Props = $props()
|
|
13
10
|
</script>
|
|
14
11
|
|
|
15
12
|
<div class="flex flex-row gap-4 text-xs">
|
|
@@ -31,4 +28,3 @@
|
|
|
31
28
|
<abbr class="text-subtle-2">º</abbr>
|
|
32
29
|
</Button>
|
|
33
30
|
</div>
|
|
34
|
-
<ErrorDisplay {lastError} />
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
import ApiSection from '../../api-section.svelte'
|
|
10
10
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
11
11
|
import IsMoving from '../../is-moving.svelte'
|
|
12
|
-
import
|
|
12
|
+
import { Section } from '../../section'
|
|
13
|
+
import { useSectionErrors } from '../../section/use-section-errors.svelte'
|
|
13
14
|
import StopButton from '../../stop-button.svelte'
|
|
14
15
|
import { formatNumeric } from '../../../format'
|
|
15
16
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
@@ -38,6 +39,11 @@
|
|
|
38
39
|
const quickMoveMutation = createResourceMutation(client, 'move')
|
|
39
40
|
const stopMutation = createResourceMutation(client, 'stop')
|
|
40
41
|
|
|
42
|
+
const quickMoveErrors = useSectionErrors(() => ({
|
|
43
|
+
queries: [positionQuery],
|
|
44
|
+
mutations: [quickMoveMutation],
|
|
45
|
+
}))
|
|
46
|
+
|
|
41
47
|
const moveTo = (angle: number) => {
|
|
42
48
|
moveMutation.mutate([angle], {})
|
|
43
49
|
}
|
|
@@ -55,62 +61,67 @@
|
|
|
55
61
|
<div class="grid grid-cols-1 divide-y @2xl:grid-cols-3 @2xl:divide-x @2xl:divide-y-0">
|
|
56
62
|
<ApiSection
|
|
57
63
|
class="grow flex-col gap-4"
|
|
58
|
-
|
|
64
|
+
method="GetPosition"
|
|
59
65
|
api={ResourceTriplets.Servo}
|
|
60
|
-
|
|
66
|
+
queries={[positionQuery]}
|
|
61
67
|
>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
<span class="
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
</Query>
|
|
68
|
+
{#if positionQuery.data !== undefined}
|
|
69
|
+
<!-- span required to get unit closer to position reading -->
|
|
70
|
+
<span class="flex flex-row gap-1">
|
|
71
|
+
<span class="font-roboto-mono font-normal"
|
|
72
|
+
>{formatNumeric(positionQuery.data)}</span
|
|
73
|
+
>
|
|
74
|
+
<abbr class="text-subtle-2">º</abbr>
|
|
75
|
+
</span>
|
|
76
|
+
{/if}
|
|
77
|
+
<Section.Text class="mt-auto">Updates automatically</Section.Text>
|
|
73
78
|
</ApiSection>
|
|
74
79
|
<ApiSection
|
|
75
80
|
class="grow flex-col gap-4"
|
|
76
|
-
|
|
81
|
+
method="Move"
|
|
77
82
|
api={ResourceTriplets.Servo}
|
|
83
|
+
queries={[positionQuery]}
|
|
84
|
+
mutations={[moveMutation]}
|
|
78
85
|
>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/>
|
|
86
|
-
{/if}
|
|
87
|
-
</Query>
|
|
86
|
+
{#if positionQuery.data !== undefined}
|
|
87
|
+
<Move
|
|
88
|
+
currentPosition={positionQuery.data}
|
|
89
|
+
{moveTo}
|
|
90
|
+
/>
|
|
91
|
+
{/if}
|
|
88
92
|
</ApiSection>
|
|
89
|
-
<
|
|
93
|
+
<Section
|
|
94
|
+
errorReporter={quickMoveErrors}
|
|
90
95
|
class="grow flex-col gap-4"
|
|
91
|
-
title="Quick move"
|
|
92
|
-
bottomText="Press a button to execute"
|
|
93
96
|
>
|
|
94
|
-
<
|
|
97
|
+
<div class="flex flex-col gap-0.5">
|
|
98
|
+
<Section.Heading>
|
|
99
|
+
Quick move
|
|
100
|
+
{#snippet aside()}
|
|
101
|
+
<Section.Errors errors={quickMoveErrors.errors} />
|
|
102
|
+
{/snippet}
|
|
103
|
+
</Section.Heading>
|
|
104
|
+
</div>
|
|
105
|
+
<Section.Body isLoading={quickMoveErrors.isLoading}>
|
|
95
106
|
{#if positionQuery.data !== undefined}
|
|
96
107
|
<QuickMove
|
|
97
108
|
currentPosition={positionQuery.data}
|
|
98
109
|
moveTo={quickMoveTo}
|
|
99
|
-
lastError={quickMoveMutation.error}
|
|
100
110
|
/>
|
|
101
111
|
{/if}
|
|
102
|
-
|
|
103
|
-
|
|
112
|
+
<Section.Text class="mt-auto">Press a button to execute</Section.Text>
|
|
113
|
+
</Section.Body>
|
|
114
|
+
</Section>
|
|
104
115
|
</div>
|
|
105
116
|
</div>
|
|
106
117
|
<div class="flex flex-col divide-y @4xl:ml-auto @4xl:w-full @4xl:max-w-40">
|
|
107
118
|
<ApiSection
|
|
108
119
|
class="grow flex-col gap-4"
|
|
109
|
-
|
|
120
|
+
method="Stop"
|
|
110
121
|
api={ResourceTriplets.Servo}
|
|
122
|
+
mutations={[stopMutation]}
|
|
111
123
|
>
|
|
112
124
|
<StopButton
|
|
113
|
-
error={stopMutation.error}
|
|
114
125
|
onStop={() => {
|
|
115
126
|
stopMutation.mutate([])
|
|
116
127
|
}}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
|
-
import
|
|
6
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
7
7
|
|
|
8
8
|
import Position from './position.svelte'
|
|
9
9
|
|
|
@@ -24,15 +24,12 @@
|
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<ApiSection
|
|
27
|
-
|
|
27
|
+
method="GetPosition"
|
|
28
|
+
api={ResourceTriplets.Slam}
|
|
29
|
+
queries={[query]}
|
|
28
30
|
class="grow flex-col gap-4"
|
|
29
31
|
>
|
|
30
|
-
|
|
31
|
-
{query}
|
|
32
|
-
|
|
33
|
-
>
|
|
34
|
-
{#if query.data !== undefined}
|
|
35
|
-
<Position position={query.data} />
|
|
36
|
-
{/if}
|
|
37
|
-
</Query>
|
|
32
|
+
{#if query.data !== undefined}
|
|
33
|
+
<Position position={query.data} />
|
|
34
|
+
{/if}
|
|
38
35
|
</ApiSection>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button, Label, NumericInput } from '@viamrobotics/prime-core'
|
|
3
3
|
|
|
4
|
+
import type { SectionMutation } from '../../section/use-section-errors.svelte'
|
|
5
|
+
|
|
4
6
|
import ApiSection from '../../api-section.svelte'
|
|
5
|
-
import ErrorDisplay from '../../error.svelte'
|
|
6
7
|
import { numberValueFromEvent } from '../../../event-handlers'
|
|
7
8
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
8
9
|
|
|
@@ -13,10 +14,10 @@
|
|
|
13
14
|
updateDestination: (_: Partial<PosePosition>) => void
|
|
14
15
|
moveOnMap: (planDeviationM: number | undefined) => void
|
|
15
16
|
stopPlan: () => void
|
|
16
|
-
|
|
17
|
+
mutations: SectionMutation[]
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
const { destination, updateDestination, moveOnMap, stopPlan,
|
|
20
|
+
const { destination, updateDestination, moveOnMap, stopPlan, mutations }: Props = $props()
|
|
20
21
|
|
|
21
22
|
const destinationID = $props.id()
|
|
22
23
|
|
|
@@ -25,8 +26,9 @@
|
|
|
25
26
|
|
|
26
27
|
<ApiSection
|
|
27
28
|
class="grow flex-col gap-4"
|
|
28
|
-
|
|
29
|
+
method="MoveOnMap"
|
|
29
30
|
api={ResourceTriplets.Motion}
|
|
31
|
+
{mutations}
|
|
30
32
|
>
|
|
31
33
|
<Label>
|
|
32
34
|
Plan deviation <abbr>(m)</abbr>
|
|
@@ -102,5 +104,4 @@
|
|
|
102
104
|
Stop
|
|
103
105
|
</Button>
|
|
104
106
|
</div>
|
|
105
|
-
<ErrorDisplay {lastError} />
|
|
106
107
|
</ApiSection>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { SectionMutation } from '../../section/use-section-errors.svelte';
|
|
1
2
|
import type { PosePosition } from './pose';
|
|
2
3
|
interface Props {
|
|
3
4
|
destination: PosePosition | undefined;
|
|
4
5
|
updateDestination: (_: Partial<PosePosition>) => void;
|
|
5
6
|
moveOnMap: (planDeviationM: number | undefined) => void;
|
|
6
7
|
stopPlan: () => void;
|
|
7
|
-
|
|
8
|
+
mutations: SectionMutation[];
|
|
8
9
|
}
|
|
9
10
|
declare const MoveOnMap: import("svelte").Component<Props, {}, "">;
|
|
10
11
|
type MoveOnMap = ReturnType<typeof MoveOnMap>;
|