@wandelbots/wandelbots-js-react-components 1.17.3 → 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.
Files changed (95) hide show
  1. package/dist/components/jogging/JoggingActivationRequired.d.ts +9 -0
  2. package/dist/components/jogging/JoggingActivationRequired.d.ts.map +1 -0
  3. package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
  4. package/dist/components/jogging/JoggingJointTab.d.ts.map +1 -1
  5. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  6. package/dist/components/robots/ABB_1200_07_7.d.ts +7 -2
  7. package/dist/components/robots/ABB_1200_07_7.d.ts.map +1 -1
  8. package/dist/components/robots/DHRobot.d.ts.map +1 -1
  9. package/dist/components/robots/FANUC_ARC_Mate_100iD.d.ts +7 -2
  10. package/dist/components/robots/FANUC_ARC_Mate_100iD.d.ts.map +1 -1
  11. package/dist/components/robots/FANUC_ARC_Mate_120iD.d.ts +7 -2
  12. package/dist/components/robots/FANUC_ARC_Mate_120iD.d.ts.map +1 -1
  13. package/dist/components/robots/FANUC_CRX10iA.d.ts +7 -2
  14. package/dist/components/robots/FANUC_CRX10iA.d.ts.map +1 -1
  15. package/dist/components/robots/FANUC_CRX20iAL.d.ts +7 -2
  16. package/dist/components/robots/FANUC_CRX20iAL.d.ts.map +1 -1
  17. package/dist/components/robots/FANUC_CRX25iA.d.ts +7 -2
  18. package/dist/components/robots/FANUC_CRX25iA.d.ts.map +1 -1
  19. package/dist/components/robots/FANUC_CRX25iAL.d.ts +7 -2
  20. package/dist/components/robots/FANUC_CRX25iAL.d.ts.map +1 -1
  21. package/dist/components/robots/KUKA_KR16_R2010_2.d.ts +7 -2
  22. package/dist/components/robots/KUKA_KR16_R2010_2.d.ts.map +1 -1
  23. package/dist/components/robots/KUKA_KR210_R2700.d.ts +7 -2
  24. package/dist/components/robots/KUKA_KR210_R2700.d.ts.map +1 -1
  25. package/dist/components/robots/KUKA_KR270_R2700.d.ts +7 -2
  26. package/dist/components/robots/KUKA_KR270_R2700.d.ts.map +1 -1
  27. package/dist/components/robots/Robot.d.ts +3 -3
  28. package/dist/components/robots/Robot.d.ts.map +1 -1
  29. package/dist/components/robots/RobotAnimator.d.ts +7 -4
  30. package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
  31. package/dist/components/robots/SupportedRobot.d.ts +1 -5
  32. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  33. package/dist/components/robots/UniversalRobots_UR10.d.ts +2 -2
  34. package/dist/components/robots/UniversalRobots_UR10.d.ts.map +1 -1
  35. package/dist/components/robots/UniversalRobots_UR10e.d.ts +2 -2
  36. package/dist/components/robots/UniversalRobots_UR10e.d.ts.map +1 -1
  37. package/dist/components/robots/UniversalRobots_UR3.d.ts +2 -2
  38. package/dist/components/robots/UniversalRobots_UR3.d.ts.map +1 -1
  39. package/dist/components/robots/UniversalRobots_UR3e.d.ts +2 -2
  40. package/dist/components/robots/UniversalRobots_UR3e.d.ts.map +1 -1
  41. package/dist/components/robots/UniversalRobots_UR5.d.ts +2 -2
  42. package/dist/components/robots/UniversalRobots_UR5.d.ts.map +1 -1
  43. package/dist/components/robots/UniversalRobots_UR5e.d.ts +2 -2
  44. package/dist/components/robots/UniversalRobots_UR5e.d.ts.map +1 -1
  45. package/dist/components/robots/Yaskawa_AR1440.d.ts +8 -2
  46. package/dist/components/robots/Yaskawa_AR1440.d.ts.map +1 -1
  47. package/dist/components/robots/Yaskawa_AR1730.d.ts +8 -2
  48. package/dist/components/robots/Yaskawa_AR1730.d.ts.map +1 -1
  49. package/dist/components/robots/Yaskawa_AR2010.d.ts +8 -2
  50. package/dist/components/robots/Yaskawa_AR2010.d.ts.map +1 -1
  51. package/dist/components/robots/Yaskawa_AR3120.d.ts +8 -2
  52. package/dist/components/robots/Yaskawa_AR3120.d.ts.map +1 -1
  53. package/dist/components/robots/Yaskawa_AR900.d.ts +7 -2
  54. package/dist/components/robots/Yaskawa_AR900.d.ts.map +1 -1
  55. package/dist/components/robots/Yaskawa_GP50.d.ts +7 -2
  56. package/dist/components/robots/Yaskawa_GP50.d.ts.map +1 -1
  57. package/dist/components/robots/types.d.ts +17 -0
  58. package/dist/components/robots/types.d.ts.map +1 -0
  59. package/dist/index.cjs +32 -32
  60. package/dist/index.cjs.map +1 -1
  61. package/dist/index.js +9370 -9717
  62. package/dist/index.js.map +1 -1
  63. package/package.json +1 -1
  64. package/src/components/TransparentOverlay.tsx +2 -2
  65. package/src/components/jogging/JoggingActivationRequired.tsx +46 -0
  66. package/src/components/jogging/JoggingCartesianTab.tsx +84 -79
  67. package/src/components/jogging/JoggingJointTab.tsx +66 -61
  68. package/src/components/jogging/JoggingPanel.tsx +1 -32
  69. package/src/components/robots/ABB_1200_07_7.tsx +7 -22
  70. package/src/components/robots/DHRobot.tsx +34 -33
  71. package/src/components/robots/FANUC_ARC_Mate_100iD.tsx +7 -22
  72. package/src/components/robots/FANUC_ARC_Mate_120iD.tsx +7 -22
  73. package/src/components/robots/FANUC_CRX10iA.tsx +7 -22
  74. package/src/components/robots/FANUC_CRX20iAL.tsx +7 -22
  75. package/src/components/robots/FANUC_CRX25iA.tsx +7 -22
  76. package/src/components/robots/FANUC_CRX25iAL.tsx +7 -22
  77. package/src/components/robots/KUKA_KR16_R2010_2.tsx +19 -34
  78. package/src/components/robots/KUKA_KR210_R2700.tsx +7 -23
  79. package/src/components/robots/KUKA_KR270_R2700.tsx +7 -23
  80. package/src/components/robots/Robot.tsx +3 -3
  81. package/src/components/robots/RobotAnimator.tsx +32 -21
  82. package/src/components/robots/SupportedRobot.tsx +93 -103
  83. package/src/components/robots/UniversalRobots_UR10.tsx +3 -20
  84. package/src/components/robots/UniversalRobots_UR10e.tsx +2 -19
  85. package/src/components/robots/UniversalRobots_UR3.tsx +2 -19
  86. package/src/components/robots/UniversalRobots_UR3e.tsx +3 -20
  87. package/src/components/robots/UniversalRobots_UR5.tsx +3 -20
  88. package/src/components/robots/UniversalRobots_UR5e.tsx +3 -20
  89. package/src/components/robots/Yaskawa_AR1440.tsx +8 -24
  90. package/src/components/robots/Yaskawa_AR1730.tsx +8 -24
  91. package/src/components/robots/Yaskawa_AR2010.tsx +8 -24
  92. package/src/components/robots/Yaskawa_AR3120.tsx +8 -24
  93. package/src/components/robots/Yaskawa_AR900.tsx +7 -22
  94. package/src/components/robots/Yaskawa_GP50.tsx +7 -24
  95. package/src/components/robots/types.ts +19 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "1.17.3",
