@wandelbots/wandelbots-js-react-components 2.41.0-pr.feature-seperate-timer.383.35a3a58 → 2.41.0-pr.feature-seperate-timer.383.20b279f
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/jogging/PoseCartesianValues.d.ts +3 -6
- package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts +2 -6
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/index.cjs +34 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2047 -2130
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/jogging/PoseCartesianValues.tsx +15 -86
- package/src/components/jogging/PoseJointValues.tsx +16 -87
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.41.0-pr.feature-seperate-timer.383.
|
|
3
|
+
"version": "2.41.0-pr.feature-seperate-timer.383.20b279f",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -1,96 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Stack } from "@mui/material"
|
|
2
2
|
import { poseToWandelscriptString } from "@wandelbots/nova-js"
|
|
3
|
-
import type {
|
|
4
|
-
ConnectedMotionGroup,
|
|
5
|
-
MotionStreamConnection,
|
|
6
|
-
} from "@wandelbots/nova-js/v1"
|
|
3
|
+
import type { TcpPose } from "@wandelbots/nova-js/v1"
|
|
7
4
|
import { observer } from "mobx-react-lite"
|
|
8
|
-
import { useRef, useState } from "react"
|
|
9
5
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
10
6
|
import { CopyableText } from "../CopyableText"
|
|
11
|
-
import { useAnimationFrame } from "../utils/hooks"
|
|
12
7
|
|
|
13
8
|
export type PoseCartesianValuesProps = {
|
|
14
|
-
|
|
15
|
-
motionStream?: MotionStreamConnection
|
|
16
|
-
connectedMotionGroup?: ConnectedMotionGroup
|
|
17
|
-
showCopyButton?: boolean
|
|
9
|
+
pose: TcpPose
|
|
18
10
|
}
|
|
19
11
|
|
|
20
12
|
export const PoseCartesianValues = externalizeComponent(
|
|
21
|
-
observer(
|
|
22
|
-
(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function getCurrentPoseString() {
|
|
37
|
-
const tcpPose = motionStream
|
|
38
|
-
? motionStream.rapidlyChangingMotionState.tcp_pose
|
|
39
|
-
: connectedMotionGroup?.rapidlyChangingMotionState.tcp_pose
|
|
40
|
-
|
|
41
|
-
if (!tcpPose) return ""
|
|
42
|
-
return poseToWandelscriptString(tcpPose)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const handleCopy = async () => {
|
|
46
|
-
try {
|
|
47
|
-
await navigator.clipboard.writeText(getCurrentPoseString())
|
|
48
|
-
setCopyMessage("Copied!")
|
|
49
|
-
setTimeout(() => setCopyMessage(""), 2000)
|
|
50
|
-
} catch {
|
|
51
|
-
setCopyMessage("Copy failed")
|
|
52
|
-
setTimeout(() => setCopyMessage(""), 2000)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
useAnimationFrame(() => {
|
|
57
|
-
if (!poseHolderRef.current) {
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
const newPoseContent = getCurrentPoseString()
|
|
61
|
-
if (poseHolderRef.current.textContent === newPoseContent) {
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
poseHolderRef.current.textContent = newPoseContent
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Stack
|
|
70
|
-
direction="row"
|
|
71
|
-
alignItems="center"
|
|
72
|
-
spacing={1}
|
|
73
|
-
sx={{ flexGrow: 1, minWidth: 0, overflow: "hidden" }}
|
|
74
|
-
>
|
|
75
|
-
<CopyableText value={getCurrentPoseString()} ref={poseHolderRef} />
|
|
76
|
-
{showCopyButton && (
|
|
77
|
-
<Button
|
|
78
|
-
variant="contained"
|
|
79
|
-
color="secondary"
|
|
80
|
-
size="small"
|
|
81
|
-
onClick={handleCopy}
|
|
82
|
-
sx={{ flexShrink: 0 }}
|
|
83
|
-
>
|
|
84
|
-
Copy
|
|
85
|
-
</Button>
|
|
86
|
-
)}
|
|
87
|
-
{copyMessage && (
|
|
88
|
-
<Typography variant="caption" color="success.main">
|
|
89
|
-
{copyMessage}
|
|
90
|
-
</Typography>
|
|
91
|
-
)}
|
|
92
|
-
</Stack>
|
|
93
|
-
)
|
|
94
|
-
},
|
|
95
|
-
),
|
|
13
|
+
observer(({ pose }: PoseCartesianValuesProps) => {
|
|
14
|
+
return (
|
|
15
|
+
<Stack
|
|
16
|
+
alignItems="left"
|
|
17
|
+
spacing={2}
|
|
18
|
+
sx={{ flexGrow: 1, minWidth: 0, overflow: "hidden" }}
|
|
19
|
+
data-testid="pose-cartesian-values"
|
|
20
|
+
>
|
|
21
|
+
<CopyableText value={poseToWandelscriptString(pose)} />
|
|
22
|
+
</Stack>
|
|
23
|
+
)
|
|
24
|
+
}),
|
|
96
25
|
)
|
|
@@ -1,96 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
ConnectedMotionGroup,
|
|
4
|
-
MotionStreamConnection,
|
|
5
|
-
} from "@wandelbots/nova-js/v1"
|
|
1
|
+
import { Stack } from "@mui/material"
|
|
6
2
|
import { observer } from "mobx-react-lite"
|
|
7
|
-
import { useRef, useState } from "react"
|
|
8
3
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
9
4
|
import { CopyableText } from "../CopyableText"
|
|
10
|
-
import { useAnimationFrame } from "../utils/hooks"
|
|
11
5
|
|
|
12
6
|
export type PoseJointValuesProps = {
|
|
13
|
-
|
|
14
|
-
motionStream?: MotionStreamConnection
|
|
15
|
-
connectedMotionGroup?: ConnectedMotionGroup
|
|
16
|
-
showCopyButton?: boolean
|
|
7
|
+
pose: number[]
|
|
17
8
|
}
|
|
18
9
|
|
|
19
10
|
export const PoseJointValues = externalizeComponent(
|
|
20
|
-
observer(
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function getCurrentPoseString() {
|
|
36
|
-
const joints = motionStream
|
|
37
|
-
? motionStream.rapidlyChangingMotionState.state.joint_position.joints
|
|
38
|
-
: connectedMotionGroup?.rapidlyChangingMotionState.state
|
|
39
|
-
.joint_position.joints
|
|
40
|
-
|
|
41
|
-
if (!joints) return ""
|
|
42
|
-
return `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const handleCopy = async () => {
|
|
46
|
-
try {
|
|
47
|
-
await navigator.clipboard.writeText(getCurrentPoseString())
|
|
48
|
-
setCopyMessage("Copied!")
|
|
49
|
-
setTimeout(() => setCopyMessage(""), 2000)
|
|
50
|
-
} catch {
|
|
51
|
-
setCopyMessage("Copy failed")
|
|
52
|
-
setTimeout(() => setCopyMessage(""), 2000)
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
useAnimationFrame(() => {
|
|
57
|
-
if (!poseHolderRef.current) {
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
const newPoseContent = getCurrentPoseString()
|
|
61
|
-
if (poseHolderRef.current.textContent === newPoseContent) {
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
poseHolderRef.current.textContent = newPoseContent
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<Stack
|
|
70
|
-
direction="row"
|
|
71
|
-
alignItems="center"
|
|
72
|
-
spacing={1}
|
|
73
|
-
sx={{ flexGrow: 1, minWidth: 0, overflow: "hidden" }}
|
|
74
|
-
>
|
|
75
|
-
<CopyableText value={getCurrentPoseString()} ref={poseHolderRef} />
|
|
76
|
-
{showCopyButton && (
|
|
77
|
-
<Button
|
|
78
|
-
variant="contained"
|
|
79
|
-
color="secondary"
|
|
80
|
-
size="small"
|
|
81
|
-
onClick={handleCopy}
|
|
82
|
-
sx={{ flexShrink: 0 }}
|
|
83
|
-
>
|
|
84
|
-
Copy
|
|
85
|
-
</Button>
|
|
86
|
-
)}
|
|
87
|
-
{copyMessage && (
|
|
88
|
-
<Typography variant="caption" color="success.main">
|
|
89
|
-
{copyMessage}
|
|
90
|
-
</Typography>
|
|
91
|
-
)}
|
|
92
|
-
</Stack>
|
|
93
|
-
)
|
|
94
|
-
},
|
|
95
|
-
),
|
|
11
|
+
observer(({ pose }: PoseJointValuesProps) => {
|
|
12
|
+
const poseString = `[${pose.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<Stack
|
|
16
|
+
alignItems="left"
|
|
17
|
+
spacing={2}
|
|
18
|
+
sx={{ flexGrow: 1, minWidth: 0, overflow: "hidden" }}
|
|
19
|
+
data-testid="pose-joint-values"
|
|
20
|
+
>
|
|
21
|
+
<CopyableText value={poseString} />
|
|
22
|
+
</Stack>
|
|
23
|
+
)
|
|
24
|
+
}),
|
|
96
25
|
)
|