@wandelbots/wandelbots-js-react-components 2.41.0-pr.feature-seperate-timer.383.ed84a08 → 2.41.0-pr.feature-seperate-timer.383.35a3a58
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 +2976 -2995
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/jogging/PoseCartesianValues.tsx +10 -27
- package/src/components/jogging/PoseJointValues.tsx +11 -33
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.35a3a58",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -2,14 +2,13 @@ import { Button, Stack, Typography } from "@mui/material"
|
|
|
2
2
|
import { poseToWandelscriptString } from "@wandelbots/nova-js"
|
|
3
3
|
import type {
|
|
4
4
|
ConnectedMotionGroup,
|
|
5
|
-
MotionGroupStateResponse,
|
|
6
5
|
MotionStreamConnection,
|
|
7
6
|
} from "@wandelbots/nova-js/v1"
|
|
8
7
|
import { observer } from "mobx-react-lite"
|
|
9
8
|
import { useRef, useState } from "react"
|
|
10
9
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
11
10
|
import { CopyableText } from "../CopyableText"
|
|
12
|
-
import {
|
|
11
|
+
import { useAnimationFrame } from "../utils/hooks"
|
|
13
12
|
|
|
14
13
|
export type PoseCartesianValuesProps = {
|
|
15
14
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
@@ -35,12 +34,10 @@ export const PoseCartesianValues = externalizeComponent(
|
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
function getCurrentPoseString() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
tcpPose = connectedMotionGroup.rapidlyChangingMotionState.tcp_pose
|
|
43
|
-
}
|
|
37
|
+
const tcpPose = motionStream
|
|
38
|
+
? motionStream.rapidlyChangingMotionState.tcp_pose
|
|
39
|
+
: connectedMotionGroup?.rapidlyChangingMotionState.tcp_pose
|
|
40
|
+
|
|
44
41
|
if (!tcpPose) return ""
|
|
45
42
|
return poseToWandelscriptString(tcpPose)
|
|
46
43
|
}
|
|
@@ -56,30 +53,16 @@ export const PoseCartesianValues = externalizeComponent(
|
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
useAnimationFrame(() => {
|
|
60
57
|
if (!poseHolderRef.current) {
|
|
61
58
|
return
|
|
62
59
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
tcpPose = motionStream.rapidlyChangingMotionState.tcp_pose
|
|
67
|
-
} else if (connectedMotionGroup) {
|
|
68
|
-
tcpPose = connectedMotionGroup.rapidlyChangingMotionState.tcp_pose
|
|
60
|
+
const newPoseContent = getCurrentPoseString()
|
|
61
|
+
if (poseHolderRef.current.textContent === newPoseContent) {
|
|
62
|
+
return
|
|
69
63
|
}
|
|
70
64
|
|
|
71
|
-
|
|
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
|
-
})
|
|
65
|
+
poseHolderRef.current.textContent = newPoseContent
|
|
83
66
|
})
|
|
84
67
|
|
|
85
68
|
return (
|
|
@@ -7,7 +7,7 @@ import { observer } from "mobx-react-lite"
|
|
|
7
7
|
import { useRef, useState } from "react"
|
|
8
8
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
9
9
|
import { CopyableText } from "../CopyableText"
|
|
10
|
-
import {
|
|
10
|
+
import { useAnimationFrame } from "../utils/hooks"
|
|
11
11
|
|
|
12
12
|
export type PoseJointValuesProps = {
|
|
13
13
|
/** Either a MotionStreamConnection or ConnectedMotionGroup */
|
|
@@ -33,17 +33,12 @@ export const PoseJointValues = externalizeComponent(
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function getCurrentPoseString() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
connectedMotionGroup.rapidlyChangingMotionState.state.joint_position
|
|
43
|
-
.joints
|
|
44
|
-
} else {
|
|
45
|
-
return ""
|
|
46
|
-
}
|
|
36
|
+
const joints = motionStream
|
|
37
|
+
? motionStream.rapidlyChangingMotionState.state.joint_position.joints
|
|
38
|
+
: connectedMotionGroup?.rapidlyChangingMotionState.state
|
|
39
|
+
.joint_position.joints
|
|
40
|
+
|
|
41
|
+
if (!joints) return ""
|
|
47
42
|
return `[${joints.map((j: number) => parseFloat(j.toFixed(4))).join(", ")}]`
|
|
48
43
|
}
|
|
49
44
|
|
|
@@ -58,33 +53,16 @@ export const PoseJointValues = externalizeComponent(
|
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
55
|
|
|
61
|
-
|
|
56
|
+
useAnimationFrame(() => {
|
|
62
57
|
if (!poseHolderRef.current) {
|
|
63
58
|
return
|
|
64
59
|
}
|
|
65
|
-
|
|
66
|
-
|
|
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 {
|
|
60
|
+
const newPoseContent = getCurrentPoseString()
|
|
61
|
+
if (poseHolderRef.current.textContent === newPoseContent) {
|
|
75
62
|
return
|
|
76
63
|
}
|
|
77
64
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
requestAnimationFrame(() => {
|
|
81
|
-
if (
|
|
82
|
-
poseHolderRef.current &&
|
|
83
|
-
poseHolderRef.current.textContent !== newPoseContent
|
|
84
|
-
) {
|
|
85
|
-
poseHolderRef.current.textContent = newPoseContent
|
|
86
|
-
}
|
|
87
|
-
})
|
|
65
|
+
poseHolderRef.current.textContent = newPoseContent
|
|
88
66
|
})
|
|
89
67
|
|
|
90
68
|
return (
|