@viamrobotics/test-widgets 0.17.4 → 0.18.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/components/boundary.svelte +6 -1
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +8 -1
- package/dist/components/section/section-error.svelte +52 -8
- package/dist/components/section/section-error.svelte.d.ts +2 -0
- package/dist/components/section/section-errors.svelte +10 -2
- package/dist/components/widgets/arm/arm.svelte +5 -14
- package/dist/components/widgets/arm/stop-widget.svelte +20 -0
- package/dist/components/widgets/arm/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/base/base.svelte +32 -150
- package/dist/components/widgets/base/stop-widget.svelte +20 -0
- package/dist/components/widgets/base/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/camera/camera.svelte +28 -10
- package/dist/components/widgets/camera/export-screenshot.svelte +12 -20
- package/dist/components/widgets/camera/export-screenshot.svelte.d.ts +2 -0
- package/dist/components/widgets/camera/live-or-polling-video.svelte +13 -12
- package/dist/components/widgets/camera/picture-in-picture-button.svelte +7 -15
- package/dist/components/widgets/custom-control/custom-control.svelte +2 -2
- package/dist/components/widgets/do-command/do-command.svelte +6 -6
- package/dist/components/widgets/gantry/move-to-position-widget.svelte +12 -8
- package/dist/components/widgets/gantry/quick-move-widget.svelte +29 -15
- package/dist/components/widgets/gripper/grab-widget.svelte +10 -3
- package/dist/components/widgets/gripper/gripper.svelte +15 -54
- package/dist/components/widgets/gripper/is-holding-something-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/gripper/open-grab-control.svelte +60 -0
- package/dist/components/widgets/gripper/open-grab-control.svelte.d.ts +9 -0
- package/dist/components/widgets/gripper/open-widget.svelte +10 -3
- package/dist/components/widgets/gripper/stop-widget.svelte +20 -0
- package/dist/components/widgets/gripper/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/ml-model-service/metadata-widget.svelte +52 -0
- package/dist/components/widgets/ml-model-service/metadata-widget.svelte.d.ts +13 -0
- package/dist/components/widgets/ml-model-service/ml-model-service.svelte +9 -22
- package/dist/components/widgets/movement-sensor/movement-sensor.svelte +102 -125
- package/dist/components/widgets/operations-and-sessions/operations-and-sessions.svelte +11 -7
- package/dist/components/widgets/servo/get-position-widget.svelte +42 -0
- package/dist/components/widgets/servo/get-position-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/servo/move-widget.svelte +10 -5
- package/dist/components/widgets/servo/quick-move-widget.svelte +28 -10
- package/dist/components/widgets/servo/servo.svelte +22 -111
- package/dist/components/widgets/servo/stop-widget.svelte +20 -0
- package/dist/components/widgets/servo/stop-widget.svelte.d.ts +7 -0
- package/dist/components/widgets/switch/position-view.svelte +8 -5
- package/dist/components/widgets/switch/position.svelte +1 -5
- package/dist/components/widgets/switch/position.svelte.d.ts +0 -1
- package/dist/components/widgets/switch/switch.svelte +18 -17
- package/dist/components/widgets/vision-service/vision-service.svelte +12 -7
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +15 -5
- package/package.json +13 -13
- package/dist/components/content-rect.svelte +0 -26
- package/dist/components/content-rect.svelte.d.ts +0 -11
- package/dist/components/error.svelte +0 -71
- package/dist/components/error.svelte.d.ts +0 -15
- package/dist/components/queries.svelte +0 -97
- package/dist/components/queries.svelte.d.ts +0 -17
- package/dist/components/query.svelte +0 -29
- package/dist/components/query.svelte.d.ts +0 -15
- package/dist/components/widgets/gripper/is-holding-something.svelte.d.ts +0 -7
- /package/dist/components/widgets/gripper/{is-holding-something.svelte → is-holding-something-widget.svelte} +0 -0
|
@@ -6,7 +6,12 @@
|
|
|
6
6
|
let isErrorExpanded = $state(false)
|
|
7
7
|
|
|
8
8
|
const describeError = (error: unknown) => {
|
|
9
|
-
|
|
9
|
+
const message = String(error)
|
|
10
|
+
const stack = error instanceof Error ? error.stack : undefined
|
|
11
|
+
if (stack === undefined) return message
|
|
12
|
+
|
|
13
|
+
// A Chromium stack opens with the message. A Firefox or Safari stack holds only the call frames.
|
|
14
|
+
return stack.startsWith(message) ? stack : `${message}\n${stack}`
|
|
10
15
|
}
|
|
11
16
|
</script>
|
|
12
17
|
|
|
@@ -6,6 +6,7 @@ export { default as ArmManualModeWidget } from './widgets/arm/manual-mode-widget
|
|
|
6
6
|
export { default as ArmMoveToJointPositionsWidget } from './widgets/arm/move-to-joint-positions-widget.svelte';
|
|
7
7
|
export { default as ArmMoveToPositionWidget } from './widgets/arm/move-to-position-widget.svelte';
|
|
8
8
|
export { default as ArmQuickMoveWidget } from './widgets/arm/quick-move-widget.svelte';
|
|
9
|
+
export { default as ArmStopWidget } from './widgets/arm/stop-widget.svelte';
|
|
9
10
|
export { default as AudioInputWidget } from './widgets/audio-input/audio-input.svelte';
|
|
10
11
|
export { default as AudioInputGetPropertiesWidget } from './widgets/audio-input/get-properties-widget.svelte';
|
|
11
12
|
export { default as AudioOutputWidget } from './widgets/audio-output/audio-output.svelte';
|
|
@@ -17,6 +18,7 @@ export { default as BaseQuickMoveWidget } from './widgets/base/quick-move-widget
|
|
|
17
18
|
export { default as BaseSetPowerWidget } from './widgets/base/set-power-widget.svelte';
|
|
18
19
|
export { default as BaseSetVelocityWidget } from './widgets/base/set-velocity-widget.svelte';
|
|
19
20
|
export { default as BaseSpinWidget } from './widgets/base/spin-widget.svelte';
|
|
21
|
+
export { default as BaseStopWidget } from './widgets/base/stop-widget.svelte';
|
|
20
22
|
export { default as BoardWidget } from './widgets/board/board.svelte';
|
|
21
23
|
export { default as BoardReadWritePinsWidget } from './widgets/board/read-write-pins-widget.svelte';
|
|
22
24
|
export { default as ButtonWidget } from './widgets/button/button.svelte';
|
|
@@ -38,10 +40,13 @@ export { default as GantryQuickMoveWidget } from './widgets/gantry/quick-move-wi
|
|
|
38
40
|
export { default as GenericWidget } from './widgets/generic/generic.svelte';
|
|
39
41
|
export { default as GripperGrabWidget } from './widgets/gripper/grab-widget.svelte';
|
|
40
42
|
export { default as GripperWidget } from './widgets/gripper/gripper.svelte';
|
|
41
|
-
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something.svelte';
|
|
43
|
+
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something-widget.svelte';
|
|
42
44
|
export { default as GripperIsMovingWidget } from './widgets/gripper/is-moving-widget.svelte';
|
|
45
|
+
export { default as GripperOpenGrabWidget } from './widgets/gripper/open-grab-control.svelte';
|
|
43
46
|
export { default as GripperOpenWidget } from './widgets/gripper/open-widget.svelte';
|
|
47
|
+
export { default as GripperStopWidget } from './widgets/gripper/stop-widget.svelte';
|
|
44
48
|
export { default as InputControllerWidget } from './widgets/input-controller/input-controller.svelte';
|
|
49
|
+
export { default as MLModelServiceMetadataWidget } from './widgets/ml-model-service/metadata-widget.svelte';
|
|
45
50
|
export { default as MLModelServiceWidget } from './widgets/ml-model-service/ml-model-service.svelte';
|
|
46
51
|
export { default as MotionServiceWidget } from './widgets/motion/motion.svelte';
|
|
47
52
|
export { default as MotionMoveWidget } from './widgets/motion/move-widget.svelte';
|
|
@@ -63,10 +68,12 @@ export { default as PowerSensorGetVoltageWidget } from './widgets/power-sensor/g
|
|
|
63
68
|
export { default as PowerSensorGetCurrentWidget } from './widgets/power-sensor/get-current-widget.svelte';
|
|
64
69
|
export { default as PowerSensorGetPowerWidget } from './widgets/power-sensor/get-power-widget.svelte';
|
|
65
70
|
export { default as SensorWidget } from './widgets/sensor/sensor.svelte';
|
|
71
|
+
export { default as ServoGetPositionWidget } from './widgets/servo/get-position-widget.svelte';
|
|
66
72
|
export { default as ServoMoveWidget } from './widgets/servo/move-widget.svelte';
|
|
67
73
|
export { default as ServoQuickMoveWidget } from './widgets/servo/quick-move-widget.svelte';
|
|
68
74
|
export { default as ServoWidget } from './widgets/servo/servo.svelte';
|
|
69
75
|
export { default as ServoIsMovingWidget } from './widgets/servo/is-moving-widget.svelte';
|
|
76
|
+
export { default as ServoStopWidget } from './widgets/servo/stop-widget.svelte';
|
|
70
77
|
export { default as SlamMap2D } from './slam/map2d/index.svelte';
|
|
71
78
|
export { default as SlamWidget } from './widgets/slam/slam.svelte';
|
|
72
79
|
export { default as SlamGetPositionWidget } from './widgets/slam/get-position-widget.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export { default as ArmManualModeWidget } from './widgets/arm/manual-mode-widget
|
|
|
6
6
|
export { default as ArmMoveToJointPositionsWidget } from './widgets/arm/move-to-joint-positions-widget.svelte';
|
|
7
7
|
export { default as ArmMoveToPositionWidget } from './widgets/arm/move-to-position-widget.svelte';
|
|
8
8
|
export { default as ArmQuickMoveWidget } from './widgets/arm/quick-move-widget.svelte';
|
|
9
|
+
export { default as ArmStopWidget } from './widgets/arm/stop-widget.svelte';
|
|
9
10
|
export { default as AudioInputWidget } from './widgets/audio-input/audio-input.svelte';
|
|
10
11
|
export { default as AudioInputGetPropertiesWidget } from './widgets/audio-input/get-properties-widget.svelte';
|
|
11
12
|
export { default as AudioOutputWidget } from './widgets/audio-output/audio-output.svelte';
|
|
@@ -17,6 +18,7 @@ export { default as BaseQuickMoveWidget } from './widgets/base/quick-move-widget
|
|
|
17
18
|
export { default as BaseSetPowerWidget } from './widgets/base/set-power-widget.svelte';
|
|
18
19
|
export { default as BaseSetVelocityWidget } from './widgets/base/set-velocity-widget.svelte';
|
|
19
20
|
export { default as BaseSpinWidget } from './widgets/base/spin-widget.svelte';
|
|
21
|
+
export { default as BaseStopWidget } from './widgets/base/stop-widget.svelte';
|
|
20
22
|
export { default as BoardWidget } from './widgets/board/board.svelte';
|
|
21
23
|
export { default as BoardReadWritePinsWidget } from './widgets/board/read-write-pins-widget.svelte';
|
|
22
24
|
export { default as ButtonWidget } from './widgets/button/button.svelte';
|
|
@@ -37,10 +39,13 @@ export { default as GantryQuickMoveWidget } from './widgets/gantry/quick-move-wi
|
|
|
37
39
|
export { default as GenericWidget } from './widgets/generic/generic.svelte';
|
|
38
40
|
export { default as GripperGrabWidget } from './widgets/gripper/grab-widget.svelte';
|
|
39
41
|
export { default as GripperWidget } from './widgets/gripper/gripper.svelte';
|
|
40
|
-
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something.svelte';
|
|
42
|
+
export { default as GripperIsHoldingSomethingWidget } from './widgets/gripper/is-holding-something-widget.svelte';
|
|
41
43
|
export { default as GripperIsMovingWidget } from './widgets/gripper/is-moving-widget.svelte';
|
|
44
|
+
export { default as GripperOpenGrabWidget } from './widgets/gripper/open-grab-control.svelte';
|
|
42
45
|
export { default as GripperOpenWidget } from './widgets/gripper/open-widget.svelte';
|
|
46
|
+
export { default as GripperStopWidget } from './widgets/gripper/stop-widget.svelte';
|
|
43
47
|
export { default as InputControllerWidget } from './widgets/input-controller/input-controller.svelte';
|
|
48
|
+
export { default as MLModelServiceMetadataWidget } from './widgets/ml-model-service/metadata-widget.svelte';
|
|
44
49
|
export { default as MLModelServiceWidget } from './widgets/ml-model-service/ml-model-service.svelte';
|
|
45
50
|
export { default as MotionServiceWidget } from './widgets/motion/motion.svelte';
|
|
46
51
|
export { default as MotionMoveWidget } from './widgets/motion/move-widget.svelte';
|
|
@@ -62,10 +67,12 @@ export { default as PowerSensorGetVoltageWidget } from './widgets/power-sensor/g
|
|
|
62
67
|
export { default as PowerSensorGetCurrentWidget } from './widgets/power-sensor/get-current-widget.svelte';
|
|
63
68
|
export { default as PowerSensorGetPowerWidget } from './widgets/power-sensor/get-power-widget.svelte';
|
|
64
69
|
export { default as SensorWidget } from './widgets/sensor/sensor.svelte';
|
|
70
|
+
export { default as ServoGetPositionWidget } from './widgets/servo/get-position-widget.svelte';
|
|
65
71
|
export { default as ServoMoveWidget } from './widgets/servo/move-widget.svelte';
|
|
66
72
|
export { default as ServoQuickMoveWidget } from './widgets/servo/quick-move-widget.svelte';
|
|
67
73
|
export { default as ServoWidget } from './widgets/servo/servo.svelte';
|
|
68
74
|
export { default as ServoIsMovingWidget } from './widgets/servo/is-moving-widget.svelte';
|
|
75
|
+
export { default as ServoStopWidget } from './widgets/servo/stop-widget.svelte';
|
|
69
76
|
export { default as SlamMap2D } from './slam/map2d/index.svelte';
|
|
70
77
|
export { default as SlamWidget } from './widgets/slam/slam.svelte';
|
|
71
78
|
export { default as SlamGetPositionWidget } from './widgets/slam/get-position-widget.svelte';
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ClassValue } from 'svelte/elements'
|
|
3
3
|
|
|
4
|
+
import { IconButton, Tooltip } from '@viamrobotics/prime-core'
|
|
4
5
|
import { untrack } from 'svelte'
|
|
5
6
|
|
|
6
|
-
import ErrorDisplay from '../error.svelte'
|
|
7
7
|
import { useSectionErrorReporter } from './section-error-reporter'
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
error: Error | null | undefined
|
|
11
|
+
/** Id of the inline line rendered outside a section, for an `aria-describedby` that points at it. */
|
|
12
|
+
id?: string
|
|
11
13
|
/** Classes for the inline line rendered outside a section. */
|
|
12
14
|
class?: ClassValue
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
const
|
|
17
|
+
const defaultId = $props.id()
|
|
18
|
+
|
|
19
|
+
const { error, id = `error_${defaultId}`, class: className }: Props = $props()
|
|
16
20
|
|
|
17
21
|
const getReporter = useSectionErrorReporter()
|
|
18
22
|
const reporter = $derived(getReporter?.())
|
|
@@ -22,15 +26,55 @@
|
|
|
22
26
|
// Registering writes the section's error set, so it must not subscribe this effect to it.
|
|
23
27
|
return untrack(() => current?.report(() => error ?? null))
|
|
24
28
|
})
|
|
29
|
+
|
|
30
|
+
const COPY_CONFIRMATION_MS = 750
|
|
31
|
+
|
|
32
|
+
const errorText = $derived(error?.name && error.message ? `${error.name}: ${error.message}` : '')
|
|
33
|
+
|
|
34
|
+
let isShowingCopySuccess = $state(false)
|
|
35
|
+
let copySuccessTimeoutId: ReturnType<typeof setTimeout> | undefined
|
|
36
|
+
|
|
37
|
+
const copyErrorToClipboard = async () => {
|
|
38
|
+
try {
|
|
39
|
+
await globalThis.navigator.clipboard.writeText(errorText)
|
|
40
|
+
isShowingCopySuccess = true
|
|
41
|
+
clearTimeout(copySuccessTimeoutId)
|
|
42
|
+
copySuccessTimeoutId = setTimeout(() => {
|
|
43
|
+
isShowingCopySuccess = false
|
|
44
|
+
}, COPY_CONFIRMATION_MS)
|
|
45
|
+
} catch (copyError) {
|
|
46
|
+
console.error('Failed to copy error to clipboard', copyError)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
$effect(() => () => clearTimeout(copySuccessTimeoutId))
|
|
25
51
|
</script>
|
|
26
52
|
|
|
27
53
|
<!--
|
|
28
54
|
Adds `error` to the enclosing section's indicator. Outside a section that shows errors, such as
|
|
29
|
-
a form rendered on its own, it falls back to an inline error line.
|
|
55
|
+
a form rendered on its own, it falls back to an inline error line with a copy button.
|
|
30
56
|
-->
|
|
31
|
-
{#if !reporter}
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
{#if !reporter && errorText}
|
|
58
|
+
<div class="flex items-center justify-between gap-1">
|
|
59
|
+
<p
|
|
60
|
+
{id}
|
|
61
|
+
class={[
|
|
62
|
+
'font-roboto-mono text-danger-dark min-w-0 overflow-auto text-xs wrap-break-word',
|
|
63
|
+
className,
|
|
64
|
+
]}
|
|
65
|
+
>
|
|
66
|
+
{errorText}
|
|
67
|
+
</p>
|
|
68
|
+
<div class="shrink-0">
|
|
69
|
+
<Tooltip let:tooltipID>
|
|
70
|
+
<IconButton
|
|
71
|
+
aria-describedby={tooltipID}
|
|
72
|
+
icon={isShowingCopySuccess ? 'check' : 'content-copy'}
|
|
73
|
+
label="Copy error"
|
|
74
|
+
on:click={copyErrorToClipboard}
|
|
75
|
+
/>
|
|
76
|
+
<div slot="description">Copy error</div>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
36
80
|
{/if}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ClassValue } from 'svelte/elements';
|
|
2
2
|
interface Props {
|
|
3
3
|
error: Error | null | undefined;
|
|
4
|
+
/** Id of the inline line rendered outside a section, for an `aria-describedby` that points at it. */
|
|
5
|
+
id?: string;
|
|
4
6
|
/** Classes for the inline line rendered outside a section. */
|
|
5
7
|
class?: ClassValue;
|
|
6
8
|
}
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
return hasErrors ? 'alert-circle' : 'alert-circle-outline'
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
// The cue replays only when the held set changes to a non-empty
|
|
33
|
-
// fires once and each new distinct error or failed attempt fires again.
|
|
32
|
+
// The cue replays and the live region re-announces only when the held set changes to a non-empty
|
|
33
|
+
// one, so a steady failing poll fires once and each new distinct error or failed attempt fires again.
|
|
34
34
|
let lastKeys = ''
|
|
35
35
|
let arrivals = 0
|
|
36
36
|
const arrival = $derived.by(() => {
|
|
@@ -60,6 +60,14 @@
|
|
|
60
60
|
$effect(() => () => clearTimeout(copiedTimer))
|
|
61
61
|
</script>
|
|
62
62
|
|
|
63
|
+
<span
|
|
64
|
+
aria-live="polite"
|
|
65
|
+
class="sr-only"
|
|
66
|
+
>
|
|
67
|
+
{#key arrival}
|
|
68
|
+
{#if hasErrors}{summary}{/if}
|
|
69
|
+
{/key}
|
|
70
|
+
</span>
|
|
63
71
|
<Tooltip let:tooltipID>
|
|
64
72
|
<button
|
|
65
73
|
type="button"
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
11
11
|
import IsMoving from '../../is-moving.svelte'
|
|
12
12
|
import { Section } from '../../section'
|
|
13
|
-
import StopButton from '../../stop-button.svelte'
|
|
14
13
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
15
14
|
|
|
16
15
|
import GetJointPositions from './get-joint-positions.svelte'
|
|
@@ -18,6 +17,7 @@
|
|
|
18
17
|
import ManualModeWidget from './manual-mode-widget.svelte'
|
|
19
18
|
import MoveToJointPositions from './move-to-joint-positions.svelte'
|
|
20
19
|
import MoveToPositionControl from './move-to-position-control.svelte'
|
|
20
|
+
import StopWidget from './stop-widget.svelte'
|
|
21
21
|
import { useArmMotionTracking } from './use-arm-motion-tracking.svelte'
|
|
22
22
|
|
|
23
23
|
interface Props {
|
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
refetchInterval: motionTracking.refetchInterval,
|
|
45
45
|
}))
|
|
46
46
|
const kinematicsQuery = createResourceQuery(client, 'getKinematics', { refetchInterval: 500 })
|
|
47
|
-
const stopMutation = createResourceMutation(client, 'stop')
|
|
48
47
|
|
|
49
48
|
const moveToJointPositions = async (jointPositionsList: number[]) => {
|
|
50
49
|
await moveToJointPosMutation.mutateAsync([jointPositionsList])
|
|
@@ -107,18 +106,10 @@
|
|
|
107
106
|
<div
|
|
108
107
|
class="flex flex-row gap-4 @2xl:ml-auto @2xl:w-full @2xl:max-w-40 @2xl:flex-col @2xl:gap-0 @2xl:divide-y"
|
|
109
108
|
>
|
|
110
|
-
<
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
mutations={[stopMutation]}
|
|
115
|
-
>
|
|
116
|
-
<StopButton
|
|
117
|
-
onStop={() => {
|
|
118
|
-
stopMutation.mutate([], {})
|
|
119
|
-
}}
|
|
120
|
-
/>
|
|
121
|
-
</ApiSection>
|
|
109
|
+
<StopWidget
|
|
110
|
+
{partID}
|
|
111
|
+
{resourceName}
|
|
112
|
+
/>
|
|
122
113
|
<IsMoving
|
|
123
114
|
client={ArmClient}
|
|
124
115
|
api={ResourceTriplets.Arm}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ArmClient } from '@viamrobotics/sdk'
|
|
3
|
+
|
|
4
|
+
import Stop from '../../stop.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
|
+
<Stop
|
|
16
|
+
client={ArmClient}
|
|
17
|
+
api={ResourceTriplets.Arm}
|
|
18
|
+
{partID}
|
|
19
|
+
{resourceName}
|
|
20
|
+
/>
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { Label, Switch } from '@viamrobotics/prime-core'
|
|
3
|
-
import { BaseClient, type Vector3 } from '@viamrobotics/sdk'
|
|
4
|
-
import { createResourceClient, createResourceMutation } from '@viamrobotics/svelte-sdk'
|
|
5
|
-
|
|
6
|
-
import ApiSection from '../../api-section.svelte'
|
|
7
2
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
8
|
-
import IsMoving from '../../is-moving.svelte'
|
|
9
|
-
import { Section } from '../../section'
|
|
10
|
-
import { useSectionErrors } from '../../section/use-section-errors.svelte'
|
|
11
|
-
import StopButton from '../../stop-button.svelte'
|
|
12
|
-
import { ResourceTriplets } from '../../../resource-triplet'
|
|
13
3
|
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
4
|
+
import IsMovingWidget from './is-moving-widget.svelte'
|
|
5
|
+
import MoveStraightWidget from './move-straight-widget.svelte'
|
|
6
|
+
import QuickMoveWidget from './quick-move-widget.svelte'
|
|
7
|
+
import SetPowerWidget from './set-power-widget.svelte'
|
|
8
|
+
import SetVelocityWidget from './set-velocity-widget.svelte'
|
|
9
|
+
import SpinWidget from './spin-widget.svelte'
|
|
10
|
+
import StopWidget from './stop-widget.svelte'
|
|
19
11
|
|
|
20
12
|
interface Props {
|
|
21
13
|
partID: string
|
|
@@ -23,153 +15,43 @@
|
|
|
23
15
|
}
|
|
24
16
|
|
|
25
17
|
const { partID, resourceName }: Props = $props()
|
|
26
|
-
|
|
27
|
-
const client = createResourceClient(
|
|
28
|
-
BaseClient,
|
|
29
|
-
() => partID,
|
|
30
|
-
() => resourceName
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
const setPowerMutation = createResourceMutation(client, 'setPower')
|
|
34
|
-
const quickSetPowerMutation = createResourceMutation(client, 'setPower')
|
|
35
|
-
const setVelocityMutation = createResourceMutation(client, 'setVelocity')
|
|
36
|
-
const spinMutation = createResourceMutation(client, 'spin')
|
|
37
|
-
const moveStraightMutation = createResourceMutation(client, 'moveStraight')
|
|
38
|
-
const stopMutation = createResourceMutation(client, 'stop')
|
|
39
|
-
|
|
40
|
-
const setPower = (linear: Vector3, angular: Vector3) => {
|
|
41
|
-
setPowerMutation.mutate([linear, angular], {})
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const quickSetPower = (linear: Vector3, angular: Vector3) => {
|
|
45
|
-
quickSetPowerMutation.mutate([linear, angular], {})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const setVelocity = (linear: Vector3, angular: Vector3) => {
|
|
49
|
-
setVelocityMutation.mutate([linear, angular], {})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const spin = (angleDeg: number, degsPerSec: number) => {
|
|
53
|
-
spinMutation.mutate([angleDeg, degsPerSec], {})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const moveStraight = (distanceMm: number, mmPerSec: number) => {
|
|
57
|
-
moveStraightMutation.mutate([distanceMm, mmPerSec], {})
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const quickMoveErrors = useSectionErrors(() => ({ mutations: [quickSetPowerMutation] }))
|
|
61
|
-
|
|
62
|
-
let quickMoveKeyboardControl = $state(false)
|
|
63
18
|
</script>
|
|
64
19
|
|
|
65
20
|
<ConnectionStatus {partID}>
|
|
66
21
|
{#snippet connected()}
|
|
67
22
|
<div class="@container">
|
|
68
23
|
<div class="flex flex-col divide-y @4xl:flex-row @4xl:divide-x @4xl:divide-y-0">
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<div class="flex flex-col gap-0.5">
|
|
74
|
-
<Section.Heading>
|
|
75
|
-
Quick move
|
|
76
|
-
{#snippet aside()}
|
|
77
|
-
<Section.Errors errors={quickMoveErrors.errors} />
|
|
78
|
-
{/snippet}
|
|
79
|
-
</Section.Heading>
|
|
80
|
-
<Label>
|
|
81
|
-
Keyboard control
|
|
82
|
-
|
|
83
|
-
<Switch
|
|
84
|
-
slot="input"
|
|
85
|
-
on={quickMoveKeyboardControl}
|
|
86
|
-
on:change={() => (quickMoveKeyboardControl = !quickMoveKeyboardControl)}
|
|
87
|
-
/>
|
|
88
|
-
</Label>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<Section.Body>
|
|
92
|
-
<div class="flex grow flex-wrap justify-between gap-2">
|
|
93
|
-
<QuickMove
|
|
94
|
-
isKeyboardEnabled={quickMoveKeyboardControl}
|
|
95
|
-
setPower={quickSetPower}
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
</Section.Body>
|
|
99
|
-
</Section>
|
|
24
|
+
<QuickMoveWidget
|
|
25
|
+
{partID}
|
|
26
|
+
{resourceName}
|
|
27
|
+
/>
|
|
100
28
|
<div class="flex grow flex-col divide-y @4xl:ml-auto @4xl:w-full @4xl:max-w-40">
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
>
|
|
107
|
-
<StopButton
|
|
108
|
-
onStop={() => {
|
|
109
|
-
stopMutation.mutate([])
|
|
110
|
-
}}
|
|
111
|
-
/>
|
|
112
|
-
</ApiSection>
|
|
113
|
-
<IsMoving
|
|
114
|
-
client={BaseClient}
|
|
115
|
-
api={ResourceTriplets.Base}
|
|
29
|
+
<StopWidget
|
|
30
|
+
{partID}
|
|
31
|
+
{resourceName}
|
|
32
|
+
/>
|
|
33
|
+
<IsMovingWidget
|
|
116
34
|
{partID}
|
|
117
35
|
{resourceName}
|
|
118
36
|
/>
|
|
119
37
|
</div>
|
|
120
38
|
</div>
|
|
121
39
|
</div>
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
api={ResourceTriplets.Base}
|
|
139
|
-
mutations={[spinMutation]}
|
|
140
|
-
>
|
|
141
|
-
{#snippet subheading()}
|
|
142
|
-
<Section.Text>Turn to a given angle at a given velocity</Section.Text>
|
|
143
|
-
{/snippet}
|
|
144
|
-
<div class="flex grow flex-wrap justify-between gap-2">
|
|
145
|
-
<Spin {spin} />
|
|
146
|
-
</div>
|
|
147
|
-
</ApiSection>
|
|
148
|
-
<ApiSection
|
|
149
|
-
class="flex-row flex-wrap gap-2"
|
|
150
|
-
method="SetPower"
|
|
151
|
-
api={ResourceTriplets.Base}
|
|
152
|
-
mutations={[setPowerMutation]}
|
|
153
|
-
>
|
|
154
|
-
{#snippet subheading()}
|
|
155
|
-
<Section.Text>Move continuously at a given amount of power</Section.Text>
|
|
156
|
-
{/snippet}
|
|
157
|
-
<div class="flex grow flex-wrap justify-between gap-2">
|
|
158
|
-
<SetPower {setPower} />
|
|
159
|
-
</div>
|
|
160
|
-
</ApiSection>
|
|
161
|
-
<ApiSection
|
|
162
|
-
class="flex-row flex-wrap gap-2"
|
|
163
|
-
method="SetVelocity"
|
|
164
|
-
api={ResourceTriplets.Base}
|
|
165
|
-
mutations={[setVelocityMutation]}
|
|
166
|
-
>
|
|
167
|
-
{#snippet subheading()}
|
|
168
|
-
<Section.Text>Move continually at a given velocity</Section.Text>
|
|
169
|
-
{/snippet}
|
|
170
|
-
<div class="flex grow flex-wrap justify-between gap-2">
|
|
171
|
-
<SetVelocity {setVelocity} />
|
|
172
|
-
</div>
|
|
173
|
-
</ApiSection>
|
|
40
|
+
<MoveStraightWidget
|
|
41
|
+
{partID}
|
|
42
|
+
{resourceName}
|
|
43
|
+
/>
|
|
44
|
+
<SpinWidget
|
|
45
|
+
{partID}
|
|
46
|
+
{resourceName}
|
|
47
|
+
/>
|
|
48
|
+
<SetPowerWidget
|
|
49
|
+
{partID}
|
|
50
|
+
{resourceName}
|
|
51
|
+
/>
|
|
52
|
+
<SetVelocityWidget
|
|
53
|
+
{partID}
|
|
54
|
+
{resourceName}
|
|
55
|
+
/>
|
|
174
56
|
{/snippet}
|
|
175
57
|
</ConnectionStatus>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { BaseClient } from '@viamrobotics/sdk'
|
|
3
|
+
|
|
4
|
+
import Stop from '../../stop.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
|
+
<Stop
|
|
16
|
+
client={BaseClient}
|
|
17
|
+
api={ResourceTriplets.Base}
|
|
18
|
+
{partID}
|
|
19
|
+
{resourceName}
|
|
20
|
+
/>
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
import { useAddImageToDataset } from '../../../add-image-to-dataset'
|
|
10
10
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
11
|
-
import Query from '../../query.svelte'
|
|
12
11
|
import RefetchController from '../../refetch-controller.svelte'
|
|
13
12
|
import {
|
|
14
13
|
createRefetchIntervalStore,
|
|
15
14
|
RefetchIntervals,
|
|
16
15
|
} from '../../refetch-interval-store.svelte'
|
|
17
|
-
import { Section } from '../../section'
|
|
16
|
+
import { Section, useSectionErrors } from '../../section'
|
|
17
|
+
import { usePip } from '../../../pip/context.svelte'
|
|
18
18
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
19
19
|
|
|
20
20
|
import PCDWidget from '../pcd/pcd-widget.svelte'
|
|
@@ -143,6 +143,15 @@
|
|
|
143
143
|
}
|
|
144
144
|
)
|
|
145
145
|
|
|
146
|
+
let exportScreenshotError = $state<Error | null>(null)
|
|
147
|
+
const pip = usePip()
|
|
148
|
+
|
|
149
|
+
const imagesErrors = useSectionErrors(() => ({
|
|
150
|
+
mutations: [{ error: exportScreenshotError }, { error: pip.error ?? null }],
|
|
151
|
+
}))
|
|
152
|
+
|
|
153
|
+
const pointcloudErrors = useSectionErrors(() => ({ queries: [pointcloudQuery] }))
|
|
154
|
+
|
|
146
155
|
// Firefox has native support for picture-in-picture and does not need
|
|
147
156
|
// to be requested separately. Don't show a "toggle pip" button in Firefox.
|
|
148
157
|
const isFirefox = navigator.userAgent.toLowerCase().includes('firefox')
|
|
@@ -167,6 +176,9 @@
|
|
|
167
176
|
method="GetImages"
|
|
168
177
|
api={ResourceTriplets.Camera}
|
|
169
178
|
/>
|
|
179
|
+
{#snippet aside()}
|
|
180
|
+
<Section.Errors errors={imagesErrors.errors} />
|
|
181
|
+
{/snippet}
|
|
170
182
|
</Section.Heading>
|
|
171
183
|
</div>
|
|
172
184
|
<div class="p-4">
|
|
@@ -230,6 +242,9 @@
|
|
|
230
242
|
name={client.current?.name ?? ''}
|
|
231
243
|
sourceName={selectedSource}
|
|
232
244
|
getImage={exportScreenshotQuery.refetch}
|
|
245
|
+
onExportError={(error) => {
|
|
246
|
+
exportScreenshotError = error
|
|
247
|
+
}}
|
|
233
248
|
/>
|
|
234
249
|
{#if addImageToDataset}
|
|
235
250
|
<Button
|
|
@@ -327,13 +342,19 @@
|
|
|
327
342
|
</div>
|
|
328
343
|
</section>
|
|
329
344
|
|
|
330
|
-
<
|
|
345
|
+
<Section
|
|
346
|
+
errorReporter={pointcloudErrors}
|
|
347
|
+
class="flex-col gap-4"
|
|
348
|
+
>
|
|
331
349
|
<div class="flex flex-col gap-0.5">
|
|
332
350
|
<Section.Heading>
|
|
333
351
|
<Section.Method
|
|
334
352
|
method="GetPointCloud"
|
|
335
353
|
api={ResourceTriplets.Camera}
|
|
336
354
|
/>
|
|
355
|
+
{#snippet aside()}
|
|
356
|
+
<Section.Errors errors={pointcloudErrors.errors} />
|
|
357
|
+
{/snippet}
|
|
337
358
|
</Section.Heading>
|
|
338
359
|
<p class="text-subtle-2 text-xs">
|
|
339
360
|
Get depth measurement data from cameras with depth sensing support
|
|
@@ -347,15 +368,12 @@
|
|
|
347
368
|
/>
|
|
348
369
|
|
|
349
370
|
{#if isShowingPointcloud}
|
|
350
|
-
<
|
|
351
|
-
|
|
352
|
-
class="h-6"
|
|
353
|
-
>
|
|
354
|
-
{#if pointcloudQuery.data}
|
|
371
|
+
<Section.Body isLoading={pointcloudErrors.isLoading}>
|
|
372
|
+
{#if pointcloudQuery.data !== undefined}
|
|
355
373
|
<PCDWidget data={pointcloudQuery.data} />
|
|
356
374
|
{/if}
|
|
357
|
-
</
|
|
375
|
+
</Section.Body>
|
|
358
376
|
{/if}
|
|
359
|
-
</
|
|
377
|
+
</Section>
|
|
360
378
|
{/snippet}
|
|
361
379
|
</ConnectionStatus>
|