@wandelbots/wandelbots-js-react-components 1.17.4 → 1.17.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "1.17.4",
3
+ "version": "1.17.6",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,4 +1,5 @@
1
1
  import { Stack } from "@mui/material"
2
+ import { omit } from "lodash-es"
2
3
  import React from "react"
3
4
 
4
5
  export const TransparentOverlay = (
@@ -14,11 +15,12 @@ export const TransparentOverlay = (
14
15
  alignItems="center"
15
16
  justifyContent="center"
16
17
  sx={{
17
- backgroundColor: "rgba(0, 0, 0, 0.5)",
18
- backdropFilter: "blur(10px)",
18
+ backgroundColor: "rgba(0, 0, 0, 0.6)",
19
+ backdropFilter: "blur(1px)",
19
20
  zIndex: 100,
21
+ ...(props.sx || {}),
20
22
  }}
21
- {...props}
23
+ {...omit(props, "sx")}
22
24
  />
23
25
  )
24
26
  }
@@ -0,0 +1,50 @@
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
+ sx={{
18
+ borderRadius: "6px",
19
+ }}
20
+ >
21
+ <Button
22
+ color="primary"
23
+ variant="contained"
24
+ onClick={() => store.activate({ manual: true })}
25
+ disabled={store.isLocked}
26
+ >
27
+ {t("Jogging.Activate.bt")}
28
+ </Button>
29
+ </TransparentOverlay>
30
+ )
31
+ } else if (store.activationState === "loading" || store.activationError) {
32
+ return (
33
+ <TransparentOverlay>
34
+ <LoadingCover
35
+ message={t("Jogging.Activating.lb")}
36
+ error={store.activationError}
37
+ />
38
+ </TransparentOverlay>
39
+ )
40
+ }
41
+ }
42
+
43
+ return (
44
+ <Stack sx={{ position: "relative", padding: "6px" }}>
45
+ {renderOverlay()}
46
+ {children}
47
+ </Stack>
48
+ )
49
+ },
50
+ )
@@ -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 width="80%" maxWidth="296px" margin="auto" marginTop="16px">
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
- {/* Cartesian translate jogging */}
170
- {store.selectedCartesianMotionType === "translate" &&
171
- axisList.map((axis) => (
172
- <JoggingCartesianAxisControl
173
- key={axis.id}
174
- color={axis.color}
175
- disabled={store.isLocked}
176
- sx={{
177
- marginTop: "12px",
178
- }}
179
- label={
180
- <>
181
- {axis.icon}
182
- <Typography
183
- sx={{
184
- fontSize: "24px",
185
- color: "white",
186
- }}
187
- >
188
- {axis.id.toUpperCase()}
189
- </Typography>
190
- </>
191
- }
192
- getDisplayedValue={() =>
193
- formatMM(
194
- store.jogger.motionStream.rapidlyChangingMotionState
195
- .tcp_pose?.position[axis.id] || 0,
196
- )
197
- }
198
- startJogging={(direction: "-" | "+") =>
199
- startCartesianJogging({
200
- axis: axis.id,
201
- motionType: "translate",
202
- direction,
203
- })
204
- }
205
- stopJogging={stopJogging}
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
- {/* Cartesian rotate jogging */}
210
- {store.selectedCartesianMotionType === "rotate" &&
211
- axisList.map((axis) => (
212
- <JoggingCartesianAxisControl
213
- key={axis.id}
214
- color={axis.color}
215
- disabled={store.isLocked}
216
- sx={{
217
- marginTop: "12px",
218
- }}
219
- label={
220
- <>
221
- <RotationIcon />
222
- <Typography
223
- sx={{
224
- fontSize: "24px",
225
- color: "white",
226
- }}
227
- >
228
- {axis.id.toUpperCase()}
229
- </Typography>
230
- </>
231
- }
232
- getDisplayedValue={() =>
233
- formatDegrees(
234
- store.jogger.motionStream.rapidlyChangingMotionState
235
- .tcp_pose?.orientation?.[axis.id] || 0,
236
- )
237
- }
238
- startJogging={(direction: "-" | "+") =>
239
- startCartesianJogging({
240
- axis: axis.id,
241
- motionType: "rotate",
242
- direction,
243
- })
244
- }
245
- stopJogging={stopJogging}
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 type { JoggingStore } from "./JoggingStore"
5
- import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
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 { useEffect } from "react"
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
- return (
44
- <Stack
45
- direction="row"
46
- alignItems="center"
47
- gap={2}
48
- key={`joint-${joint.index}`}
49
- marginTop="0.8rem"
50
- >
51
- <Typography
52
- sx={{
53
- flexGrow: 1,
54
- textAlign: "right",
55
- }}
56
- >{`J${joint.index + 1}`}</Typography>
57
- <JoggingJointRotationControl
58
- key={joint.index}
59
- disabled={store.isLocked}
60
- lowerLimitDegs={lowerLimitDegs}
61
- upperLimitDegs={upperLimitDegs}
62
- getValueDegs={() => {
63
- const value =
64
- store.jogger.motionStream.rapidlyChangingMotionState.state
65
- .joint_position.joints[joint.index]
66
- return value !== undefined
67
- ? radiansToDegrees(value)
68
- : undefined
69
- }}
70
- startJogging={(direction: "-" | "+") =>
71
- startJointJogging({
72
- joint: joint.index,
73
- direction,
74
- })
75
- }
76
- stopJogging={stopJointJogging}
77
- />
78
- {/* Just to balance out the right side */}
79
- <Typography
80
- sx={{
81
- flexGrow: 1,
82
- }}
83
- />
84
- </Stack>
85
- )
86
- })}
87
- </Stack>
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,16 +1,16 @@
1
1
  import {
2
- Stack,
3
- MenuItem,
4
2
  InputLabel,
3
+ MenuItem,
5
4
  Select,
6
- ToggleButtonGroup,
5
+ Stack,
7
6
  ToggleButton,
7
+ ToggleButtonGroup,
8
8
  } from "@mui/material"
9
9
  import { observer } from "mobx-react-lite"
10
- import type { IncrementOptionId, JoggingStore } from "./JoggingStore"
11
10
  import { useTranslation } from "react-i18next"
12
11
  import OrientationCoordSysIcon from "../../icons/orientation-coord-system.svg"
13
12
  import OrientationToolIcon from "../../icons/orientation-tool.svg"
13
+ import type { IncrementOptionId, JoggingStore } from "./JoggingStore"
14
14
 
15
15
  export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
16
16
  const { t } = useTranslation()
@@ -30,7 +30,7 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
30
30
  alignItems={"center"}
31
31
  spacing={2}
32
32
  sx={{
33
- padding: "8px 16px",
33
+ padding: "6px 16px",
34
34
  "& label": {
35
35
  opacity: 0.7,
36
36
  fontSize: "12px",
@@ -83,7 +83,7 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
83
83
  alignItems={"center"}
84
84
  spacing={2}
85
85
  sx={{
86
- padding: "8px 16px",
86
+ padding: "6px 16px",
87
87
  "& label": {
88
88
  opacity: 0.7,
89
89
  fontSize: "12px",
@@ -1,13 +1,11 @@
1
- import { Button, Paper, Stack, Tab, Tabs } from "@mui/material"
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>