@wandelbots/wandelbots-js-react-components 2.41.0-pr.feature-seperate-timer.383.cd7e408 → 2.41.0-pr.feature-seperate-timer.383.ed84a08
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.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2666 -2673
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/jogging/PoseCartesianValues.tsx +27 -36
- package/src/components/jogging/PoseJointValues.tsx +34 -37
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.ed84a08",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
60
60
|
"@rollup/plugin-terser": "^0.4.4",
|
|
61
61
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
62
|
-
"@storybook/addon-docs": "^9.1.
|
|
63
|
-
"@storybook/react-vite": "^9.1.
|
|
62
|
+
"@storybook/addon-docs": "^9.1.6",
|
|
63
|
+
"@storybook/react-vite": "^9.1.6",
|
|
64
64
|
"@storybook/test-runner": "^0.23.0",
|
|
65
65
|
"@svgr/rollup": "^8.1.0",
|
|
66
66
|
"@testing-library/jest-dom": "^6.6.3",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@vitejs/plugin-react": "^4.3.4",
|
|
73
73
|
"@wandelbots/nova-js": "^2.1.0",
|
|
74
74
|
"add": "^2.0.6",
|
|
75
|
-
"eslint-plugin-storybook": "^9.1.
|
|
75
|
+
"eslint-plugin-storybook": "^9.1.6",
|
|
76
76
|
"glob": "^11.0.1",
|
|
77
77
|
"http-server": "^14.1.1",
|
|
78
78
|
"husky": "^9.1.7",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
96
96
|
"rollup-plugin-postcss": "^4.0.2",
|
|
97
97
|
"semantic-release": "^24.2.3",
|
|
98
|
-
"storybook": "^9.1.
|
|
98
|
+
"storybook": "^9.1.6",
|
|
99
99
|
"storybook-preset-inline-svg": "^1.0.1",
|
|
100
100
|
"three": "^0.174.0",
|
|
101
101
|
"three-stdlib": "^2.35.14",
|
|
@@ -9,29 +9,7 @@ import { observer } from "mobx-react-lite"
|
|
|
9
9
|
import { useRef, useState } from "react"
|
|
10
10
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
11
11
|
import { CopyableText } from "../CopyableText"
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
/** Minimal interface for what PoseCartesianValues needs from motion stream */
|
|
15
|
-
type MotionStateProvider = {
|
|
16
|
-
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** Creates a motion state provider from either a MotionStreamConnection or ConnectedMotionGroup */
|
|
20
|
-
function createMotionStateProvider(
|
|
21
|
-
motionStream?: MotionStreamConnection,
|
|
22
|
-
connectedMotionGroup?: ConnectedMotionGroup,
|
|
23
|
-
): MotionStateProvider | undefined {
|
|
24
|
-
if (motionStream) {
|
|
25
|
-
return motionStream
|
|
26
|
-
}
|
|
27
|
-
if (connectedMotionGroup) {
|
|
28
|
-
return {
|
|
29
|
-
rapidlyChangingMotionState:
|
|
30
|
-
connectedMotionGroup.rapidlyChangingMotionState,
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return undefined
|
|
34
|
-
}
|
|
12
|
+
import { useAutorun } from "../utils/hooks"
|
|
35
13
|
|
|
36
14
|
export type PoseCartesianValuesProps = {
|
|
37
15
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
@@ -50,20 +28,19 @@ export const PoseCartesianValues = externalizeComponent(
|
|
|
50
28
|
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
51
29
|
const [copyMessage, setCopyMessage] = useState("")
|
|
52
30
|
|
|
53
|
-
|
|
54
|
-
motionStream,
|
|
55
|
-
connectedMotionGroup,
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
if (!activeMotionStream) {
|
|
31
|
+
if (!motionStream && !connectedMotionGroup) {
|
|
59
32
|
throw new Error(
|
|
60
33
|
"PoseCartesianValues requires either motionStream or connectedMotionGroup prop",
|
|
61
34
|
)
|
|
62
35
|
}
|
|
63
36
|
|
|
64
37
|
function getCurrentPoseString() {
|
|
65
|
-
|
|
66
|
-
|
|
38
|
+
let tcpPose: MotionGroupStateResponse["tcp_pose"] | undefined
|
|
39
|
+
if (motionStream) {
|
|
40
|
+
tcpPose = motionStream.rapidlyChangingMotionState.tcp_pose
|
|
41
|
+
} else if (connectedMotionGroup) {
|
|
42
|
+
tcpPose = connectedMotionGroup.rapidlyChangingMotionState.tcp_pose
|
|
43
|
+
}
|
|
67
44
|
if (!tcpPose) return ""
|
|
68
45
|
return poseToWandelscriptString(tcpPose)
|
|
69
46
|
}
|
|
@@ -79,16 +56,30 @@ export const PoseCartesianValues = externalizeComponent(
|
|
|
79
56
|
}
|
|
80
57
|
}
|
|
81
58
|
|
|
82
|
-
|
|
59
|
+
useAutorun(() => {
|
|
83
60
|
if (!poseHolderRef.current) {
|
|
84
61
|
return
|
|
85
62
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
|
|
64
|
+
let tcpPose: MotionGroupStateResponse["tcp_pose"] | undefined
|
|
65
|
+
if (motionStream) {
|
|
66
|
+
tcpPose = motionStream.rapidlyChangingMotionState.tcp_pose
|
|
67
|
+
} else if (connectedMotionGroup) {
|
|
68
|
+
tcpPose = connectedMotionGroup.rapidlyChangingMotionState.tcp_pose
|
|
89
69
|
}
|
|
90
70
|
|
|
91
|
-
|
|
71
|
+
if (!tcpPose) return
|
|
72
|
+
|
|
73
|
+
const newPoseContent = poseToWandelscriptString(tcpPose)
|
|
74
|
+
|
|
75
|
+
requestAnimationFrame(() => {
|
|
76
|
+
if (
|
|
77
|
+
poseHolderRef.current &&
|
|
78
|
+
poseHolderRef.current.textContent !== newPoseContent
|
|
79
|
+
) {
|
|
80
|
+
poseHolderRef.current.textContent = newPoseContent
|
|
81
|
+
}
|
|
82
|
+
})
|
|
92
83
|
})
|
|
93
84
|
|
|
94
85
|
return (
|
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
import { Button, Stack, Typography } from "@mui/material"
|
|
2
2
|
import type {
|
|
3
3
|
ConnectedMotionGroup,
|
|
4
|
-
MotionGroupStateResponse,
|
|
5
4
|
MotionStreamConnection,
|
|
6
5
|
} from "@wandelbots/nova-js/v1"
|
|
7
6
|
import { observer } from "mobx-react-lite"
|
|
8
7
|
import { useRef, useState } from "react"
|
|
9
8
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
10
9
|
import { CopyableText } from "../CopyableText"
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
/** Minimal interface for what PoseJointValues needs from motion stream */
|
|
14
|
-
type MotionStateProvider = {
|
|
15
|
-
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/** Creates a motion state provider from either a MotionStreamConnection or ConnectedMotionGroup */
|
|
19
|
-
function createMotionStateProvider(
|
|
20
|
-
motionStream?: MotionStreamConnection,
|
|
21
|
-
connectedMotionGroup?: ConnectedMotionGroup,
|
|
22
|
-
): MotionStateProvider | undefined {
|
|
23
|
-
if (motionStream) {
|
|
24
|
-
return motionStream
|
|
25
|
-
}
|
|
26
|
-
if (connectedMotionGroup) {
|
|
27
|
-
return {
|
|
28
|
-
rapidlyChangingMotionState:
|
|
29
|
-
connectedMotionGroup.rapidlyChangingMotionState,
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return undefined
|
|
33
|
-
}
|
|
10
|
+
import { useAutorun } from "../utils/hooks"
|
|
34
11
|
|
|
35
12
|
export type PoseJointValuesProps = {
|
|
36
13
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
@@ -49,21 +26,24 @@ export const PoseJointValues = externalizeComponent(
|
|
|
49
26
|
const poseHolderRef = useRef<HTMLDivElement>(null)
|
|
50
27
|
const [copyMessage, setCopyMessage] = useState("")
|
|
51
28
|
|
|
52
|
-
|
|
53
|
-
motionStream,
|
|
54
|
-
connectedMotionGroup,
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
if (!activeMotionStream) {
|
|
29
|
+
if (!motionStream && !connectedMotionGroup) {
|
|
58
30
|
throw new Error(
|
|
59
31
|
"PoseJointValues requires either motionStream or connectedMotionGroup prop",
|
|
60
32
|
)
|
|
61
33
|
}
|
|
62
34
|
|
|
63
35
|
function getCurrentPoseString() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
36
|
+
let joints: number[]
|
|
37
|
+
if (motionStream) {
|
|
38
|
+
joints =
|
|
39
|
+
motionStream.rapidlyChangingMotionState.state.joint_position.joints
|
|
40
|
+
} else if (connectedMotionGroup) {
|
|
41
|
+
joints =
|
|
42
|
+
connectedMotionGroup.rapidlyChangingMotionState.state.joint_position
|
|
43
|
+
.joints
|
|
44
|
+
} else {
|
|
45
|
+
return ""
|
|
46
|
+
}
|
|
67
47
|
return `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
68
48
|
}
|
|
69
49
|
|
|
@@ -78,16 +58,33 @@ export const PoseJointValues = externalizeComponent(
|
|
|
78
58
|
}
|
|
79
59
|
}
|
|
80
60
|
|
|
81
|
-
|
|
61
|
+
useAutorun(() => {
|
|
82
62
|
if (!poseHolderRef.current) {
|
|
83
63
|
return
|
|
84
64
|
}
|
|
85
65
|
|
|
86
|
-
|
|
87
|
-
if (
|
|
66
|
+
let joints: number[]
|
|
67
|
+
if (motionStream) {
|
|
68
|
+
joints =
|
|
69
|
+
motionStream.rapidlyChangingMotionState.state.joint_position.joints
|
|
70
|
+
} else if (connectedMotionGroup) {
|
|
71
|
+
joints =
|
|
72
|
+
connectedMotionGroup.rapidlyChangingMotionState.state.joint_position
|
|
73
|
+
.joints
|
|
74
|
+
} else {
|
|
88
75
|
return
|
|
89
76
|
}
|
|
90
|
-
|
|
77
|
+
|
|
78
|
+
const newPoseContent = `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
79
|
+
|
|
80
|
+
requestAnimationFrame(() => {
|
|
81
|
+
if (
|
|
82
|
+
poseHolderRef.current &&
|
|
83
|
+
poseHolderRef.current.textContent !== newPoseContent
|
|
84
|
+
) {
|
|
85
|
+
poseHolderRef.current.textContent = newPoseContent
|
|
86
|
+
}
|
|
87
|
+
})
|
|
91
88
|
})
|
|
92
89
|
|
|
93
90
|
return (
|