@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { Icon, Tooltip } from '@viamrobotics/prime-core'
|
|
3
|
+
|
|
3
4
|
import { errorKey } from './error-key'
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
@@ -7,12 +8,138 @@
|
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
const { errors }: Props = $props()
|
|
11
|
+
|
|
12
|
+
const COPIED_MS = 750
|
|
13
|
+
|
|
14
|
+
const count = $derived(errors.length)
|
|
15
|
+
const hasErrors = $derived(count > 0)
|
|
16
|
+
const summary = $derived(hasErrors ? `${count} ${count === 1 ? 'error' : 'errors'}` : 'No errors')
|
|
17
|
+
const text = $derived(errors.map((error) => `${error.name}: ${error.message}`).join('\n'))
|
|
18
|
+
|
|
19
|
+
let copied = $state(false)
|
|
20
|
+
let copiedTimer: ReturnType<typeof setTimeout> | undefined
|
|
21
|
+
|
|
22
|
+
const label = $derived.by(() => {
|
|
23
|
+
if (copied) return `Copied ${summary}`
|
|
24
|
+
return hasErrors ? `${summary}, copy to clipboard` : summary
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const iconName = $derived.by(() => {
|
|
28
|
+
if (copied) return 'check'
|
|
29
|
+
return hasErrors ? 'alert-circle' : 'alert-circle-outline'
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// The cue replays only when the held set changes to a non-empty one, so a steady failing poll
|
|
33
|
+
// fires once and each new distinct error or failed attempt fires again.
|
|
34
|
+
let lastKeys = ''
|
|
35
|
+
let arrivals = 0
|
|
36
|
+
const arrival = $derived.by(() => {
|
|
37
|
+
const keys = errors.map((error) => errorKey(error)).join('\0\0')
|
|
38
|
+
if (keys !== lastKeys) {
|
|
39
|
+
lastKeys = keys
|
|
40
|
+
if (keys !== '') arrivals += 1
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return arrivals
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
const copy = async () => {
|
|
47
|
+
if (!hasErrors) return
|
|
48
|
+
try {
|
|
49
|
+
await globalThis.navigator.clipboard.writeText(text)
|
|
50
|
+
copied = true
|
|
51
|
+
clearTimeout(copiedTimer)
|
|
52
|
+
copiedTimer = setTimeout(() => {
|
|
53
|
+
copied = false
|
|
54
|
+
}, COPIED_MS)
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error('Failed to copy errors to clipboard', error)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
$effect(() => () => clearTimeout(copiedTimer))
|
|
10
61
|
</script>
|
|
11
62
|
|
|
12
|
-
|
|
13
|
-
<
|
|
63
|
+
<Tooltip let:tooltipID>
|
|
64
|
+
<button
|
|
65
|
+
type="button"
|
|
66
|
+
aria-label={label}
|
|
67
|
+
aria-describedby={tooltipID}
|
|
68
|
+
onclick={copy}
|
|
69
|
+
class={[
|
|
70
|
+
// The pseudo-element pads the hit area to 24px (WCAG 2.5.8) without growing the heading row.
|
|
71
|
+
'relative inline-flex items-center gap-0.5 p-0.5 after:absolute after:-inset-0.5',
|
|
72
|
+
{
|
|
73
|
+
'text-gray-6': !hasErrors && !copied,
|
|
74
|
+
'text-danger-dark hover:bg-medium': hasErrors && !copied,
|
|
75
|
+
'text-success-dark': copied,
|
|
76
|
+
},
|
|
77
|
+
]}
|
|
78
|
+
>
|
|
79
|
+
{#key arrival}
|
|
80
|
+
<span class={['inline-flex rounded-full', arrival > 0 && 'arrival']}>
|
|
81
|
+
<Icon name={iconName} />
|
|
82
|
+
</span>
|
|
83
|
+
{/key}
|
|
84
|
+
{#if hasErrors}
|
|
85
|
+
<span class="font-roboto-mono text-xs leading-none">{count}</span>
|
|
86
|
+
{/if}
|
|
87
|
+
</button>
|
|
88
|
+
<div
|
|
89
|
+
slot="description"
|
|
90
|
+
class="flex flex-col gap-1"
|
|
91
|
+
>
|
|
92
|
+
<div class="text-gray-5 flex justify-between gap-3">
|
|
93
|
+
<span>{summary}</span>
|
|
94
|
+
{#if hasErrors}
|
|
95
|
+
<span>{copied ? 'Copied' : 'Click to copy'}</span>
|
|
96
|
+
{/if}
|
|
97
|
+
</div>
|
|
14
98
|
{#each errors as error (errorKey(error))}
|
|
15
|
-
<
|
|
99
|
+
<p class="font-roboto-mono">{error.name}: {error.message}</p>
|
|
16
100
|
{/each}
|
|
17
101
|
</div>
|
|
18
|
-
|
|
102
|
+
</Tooltip>
|
|
103
|
+
|
|
104
|
+
<style>
|
|
105
|
+
@keyframes arrival {
|
|
106
|
+
0% {
|
|
107
|
+
transform: scale(1) rotate(0deg);
|
|
108
|
+
background-color: transparent;
|
|
109
|
+
}
|
|
110
|
+
15% {
|
|
111
|
+
transform: scale(1.35) rotate(-14deg);
|
|
112
|
+
background-color: color-mix(in srgb, var(--color-danger-light) 50%, transparent);
|
|
113
|
+
}
|
|
114
|
+
30% {
|
|
115
|
+
transform: scale(1.35) rotate(14deg);
|
|
116
|
+
background-color: color-mix(in srgb, var(--color-danger-light) 50%, transparent);
|
|
117
|
+
}
|
|
118
|
+
45% {
|
|
119
|
+
transform: scale(1.35) rotate(-14deg);
|
|
120
|
+
background-color: color-mix(in srgb, var(--color-danger-light) 50%, transparent);
|
|
121
|
+
}
|
|
122
|
+
60% {
|
|
123
|
+
transform: scale(1.35) rotate(14deg);
|
|
124
|
+
background-color: color-mix(in srgb, var(--color-danger-light) 50%, transparent);
|
|
125
|
+
}
|
|
126
|
+
80% {
|
|
127
|
+
transform: scale(1.35) rotate(0deg);
|
|
128
|
+
background-color: color-mix(in srgb, var(--color-danger-light) 50%, transparent);
|
|
129
|
+
}
|
|
130
|
+
100% {
|
|
131
|
+
transform: scale(1) rotate(0deg);
|
|
132
|
+
background-color: transparent;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.arrival {
|
|
137
|
+
animation: arrival 600ms cubic-bezier(0.165, 0.84, 0.44, 1) 1;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@media (prefers-reduced-motion: reduce) {
|
|
141
|
+
.arrival {
|
|
142
|
+
animation: none;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements'
|
|
4
4
|
|
|
5
|
+
import { provideSectionErrorReporter, type SectionErrorReporter } from './section-error-reporter'
|
|
6
|
+
|
|
5
7
|
interface Props extends HTMLAttributes<HTMLElement> {
|
|
6
8
|
children: Snippet
|
|
9
|
+
/** Collects errors that `Section.Error` parts inside the section report, e.g. `useSectionErrors`' result. */
|
|
10
|
+
errorReporter?: SectionErrorReporter
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
const { children, class: className, ...rest }: Props = $props()
|
|
13
|
+
const { children, errorReporter, class: className, ...rest }: Props = $props()
|
|
14
|
+
|
|
15
|
+
provideSectionErrorReporter(() => errorReporter)
|
|
10
16
|
</script>
|
|
11
17
|
|
|
12
18
|
<section
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import { type SectionErrorReporter } from './section-error-reporter';
|
|
3
4
|
interface Props extends HTMLAttributes<HTMLElement> {
|
|
4
5
|
children: Snippet;
|
|
6
|
+
/** Collects errors that `Section.Error` parts inside the section report, e.g. `useSectionErrors`' result. */
|
|
7
|
+
errorReporter?: SectionErrorReporter;
|
|
5
8
|
}
|
|
6
9
|
declare const Section: import("svelte").Component<Props, {}, "">;
|
|
7
10
|
type Section = ReturnType<typeof Section>;
|
|
@@ -15,4 +15,5 @@ export declare const dedupeErrors: (errors: (Error | null)[]) => Error[];
|
|
|
15
15
|
export declare const useSectionErrors: (getSources: () => SectionSources) => {
|
|
16
16
|
readonly errors: Error[];
|
|
17
17
|
readonly isLoading: boolean;
|
|
18
|
+
report(getError: () => Error | null): () => void;
|
|
18
19
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SvelteSet } from 'svelte/reactivity';
|
|
1
2
|
import { errorKey } from './error-key';
|
|
2
3
|
export const dedupeErrors = (errors) => {
|
|
3
4
|
const present = errors.filter((error) => error !== null);
|
|
@@ -23,9 +24,12 @@ export const useSectionErrors = (getSources) => {
|
|
|
23
24
|
}
|
|
24
25
|
return held;
|
|
25
26
|
});
|
|
27
|
+
// Errors that `Section.Error` parts inside the section report, e.g. an inner form's mutation.
|
|
28
|
+
const reported = new SvelteSet();
|
|
26
29
|
const errors = $derived.by(() => {
|
|
27
30
|
const mutationErrors = (getSources().mutations ?? []).map((mutation) => mutation.error);
|
|
28
|
-
|
|
31
|
+
const reportedErrors = [...reported].map((getError) => getError());
|
|
32
|
+
return dedupeErrors([...queryErrors, ...mutationErrors, ...reportedErrors]);
|
|
29
33
|
});
|
|
30
34
|
const isLoading = $derived(errors.length === 0 && (getSources().queries ?? []).some((query) => query.isLoading));
|
|
31
35
|
return {
|
|
@@ -35,5 +39,11 @@ export const useSectionErrors = (getSources) => {
|
|
|
35
39
|
get isLoading() {
|
|
36
40
|
return isLoading;
|
|
37
41
|
},
|
|
42
|
+
report(getError) {
|
|
43
|
+
reported.add(getError);
|
|
44
|
+
return () => {
|
|
45
|
+
reported.delete(getError);
|
|
46
|
+
};
|
|
47
|
+
},
|
|
38
48
|
};
|
|
39
49
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
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
|
onStop: () => void
|
|
8
|
-
error: Error | null
|
|
9
6
|
}
|
|
10
7
|
|
|
11
|
-
const {
|
|
8
|
+
const { onStop }: Props = $props()
|
|
12
9
|
</script>
|
|
13
10
|
|
|
14
11
|
<Button
|
|
@@ -18,4 +15,3 @@
|
|
|
18
15
|
>
|
|
19
16
|
Stop
|
|
20
17
|
</Button>
|
|
21
|
-
<ErrorDisplay lastError={error} />
|
|
@@ -9,7 +9,7 @@
|
|
|
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
13
|
import StopButton from '../../stop-button.svelte'
|
|
14
14
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
15
15
|
|
|
@@ -72,43 +72,35 @@
|
|
|
72
72
|
>
|
|
73
73
|
<ApiSection
|
|
74
74
|
class="grow flex-col gap-4"
|
|
75
|
-
|
|
75
|
+
method="GetJointPositions"
|
|
76
76
|
api={ResourceTriplets.Arm}
|
|
77
|
-
|
|
77
|
+
queries={[jointPositionsQuery]}
|
|
78
78
|
>
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
</Query>
|
|
79
|
+
{#if jointPositionsQuery.data}
|
|
80
|
+
<GetJointPositions positions={jointPositionsQuery.data.values} />
|
|
81
|
+
{/if}
|
|
82
|
+
<Section.Text class="mt-auto">Updates automatically</Section.Text>
|
|
84
83
|
</ApiSection>
|
|
85
84
|
<ApiSection
|
|
86
85
|
class="grow flex-col gap-4"
|
|
87
|
-
|
|
86
|
+
method="MoveToJointPositions"
|
|
88
87
|
api={ResourceTriplets.Arm}
|
|
88
|
+
queries={[jointPositionsQuery, kinematicsQuery]}
|
|
89
|
+
mutations={[moveToJointPosMutation]}
|
|
89
90
|
>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
/>
|
|
99
|
-
{/if}
|
|
100
|
-
</Query>
|
|
101
|
-
</ApiSection>
|
|
102
|
-
<ApiSection
|
|
103
|
-
class="grow flex-col gap-4"
|
|
104
|
-
title="MoveToPosition"
|
|
105
|
-
api={ResourceTriplets.Arm}
|
|
106
|
-
>
|
|
107
|
-
<MoveToPositionControl
|
|
108
|
-
{partID}
|
|
109
|
-
{resourceName}
|
|
110
|
-
/>
|
|
91
|
+
{#if jointPositionsQuery.data}
|
|
92
|
+
<MoveToJointPositions
|
|
93
|
+
positions={jointPositionsQuery.data.values}
|
|
94
|
+
{moveToJointPositions}
|
|
95
|
+
{jointLimitsDegrees}
|
|
96
|
+
isMoving={motionTracking.isTracking}
|
|
97
|
+
/>
|
|
98
|
+
{/if}
|
|
111
99
|
</ApiSection>
|
|
100
|
+
<MoveToPositionControl
|
|
101
|
+
{partID}
|
|
102
|
+
{resourceName}
|
|
103
|
+
/>
|
|
112
104
|
</div>
|
|
113
105
|
|
|
114
106
|
<!-- Control actions sidebar -->
|
|
@@ -117,11 +109,11 @@
|
|
|
117
109
|
>
|
|
118
110
|
<ApiSection
|
|
119
111
|
class="grow flex-col gap-4"
|
|
120
|
-
|
|
112
|
+
method="Stop"
|
|
121
113
|
api={ResourceTriplets.Arm}
|
|
114
|
+
mutations={[stopMutation]}
|
|
122
115
|
>
|
|
123
116
|
<StopButton
|
|
124
|
-
error={stopMutation.error}
|
|
125
117
|
onStop={() => {
|
|
126
118
|
stopMutation.mutate([], {})
|
|
127
119
|
}}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
|
-
import
|
|
6
|
+
import { Section } from '../../section'
|
|
7
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
7
8
|
|
|
8
9
|
import GetJointPositions from './get-joint-positions.svelte'
|
|
9
10
|
|
|
@@ -24,13 +25,13 @@
|
|
|
24
25
|
</script>
|
|
25
26
|
|
|
26
27
|
<ApiSection
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
method="GetJointPositions"
|
|
29
|
+
api={ResourceTriplets.Arm}
|
|
30
|
+
queries={[query]}
|
|
29
31
|
class="grow flex-col gap-4"
|
|
30
32
|
>
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
</Query>
|
|
33
|
+
{#if query.data}
|
|
34
|
+
<GetJointPositions positions={query.data.values} />
|
|
35
|
+
{/if}
|
|
36
|
+
<Section.Text class="mt-auto">Updates automatically</Section.Text>
|
|
36
37
|
</ApiSection>
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
} from '@viamrobotics/svelte-sdk'
|
|
8
8
|
|
|
9
9
|
import ApiSection from '../../api-section.svelte'
|
|
10
|
+
import { Section } from '../../section'
|
|
11
|
+
import { useSectionErrors } from '../../section/use-section-errors.svelte'
|
|
10
12
|
import { ResourceTriplets } from '../../../resource-triplet'
|
|
11
13
|
|
|
12
14
|
import ManualMode from './manual-mode.svelte'
|
|
@@ -36,6 +38,12 @@
|
|
|
36
38
|
|
|
37
39
|
const setManualModeMutation = createResourceMutation(client, 'setManualMode')
|
|
38
40
|
|
|
41
|
+
// The band renders no ApiSection, so it reads the same sources through the errors indicator.
|
|
42
|
+
const bandErrors = useSectionErrors(() => ({
|
|
43
|
+
queries: [propertiesQuery, manualModeQuery],
|
|
44
|
+
mutations: [setManualModeMutation],
|
|
45
|
+
}))
|
|
46
|
+
|
|
39
47
|
const setManualMode = (manualMode: boolean, enabledFor: number) => {
|
|
40
48
|
setManualModeMutation.mutate([manualMode, enabledFor], {})
|
|
41
49
|
}
|
|
@@ -45,27 +53,28 @@
|
|
|
45
53
|
{#if band}
|
|
46
54
|
<section
|
|
47
55
|
aria-label="SetManualMode"
|
|
48
|
-
class="border-b px-4 py-3"
|
|
56
|
+
class="flex items-start justify-between gap-2 border-b px-4 py-3"
|
|
49
57
|
>
|
|
50
58
|
<ManualMode
|
|
51
59
|
title="ManualMode"
|
|
52
60
|
isManualMode={manualModeQuery.data ?? false}
|
|
53
61
|
isPending={setManualModeMutation.isPending}
|
|
54
62
|
{setManualMode}
|
|
55
|
-
lastError={setManualModeMutation.error}
|
|
56
63
|
/>
|
|
64
|
+
<Section.Errors errors={bandErrors.errors} />
|
|
57
65
|
</section>
|
|
58
66
|
{:else}
|
|
59
67
|
<ApiSection
|
|
60
|
-
|
|
68
|
+
method="SetManualMode"
|
|
61
69
|
api={ResourceTriplets.Arm}
|
|
70
|
+
queries={[propertiesQuery, manualModeQuery]}
|
|
71
|
+
mutations={[setManualModeMutation]}
|
|
62
72
|
class="grow flex-col gap-4"
|
|
63
73
|
>
|
|
64
74
|
<ManualMode
|
|
65
75
|
isManualMode={manualModeQuery.data ?? false}
|
|
66
76
|
isPending={setManualModeMutation.isPending}
|
|
67
77
|
{setManualMode}
|
|
68
|
-
lastError={setManualModeMutation.error}
|
|
69
78
|
/>
|
|
70
79
|
</ApiSection>
|
|
71
80
|
{/if}
|
|
@@ -1,7 +1,6 @@
|
|
|
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 StatusPill from '../../status-pill.svelte'
|
|
6
5
|
import { numberValueFromEvent } from '../../../event-handlers'
|
|
7
6
|
|
|
@@ -12,11 +11,10 @@
|
|
|
12
11
|
title?: string
|
|
13
12
|
isManualMode: boolean
|
|
14
13
|
isPending: boolean
|
|
15
|
-
lastError: Error | null
|
|
16
14
|
setManualMode: (manualMode: boolean, enabledFor: number) => void
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
const { title, isManualMode, isPending, setManualMode
|
|
17
|
+
const { title, isManualMode, isPending, setManualMode }: Props = $props()
|
|
20
18
|
|
|
21
19
|
let enabledFor = $state(90)
|
|
22
20
|
let enableAfter = $state(5)
|
|
@@ -147,6 +145,4 @@
|
|
|
147
145
|
Manual mode puts the arm into gravity compensation or servo release mode so the arm can be moved
|
|
148
146
|
by hand.
|
|
149
147
|
</p>
|
|
150
|
-
|
|
151
|
-
<ErrorDisplay {lastError} />
|
|
152
148
|
</div>
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
createResourceQuery,
|
|
7
7
|
} from '@viamrobotics/svelte-sdk'
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import ApiSection from '../../api-section.svelte'
|
|
10
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
10
11
|
|
|
11
12
|
import { getJointPositionLimits, type KinematicsJSON } from './joint-position-limits'
|
|
12
13
|
import MoveToJointPositions from './move-to-joint-positions.svelte'
|
|
@@ -49,14 +50,19 @@
|
|
|
49
50
|
)
|
|
50
51
|
</script>
|
|
51
52
|
|
|
52
|
-
<
|
|
53
|
+
<ApiSection
|
|
54
|
+
method="MoveToJointPositions"
|
|
55
|
+
api={ResourceTriplets.Arm}
|
|
56
|
+
queries={[jointPositionsQuery, kinematicsQuery]}
|
|
57
|
+
mutations={[moveToJointPosMutation]}
|
|
58
|
+
class="grow flex-col gap-4"
|
|
59
|
+
>
|
|
53
60
|
{#if jointPositionsQuery.data}
|
|
54
61
|
<MoveToJointPositions
|
|
55
62
|
positions={jointPositionsQuery.data.values}
|
|
56
63
|
{moveToJointPositions}
|
|
57
|
-
lastError={moveToJointPosMutation.error}
|
|
58
64
|
{jointLimitsDegrees}
|
|
59
65
|
isMoving={motionTracking.isTracking}
|
|
60
66
|
/>
|
|
61
67
|
{/if}
|
|
62
|
-
</
|
|
68
|
+
</ApiSection>
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
import AngleUnitToggle from '../../angle-unit-toggle.svelte'
|
|
5
5
|
import CopyButton from '../../copy-button.svelte'
|
|
6
|
-
import ErrorDisplay from '../../error.svelte'
|
|
7
6
|
import PasteButton from '../../paste-button.svelte'
|
|
8
7
|
import { degreesToRadians, formatNumeric, radiansToDegrees } from '../../../format'
|
|
9
8
|
|
|
@@ -23,18 +22,11 @@
|
|
|
23
22
|
positions: number[]
|
|
24
23
|
/** Sends the move. Rejects when it fails. */
|
|
25
24
|
moveToJointPositions: (jointPositions: number[]) => Promise<void>
|
|
26
|
-
lastError: Error | null
|
|
27
25
|
jointLimitsDegrees: JointLimit[]
|
|
28
26
|
isMoving?: boolean
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
const {
|
|
32
|
-
positions,
|
|
33
|
-
moveToJointPositions,
|
|
34
|
-
lastError,
|
|
35
|
-
jointLimitsDegrees,
|
|
36
|
-
isMoving = false,
|
|
37
|
-
}: Props = $props()
|
|
29
|
+
const { positions, moveToJointPositions, jointLimitsDegrees, isMoving = false }: Props = $props()
|
|
38
30
|
|
|
39
31
|
const targets = useEditedTargets<number>(
|
|
40
32
|
(index) => positions[index] ?? 0,
|
|
@@ -126,6 +118,4 @@
|
|
|
126
118
|
{isMoving}
|
|
127
119
|
/>
|
|
128
120
|
{/if}
|
|
129
|
-
|
|
130
|
-
<ErrorDisplay {lastError} />
|
|
131
121
|
</div>
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
useRobotClient,
|
|
11
11
|
} from '@viamrobotics/svelte-sdk'
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import ApiSection from '../../api-section.svelte'
|
|
14
|
+
import { ResourceTriplets } from '../../../resource-triplet'
|
|
14
15
|
|
|
15
16
|
import {
|
|
16
17
|
canPlanMotion,
|
|
@@ -78,7 +79,7 @@
|
|
|
78
79
|
|
|
79
80
|
const moveMutation = createResourceMutation(motionClient, 'move')
|
|
80
81
|
const moveToPosMutation = createResourceMutation(armClient, 'moveToPosition')
|
|
81
|
-
const
|
|
82
|
+
const activeMutation = $derived(mode === 'motion' ? moveMutation : moveToPosMutation)
|
|
82
83
|
|
|
83
84
|
const motionTracking = useArmMotionTracking(armClient, {
|
|
84
85
|
isMovePending: () => moveMutation.isPending || moveToPosMutation.isPending,
|
|
@@ -129,7 +130,13 @@
|
|
|
129
130
|
{/if}
|
|
130
131
|
{/snippet}
|
|
131
132
|
|
|
132
|
-
<
|
|
133
|
+
<ApiSection
|
|
134
|
+
method="MoveToPosition"
|
|
135
|
+
api={ResourceTriplets.Arm}
|
|
136
|
+
queries={[frameSystemQuery, activeQuery]}
|
|
137
|
+
mutations={[activeMutation]}
|
|
138
|
+
class="grow flex-col gap-4"
|
|
139
|
+
>
|
|
133
140
|
{#if motionAvailable}
|
|
134
141
|
<Label position="top">
|
|
135
142
|
<span class="flex items-center gap-1 text-xs">
|
|
@@ -184,18 +191,15 @@
|
|
|
184
191
|
{/snippet}
|
|
185
192
|
</Banner>
|
|
186
193
|
{/if}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
{#
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
{/key}
|
|
200
|
-
</Queries>
|
|
201
|
-
</div>
|
|
194
|
+
<!-- Re-seed the editor on a mode change: the two modes report the pose in different frames. -->
|
|
195
|
+
{#key mode}
|
|
196
|
+
{#if endPosition}
|
|
197
|
+
<MoveToPosition
|
|
198
|
+
{endPosition}
|
|
199
|
+
{moveToPosition}
|
|
200
|
+
isMoving={motionTracking.isTracking}
|
|
201
|
+
{description}
|
|
202
|
+
/>
|
|
203
|
+
{/if}
|
|
204
|
+
{/key}
|
|
205
|
+
</ApiSection>
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
|
|
26
26
|
import { Button, Icon, Tooltip } from '@viamrobotics/prime-core'
|
|
27
27
|
|
|
28
|
-
import ErrorDisplay from '../../error.svelte'
|
|
29
28
|
import PoseEditor from '../../pose-editor.svelte'
|
|
30
29
|
import StatusPill from '../../status-pill.svelte'
|
|
31
30
|
|
|
@@ -34,7 +33,6 @@
|
|
|
34
33
|
interface Props {
|
|
35
34
|
endPosition: Pose
|
|
36
35
|
moveToPosition: (position: Pose) => void
|
|
37
|
-
lastError: Error | null
|
|
38
36
|
isMoving?: boolean
|
|
39
37
|
description?: Snippet
|
|
40
38
|
}
|
|
@@ -42,7 +40,6 @@
|
|
|
42
40
|
const {
|
|
43
41
|
endPosition,
|
|
44
42
|
moveToPosition,
|
|
45
|
-
lastError,
|
|
46
43
|
isMoving = false,
|
|
47
44
|
description: customDescription,
|
|
48
45
|
}: Props = $props()
|
|
@@ -142,5 +139,4 @@
|
|
|
142
139
|
{/if}
|
|
143
140
|
</span>
|
|
144
141
|
</div>
|
|
145
|
-
<ErrorDisplay {lastError} />
|
|
146
142
|
</div>
|