@viamrobotics/test-widgets 0.9.2 → 0.10.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/audio-properties.svelte.d.ts +8 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/{widgets/motion/pose-input.svelte → pose-editor.svelte} +26 -46
- package/dist/components/pose-editor.svelte.d.ts +12 -0
- package/dist/components/widgets/arm/move-to-position.svelte +10 -117
- package/dist/components/widgets/audio-input/audio-input.svelte +1 -1
- package/dist/components/widgets/audio-input/get-properties-widget.svelte +1 -2
- package/dist/components/widgets/audio-output/audio-output.svelte +1 -1
- package/dist/components/widgets/audio-output/get-properties-widget.svelte +1 -2
- package/dist/components/widgets/camera/camera.svelte +20 -8
- package/dist/components/widgets/do-command/resource-do-command.svelte +24 -0
- package/dist/components/widgets/do-command/resource-do-command.svelte.d.ts +7 -0
- package/dist/components/widgets/gantry/move-to-position.svelte +9 -4
- package/dist/components/widgets/motion/motion.svelte +2 -0
- package/dist/components/widgets/motion/move.svelte +27 -4
- package/dist/components/widgets/pcd/inputs.svelte +5 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{components/widgets/motion/parse-pasted-pose.d.ts → parse-pasted-pose.d.ts} +2 -2
- package/dist/{components/widgets/motion/parse-pasted-pose.js → parse-pasted-pose.js} +2 -2
- package/package.json +1 -1
- package/dist/components/widgets/audio-input/properties.svelte.d.ts +0 -8
- package/dist/components/widgets/audio-output/properties.svelte +0 -26
- package/dist/components/widgets/audio-output/properties.svelte.d.ts +0 -8
- package/dist/components/widgets/motion/pose-input.svelte.d.ts +0 -8
- /package/dist/components/{widgets/audio-input/properties.svelte → audio-properties.svelte} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
supportedCodecs: string[];
|
|
3
|
+
sampleRateHz: number;
|
|
4
|
+
numChannels: number;
|
|
5
|
+
}
|
|
6
|
+
declare const AudioProperties: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type AudioProperties = ReturnType<typeof AudioProperties>;
|
|
8
|
+
export default AudioProperties;
|
|
@@ -26,6 +26,7 @@ export { default as LiveOrPollingVideo } from './widgets/camera/live-or-polling-
|
|
|
26
26
|
export type { ComponentPreview, ComponentPreviewSnippet, } from './widgets/discovery/component-preview.ts';
|
|
27
27
|
export { default as DiscoveryWidget } from './widgets/discovery/discovery.svelte';
|
|
28
28
|
export { default as DoCommandWidget } from './widgets/do-command/do-command.svelte';
|
|
29
|
+
export { default as ResourceDoCommandWidget } from './widgets/do-command/resource-do-command.svelte';
|
|
29
30
|
export { default as EncoderWidget } from './widgets/encoder/encoder.svelte';
|
|
30
31
|
export { default as EncoderGetPositionWidget } from './widgets/encoder/get-position-widget.svelte';
|
|
31
32
|
export { default as GantryWidget } from './widgets/gantry/gantry.svelte';
|
package/dist/components/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export { default as CameraWidget } from './widgets/camera/camera.svelte';
|
|
|
25
25
|
export { default as LiveOrPollingVideo } from './widgets/camera/live-or-polling-video.svelte';
|
|
26
26
|
export { default as DiscoveryWidget } from './widgets/discovery/discovery.svelte';
|
|
27
27
|
export { default as DoCommandWidget } from './widgets/do-command/do-command.svelte';
|
|
28
|
+
export { default as ResourceDoCommandWidget } from './widgets/do-command/resource-do-command.svelte';
|
|
28
29
|
export { default as EncoderWidget } from './widgets/encoder/encoder.svelte';
|
|
29
30
|
export { default as EncoderGetPositionWidget } from './widgets/encoder/get-position-widget.svelte';
|
|
30
31
|
export { default as GantryWidget } from './widgets/gantry/gantry.svelte';
|
|
@@ -16,23 +16,26 @@
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<script lang="ts">
|
|
19
|
-
import {
|
|
19
|
+
import { Icon, NumericInput, Tooltip } from '@viamrobotics/prime-core'
|
|
20
20
|
|
|
21
|
-
import AngleUnitToggle from '
|
|
22
|
-
import CopyButton from '
|
|
23
|
-
import PasteButton from '
|
|
24
|
-
import Table from '
|
|
25
|
-
import { numberValueFromEvent } from '
|
|
26
|
-
import { degreesToRadians, formatNumeric, radiansToDegrees } from '
|
|
27
|
-
|
|
28
|
-
import { parsePastedPose } from './parse-pasted-pose'
|
|
21
|
+
import AngleUnitToggle from './angle-unit-toggle.svelte'
|
|
22
|
+
import CopyButton from './copy-button.svelte'
|
|
23
|
+
import PasteButton from './paste-button.svelte'
|
|
24
|
+
import Table from './table.svelte'
|
|
25
|
+
import { numberValueFromEvent } from '../event-handlers'
|
|
26
|
+
import { degreesToRadians, formatNumeric, radiansToDegrees } from '../format'
|
|
27
|
+
import { parsePastedPose } from '../parse-pasted-pose'
|
|
29
28
|
|
|
30
29
|
interface Props {
|
|
31
30
|
pose: Pose
|
|
32
31
|
onPoseChange: (pose: Pose) => void
|
|
32
|
+
/** Heading shown above the input table. */
|
|
33
|
+
title: string
|
|
34
|
+
/** Optional info-tooltip text shown next to the title. */
|
|
35
|
+
description?: string
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
const { pose, onPoseChange }: Props = $props()
|
|
38
|
+
const { pose, onPoseChange, title, description }: Props = $props()
|
|
36
39
|
|
|
37
40
|
let useRadians = $state(false)
|
|
38
41
|
|
|
@@ -41,6 +44,8 @@
|
|
|
41
44
|
theta: useRadians ? degreesToRadians(pose.theta) : pose.theta,
|
|
42
45
|
})
|
|
43
46
|
|
|
47
|
+
// Copy the stored pose (theta in degrees) so it round-trips through paste
|
|
48
|
+
// regardless of the display unit currently selected.
|
|
44
49
|
const copyData = $derived(JSON.stringify(pose))
|
|
45
50
|
|
|
46
51
|
const handlePaste = (data: string): boolean => {
|
|
@@ -57,10 +62,6 @@
|
|
|
57
62
|
onPoseChange({ ...pose, [key]: nextValue })
|
|
58
63
|
}
|
|
59
64
|
|
|
60
|
-
const zero = () => {
|
|
61
|
-
onPoseChange({ x: 0, y: 0, z: 0, oX: 0, oY: 0, oZ: 1, theta: 0 })
|
|
62
|
-
}
|
|
63
|
-
|
|
64
65
|
const poseUnits = $derived({
|
|
65
66
|
x: 'mm',
|
|
66
67
|
y: 'mm',
|
|
@@ -75,18 +76,17 @@
|
|
|
75
76
|
<div class="flex min-w-0 flex-col gap-4">
|
|
76
77
|
<div class="flex items-center justify-between">
|
|
77
78
|
<span class="flex flex-row items-center gap-1 text-sm">
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
</Tooltip>
|
|
79
|
+
{title}
|
|
80
|
+
{#if description}
|
|
81
|
+
<Tooltip>
|
|
82
|
+
<Icon
|
|
83
|
+
name="information-outline"
|
|
84
|
+
cx="text-gray-6"
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<span slot="description">{description}</span>
|
|
88
|
+
</Tooltip>
|
|
89
|
+
{/if}
|
|
90
90
|
</span>
|
|
91
91
|
<div class="flex gap-1">
|
|
92
92
|
<AngleUnitToggle
|
|
@@ -131,24 +131,4 @@
|
|
|
131
131
|
{/each}
|
|
132
132
|
</tbody>
|
|
133
133
|
</Table>
|
|
134
|
-
|
|
135
|
-
<div class="flex flex-col gap-2">
|
|
136
|
-
<span class="flex flex-row gap-2">
|
|
137
|
-
<h4 class="text-xs font-semibold">Quick set</h4>
|
|
138
|
-
<Tooltip>
|
|
139
|
-
<Icon
|
|
140
|
-
name="information-outline"
|
|
141
|
-
cx="text-gray-6"
|
|
142
|
-
/>
|
|
143
|
-
|
|
144
|
-
<span slot="description"> Will update the pose values but will not execute </span>
|
|
145
|
-
</Tooltip>
|
|
146
|
-
</span>
|
|
147
|
-
<Button
|
|
148
|
-
class="w-fit"
|
|
149
|
-
onclick={zero}
|
|
150
|
-
>
|
|
151
|
-
Zero
|
|
152
|
-
</Button>
|
|
153
|
-
</div>
|
|
154
134
|
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Pose } from '@viamrobotics/sdk';
|
|
2
|
+
interface Props {
|
|
3
|
+
pose: Pose;
|
|
4
|
+
onPoseChange: (pose: Pose) => void;
|
|
5
|
+
/** Heading shown above the input table. */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Optional info-tooltip text shown next to the title. */
|
|
8
|
+
description?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const PoseEditor: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type PoseEditor = ReturnType<typeof PoseEditor>;
|
|
12
|
+
export default PoseEditor;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Pose } from '@viamrobotics/sdk'
|
|
3
3
|
|
|
4
|
-
import { Button, Icon,
|
|
4
|
+
import { Button, Icon, Tooltip } from '@viamrobotics/prime-core'
|
|
5
5
|
|
|
6
|
-
import AngleUnitToggle from '../../angle-unit-toggle.svelte'
|
|
7
|
-
import CopyButton from '../../copy-button.svelte'
|
|
8
6
|
import ErrorDisplay from '../../error.svelte'
|
|
9
|
-
import
|
|
10
|
-
import Table from '../../table.svelte'
|
|
11
|
-
import { numberValueFromEvent } from '../../../event-handlers'
|
|
12
|
-
import { degreesToRadians, formatNumeric, radiansToDegrees } from '../../../format'
|
|
7
|
+
import PoseEditor from '../../pose-editor.svelte'
|
|
13
8
|
|
|
14
9
|
interface Props {
|
|
15
10
|
endPosition: Pose
|
|
@@ -21,7 +16,6 @@
|
|
|
21
16
|
|
|
22
17
|
// svelte-ignore state_referenced_locally
|
|
23
18
|
let desiredPosition = $state({ ...endPosition })
|
|
24
|
-
let useRadians = $state(false)
|
|
25
19
|
|
|
26
20
|
const resetToZero = () => {
|
|
27
21
|
desiredPosition = {
|
|
@@ -38,118 +32,17 @@
|
|
|
38
32
|
const resetToCurrent = () => {
|
|
39
33
|
desiredPosition = { ...endPosition }
|
|
40
34
|
}
|
|
41
|
-
|
|
42
|
-
const displayPosition = $derived({
|
|
43
|
-
x: desiredPosition.x,
|
|
44
|
-
y: desiredPosition.y,
|
|
45
|
-
z: desiredPosition.z,
|
|
46
|
-
oX: desiredPosition.oX,
|
|
47
|
-
oY: desiredPosition.oY,
|
|
48
|
-
oZ: desiredPosition.oZ,
|
|
49
|
-
theta: useRadians ? degreesToRadians(desiredPosition.theta) : desiredPosition.theta,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
const copyData = $derived(JSON.stringify(displayPosition))
|
|
53
|
-
const handlePaste = (data: string): boolean => {
|
|
54
|
-
try {
|
|
55
|
-
desiredPosition = JSON.parse(data) as Pose
|
|
56
|
-
} catch {
|
|
57
|
-
return false
|
|
58
|
-
}
|
|
59
|
-
return true
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const handleAngleInputChange = (key: keyof Pose, inputValue: number) => {
|
|
63
|
-
if (key === 'theta') {
|
|
64
|
-
desiredPosition[key] = useRadians ? radiansToDegrees(inputValue) : inputValue
|
|
65
|
-
} else {
|
|
66
|
-
desiredPosition[key] = inputValue
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const positionLabels: Record<keyof Pose, string> = {
|
|
71
|
-
x: 'X',
|
|
72
|
-
y: 'Y',
|
|
73
|
-
z: 'Z',
|
|
74
|
-
oX: 'OX',
|
|
75
|
-
oY: 'OY',
|
|
76
|
-
oZ: 'OZ',
|
|
77
|
-
theta: 'θ',
|
|
78
|
-
} as const
|
|
79
|
-
const positionUnits = $derived({
|
|
80
|
-
x: 'mm',
|
|
81
|
-
y: 'mm',
|
|
82
|
-
z: 'mm',
|
|
83
|
-
oX: '',
|
|
84
|
-
oY: '',
|
|
85
|
-
oZ: '',
|
|
86
|
-
theta: useRadians ? 'rad' : 'deg',
|
|
87
|
-
} as const satisfies Record<keyof Pose, string>)
|
|
88
|
-
|
|
89
|
-
const positionLabelsList = Object.entries(positionLabels) as [keyof Pose, string][]
|
|
90
35
|
</script>
|
|
91
36
|
|
|
92
37
|
<div class="flex min-w-0 flex-col gap-4">
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
<span slot="description">
|
|
104
|
-
Pose is with respect to the arm origin and does not take into account the motion service
|
|
105
|
-
or frame system.
|
|
106
|
-
</span>
|
|
107
|
-
</Tooltip>
|
|
108
|
-
</span>
|
|
109
|
-
<div class="flex gap-1">
|
|
110
|
-
<AngleUnitToggle
|
|
111
|
-
{useRadians}
|
|
112
|
-
onToggle={() => {
|
|
113
|
-
useRadians = !useRadians
|
|
114
|
-
}}
|
|
115
|
-
/>
|
|
116
|
-
<CopyButton data={copyData} />
|
|
117
|
-
<PasteButton onPaste={handlePaste} />
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<Table>
|
|
122
|
-
<thead>
|
|
123
|
-
<tr>
|
|
124
|
-
<th>Pose</th>
|
|
125
|
-
<th>Value</th>
|
|
126
|
-
</tr>
|
|
127
|
-
</thead>
|
|
128
|
-
<tbody>
|
|
129
|
-
{#each positionLabelsList as labelList (labelList)}
|
|
130
|
-
{@const [key, label] = labelList}
|
|
131
|
-
{@const value = Number.parseFloat(formatNumeric(displayPosition[key]))}
|
|
132
|
-
<tr>
|
|
133
|
-
<th>
|
|
134
|
-
<span class="relative inline-flex justify-center">
|
|
135
|
-
{label}
|
|
136
|
-
<abbr class="text-subtle-2 absolute left-full ml-1">{positionUnits[key]}</abbr>
|
|
137
|
-
</span>
|
|
138
|
-
</th>
|
|
139
|
-
<th>
|
|
140
|
-
<NumericInput
|
|
141
|
-
cx="max-w-[76px]"
|
|
142
|
-
{value}
|
|
143
|
-
on:change={(event) => {
|
|
144
|
-
const inputValue = numberValueFromEvent(event) ?? 0
|
|
145
|
-
handleAngleInputChange(key, inputValue)
|
|
146
|
-
}}
|
|
147
|
-
/>
|
|
148
|
-
</th>
|
|
149
|
-
</tr>
|
|
150
|
-
{/each}
|
|
151
|
-
</tbody>
|
|
152
|
-
</Table>
|
|
38
|
+
<PoseEditor
|
|
39
|
+
pose={desiredPosition}
|
|
40
|
+
onPoseChange={(next) => {
|
|
41
|
+
desiredPosition = next
|
|
42
|
+
}}
|
|
43
|
+
title="Pose Values"
|
|
44
|
+
description="Pose is with respect to the arm origin and does not take into account the motion service or frame system."
|
|
45
|
+
/>
|
|
153
46
|
|
|
154
47
|
<div class="mb-2 flex flex-col gap-2">
|
|
155
48
|
<span class="flex flex-row gap-2">
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
5
5
|
|
|
6
6
|
import ApiSection from '../../api-section.svelte'
|
|
7
|
+
import Properties from '../../audio-properties.svelte'
|
|
7
8
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
8
9
|
import MutationSection from '../../mutation-section.svelte'
|
|
9
10
|
import Query from '../../query.svelte'
|
|
@@ -12,7 +13,6 @@
|
|
|
12
13
|
import { numberValueFromEvent } from '../../../event-handlers'
|
|
13
14
|
|
|
14
15
|
import { createAudioCapturer } from './create-audio-capturer.svelte.js'
|
|
15
|
-
import Properties from './properties.svelte'
|
|
16
16
|
|
|
17
17
|
interface Props {
|
|
18
18
|
partID: string
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import Properties from '../../audio-properties.svelte'
|
|
6
7
|
import Query from '../../query.svelte'
|
|
7
8
|
|
|
8
|
-
import Properties from './properties.svelte'
|
|
9
|
-
|
|
10
9
|
interface Props {
|
|
11
10
|
partID: string
|
|
12
11
|
resourceName: string
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
5
5
|
|
|
6
6
|
import ApiSection from '../../api-section.svelte'
|
|
7
|
+
import Properties from '../../audio-properties.svelte'
|
|
7
8
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
8
9
|
import MutationSection from '../../mutation-section.svelte'
|
|
9
10
|
import Query from '../../query.svelte'
|
|
@@ -13,7 +14,6 @@
|
|
|
13
14
|
|
|
14
15
|
import { ExtToCodec, MimeToCodec } from './codec.js'
|
|
15
16
|
import { createAudioPlayer } from './create-audio-player.svelte.js'
|
|
16
|
-
import Properties from './properties.svelte'
|
|
17
17
|
|
|
18
18
|
interface Props {
|
|
19
19
|
partID: string
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
4
4
|
|
|
5
5
|
import ApiSection from '../../api-section.svelte'
|
|
6
|
+
import Properties from '../../audio-properties.svelte'
|
|
6
7
|
import Query from '../../query.svelte'
|
|
7
8
|
|
|
8
|
-
import Properties from './properties.svelte'
|
|
9
|
-
|
|
10
9
|
interface Props {
|
|
11
10
|
partID: string
|
|
12
11
|
resourceName: string
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { Button, Label, Select, Switch, ToggleButtons } from '@viamrobotics/prime-core'
|
|
4
4
|
import { CameraClient } from '@viamrobotics/sdk'
|
|
5
5
|
import { createResourceClient, createResourceQuery } from '@viamrobotics/svelte-sdk'
|
|
6
|
+
import { PersistedState } from 'runed'
|
|
6
7
|
|
|
7
8
|
import { useAddImageToDataset } from '../../../add-image-to-dataset'
|
|
8
9
|
import ConnectionStatus from '../../connection-status.svelte'
|
|
@@ -37,14 +38,12 @@
|
|
|
37
38
|
() => resourceName,
|
|
38
39
|
'camera'
|
|
39
40
|
)
|
|
40
|
-
|
|
41
|
-
$
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
isPlaying = false
|
|
47
|
-
})
|
|
41
|
+
|
|
42
|
+
const waitToStartFeed = $derived(
|
|
43
|
+
new PersistedState(`camera-wait-to-start-feed/${partID}/${resourceName}`, false)
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
let isPlaying = $derived(!waitToStartFeed.current)
|
|
48
47
|
let isShowingPointcloud = $state(false)
|
|
49
48
|
let selectedSource = $state('')
|
|
50
49
|
let sourceNames = $state<string[]>([])
|
|
@@ -168,6 +167,19 @@
|
|
|
168
167
|
headingId={getImagesHeadingID}
|
|
169
168
|
/>
|
|
170
169
|
</div>
|
|
170
|
+
<div class="flex gap-4 px-4 pt-3">
|
|
171
|
+
<Label position="left">
|
|
172
|
+
Wait to start feed
|
|
173
|
+
<Switch
|
|
174
|
+
slot="input"
|
|
175
|
+
annotated
|
|
176
|
+
on={waitToStartFeed.current}
|
|
177
|
+
on:change={(event) => {
|
|
178
|
+
waitToStartFeed.current = event.detail
|
|
179
|
+
}}
|
|
180
|
+
/>
|
|
181
|
+
</Label>
|
|
182
|
+
</div>
|
|
171
183
|
{#if isPlaying}
|
|
172
184
|
<div class="flex gap-4 p-4 pb-3">
|
|
173
185
|
<RefetchController
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useResourceNames } from '@viamrobotics/svelte-sdk'
|
|
3
|
+
|
|
4
|
+
import DoCommand from './do-command.svelte'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
partID: string
|
|
8
|
+
resourceName: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { partID, resourceName }: Props = $props()
|
|
12
|
+
|
|
13
|
+
const resourceNames = useResourceNames(() => partID)
|
|
14
|
+
const resource = $derived(
|
|
15
|
+
resourceNames.current.find((candidate) => candidate.name === resourceName)
|
|
16
|
+
)
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
{#if resource}
|
|
20
|
+
<DoCommand
|
|
21
|
+
{partID}
|
|
22
|
+
{resource}
|
|
23
|
+
/>
|
|
24
|
+
{/if}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import ErrorDisplay from '../../error.svelte'
|
|
6
6
|
import Table from '../../table.svelte'
|
|
7
|
+
import { numberValueFromEvent } from '../../../event-handlers'
|
|
7
8
|
|
|
8
9
|
import { matchArrayLength } from './match-array-length'
|
|
9
10
|
|
|
@@ -36,12 +37,16 @@
|
|
|
36
37
|
})
|
|
37
38
|
|
|
38
39
|
const onChangePos = (index: number, event: Event) => {
|
|
39
|
-
const
|
|
40
|
-
|
|
40
|
+
const value = numberValueFromEvent(event)
|
|
41
|
+
if (value !== undefined) {
|
|
42
|
+
desiredPositions[index] = value
|
|
43
|
+
}
|
|
41
44
|
}
|
|
42
45
|
const onChangeSpeed = (index: number, event: Event) => {
|
|
43
|
-
const
|
|
44
|
-
|
|
46
|
+
const value = numberValueFromEvent(event)
|
|
47
|
+
if (value !== undefined) {
|
|
48
|
+
desiredSpeeds[index] = value
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
const resetToZero = () => {
|
|
47
52
|
desiredSpeeds = matchArrayLength([], positions, 50)
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Pose } from '@viamrobotics/sdk'
|
|
3
3
|
|
|
4
|
-
import { Button, Progress } from '@viamrobotics/prime-core'
|
|
4
|
+
import { Button, Icon, Progress, Tooltip } from '@viamrobotics/prime-core'
|
|
5
5
|
import { CodeEditor } from '@viamrobotics/prime-core/code-editor'
|
|
6
6
|
import { PersistedState } from 'runed'
|
|
7
7
|
|
|
8
8
|
import ErrorDisplay from '../../error.svelte'
|
|
9
|
+
import PoseEditor from '../../pose-editor.svelte'
|
|
9
10
|
|
|
10
11
|
import type { MoveInput } from './parse-move-args'
|
|
11
12
|
|
|
12
|
-
import PoseInput from './pose-input.svelte'
|
|
13
|
-
|
|
14
13
|
interface Props {
|
|
15
14
|
/** The frame being moved. Gates execution and re-seeds the editor on change. */
|
|
16
15
|
frameName: string
|
|
@@ -56,13 +55,37 @@
|
|
|
56
55
|
</script>
|
|
57
56
|
|
|
58
57
|
<div class="flex min-w-0 flex-col gap-4">
|
|
59
|
-
<
|
|
58
|
+
<PoseEditor
|
|
60
59
|
{pose}
|
|
61
60
|
onPoseChange={(next) => {
|
|
62
61
|
edit = { key: editKey, pose: next }
|
|
63
62
|
}}
|
|
63
|
+
title="Destination pose"
|
|
64
|
+
description="The target pose expressed in the selected reference frame. Translations are in millimeters."
|
|
64
65
|
/>
|
|
65
66
|
|
|
67
|
+
<div class="flex flex-col gap-2">
|
|
68
|
+
<span class="flex flex-row gap-2">
|
|
69
|
+
<h4 class="text-xs font-semibold">Quick set</h4>
|
|
70
|
+
<Tooltip>
|
|
71
|
+
<Icon
|
|
72
|
+
name="information-outline"
|
|
73
|
+
cx="text-gray-6"
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
<span slot="description"> Will update the pose values but will not execute </span>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
</span>
|
|
79
|
+
<Button
|
|
80
|
+
class="w-fit"
|
|
81
|
+
onclick={() => {
|
|
82
|
+
edit = { key: editKey, pose: zeroPose }
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
Zero
|
|
86
|
+
</Button>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
66
89
|
<div class="flex flex-col gap-1">
|
|
67
90
|
<span class="text-xs font-medium">
|
|
68
91
|
World state <abbr class="text-subtle-2">(optional JSON)</abbr>
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
import { Label, NumericInput, Select } from '@viamrobotics/prime-core'
|
|
5
5
|
|
|
6
|
+
import { numberValueFromEvent } from '../../../event-handlers'
|
|
7
|
+
|
|
6
8
|
import Download from './download.svelte'
|
|
7
9
|
|
|
8
10
|
interface Props {
|
|
@@ -25,8 +27,9 @@
|
|
|
25
27
|
] as const
|
|
26
28
|
|
|
27
29
|
const handlePointSizeChange = (event: Event) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
const value = numberValueFromEvent(event)
|
|
31
|
+
if (value !== undefined) {
|
|
32
|
+
onPointSizeChange(value)
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createAddImageToDatasetContext, type ImageData, useAddImageToDataset, } from './add-image-to-dataset';
|
|
2
2
|
export { apiDocsHref } from './api-docs-href';
|
|
3
|
-
export { clientForResource } from './client-map';
|
|
3
|
+
export { clientForResource, supportsDoCommand } from './client-map';
|
|
4
4
|
export * from './components';
|
|
5
5
|
export { getResourceAPI } from './get-resource-api';
|
|
6
6
|
export { isKnownResource,
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createAddImageToDatasetContext, useAddImageToDataset, } from './add-image-to-dataset';
|
|
2
2
|
export { apiDocsHref } from './api-docs-href';
|
|
3
|
-
export { clientForResource } from './client-map';
|
|
3
|
+
export { clientForResource, supportsDoCommand } from './client-map';
|
|
4
4
|
export * from './components';
|
|
5
5
|
export { getResourceAPI } from './get-resource-api';
|
|
6
6
|
export { isKnownResource,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Pose } from '@viamrobotics/sdk';
|
|
2
2
|
/**
|
|
3
3
|
* Parses a clipboard string as a pose. Accepts a JSON object with numeric
|
|
4
|
-
* `x`, `y`, `z`, `oX`, `oY`, `oZ`, and `theta` fields — the same shape the
|
|
5
|
-
*
|
|
4
|
+
* `x`, `y`, `z`, `oX`, `oY`, `oZ`, and `theta` fields — the same shape the pose
|
|
5
|
+
* editor copies, so poses can be pasted between any widget that edits one.
|
|
6
6
|
*
|
|
7
7
|
* @param data - The pasted string.
|
|
8
8
|
* @returns The parsed pose, or `undefined` if it is not a valid pose.
|
|
@@ -8,8 +8,8 @@ const isPose = (value) => {
|
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* Parses a clipboard string as a pose. Accepts a JSON object with numeric
|
|
11
|
-
* `x`, `y`, `z`, `oX`, `oY`, `oZ`, and `theta` fields — the same shape the
|
|
12
|
-
*
|
|
11
|
+
* `x`, `y`, `z`, `oX`, `oY`, `oZ`, and `theta` fields — the same shape the pose
|
|
12
|
+
* editor copies, so poses can be pasted between any widget that edits one.
|
|
13
13
|
*
|
|
14
14
|
* @param data - The pasted string.
|
|
15
15
|
* @returns The parsed pose, or `undefined` if it is not a valid pose.
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
interface Props {
|
|
3
|
-
supportedCodecs: string[]
|
|
4
|
-
sampleRateHz: number
|
|
5
|
-
numChannels: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const { supportedCodecs, sampleRateHz, numChannels }: Props = $props()
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<dl class="font-roboto-mono flex flex-col gap-y-2 text-sm">
|
|
12
|
-
<div class="flex flex-col gap-0.5">
|
|
13
|
-
<dt class="text-default w-50 min-w-50 pr-2 font-medium">Supported Codecs</dt>
|
|
14
|
-
<dd class="text-subtle-1">
|
|
15
|
-
{supportedCodecs.length > 0 ? supportedCodecs.join(', ') : 'None'}
|
|
16
|
-
</dd>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="flex flex-col gap-0.5">
|
|
19
|
-
<dt class="text-default w-50 min-w-50 pr-2 font-medium">Sample Rate</dt>
|
|
20
|
-
<dd class="text-subtle-1">{sampleRateHz} Hz</dd>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="flex flex-col gap-0.5">
|
|
23
|
-
<dt class="text-default w-50 min-w-50 pr-2 font-medium">Channels</dt>
|
|
24
|
-
<dd class="text-subtle-1">{numChannels}</dd>
|
|
25
|
-
</div>
|
|
26
|
-
</dl>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Pose } from '@viamrobotics/sdk';
|
|
2
|
-
interface Props {
|
|
3
|
-
pose: Pose;
|
|
4
|
-
onPoseChange: (pose: Pose) => void;
|
|
5
|
-
}
|
|
6
|
-
declare const PoseInput: import("svelte").Component<Props, {}, "">;
|
|
7
|
-
type PoseInput = ReturnType<typeof PoseInput>;
|
|
8
|
-
export default PoseInput;
|
|
File without changes
|