@wandelbots/wandelbots-js-react-components 1.17.4 → 1.17.5
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/JoggingActivationRequired.d.ts +9 -0
- package/dist/components/jogging/JoggingActivationRequired.d.ts.map +1 -0
- package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingJointTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
- package/dist/index.cjs +23 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1216 -1205
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/TransparentOverlay.tsx +2 -2
- package/src/components/jogging/JoggingActivationRequired.tsx +46 -0
- package/src/components/jogging/JoggingCartesianTab.tsx +84 -79
- package/src/components/jogging/JoggingJointTab.tsx +66 -61
- package/src/components/jogging/JoggingPanel.tsx +1 -32
package/package.json
CHANGED
|
@@ -14,8 +14,8 @@ export const TransparentOverlay = (
|
|
|
14
14
|
alignItems="center"
|
|
15
15
|
justifyContent="center"
|
|
16
16
|
sx={{
|
|
17
|
-
backgroundColor: "rgba(0, 0, 0, 0.
|
|
18
|
-
backdropFilter: "blur(
|
|
17
|
+
backgroundColor: "rgba(0, 0, 0, 0.6)",
|
|
18
|
+
backdropFilter: "blur(1px)",
|
|
19
19
|
zIndex: 100,
|
|
20
20
|
}}
|
|
21
21
|
{...props}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Button, Stack } from "@mui/material"
|
|
2
|
+
import { observer } from "mobx-react-lite"
|
|
3
|
+
import type React from "react"
|
|
4
|
+
import { useTranslation } from "react-i18next"
|
|
5
|
+
import { LoadingCover } from "../LoadingCover"
|
|
6
|
+
import { TransparentOverlay } from "../TransparentOverlay"
|
|
7
|
+
import type { JoggingStore } from "./JoggingStore"
|
|
8
|
+
|
|
9
|
+
export const JoggingActivationRequired = observer(
|
|
10
|
+
({ store, children }: { store: JoggingStore; children: React.ReactNode }) => {
|
|
11
|
+
const { t } = useTranslation()
|
|
12
|
+
|
|
13
|
+
function renderOverlay() {
|
|
14
|
+
if (store.activationState === "inactive" && !store.activationError) {
|
|
15
|
+
return (
|
|
16
|
+
<TransparentOverlay>
|
|
17
|
+
<Button
|
|
18
|
+
color="primary"
|
|
19
|
+
variant="contained"
|
|
20
|
+
onClick={() => store.activate({ manual: true })}
|
|
21
|
+
disabled={store.isLocked}
|
|
22
|
+
>
|
|
23
|
+
{t("Jogging.Activate.bt")}
|
|
24
|
+
</Button>
|
|
25
|
+
</TransparentOverlay>
|
|
26
|
+
)
|
|
27
|
+
} else if (store.activationState === "loading" || store.activationError) {
|
|
28
|
+
return (
|
|
29
|
+
<TransparentOverlay>
|
|
30
|
+
<LoadingCover
|
|
31
|
+
message={t("Jogging.Activating.lb")}
|
|
32
|
+
error={store.activationError}
|
|
33
|
+
/>
|
|
34
|
+
</TransparentOverlay>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Stack sx={{ position: "relative" }}>
|
|
41
|
+
{renderOverlay()}
|
|
42
|
+
{children}
|
|
43
|
+
</Stack>
|
|
44
|
+
)
|
|
45
|
+
},
|
|
46
|
+
)
|
|
@@ -12,6 +12,7 @@ import YAxisIcon from "../../icons/axis-y.svg"
|
|
|
12
12
|
import ZAxisIcon from "../../icons/axis-z.svg"
|
|
13
13
|
import RotationIcon from "../../icons/rotation.svg"
|
|
14
14
|
import { useReaction } from "../utils/hooks"
|
|
15
|
+
import { JoggingActivationRequired } from "./JoggingActivationRequired"
|
|
15
16
|
import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl"
|
|
16
17
|
import { JoggingCartesianValues } from "./JoggingCartesianValues"
|
|
17
18
|
import { JoggingJointLimitDetector } from "./JoggingJointLimitDetector"
|
|
@@ -150,7 +151,13 @@ export const JoggingCartesianTab = observer(
|
|
|
150
151
|
{/* Jogging options */}
|
|
151
152
|
<JoggingOptions store={store} />
|
|
152
153
|
|
|
153
|
-
<Stack
|
|
154
|
+
<Stack
|
|
155
|
+
width="80%"
|
|
156
|
+
maxWidth="296px"
|
|
157
|
+
margin="auto"
|
|
158
|
+
marginTop="16px"
|
|
159
|
+
gap="12px"
|
|
160
|
+
>
|
|
154
161
|
{/* Translate or rotate toggle */}
|
|
155
162
|
<ToggleButtonGroup
|
|
156
163
|
value={store.selectedCartesianMotionType}
|
|
@@ -166,85 +173,83 @@ export const JoggingCartesianTab = observer(
|
|
|
166
173
|
</ToggleButton>
|
|
167
174
|
</ToggleButtonGroup>
|
|
168
175
|
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
))}
|
|
176
|
+
<JoggingActivationRequired store={store}>
|
|
177
|
+
{/* Cartesian translate jogging */}
|
|
178
|
+
<Stack gap="12px">
|
|
179
|
+
{store.selectedCartesianMotionType === "translate" &&
|
|
180
|
+
axisList.map((axis) => (
|
|
181
|
+
<JoggingCartesianAxisControl
|
|
182
|
+
key={axis.id}
|
|
183
|
+
color={axis.color}
|
|
184
|
+
disabled={store.isLocked}
|
|
185
|
+
label={
|
|
186
|
+
<>
|
|
187
|
+
{axis.icon}
|
|
188
|
+
<Typography
|
|
189
|
+
sx={{
|
|
190
|
+
fontSize: "24px",
|
|
191
|
+
color: "white",
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
{axis.id.toUpperCase()}
|
|
195
|
+
</Typography>
|
|
196
|
+
</>
|
|
197
|
+
}
|
|
198
|
+
getDisplayedValue={() =>
|
|
199
|
+
formatMM(
|
|
200
|
+
store.jogger.motionStream.rapidlyChangingMotionState
|
|
201
|
+
.tcp_pose?.position[axis.id] || 0,
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
startJogging={(direction: "-" | "+") =>
|
|
205
|
+
startCartesianJogging({
|
|
206
|
+
axis: axis.id,
|
|
207
|
+
motionType: "translate",
|
|
208
|
+
direction,
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
stopJogging={stopJogging}
|
|
212
|
+
/>
|
|
213
|
+
))}
|
|
208
214
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
))}
|
|
215
|
+
{/* Cartesian rotate jogging */}
|
|
216
|
+
{store.selectedCartesianMotionType === "rotate" &&
|
|
217
|
+
axisList.map((axis) => (
|
|
218
|
+
<JoggingCartesianAxisControl
|
|
219
|
+
key={axis.id}
|
|
220
|
+
color={axis.color}
|
|
221
|
+
disabled={store.isLocked}
|
|
222
|
+
label={
|
|
223
|
+
<>
|
|
224
|
+
<RotationIcon />
|
|
225
|
+
<Typography
|
|
226
|
+
sx={{
|
|
227
|
+
fontSize: "24px",
|
|
228
|
+
color: "white",
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{axis.id.toUpperCase()}
|
|
232
|
+
</Typography>
|
|
233
|
+
</>
|
|
234
|
+
}
|
|
235
|
+
getDisplayedValue={() =>
|
|
236
|
+
formatDegrees(
|
|
237
|
+
store.jogger.motionStream.rapidlyChangingMotionState
|
|
238
|
+
.tcp_pose?.orientation?.[axis.id] || 0,
|
|
239
|
+
)
|
|
240
|
+
}
|
|
241
|
+
startJogging={(direction: "-" | "+") =>
|
|
242
|
+
startCartesianJogging({
|
|
243
|
+
axis: axis.id,
|
|
244
|
+
motionType: "rotate",
|
|
245
|
+
direction,
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
stopJogging={stopJogging}
|
|
249
|
+
/>
|
|
250
|
+
))}
|
|
251
|
+
</Stack>
|
|
252
|
+
</JoggingActivationRequired>
|
|
248
253
|
</Stack>
|
|
249
254
|
|
|
250
255
|
{/* Show message if joint limits reached */}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Stack, Typography } from "@mui/material"
|
|
2
|
-
import { observer } from "mobx-react-lite"
|
|
3
2
|
import { radiansToDegrees } from "@wandelbots/wandelbots-js"
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import { observer } from "mobx-react-lite"
|
|
4
|
+
import { JoggingActivationRequired } from "./JoggingActivationRequired"
|
|
5
|
+
import { JoggingJointLimitDetector } from "./JoggingJointLimitDetector"
|
|
6
6
|
import { JoggingJointRotationControl } from "./JoggingJointRotationControl"
|
|
7
7
|
import { JoggingJointValues } from "./JoggingJointValues"
|
|
8
|
-
import {
|
|
8
|
+
import type { JoggingStore } from "./JoggingStore"
|
|
9
|
+
import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
|
|
9
10
|
|
|
10
11
|
export const JoggingJointTab = observer(
|
|
11
12
|
({ store }: { store: JoggingStore }) => {
|
|
@@ -27,64 +28,68 @@ export const JoggingJointTab = observer(
|
|
|
27
28
|
return (
|
|
28
29
|
<Stack>
|
|
29
30
|
<JoggingJointValues store={store} />
|
|
30
|
-
<Stack>
|
|
31
|
-
{store.jogger.motionStream.joints.map((joint) => {
|
|
32
|
-
const jointLimits =
|
|
33
|
-
store.motionGroupSpec.mechanical_joint_limits?.[joint.index]
|
|
34
|
-
const lowerLimitDegs =
|
|
35
|
-
jointLimits?.lower_limit !== undefined
|
|
36
|
-
? radiansToDegrees(jointLimits.lower_limit)
|
|
37
|
-
: undefined
|
|
38
|
-
const upperLimitDegs =
|
|
39
|
-
jointLimits?.upper_limit !== undefined
|
|
40
|
-
? radiansToDegrees(jointLimits.upper_limit)
|
|
41
|
-
: undefined
|
|
42
31
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
32
|
+
<Stack marginTop="0.8rem" />
|
|
33
|
+
<JoggingActivationRequired store={store}>
|
|
34
|
+
<Stack gap="0.8rem">
|
|
35
|
+
{store.jogger.motionStream.joints.map((joint) => {
|
|
36
|
+
const jointLimits =
|
|
37
|
+
store.motionGroupSpec.mechanical_joint_limits?.[joint.index]
|
|
38
|
+
const lowerLimitDegs =
|
|
39
|
+
jointLimits?.lower_limit !== undefined
|
|
40
|
+
? radiansToDegrees(jointLimits.lower_limit)
|
|
41
|
+
: undefined
|
|
42
|
+
const upperLimitDegs =
|
|
43
|
+
jointLimits?.upper_limit !== undefined
|
|
44
|
+
? radiansToDegrees(jointLimits.upper_limit)
|
|
45
|
+
: undefined
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Stack
|
|
49
|
+
direction="row"
|
|
50
|
+
alignItems="center"
|
|
51
|
+
gap={2}
|
|
52
|
+
key={`joint-${joint.index}`}
|
|
53
|
+
>
|
|
54
|
+
<Typography
|
|
55
|
+
sx={{
|
|
56
|
+
flexGrow: 1,
|
|
57
|
+
textAlign: "right",
|
|
58
|
+
}}
|
|
59
|
+
>{`J${joint.index + 1}`}</Typography>
|
|
60
|
+
<JoggingJointRotationControl
|
|
61
|
+
key={joint.index}
|
|
62
|
+
disabled={store.isLocked}
|
|
63
|
+
lowerLimitDegs={lowerLimitDegs}
|
|
64
|
+
upperLimitDegs={upperLimitDegs}
|
|
65
|
+
getValueDegs={() => {
|
|
66
|
+
const value =
|
|
67
|
+
store.jogger.motionStream.rapidlyChangingMotionState
|
|
68
|
+
.state.joint_position.joints[joint.index]
|
|
69
|
+
return value !== undefined
|
|
70
|
+
? radiansToDegrees(value)
|
|
71
|
+
: undefined
|
|
72
|
+
}}
|
|
73
|
+
startJogging={(direction: "-" | "+") =>
|
|
74
|
+
startJointJogging({
|
|
75
|
+
joint: joint.index,
|
|
76
|
+
direction,
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
stopJogging={stopJointJogging}
|
|
80
|
+
/>
|
|
81
|
+
{/* Just to balance out the right side */}
|
|
82
|
+
<Typography
|
|
83
|
+
sx={{
|
|
84
|
+
flexGrow: 1,
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
</Stack>
|
|
88
|
+
)
|
|
89
|
+
})}
|
|
90
|
+
</Stack>
|
|
91
|
+
</JoggingActivationRequired>
|
|
92
|
+
<JoggingJointLimitDetector store={store} />
|
|
88
93
|
<JoggingVelocitySlider store={store} />
|
|
89
94
|
</Stack>
|
|
90
95
|
)
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Paper, Stack, Tab, Tabs } from "@mui/material"
|
|
2
2
|
import { NovaClient } from "@wandelbots/wandelbots-js"
|
|
3
3
|
import { isString } from "lodash-es"
|
|
4
4
|
import { runInAction } from "mobx"
|
|
5
5
|
import { observer, useLocalObservable } from "mobx-react-lite"
|
|
6
6
|
import { useEffect } from "react"
|
|
7
|
-
import { useTranslation } from "react-i18next"
|
|
8
7
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
9
8
|
import { LoadingCover } from "../LoadingCover"
|
|
10
|
-
import { TransparentOverlay } from "../TransparentOverlay"
|
|
11
9
|
import { useReaction } from "../utils/hooks"
|
|
12
10
|
import { JoggingCartesianTab } from "./JoggingCartesianTab"
|
|
13
11
|
import { JoggingJointTab } from "./JoggingJointTab"
|
|
@@ -117,8 +115,6 @@ const JoggingPanelInner = observer(
|
|
|
117
115
|
store: JoggingStore
|
|
118
116
|
children?: React.ReactNode
|
|
119
117
|
}) => {
|
|
120
|
-
const { t } = useTranslation()
|
|
121
|
-
|
|
122
118
|
// Jogger is only active as long as the tab is focused
|
|
123
119
|
useEffect(() => {
|
|
124
120
|
function deactivate() {
|
|
@@ -151,32 +147,6 @@ const JoggingPanelInner = observer(
|
|
|
151
147
|
},
|
|
152
148
|
)
|
|
153
149
|
|
|
154
|
-
function renderOverlay() {
|
|
155
|
-
if (store.activationState === "inactive" && !store.activationError) {
|
|
156
|
-
return (
|
|
157
|
-
<TransparentOverlay>
|
|
158
|
-
<Button
|
|
159
|
-
color="primary"
|
|
160
|
-
variant="contained"
|
|
161
|
-
onClick={() => store.activate({ manual: true })}
|
|
162
|
-
disabled={store.isLocked}
|
|
163
|
-
>
|
|
164
|
-
{t("Jogging.Activate.bt")}
|
|
165
|
-
</Button>
|
|
166
|
-
</TransparentOverlay>
|
|
167
|
-
)
|
|
168
|
-
} else if (store.activationState === "loading" || store.activationError) {
|
|
169
|
-
return (
|
|
170
|
-
<TransparentOverlay>
|
|
171
|
-
<LoadingCover
|
|
172
|
-
message={t("Jogging.Activating.lb")}
|
|
173
|
-
error={store.activationError}
|
|
174
|
-
/>
|
|
175
|
-
</TransparentOverlay>
|
|
176
|
-
)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
150
|
function renderTabContent() {
|
|
181
151
|
if (store.currentTab.id === "cartesian") {
|
|
182
152
|
return (
|
|
@@ -211,7 +181,6 @@ const JoggingPanelInner = observer(
|
|
|
211
181
|
|
|
212
182
|
{/* Current tab content */}
|
|
213
183
|
<Stack flexGrow={1} position="relative">
|
|
214
|
-
{renderOverlay()}
|
|
215
184
|
{renderTabContent()}
|
|
216
185
|
</Stack>
|
|
217
186
|
</Stack>
|