@wandelbots/wandelbots-js-react-components 4.2.0-pr.feat-JoggingPanelSupportForLinearAxis.514.bd93b8d → 4.2.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/README.md +1 -1
- package/dist/components/jogging/JoggingJointRotationControl.d.ts +15 -0
- package/dist/components/jogging/JoggingJointRotationControl.d.ts.map +1 -0
- package/dist/components/jogging/JoggingJointTab.d.ts +1 -1
- package/dist/components/jogging/JoggingJointTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +19 -17
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/core.cjs.js +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.es.js +7 -7
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +10 -10
- package/dist/lib/JoggerConnection.d.ts +3 -4
- package/dist/lib/JoggerConnection.d.ts.map +1 -1
- package/dist/{theming-DDgLNzuF.js → theming-C-zvh022.js} +2891 -2915
- package/dist/theming-C-zvh022.js.map +1 -0
- package/dist/{theming-DU4-bToO.cjs → theming-Dk07SE2_.cjs} +36 -36
- package/dist/theming-Dk07SE2_.cjs.map +1 -0
- package/package.json +1 -1
- package/src/components/jogging/{JoggingJointValueControl.tsx → JoggingJointRotationControl.tsx} +28 -51
- package/src/components/jogging/JoggingJointTab.tsx +18 -18
- package/src/components/jogging/JoggingStore.ts +12 -42
- package/src/core.ts +1 -2
- package/src/lib/JoggerConnection.test.ts +2 -4
- package/src/lib/JoggerConnection.ts +6 -10
- package/dist/components/jogging/JoggingJointValueControl.d.ts +0 -16
- package/dist/components/jogging/JoggingJointValueControl.d.ts.map +0 -1
- package/dist/theming-DDgLNzuF.js.map +0 -1
- package/dist/theming-DU4-bToO.cjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "4.2.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
package/src/components/jogging/{JoggingJointValueControl.tsx → JoggingJointRotationControl.tsx}
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import ChevronLeft from "@mui/icons-material/ChevronLeft"
|
|
2
2
|
import ChevronRight from "@mui/icons-material/ChevronRight"
|
|
3
|
-
import { radiansToDegrees } from "@wandelbots/nova-js"
|
|
4
3
|
import { IconButton, Slider, Typography, useTheme } from "@mui/material"
|
|
5
4
|
import Stack from "@mui/material/Stack"
|
|
6
5
|
import throttle from "lodash-es/throttle"
|
|
@@ -10,29 +9,28 @@ import { useTranslation } from "react-i18next"
|
|
|
10
9
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
11
10
|
import { useAnimationFrame } from "../utils/hooks"
|
|
12
11
|
|
|
13
|
-
type
|
|
12
|
+
type JoggingJointRotationControlProps = {
|
|
14
13
|
startJogging: (direction: "-" | "+") => void
|
|
15
14
|
stopJogging: () => void
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
lowerLimitDegs?: number
|
|
16
|
+
upperLimitDegs?: number
|
|
17
|
+
getValueDegs: () => number | undefined
|
|
18
|
+
|
|
20
19
|
disabled?: boolean
|
|
21
20
|
} & React.ComponentProps<typeof Stack>
|
|
22
21
|
|
|
23
22
|
/** A input widget to control an individual joint */
|
|
24
|
-
export const
|
|
23
|
+
export const JoggingJointRotationControl = externalizeComponent(
|
|
25
24
|
observer(
|
|
26
25
|
({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}: JoggingJointValueControlProps) => {
|
|
26
|
+
startJogging,
|
|
27
|
+
stopJogging,
|
|
28
|
+
lowerLimitDegs,
|
|
29
|
+
upperLimitDegs,
|
|
30
|
+
getValueDegs,
|
|
31
|
+
disabled,
|
|
32
|
+
...rest
|
|
33
|
+
}: JoggingJointRotationControlProps) => {
|
|
36
34
|
const { t } = useTranslation()
|
|
37
35
|
const [currentValue, setCurrentValue] = useState<number | undefined>()
|
|
38
36
|
const theme = useTheme()
|
|
@@ -57,18 +55,11 @@ export const JoggingJointValueControl = externalizeComponent(
|
|
|
57
55
|
}))
|
|
58
56
|
|
|
59
57
|
const updateValue = throttle(() => {
|
|
60
|
-
setCurrentValue(
|
|
58
|
+
setCurrentValue(getValueDegs())
|
|
61
59
|
}, 50)
|
|
62
60
|
|
|
63
61
|
useAnimationFrame(updateValue)
|
|
64
62
|
|
|
65
|
-
function convertToDegree(value: number| undefined){
|
|
66
|
-
if (value == undefined){
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
return radiansToDegrees(value);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
63
|
function onPointerDownMinus(ev: React.PointerEvent) {
|
|
73
64
|
// Stop right click from triggering jog
|
|
74
65
|
if (ev.button === 0) state.startJogging("-")
|
|
@@ -99,20 +90,6 @@ export const JoggingJointValueControl = externalizeComponent(
|
|
|
99
90
|
return output
|
|
100
91
|
}
|
|
101
92
|
}
|
|
102
|
-
function formatMm(value: number | undefined, precision = 1) {
|
|
103
|
-
if (value === undefined || isNaN(value)) return ""
|
|
104
|
-
|
|
105
|
-
const output = t("General.mm.variable", {
|
|
106
|
-
amount: value.toFixed(precision),
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
if (value > 0 && precision === 0) {
|
|
110
|
-
return `+${output}`
|
|
111
|
-
} else {
|
|
112
|
-
return output
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
93
|
|
|
117
94
|
return (
|
|
118
95
|
<Stack
|
|
@@ -161,8 +138,8 @@ export const JoggingJointValueControl = externalizeComponent(
|
|
|
161
138
|
sx={{
|
|
162
139
|
pointerEvents: "none",
|
|
163
140
|
color:
|
|
164
|
-
|
|
165
|
-
|
|
141
|
+
theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint
|
|
142
|
+
?.arrowColor,
|
|
166
143
|
}}
|
|
167
144
|
/>
|
|
168
145
|
</IconButton>
|
|
@@ -194,14 +171,14 @@ export const JoggingJointValueControl = externalizeComponent(
|
|
|
194
171
|
: theme.palette.text.primary,
|
|
195
172
|
}}
|
|
196
173
|
>
|
|
197
|
-
{
|
|
174
|
+
{formatDegrees(currentValue)}
|
|
198
175
|
</Typography>
|
|
199
176
|
|
|
200
177
|
<Slider
|
|
201
178
|
disabled
|
|
202
179
|
aria-label="Joint position"
|
|
203
|
-
min={
|
|
204
|
-
max={
|
|
180
|
+
min={lowerLimitDegs}
|
|
181
|
+
max={upperLimitDegs}
|
|
205
182
|
value={currentValue || 0}
|
|
206
183
|
track={false}
|
|
207
184
|
sx={{
|
|
@@ -229,15 +206,15 @@ export const JoggingJointValueControl = externalizeComponent(
|
|
|
229
206
|
},
|
|
230
207
|
}}
|
|
231
208
|
marks={
|
|
232
|
-
|
|
233
|
-
|
|
209
|
+
lowerLimitDegs !== undefined &&
|
|
210
|
+
upperLimitDegs !== undefined && [
|
|
234
211
|
{
|
|
235
|
-
value:
|
|
236
|
-
label:
|
|
212
|
+
value: lowerLimitDegs,
|
|
213
|
+
label: formatDegrees(lowerLimitDegs, 0),
|
|
237
214
|
},
|
|
238
215
|
{
|
|
239
|
-
value:
|
|
240
|
-
label:
|
|
216
|
+
value: upperLimitDegs,
|
|
217
|
+
label: formatDegrees(upperLimitDegs, 0),
|
|
241
218
|
},
|
|
242
219
|
]
|
|
243
220
|
}
|
|
@@ -259,8 +236,8 @@ export const JoggingJointValueControl = externalizeComponent(
|
|
|
259
236
|
sx={{
|
|
260
237
|
pointerEvents: "none",
|
|
261
238
|
color:
|
|
262
|
-
|
|
263
|
-
|
|
239
|
+
theme.componentsExt?.JoggingPanel?.JoggingJoint?.Joint
|
|
240
|
+
?.arrowColor,
|
|
264
241
|
}}
|
|
265
242
|
/>
|
|
266
243
|
</IconButton>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Divider, Stack, Typography, useTheme } from "@mui/material"
|
|
2
|
+
import { radiansToDegrees } from "@wandelbots/nova-js"
|
|
2
3
|
import { observer } from "mobx-react-lite"
|
|
3
4
|
import type { ReactNode } from "react"
|
|
4
5
|
import { JoggingJointLimitDetector } from "./JoggingJointLimitDetector"
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { JoggingJointRotationControl } from "./JoggingJointRotationControl"
|
|
7
|
+
import type { JoggingStore } from "./JoggingStore"
|
|
7
8
|
import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
|
|
8
9
|
|
|
9
10
|
export const JoggingJointTab = observer(
|
|
@@ -11,22 +12,14 @@ export const JoggingJointTab = observer(
|
|
|
11
12
|
const theme = useTheme()
|
|
12
13
|
async function startJointJogging(opts: {
|
|
13
14
|
joint: number
|
|
14
|
-
direction: "-" | "+"
|
|
15
|
+
direction: "-" | "+"
|
|
15
16
|
}) {
|
|
16
17
|
await store.activate()
|
|
17
18
|
|
|
18
19
|
await store.jogger.rotateJoints({
|
|
19
20
|
joint: opts.joint,
|
|
20
21
|
direction: opts.direction,
|
|
21
|
-
|
|
22
|
-
store.jointCategory === JointCategory.PRISMATIC
|
|
23
|
-
? "mm/s"
|
|
24
|
-
: "rad/s",
|
|
25
|
-
velocityValue:
|
|
26
|
-
store.jointCategory === JointCategory.PRISMATIC
|
|
27
|
-
? store.translationVelocityMmPerSec
|
|
28
|
-
: store.rotationVelocityRadsPerSec,
|
|
29
|
-
|
|
22
|
+
velocityRadsPerSec: store.rotationVelocityRadsPerSec,
|
|
30
23
|
})
|
|
31
24
|
}
|
|
32
25
|
|
|
@@ -50,6 +43,14 @@ export const JoggingJointTab = observer(
|
|
|
50
43
|
const jointLimits =
|
|
51
44
|
store.motionGroupDescription.operation_limits.auto_limits
|
|
52
45
|
?.joints?.[joint.index]?.position
|
|
46
|
+
const lowerLimitDegs =
|
|
47
|
+
jointLimits?.lower_limit !== undefined
|
|
48
|
+
? radiansToDegrees(jointLimits.lower_limit)
|
|
49
|
+
: undefined
|
|
50
|
+
const upperLimitDegs =
|
|
51
|
+
jointLimits?.upper_limit !== undefined
|
|
52
|
+
? radiansToDegrees(jointLimits.upper_limit)
|
|
53
|
+
: undefined
|
|
53
54
|
|
|
54
55
|
return (
|
|
55
56
|
<Stack
|
|
@@ -72,17 +73,16 @@ export const JoggingJointTab = observer(
|
|
|
72
73
|
</Typography>
|
|
73
74
|
)}
|
|
74
75
|
|
|
75
|
-
<
|
|
76
|
+
<JoggingJointRotationControl
|
|
76
77
|
disabled={store.isLocked}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
getValue={() => {
|
|
78
|
+
lowerLimitDegs={lowerLimitDegs}
|
|
79
|
+
upperLimitDegs={upperLimitDegs}
|
|
80
|
+
getValueDegs={() => {
|
|
81
81
|
const value =
|
|
82
82
|
store.jogger.motionStream.rapidlyChangingMotionState
|
|
83
83
|
.joint_position[joint.index]
|
|
84
84
|
return value !== undefined
|
|
85
|
-
? value
|
|
85
|
+
? radiansToDegrees(value)
|
|
86
86
|
: undefined
|
|
87
87
|
}}
|
|
88
88
|
startJogging={(direction: "-" | "+") =>
|
|
@@ -40,16 +40,8 @@ export type IncrementJogInProgress = {
|
|
|
40
40
|
axis: JoggingAxis
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export enum JointCategory {
|
|
44
|
-
REVOLUTE = "REVOLUTE",
|
|
45
|
-
PRISMATIC = "PRISMATIC",
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
type TabType = "cartesian" | "joint" | "debug";
|
|
49
|
-
|
|
50
|
-
|
|
51
43
|
export class JoggingStore {
|
|
52
|
-
selectedTabId:
|
|
44
|
+
selectedTabId: "cartesian" | "joint" | "debug" = "cartesian"
|
|
53
45
|
|
|
54
46
|
/**
|
|
55
47
|
* State of the jogging panel. Starts as "inactive"
|
|
@@ -306,20 +298,18 @@ export class JoggingStore {
|
|
|
306
298
|
}
|
|
307
299
|
|
|
308
300
|
get tabs() {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
label: "Joints",
|
|
312
|
-
}] ;
|
|
313
|
-
if(this.isTcpCartesianMoveable){
|
|
314
|
-
tempTabs.unshift({
|
|
301
|
+
return [
|
|
302
|
+
{
|
|
315
303
|
id: "cartesian",
|
|
316
|
-
label: "
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
304
|
+
label: "cartesian",
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
id: "joint",
|
|
308
|
+
label: "joint",
|
|
309
|
+
},
|
|
310
|
+
] as const
|
|
320
311
|
}
|
|
321
312
|
|
|
322
|
-
|
|
323
313
|
get incrementOptions() {
|
|
324
314
|
return incrementOptions
|
|
325
315
|
}
|
|
@@ -405,10 +395,8 @@ export class JoggingStore {
|
|
|
405
395
|
*/
|
|
406
396
|
get currentMotionType() {
|
|
407
397
|
if (
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
this.selectedCartesianMotionType === "translate"
|
|
411
|
-
) || this.jointCategory === JointCategory.PRISMATIC
|
|
398
|
+
this.selectedTabId === "cartesian" &&
|
|
399
|
+
this.selectedCartesianMotionType === "translate"
|
|
412
400
|
) {
|
|
413
401
|
return "translate"
|
|
414
402
|
} else {
|
|
@@ -416,24 +404,6 @@ export class JoggingStore {
|
|
|
416
404
|
}
|
|
417
405
|
}
|
|
418
406
|
|
|
419
|
-
|
|
420
|
-
/*
|
|
421
|
-
* ToDo replace Hardcoded Models with an api requst that delivers the type (will become part of DH-Parameters)
|
|
422
|
-
* Ticket already created
|
|
423
|
-
* */
|
|
424
|
-
get jointCategory(): JointCategory {
|
|
425
|
-
return this.motionGroupDescription.motion_group_model === "ABB_IRT710"
|
|
426
|
-
? JointCategory.PRISMATIC
|
|
427
|
-
: JointCategory.REVOLUTE
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
get isTcpCartesianMoveable(): boolean{
|
|
431
|
-
if(this.motionGroupDescription.motion_group_model === "ABB_IRT710"){
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
return true;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
407
|
onTabChange(_event: React.SyntheticEvent, newValue: number) {
|
|
438
408
|
const tab = this.tabs[newValue] || this.tabs[0]!
|
|
439
409
|
this.selectedTabId = tab.id
|
package/src/core.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from "./components/AppHeader"
|
|
|
3
3
|
export * from "./components/CycleTimer"
|
|
4
4
|
export * from "./components/DataGrid"
|
|
5
5
|
export * from "./components/jogging/JoggingCartesianAxisControl"
|
|
6
|
-
export * from "./components/jogging/
|
|
6
|
+
export * from "./components/jogging/JoggingJointRotationControl"
|
|
7
7
|
export * from "./components/jogging/JoggingPanel"
|
|
8
8
|
export { JoggingStore } from "./components/jogging/JoggingStore"
|
|
9
9
|
export * from "./components/jogging/PoseCartesianValues"
|
|
@@ -31,4 +31,3 @@ export * from "./lib/motionStateUpdate"
|
|
|
31
31
|
export * from "./lib/MotionStreamConnection"
|
|
32
32
|
export * from "./themes/themeTypes"
|
|
33
33
|
export { createNovaMuiTheme } from "./themes/theming"
|
|
34
|
-
|
|
@@ -77,8 +77,7 @@ test("jog a robot somewhat", async () => {
|
|
|
77
77
|
await jogger.rotateJoints({
|
|
78
78
|
joint: 0,
|
|
79
79
|
direction: "+",
|
|
80
|
-
|
|
81
|
-
velocityUnit: "rad/s",
|
|
80
|
+
velocityRadsPerSec: 0.1,
|
|
82
81
|
})
|
|
83
82
|
|
|
84
83
|
await delay(500)
|
|
@@ -95,8 +94,7 @@ test("jog a robot somewhat", async () => {
|
|
|
95
94
|
await jogger.rotateJoints({
|
|
96
95
|
joint: 0,
|
|
97
96
|
direction: "-",
|
|
98
|
-
|
|
99
|
-
velocityUnit: "rad/s",
|
|
97
|
+
velocityRadsPerSec: 0.1,
|
|
100
98
|
})
|
|
101
99
|
await delay(500)
|
|
102
100
|
await jogger.stop()
|
|
@@ -280,20 +280,16 @@ export class JoggerConnection {
|
|
|
280
280
|
* Jogging: Start rotation of a single robot joint at the specified velocity
|
|
281
281
|
*/
|
|
282
282
|
async rotateJoints({
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
velocityUnit
|
|
287
|
-
|
|
283
|
+
joint,
|
|
284
|
+
direction,
|
|
285
|
+
velocityRadsPerSec,
|
|
288
286
|
}: {
|
|
289
287
|
/** Index of the joint to rotate */
|
|
290
288
|
joint: number
|
|
291
289
|
/** Direction of rotation ("+" or "-") */
|
|
292
290
|
direction: "+" | "-"
|
|
293
|
-
/** Speed of the rotation
|
|
294
|
-
|
|
295
|
-
velocityUnit: "mm/s" | "rad/s"
|
|
296
|
-
|
|
291
|
+
/** Speed of the rotation in radians per second */
|
|
292
|
+
velocityRadsPerSec: number
|
|
297
293
|
}) {
|
|
298
294
|
if (!this.joggingSocket || this.mode !== "jogging") {
|
|
299
295
|
throw new Error(
|
|
@@ -304,7 +300,7 @@ export class JoggerConnection {
|
|
|
304
300
|
const velocity = new Array(this.numJoints).fill(0)
|
|
305
301
|
|
|
306
302
|
velocity[joint] =
|
|
307
|
-
direction === "-" ? -
|
|
303
|
+
direction === "-" ? -velocityRadsPerSec : velocityRadsPerSec
|
|
308
304
|
|
|
309
305
|
this.joggingSocket.sendJson({
|
|
310
306
|
message_type: "JointVelocityRequest",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Stack from "@mui/material/Stack";
|
|
2
|
-
type JoggingJointValueControlProps = {
|
|
3
|
-
startJogging: (direction: "-" | "+") => void;
|
|
4
|
-
stopJogging: () => void;
|
|
5
|
-
lowerLimit?: number;
|
|
6
|
-
upperLimit?: number;
|
|
7
|
-
useDegree: boolean;
|
|
8
|
-
getValue: () => number | undefined;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
} & React.ComponentProps<typeof Stack>;
|
|
11
|
-
/** A input widget to control an individual joint */
|
|
12
|
-
export declare const JoggingJointValueControl: (({ startJogging, stopJogging, lowerLimit, upperLimit, useDegree, getValue, disabled, ...rest }: JoggingJointValueControlProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
13
|
-
displayName: string;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=JoggingJointValueControl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JoggingJointValueControl.d.ts","sourceRoot":"","sources":["../../../src/components/jogging/JoggingJointValueControl.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,qBAAqB,CAAA;AAQvC,KAAK,6BAA6B,GAAG;IACnC,YAAY,EAAE,CAAC,SAAS,EAAE,GAAG,GAAG,GAAG,KAAK,IAAI,CAAA;IAC5C,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,QAAQ,EAAE,MAAM,MAAM,GAAG,SAAS,CAAA;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,KAAK,CAAC,CAAA;AAEtC,oDAAoD;AACpD,eAAO,MAAM,wBAAwB,mGAW7B,6BAA6B;;CA4OpC,CAAA"}
|