3
+ "version": "1.17.5",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -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.5)",
18
- backdropFilter: "blur(10px)",
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 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,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>
@@ -1,33 +1,18 @@
1
- import { useGLTF } from "@react-three/drei"
2
- import type * as THREE from "three"
3
- import type { RobotProps } from "./SupportedRobot"
4
1
  import { animated } from "@react-spring/three"
5
- import RobotAnimator from "./RobotAnimator"
2
+ import { useGLTF } from "@react-three/drei"
3
+ import type { RobotModelProps } from "./types"
6
4
 
7
- export function ABB_1200_07_7({
8
- modelURL,
9
- rapidlyChangingMotionState,
10
- ...props
11
- }: RobotProps) {
5
+ ABB_1200_07_7.config = {
6
+ rotationOffsets: [0, -Math.PI / 2, 0, 0, 0, 0],
7
+ }
8
+
9
+ export function ABB_1200_07_7({ modelURL, ...props }: RobotModelProps) {
12
10
  const gltf = useGLTF(modelURL) as any
13
11
  const nodes = gltf.nodes
14
12
  const materials = gltf.materials
15
- const rotationOffsets = [0, -Math.PI / 2, 0, 0, 0, 0]
16
-
17
- function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
18
- jointObjects.forEach(
19
- (object, index) =>
20
- (object.rotation.y = jointValues[index]! + rotationOffsets[index]!),
21
- )
22
- }
23
13
 
24
14
  return (
25
15
  <>
26
- <RobotAnimator
27
- rapidlyChangingMotionState={rapidlyChangingMotionState}
28
- robotRootObjectName="Scene"
29
- onRotationChanged={setRotation}
30
- />
31
16
  <group {...props} dispose={null}>
32
17
  <group name="Scene">
33
18
  <group name="IRB1200_7_70_IRC5" rotation={[Math.PI / 2, 0, 0]}>
@@ -1,13 +1,13 @@
1
- import { Vector3, Matrix4, Quaternion } from "three"
2
1
  import { Line } from "@react-three/drei"
3
- import type { LineGeometry } from "three/examples/jsm/lines/LineGeometry.js"
4
2
  import type { DHParameter } from "@wandelbots/wandelbots-api-client"
5
- import RobotAnimator from "./RobotAnimator"
6
3
  import type * as THREE from "three"
4
+ import { Matrix4, Quaternion, Vector3 } from "three"
5
+ import type { LineGeometry } from "three/examples/jsm/lines/LineGeometry.js"
7
6
  import {
8
7
  getAllJointsByName,
9
8
  type RobotSceneJoint,
10
9
  } from "../utils/robotTreeQuery"
10
+ import RobotAnimator from "./RobotAnimator"
11
11
  import type { DHRobotProps } from "./SupportedRobot"
12
12
 
13
13
  const CHILD_LINE = "line"
@@ -85,7 +85,7 @@ export function DHRobot({
85
85
  })
86
86
  }
87
87
 
88
- function getAllJoints(rootObject: THREE.Object3D): RobotSceneJoint[] {
88
+ function jointCollector(rootObject: THREE.Object3D): RobotSceneJoint[] {
89
89
  return getAllJointsByName(rootObject, "^group_[0-9]+$")
90
90
  }
91
91
 
@@ -93,36 +93,37 @@ export function DHRobot({
93
93
  <>
94
94
  <RobotAnimator
95
95
  rapidlyChangingMotionState={rapidlyChangingMotionState}
96
- robotRootObjectName="Scene"
96
+ jointCollector={jointCollector}
97
97
  onRotationChanged={setRotation}
98
- jointCollector={getAllJoints}
99
- />
100
- <group {...props} name="Scene">
101
- <mesh>
102
- <sphereGeometry args={[0.01, 32, 32]} />
103
- <meshStandardMaterial color={"black"} depthTest={true} />
104
- </mesh>
105
- {dhParameters!.map((param, index) => {
106
- const { a, b } = getLinePoints(
107
- param,
108
- rapidlyChangingMotionState.state.joint_position.joints[index] ?? 0,
109
- )
110
- return (
111
- <group name={`group_${index}`} key={"group_" + index}>
112
- <Line
113
- name={CHILD_LINE}
114
- points={[a, b]}
115
- color={"white"}
116
- lineWidth={5}
117
- />
118
- <mesh name={CHILD_MESH} key={"mesh_" + index} position={b}>
119
- <sphereGeometry args={[0.01, 32, 32]} />
120
- <meshStandardMaterial color={"black"} depthTest={true} />
121
- </mesh>
122
- </group>
123
- )
124
- })}
125
- </group>
98
+ >
99
+ <group {...props} name="Scene">
100
+ <mesh>
101
+ <sphereGeometry args={[0.01, 32, 32]} />
102
+ <meshStandardMaterial color={"black"} depthTest={true} />
103
+ </mesh>
104
+ {dhParameters!.map((param, index) => {
105
+ const { a, b } = getLinePoints(
106
+ param,
107
+ rapidlyChangingMotionState.state.joint_position.joints[index] ??
108
+ 0,
109
+ )
110
+ return (
111
+ <group name={`group_${index}`} key={"group_" + index}>
112
+ <Line
113
+ name={CHILD_LINE}
114
+ points={[a, b]}
115
+ color={"white"}
116
+ lineWidth={5}
117
+ />
118
+ <mesh name={CHILD_MESH} key={"mesh_" + index} position={b}>
119
+ <sphereGeometry args={[0.01, 32, 32]} />
120
+ <meshStandardMaterial color={"black"} depthTest={true} />
121
+ </mesh>
122
+ </group>
123
+ )
124
+ })}
125
+ </group>
126
+ </RobotAnimator>
126
127
  </>
127
128
  )
128
129
  }
@@ -1,33 +1,18 @@
1
- import { useGLTF } from "@react-three/drei"
2
- import type * as THREE from "three"
3
- import type { RobotProps } from "./SupportedRobot"
4
- import RobotAnimator from "./RobotAnimator"
5
1
  import { animated } from "@react-spring/three"
2
+ import { useGLTF } from "@react-three/drei"
3
+ import type { RobotModelProps } from "./types"
6
4
 
7
- export function FANUC_ARC_Mate_100iD({
8
- modelURL,
9
- rapidlyChangingMotionState,
10
- ...props
11
- }: RobotProps) {
5
+ FANUC_ARC_Mate_100iD.config = {
6
+ rotationOffsets: [0, Math.PI / 2, 0, 0, 0, 0],
7
+ }
8
+
9
+ export function FANUC_ARC_Mate_100iD({ modelURL, ...props }: RobotModelProps) {
12
10
  const gltf = useGLTF(modelURL) as any
13
11
  const nodes = gltf.nodes
14
12
  const materials = gltf.materials
15
- const rotationOffsets = [0, Math.PI / 2, 0, 0, 0, 0]
16
-
17
- function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
18
- jointObjects.forEach(
19
- (object, index) =>
20
- (object.rotation.y = jointValues[index]! + rotationOffsets[index]!),
21
- )
22
- }
23
13
 
24
14
  return (
25
15
  <>
26
- <RobotAnimator
27
- rapidlyChangingMotionState={rapidlyChangingMotionState}
28
- robotRootObjectName="Scene"
29
- onRotationChanged={setRotation}
30
- />
31
16
  <group {...props} dispose={null}>
32
17
  <group name="Scene">
33
18
  <group name="M10iD" rotation={[Math.PI / 2, 0, 0]}>