@wandelbots/wandelbots-js-react-components 1.8.0 → 1.9.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 +30 -16
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/CopyableText.d.ts +5 -0
- package/dist/components/CopyableText.d.ts.map +1 -0
- package/dist/components/LoadingButton.d.ts +1 -1
- package/dist/components/LoadingButton.stories.d.ts +1 -1
- package/dist/components/LoadingButton.stories.d.ts.map +1 -1
- package/dist/components/ThemeSelect.d.ts.map +1 -1
- package/dist/components/VelocitySlider.d.ts.map +1 -1
- package/dist/components/VelocitySlider.stories.d.ts +2 -2
- package/dist/components/VelocitySlider.stories.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianAxisControl.stories.d.ts +1 -1
- package/dist/components/jogging/JoggingCartesianAxisControl.stories.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianValues.d.ts +1 -1
- package/dist/components/jogging/JoggingCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointLimitDetector.d.ts +2 -2
- package/dist/components/jogging/JoggingJointLimitDetector.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointRotationControl.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointRotationControl.stories.d.ts +2 -2
- package/dist/components/jogging/JoggingJointRotationControl.stories.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointValues.d.ts +1 -1
- package/dist/components/jogging/JoggingJointValues.d.ts.map +1 -1
- package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts +8 -1
- package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
- package/dist/components/jogging/JoggingPanel.stories.d.ts +2 -2
- package/dist/components/jogging/JoggingPanel.stories.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +14 -1
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/components/jogging/JoggingVelocitySlider.d.ts.map +1 -1
- package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts +2 -2
- package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts.map +1 -1
- package/dist/components/wandelscript-editor/WandelscriptEditor.stories.d.ts +2 -2
- package/dist/components/wandelscript-editor/WandelscriptEditor.stories.d.ts.map +1 -1
- package/dist/externalizeComponent.d.ts +7 -0
- package/dist/externalizeComponent.d.ts.map +1 -0
- package/dist/index.cjs +29 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +49 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11681 -12331
- package/dist/index.js.map +1 -1
- package/dist/themes/color.d.ts +1 -1
- package/dist/themes/color.d.ts.map +1 -1
- package/dist/themes/novaTheme.stories.d.ts +5 -0
- package/dist/themes/novaTheme.stories.d.ts.map +1 -0
- package/dist/themes/theming.d.ts +49 -0
- package/dist/themes/theming.d.ts.map +1 -0
- package/package.json +20 -13
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -2
- package/src/components/CopyableText.tsx +30 -0
- package/src/components/LoadingButton.stories.tsx +19 -26
- package/src/components/ThemeSelect.tsx +3 -4
- package/src/components/VelocitySlider.stories.tsx +10 -15
- package/src/components/VelocitySlider.tsx +7 -2
- package/src/components/jogging/JoggingCartesianAxisControl.stories.tsx +21 -21
- package/src/components/jogging/JoggingCartesianAxisControl.tsx +1 -1
- package/src/components/jogging/JoggingCartesianTab.tsx +37 -44
- package/src/components/jogging/JoggingCartesianValues.tsx +37 -33
- package/src/components/jogging/JoggingJointLimitDetector.tsx +10 -7
- package/src/components/jogging/JoggingJointRotationControl.stories.tsx +31 -19
- package/src/components/jogging/JoggingJointRotationControl.tsx +44 -30
- package/src/components/jogging/JoggingJointValues.tsx +35 -33
- package/src/components/jogging/JoggingOptions.tsx +130 -80
- package/src/components/jogging/JoggingPanel.stories.tsx +20 -17
- package/src/components/jogging/JoggingPanel.tsx +29 -31
- package/src/components/jogging/JoggingStore.tsx +69 -18
- package/src/components/jogging/JoggingVelocitySlider.tsx +24 -22
- package/src/components/wandelscript-editor/WandelscriptEditor.stories.tsx +7 -7
- package/src/components/wandelscript-editor/WandelscriptEditor.tsx +48 -23
- package/src/externalizeComponent.tsx +37 -0
- package/src/i18n/locales/de/translations.json +2 -1
- package/src/i18n/locales/en/translations.json +2 -1
- package/src/icons/orientation-coord-system.svg +3 -0
- package/src/icons/orientation-tool.svg +3 -0
- package/src/index.ts +39 -9
- package/src/themes/color.tsx +29 -19
- package/src/themes/novaTheme.stories.tsx +77 -0
- package/src/themes/themeTypes.d.ts +11 -0
- package/src/themes/theming.ts +174 -0
- package/dist/themes/theme.d.ts +0 -144
- package/dist/themes/theme.d.ts.map +0 -1
- package/dist/themes/wbTheme.d.ts +0 -73
- package/dist/themes/wbTheme.d.ts.map +0 -1
- package/dist/themes/wbTheme.stories.d.ts +0 -7
- package/dist/themes/wbTheme.stories.d.ts.map +0 -1
- package/src/themes/theme.ts +0 -150
- package/src/themes/wbTheme.stories.tsx +0 -64
- package/src/themes/wbTheme.ts +0 -186
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
import { observer } from "mobx-react-lite"
|
|
2
|
-
import { Stack
|
|
2
|
+
import { Stack } from "@mui/material"
|
|
3
3
|
import { useRef } from "react"
|
|
4
4
|
import { poseToWandelscriptString } from "@wandelbots/wandelbots-js"
|
|
5
5
|
import { useAnimationFrame } from "../utils/hooks"
|
|
6
|
-
import { JoggingStore } from "./JoggingStore"
|
|
6
|
+
import type { JoggingStore } from "./JoggingStore"
|
|
7
|
+
import { CopyableText } from "../CopyableText"
|
|
7
8
|
|
|
8
|
-
export const JoggingCartesianValues = observer(
|
|
9
|
-
|
|
9
|
+
export const JoggingCartesianValues = observer(
|
|
10
|
+
({ store }: { store: JoggingStore }) => {
|
|
11
|
+
const poseHolderRef = useRef<HTMLPreElement>(null)
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
useAnimationFrame(() => {
|
|
18
|
-
if (!poseStringRef.current) {
|
|
19
|
-
return
|
|
13
|
+
function getCurrentPoseString() {
|
|
14
|
+
const tcpPose =
|
|
15
|
+
store.jogger.motionStream.rapidlyChangingMotionState.tcp_pose
|
|
16
|
+
if (!tcpPose) return ""
|
|
17
|
+
return poseToWandelscriptString(tcpPose)
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
useAnimationFrame(() => {
|
|
21
|
+
if (!poseHolderRef.current) {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
poseHolderRef.current.textContent = getCurrentPoseString()
|
|
26
|
+
})
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
return (
|
|
29
|
+
<Stack
|
|
30
|
+
alignItems="left"
|
|
31
|
+
spacing={2}
|
|
28
32
|
sx={{
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
padding: "16px",
|
|
34
|
+
"& label": {
|
|
35
|
+
opacity: 0.7,
|
|
36
|
+
fontSize: "12px",
|
|
37
|
+
marginBottom: "4px",
|
|
38
|
+
},
|
|
31
39
|
}}
|
|
32
40
|
>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
></Typography>
|
|
43
|
-
</Stack>
|
|
44
|
-
)
|
|
45
|
-
})
|
|
41
|
+
<CopyableText
|
|
42
|
+
label={"Pose"}
|
|
43
|
+
value={getCurrentPoseString()}
|
|
44
|
+
ref={poseHolderRef}
|
|
45
|
+
/>
|
|
46
|
+
</Stack>
|
|
47
|
+
)
|
|
48
|
+
},
|
|
49
|
+
)
|
|
@@ -2,26 +2,29 @@ import { Typography } from "@mui/material"
|
|
|
2
2
|
import { useTranslation } from "react-i18next"
|
|
3
3
|
import { useState } from "react"
|
|
4
4
|
import { isEqual } from "lodash-es"
|
|
5
|
-
import { MotionStreamConnection } from "@wandelbots/wandelbots-js"
|
|
6
5
|
import { useAnimationFrame } from "../utils/hooks"
|
|
7
|
-
import { JoggingStore } from "./JoggingStore"
|
|
6
|
+
import type { JoggingStore } from "./JoggingStore"
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Monitors the active robot motion state and displays a message if
|
|
11
10
|
* any joint limits are reached.
|
|
12
11
|
*/
|
|
13
|
-
export const JoggingJointLimitDetector = ({
|
|
12
|
+
export const JoggingJointLimitDetector = ({
|
|
13
|
+
store,
|
|
14
|
+
}: {
|
|
15
|
+
store: JoggingStore
|
|
16
|
+
}) => {
|
|
14
17
|
const { t } = useTranslation()
|
|
15
18
|
|
|
16
19
|
const [jointLimitsReached, setJointLimitsReached] = useState(
|
|
17
|
-
store.jogger.motionStream.rapidlyChangingMotionState.state
|
|
18
|
-
.limit_reached,
|
|
20
|
+
store.jogger.motionStream.rapidlyChangingMotionState.state
|
|
21
|
+
.joint_limit_reached.limit_reached,
|
|
19
22
|
)
|
|
20
23
|
|
|
21
24
|
useAnimationFrame(() => {
|
|
22
25
|
const newLimitsReached =
|
|
23
|
-
store.jogger.motionStream.rapidlyChangingMotionState.state
|
|
24
|
-
.limit_reached
|
|
26
|
+
store.jogger.motionStream.rapidlyChangingMotionState.state
|
|
27
|
+
.joint_limit_reached.limit_reached
|
|
25
28
|
|
|
26
29
|
if (!isEqual(jointLimitsReached, newLimitsReached)) {
|
|
27
30
|
setJointLimitsReached(newLimitsReached)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react"
|
|
2
|
-
import { JoggingJointRotationControl } from "
|
|
3
|
-
import { useRef } from "react"
|
|
4
|
-
import { useAnimationFrame } from "../utils/hooks"
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { JoggingJointRotationControl } from "../../index"
|
|
3
|
+
import { useRef } from "react"
|
|
4
|
+
import { useAnimationFrame } from "../utils/hooks"
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof JoggingJointRotationControl> = {
|
|
7
7
|
component: JoggingJointRotationControl,
|
|
@@ -12,27 +12,39 @@ const meta: Meta<typeof JoggingJointRotationControl> = {
|
|
|
12
12
|
disabled: false,
|
|
13
13
|
},
|
|
14
14
|
render: function Component(args) {
|
|
15
|
-
const joggingDirRef = useRef<"+" | "-" | null>(null)
|
|
16
|
-
const joggingValueRef = useRef(0)
|
|
15
|
+
const joggingDirRef = useRef<"+" | "-" | null>(null)
|
|
16
|
+
const joggingValueRef = useRef(0)
|
|
17
17
|
|
|
18
18
|
useAnimationFrame(() => {
|
|
19
19
|
if (joggingDirRef.current === "+") {
|
|
20
|
-
joggingValueRef.current += 1
|
|
20
|
+
joggingValueRef.current += 1
|
|
21
|
+
if (args.upperLimitDegs != null) {
|
|
22
|
+
joggingValueRef.current = Math.min(
|
|
23
|
+
joggingValueRef.current,
|
|
24
|
+
args.upperLimitDegs,
|
|
25
|
+
)
|
|
26
|
+
}
|
|
21
27
|
} else if (joggingDirRef.current === "-") {
|
|
22
|
-
joggingValueRef.current -= 1
|
|
28
|
+
joggingValueRef.current -= 1
|
|
29
|
+
if (args.lowerLimitDegs != null) {
|
|
30
|
+
joggingValueRef.current = Math.max(
|
|
31
|
+
joggingValueRef.current,
|
|
32
|
+
args.lowerLimitDegs,
|
|
33
|
+
)
|
|
34
|
+
}
|
|
23
35
|
}
|
|
24
36
|
})
|
|
25
37
|
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
return (
|
|
39
|
+
<JoggingJointRotationControl
|
|
40
|
+
{...args}
|
|
41
|
+
startJogging={(direction) => (joggingDirRef.current = direction)}
|
|
42
|
+
stopJogging={() => (joggingDirRef.current = null)}
|
|
43
|
+
getValueDegs={() => joggingValueRef.current}
|
|
44
|
+
/>
|
|
45
|
+
)
|
|
32
46
|
},
|
|
47
|
+
}
|
|
48
|
+
export default meta
|
|
33
49
|
|
|
34
|
-
}
|
|
35
|
-
export default meta;
|
|
36
|
-
|
|
37
|
-
export const Default: StoryObj<typeof JoggingJointRotationControl> = {
|
|
38
|
-
};
|
|
50
|
+
export const Default: StoryObj<typeof JoggingJointRotationControl> = {}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { IconButton, Slider, Typography } from "@mui/material"
|
|
1
|
+
import { IconButton, Slider, Typography, useTheme } from "@mui/material"
|
|
2
2
|
import Stack from "@mui/material/Stack"
|
|
3
3
|
import { observer, useLocalObservable } from "mobx-react-lite"
|
|
4
|
-
import { I18nextProvider, useTranslation } from "react-i18next"
|
|
5
4
|
import { ChevronLeft, ChevronRight } from "@mui/icons-material"
|
|
6
5
|
import { useAnimationFrame } from "../utils/hooks"
|
|
7
6
|
import { useState } from "react"
|
|
8
|
-
import
|
|
7
|
+
import { throttle } from "lodash-es"
|
|
8
|
+
import { useTranslation } from "react-i18next"
|
|
9
9
|
|
|
10
10
|
type JoggingJointRotationControlProps = {
|
|
11
11
|
startJogging: (direction: "-" | "+") => void
|
|
12
12
|
stopJogging: () => void
|
|
13
13
|
lowerLimitDegs?: number
|
|
14
14
|
upperLimitDegs?: number
|
|
15
|
-
getValueDegs: () => number|undefined
|
|
15
|
+
getValueDegs: () => number | undefined
|
|
16
16
|
|
|
17
17
|
disabled?: boolean
|
|
18
18
|
} & React.ComponentProps<typeof Stack>
|
|
@@ -28,7 +28,7 @@ export const JoggingJointRotationControl = observer(
|
|
|
28
28
|
...rest
|
|
29
29
|
}: JoggingJointRotationControlProps) => {
|
|
30
30
|
const { t } = useTranslation()
|
|
31
|
-
const [currentValue, setCurrentValue] = useState<number|undefined>()
|
|
31
|
+
const [currentValue, setCurrentValue] = useState<number | undefined>()
|
|
32
32
|
|
|
33
33
|
const state = useLocalObservable(() => ({
|
|
34
34
|
activeJoggingDir: null as "-" | "+" | null,
|
|
@@ -44,9 +44,11 @@ export const JoggingJointRotationControl = observer(
|
|
|
44
44
|
},
|
|
45
45
|
}))
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const updateValue = throttle(() => {
|
|
48
48
|
setCurrentValue(getValueDegs())
|
|
49
|
-
})
|
|
49
|
+
}, 50)
|
|
50
|
+
|
|
51
|
+
useAnimationFrame(updateValue)
|
|
50
52
|
|
|
51
53
|
function onPointerDownMinus(ev: React.PointerEvent) {
|
|
52
54
|
// Stop right click from triggering jog
|
|
@@ -57,6 +59,17 @@ export const JoggingJointRotationControl = observer(
|
|
|
57
59
|
if (ev.button === 0) state.startJogging("+")
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
function onPointerUp(ev: React.PointerEvent) {
|
|
63
|
+
state.stopJogging()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function onPointerOut(ev: React.PointerEvent) {
|
|
67
|
+
// Prevent subelements of button from stopping jogging
|
|
68
|
+
if (ev.target !== ev.currentTarget) return
|
|
69
|
+
|
|
70
|
+
state.stopJogging()
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
function formatDegrees(value: number | undefined, precision = 1) {
|
|
61
74
|
if (value === undefined || isNaN(value)) return ""
|
|
62
75
|
|
|
@@ -72,30 +85,38 @@ export const JoggingJointRotationControl = observer(
|
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
return (
|
|
75
|
-
<I18nextProvider i18n={i18n}>
|
|
76
88
|
<Stack
|
|
77
89
|
height="64px"
|
|
78
90
|
width="100%"
|
|
79
91
|
maxWidth="300px"
|
|
80
92
|
direction="row"
|
|
81
93
|
{...rest}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
onPointerDown={onPointerDownMinus}
|
|
85
|
-
onPointerUp={state.stopJogging}
|
|
86
|
-
onPointerOut={state.stopJogging}
|
|
87
|
-
disabled={disabled}
|
|
88
|
-
sx={{
|
|
94
|
+
sx={{
|
|
95
|
+
"& .MuiIconButton-root": {
|
|
89
96
|
width: "52px",
|
|
90
97
|
color: "white",
|
|
91
98
|
alignContent: "center",
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
99
|
+
backgroundColor: "#38445A",
|
|
100
|
+
"&:disabled": {
|
|
101
|
+
opacity: 0.5,
|
|
102
|
+
backgroundColor: "#38445A",
|
|
103
|
+
},
|
|
95
104
|
"& svg": {
|
|
96
105
|
width: "42px",
|
|
97
106
|
height: "42px",
|
|
98
107
|
},
|
|
108
|
+
},
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<IconButton
|
|
112
|
+
onPointerDown={onPointerDownMinus}
|
|
113
|
+
onPointerUp={onPointerUp}
|
|
114
|
+
onPointerOut={onPointerOut}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
sx={{
|
|
117
|
+
borderRadius: "16px 0px 0px 16px",
|
|
118
|
+
backgroundColor:
|
|
119
|
+
state.activeJoggingDir === "-" ? "#495975" : undefined,
|
|
99
120
|
}}
|
|
100
121
|
>
|
|
101
122
|
<ChevronLeft />
|
|
@@ -123,6 +144,7 @@ export const JoggingJointRotationControl = observer(
|
|
|
123
144
|
fontSize: "15px",
|
|
124
145
|
position: "relative",
|
|
125
146
|
top: "5px",
|
|
147
|
+
color: "white",
|
|
126
148
|
}}
|
|
127
149
|
>
|
|
128
150
|
{formatDegrees(currentValue)}
|
|
@@ -133,7 +155,7 @@ export const JoggingJointRotationControl = observer(
|
|
|
133
155
|
aria-label="Joint position"
|
|
134
156
|
min={lowerLimitDegs}
|
|
135
157
|
max={upperLimitDegs}
|
|
136
|
-
value={currentValue}
|
|
158
|
+
value={currentValue || 0}
|
|
137
159
|
track={false}
|
|
138
160
|
sx={{
|
|
139
161
|
"& .MuiSlider-mark": {
|
|
@@ -147,6 +169,7 @@ export const JoggingJointRotationControl = observer(
|
|
|
147
169
|
"& .MuiSlider-markLabel": {
|
|
148
170
|
top: "20px",
|
|
149
171
|
fontSize: "12px",
|
|
172
|
+
color: "white",
|
|
150
173
|
},
|
|
151
174
|
"& .MuiSlider-rail": {
|
|
152
175
|
backgroundColor: "#1F283A",
|
|
@@ -171,27 +194,18 @@ export const JoggingJointRotationControl = observer(
|
|
|
171
194
|
|
|
172
195
|
<IconButton
|
|
173
196
|
onPointerDown={onPointerDownPlus}
|
|
174
|
-
onPointerUp={
|
|
175
|
-
onPointerOut={
|
|
197
|
+
onPointerUp={onPointerUp}
|
|
198
|
+
onPointerOut={onPointerOut}
|
|
176
199
|
disabled={disabled}
|
|
177
200
|
sx={{
|
|
178
|
-
width: "52px",
|
|
179
|
-
color: "white",
|
|
180
|
-
alignContent: "center",
|
|
181
|
-
fontSize: "37px",
|
|
182
201
|
borderRadius: "0px 16px 16px 0px",
|
|
183
202
|
backgroundColor:
|
|
184
203
|
state.activeJoggingDir === "+" ? "#495975 !important" : "#38445A",
|
|
185
|
-
"& svg": {
|
|
186
|
-
width: "42px",
|
|
187
|
-
height: "42px",
|
|
188
|
-
},
|
|
189
204
|
}}
|
|
190
205
|
>
|
|
191
206
|
<ChevronRight />
|
|
192
207
|
</IconButton>
|
|
193
208
|
</Stack>
|
|
194
|
-
</I18nextProvider>
|
|
195
209
|
)
|
|
196
210
|
},
|
|
197
211
|
)
|
|
@@ -2,44 +2,46 @@ import { observer } from "mobx-react-lite"
|
|
|
2
2
|
import { Stack, Typography } from "@mui/material"
|
|
3
3
|
import { useRef } from "react"
|
|
4
4
|
import { useTranslation } from "react-i18next"
|
|
5
|
-
import { JoggingStore } from "./JoggingStore"
|
|
5
|
+
import type { JoggingStore } from "./JoggingStore"
|
|
6
6
|
import { useAnimationFrame } from "../utils/hooks"
|
|
7
|
+
import { CopyableText } from "../CopyableText"
|
|
7
8
|
|
|
8
|
-
export const JoggingJointValues = observer(
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export const JoggingJointValues = observer(
|
|
10
|
+
({ store }: { store: JoggingStore }) => {
|
|
11
|
+
const poseHolderRef = useRef<HTMLPreElement>(null)
|
|
12
|
+
const { t } = useTranslation()
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
function getCurrentPoseString() {
|
|
15
|
+
const { joints } =
|
|
16
|
+
store.jogger.motionStream.rapidlyChangingMotionState.state
|
|
17
|
+
.joint_position
|
|
18
|
+
return `{${joints.map((j) => parseFloat(j.toFixed(4))).join(", ")}}`
|
|
19
|
+
}
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
useAnimationFrame(() => {
|
|
22
|
+
if (!poseHolderRef.current) return
|
|
23
|
+
poseHolderRef.current.textContent = getCurrentPoseString()
|
|
24
|
+
})
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
return (
|
|
27
|
+
<Stack
|
|
28
|
+
alignItems="left"
|
|
29
|
+
spacing={2}
|
|
26
30
|
sx={{
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
padding: "16px",
|
|
32
|
+
"& label": {
|
|
33
|
+
opacity: 0.7,
|
|
34
|
+
fontSize: "12px",
|
|
35
|
+
marginBottom: "4px",
|
|
36
|
+
},
|
|
29
37
|
}}
|
|
30
38
|
>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>
|
|
41
|
-
{getCurrentValueString()}
|
|
42
|
-
</Typography>
|
|
43
|
-
</Stack>
|
|
44
|
-
)
|
|
45
|
-
})
|
|
39
|
+
<CopyableText
|
|
40
|
+
label={"Pose"}
|
|
41
|
+
value={getCurrentPoseString()}
|
|
42
|
+
ref={poseHolderRef}
|
|
43
|
+
/>
|
|
44
|
+
</Stack>
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
)
|
|
@@ -1,96 +1,146 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Stack,
|
|
3
|
+
MenuItem,
|
|
4
|
+
InputLabel,
|
|
5
|
+
Select,
|
|
6
|
+
ToggleButtonGroup,
|
|
7
|
+
ToggleButton,
|
|
8
|
+
} from "@mui/material"
|
|
2
9
|
import { observer } from "mobx-react-lite"
|
|
3
10
|
import type { IncrementOptionId, JoggingStore } from "./JoggingStore"
|
|
4
11
|
import { useTranslation } from "react-i18next"
|
|
5
|
-
import
|
|
6
|
-
import
|
|
12
|
+
import OrientationCoordSysIcon from "../../icons/orientation-coord-system.svg"
|
|
13
|
+
import OrientationToolIcon from "../../icons/orientation-tool.svg"
|
|
7
14
|
|
|
8
15
|
export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
|
|
9
16
|
const { t } = useTranslation()
|
|
10
|
-
|
|
17
|
+
|
|
18
|
+
function onOrientationChange(
|
|
19
|
+
_event: React.MouseEvent<HTMLElement>,
|
|
20
|
+
newOrientation: string,
|
|
21
|
+
) {
|
|
22
|
+
if (newOrientation === "coordsys" || newOrientation === "tool")
|
|
23
|
+
store.setSelectedOrientation(newOrientation)
|
|
24
|
+
}
|
|
11
25
|
|
|
12
26
|
return (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{cs.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
<>
|
|
28
|
+
<Stack
|
|
29
|
+
direction={"row"}
|
|
30
|
+
alignItems={"center"}
|
|
31
|
+
spacing={2}
|
|
32
|
+
sx={{
|
|
33
|
+
padding: "16px",
|
|
34
|
+
paddingTop: "8px",
|
|
35
|
+
"& label": {
|
|
36
|
+
opacity: 0.7,
|
|
37
|
+
fontSize: "12px",
|
|
38
|
+
marginBottom: "4px",
|
|
39
|
+
},
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
{/* Coordinate system */}
|
|
43
|
+
<Stack width="50%">
|
|
44
|
+
<InputLabel id="jogging-coord-select">{"Coordinate Sys."}</InputLabel>
|
|
45
|
+
<Select
|
|
46
|
+
labelId="jogging-coord-select"
|
|
47
|
+
value={store.selectedCoordSystemId}
|
|
48
|
+
displayEmpty={true}
|
|
49
|
+
onChange={(event) => {
|
|
50
|
+
store.setSelectedCoordSystemId(event.target.value as string)
|
|
51
|
+
}}
|
|
52
|
+
disabled={store.isLocked}
|
|
53
|
+
>
|
|
54
|
+
{store.coordSystems.map((cs) => (
|
|
55
|
+
<MenuItem key={cs.coordinate_system} value={cs.coordinate_system}>
|
|
56
|
+
{cs.name || cs.coordinate_system}
|
|
57
|
+
</MenuItem>
|
|
58
|
+
))}
|
|
59
|
+
</Select>
|
|
60
|
+
</Stack>
|
|
46
61
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</
|
|
62
|
+
{/* TCP selection */}
|
|
63
|
+
<Stack width="50%">
|
|
64
|
+
<InputLabel id="jogging-tcp-select">TCP</InputLabel>
|
|
65
|
+
<Select
|
|
66
|
+
labelId="jogging-tcp-select"
|
|
67
|
+
value={store.selectedTcpId}
|
|
68
|
+
onChange={(event) => {
|
|
69
|
+
store.setSelectedTcpId(event.target.value as string)
|
|
70
|
+
}}
|
|
71
|
+
disabled={store.isLocked}
|
|
72
|
+
>
|
|
73
|
+
{store.tcps.map((tcp) => (
|
|
74
|
+
<MenuItem key={tcp.id} value={tcp.id}>
|
|
75
|
+
{tcp.id}
|
|
76
|
+
</MenuItem>
|
|
77
|
+
))}
|
|
78
|
+
</Select>
|
|
79
|
+
</Stack>
|
|
65
80
|
</Stack>
|
|
66
81
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
<Stack
|
|
83
|
+
direction={"row"}
|
|
84
|
+
alignItems={"center"}
|
|
85
|
+
spacing={2}
|
|
86
|
+
sx={{
|
|
87
|
+
padding: "16px",
|
|
88
|
+
paddingTop: "8px",
|
|
89
|
+
"& label": {
|
|
90
|
+
opacity: 0.7,
|
|
91
|
+
fontSize: "12px",
|
|
92
|
+
marginBottom: "4px",
|
|
93
|
+
},
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
{/* Orientation */}
|
|
97
|
+
<Stack width="35%">
|
|
98
|
+
<InputLabel id="orientation-select">
|
|
99
|
+
{t("Jogging.Cartesian.Orientation.lb")}
|
|
100
|
+
</InputLabel>
|
|
101
|
+
<ToggleButtonGroup
|
|
102
|
+
value={store.selectedOrientation}
|
|
103
|
+
onChange={onOrientationChange}
|
|
104
|
+
exclusive
|
|
105
|
+
aria-labelledby="orientation-select"
|
|
106
|
+
disabled={store.isLocked}
|
|
107
|
+
>
|
|
108
|
+
<ToggleButton value="coordsys">
|
|
109
|
+
<OrientationCoordSysIcon />
|
|
110
|
+
</ToggleButton>
|
|
111
|
+
<ToggleButton value="tool">
|
|
112
|
+
<OrientationToolIcon />
|
|
113
|
+
</ToggleButton>
|
|
114
|
+
</ToggleButtonGroup>
|
|
115
|
+
</Stack>
|
|
84
116
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
117
|
+
{/* Increment selection */}
|
|
118
|
+
<Stack width="65%">
|
|
119
|
+
<InputLabel id="jogging-increment-select">{"Increment"}</InputLabel>
|
|
120
|
+
<Select
|
|
121
|
+
labelId="jogging-increment-select"
|
|
122
|
+
value={store.selectedIncrementId}
|
|
123
|
+
onChange={(event) => {
|
|
124
|
+
store.setSelectedIncrementId(
|
|
125
|
+
event.target.value as IncrementOptionId,
|
|
126
|
+
)
|
|
127
|
+
}}
|
|
128
|
+
disabled={store.isLocked}
|
|
129
|
+
>
|
|
130
|
+
<MenuItem key="continuous" value="continuous">
|
|
131
|
+
{t("Jogging.Increment.Continuous.dd")}
|
|
90
132
|
</MenuItem>
|
|
91
|
-
|
|
92
|
-
|
|
133
|
+
|
|
134
|
+
{store.discreteIncrementOptions.map((inc) => (
|
|
135
|
+
<MenuItem key={inc.id} value={inc.id}>
|
|
136
|
+
{store.currentMotionType === "translate"
|
|
137
|
+
? `${inc.mm}mm`
|
|
138
|
+
: `${inc.degrees}°`}
|
|
139
|
+
</MenuItem>
|
|
140
|
+
))}
|
|
141
|
+
</Select>
|
|
142
|
+
</Stack>
|
|
93
143
|
</Stack>
|
|
94
|
-
|
|
144
|
+
</>
|
|
95
145
|
)
|
|
96
146
|
})
|