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

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 (99) hide show
  1. package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
  2. package/dist/components/jogging/JoggingJointLimitDetector.d.ts +1 -1
  3. package/dist/components/jogging/JoggingJointLimitDetector.d.ts.map +1 -1
  4. package/dist/components/jogging/JoggingPanel.d.ts +1 -1
  5. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  6. package/dist/components/jogging/JoggingVelocitySlider.d.ts.map +1 -1
  7. package/dist/components/robots/ABB_1200_07_7.d.ts +7 -2
  8. package/dist/components/robots/ABB_1200_07_7.d.ts.map +1 -1
  9. package/dist/components/robots/DHRobot.d.ts.map +1 -1
  10. package/dist/components/robots/FANUC_ARC_Mate_100iD.d.ts +7 -2
  11. package/dist/components/robots/FANUC_ARC_Mate_100iD.d.ts.map +1 -1
  12. package/dist/components/robots/FANUC_ARC_Mate_120iD.d.ts +7 -2
  13. package/dist/components/robots/FANUC_ARC_Mate_120iD.d.ts.map +1 -1
  14. package/dist/components/robots/FANUC_CRX10iA.d.ts +7 -2
  15. package/dist/components/robots/FANUC_CRX10iA.d.ts.map +1 -1
  16. package/dist/components/robots/FANUC_CRX20iAL.d.ts +7 -2
  17. package/dist/components/robots/FANUC_CRX20iAL.d.ts.map +1 -1
  18. package/dist/components/robots/FANUC_CRX25iA.d.ts +7 -2
  19. package/dist/components/robots/FANUC_CRX25iA.d.ts.map +1 -1
  20. package/dist/components/robots/FANUC_CRX25iAL.d.ts +7 -2
  21. package/dist/components/robots/FANUC_CRX25iAL.d.ts.map +1 -1
  22. package/dist/components/robots/KUKA_KR16_R2010_2.d.ts +7 -2
  23. package/dist/components/robots/KUKA_KR16_R2010_2.d.ts.map +1 -1
  24. package/dist/components/robots/KUKA_KR210_R2700.d.ts +7 -2
  25. package/dist/components/robots/KUKA_KR210_R2700.d.ts.map +1 -1
  26. package/dist/components/robots/KUKA_KR270_R2700.d.ts +7 -2
  27. package/dist/components/robots/KUKA_KR270_R2700.d.ts.map +1 -1
  28. package/dist/components/robots/Robot.d.ts +3 -3
  29. package/dist/components/robots/Robot.d.ts.map +1 -1
  30. package/dist/components/robots/RobotAnimator.d.ts +7 -4
  31. package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
  32. package/dist/components/robots/SupportedRobot.d.ts +1 -5
  33. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  34. package/dist/components/robots/UniversalRobots_UR10.d.ts +2 -2
  35. package/dist/components/robots/UniversalRobots_UR10.d.ts.map +1 -1
  36. package/dist/components/robots/UniversalRobots_UR10e.d.ts +2 -2
  37. package/dist/components/robots/UniversalRobots_UR10e.d.ts.map +1 -1
  38. package/dist/components/robots/UniversalRobots_UR3.d.ts +2 -2
  39. package/dist/components/robots/UniversalRobots_UR3.d.ts.map +1 -1
  40. package/dist/components/robots/UniversalRobots_UR3e.d.ts +2 -2
  41. package/dist/components/robots/UniversalRobots_UR3e.d.ts.map +1 -1
  42. package/dist/components/robots/UniversalRobots_UR5.d.ts +2 -2
  43. package/dist/components/robots/UniversalRobots_UR5.d.ts.map +1 -1
  44. package/dist/components/robots/UniversalRobots_UR5e.d.ts +2 -2
  45. package/dist/components/robots/UniversalRobots_UR5e.d.ts.map +1 -1
  46. package/dist/components/robots/Yaskawa_AR1440.d.ts +8 -2
  47. package/dist/components/robots/Yaskawa_AR1440.d.ts.map +1 -1
  48. package/dist/components/robots/Yaskawa_AR1730.d.ts +8 -2
  49. package/dist/components/robots/Yaskawa_AR1730.d.ts.map +1 -1
  50. package/dist/components/robots/Yaskawa_AR2010.d.ts +8 -2
  51. package/dist/components/robots/Yaskawa_AR2010.d.ts.map +1 -1
  52. package/dist/components/robots/Yaskawa_AR3120.d.ts +8 -2
  53. package/dist/components/robots/Yaskawa_AR3120.d.ts.map +1 -1
  54. package/dist/components/robots/Yaskawa_AR900.d.ts +7 -2
  55. package/dist/components/robots/Yaskawa_AR900.d.ts.map +1 -1
  56. package/dist/components/robots/Yaskawa_GP50.d.ts +7 -2
  57. package/dist/components/robots/Yaskawa_GP50.d.ts.map +1 -1
  58. package/dist/components/robots/types.d.ts +17 -0
  59. package/dist/components/robots/types.d.ts.map +1 -0
  60. package/dist/i18n/config.d.ts.map +1 -1
  61. package/dist/index.cjs +32 -32
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.js +9706 -10063
  64. package/dist/index.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/components/jogging/JoggingCartesianTab.tsx +11 -11
  67. package/src/components/jogging/JoggingJointLimitDetector.tsx +9 -8
  68. package/src/components/jogging/JoggingPanel.tsx +8 -10
  69. package/src/components/jogging/JoggingVelocitySlider.tsx +4 -5
  70. package/src/components/robots/ABB_1200_07_7.tsx +7 -22
  71. package/src/components/robots/DHRobot.tsx +34 -33
  72. package/src/components/robots/FANUC_ARC_Mate_100iD.tsx +7 -22
  73. package/src/components/robots/FANUC_ARC_Mate_120iD.tsx +7 -22
  74. package/src/components/robots/FANUC_CRX10iA.tsx +7 -22
  75. package/src/components/robots/FANUC_CRX20iAL.tsx +7 -22
  76. package/src/components/robots/FANUC_CRX25iA.tsx +7 -22
  77. package/src/components/robots/FANUC_CRX25iAL.tsx +7 -22
  78. package/src/components/robots/KUKA_KR16_R2010_2.tsx +19 -34
  79. package/src/components/robots/KUKA_KR210_R2700.tsx +7 -23
  80. package/src/components/robots/KUKA_KR270_R2700.tsx +7 -23
  81. package/src/components/robots/Robot.tsx +3 -3
  82. package/src/components/robots/RobotAnimator.tsx +32 -21
  83. package/src/components/robots/SupportedRobot.tsx +93 -103
  84. package/src/components/robots/UniversalRobots_UR10.tsx +3 -20
  85. package/src/components/robots/UniversalRobots_UR10e.tsx +2 -19
  86. package/src/components/robots/UniversalRobots_UR3.tsx +2 -19
  87. package/src/components/robots/UniversalRobots_UR3e.tsx +3 -20
  88. package/src/components/robots/UniversalRobots_UR5.tsx +3 -20
  89. package/src/components/robots/UniversalRobots_UR5e.tsx +3 -20
  90. package/src/components/robots/Yaskawa_AR1440.tsx +8 -24
  91. package/src/components/robots/Yaskawa_AR1730.tsx +8 -24
  92. package/src/components/robots/Yaskawa_AR2010.tsx +8 -24
  93. package/src/components/robots/Yaskawa_AR3120.tsx +8 -24
  94. package/src/components/robots/Yaskawa_AR900.tsx +7 -22
  95. package/src/components/robots/Yaskawa_GP50.tsx +7 -24
  96. package/src/components/robots/types.ts +19 -0
  97. package/src/i18n/config.ts +15 -19
  98. package/src/i18n/locales/de/translations.json +2 -1
  99. package/src/i18n/locales/en/translations.json +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "1.17.2",
3
+ "version": "1.17.4",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,23 +1,23 @@
1
1
  import {
2
- ToggleButtonGroup,
3
- ToggleButton,
4
2
  Stack,
3
+ ToggleButton,
4
+ ToggleButtonGroup,
5
5
  Typography,
6
6
  } from "@mui/material"
7
- import { observer } from "mobx-react-lite"
8
- import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl"
9
7
  import { degreesToRadians, radiansToDegrees } from "@wandelbots/wandelbots-js"
8
+ import { observer } from "mobx-react-lite"
10
9
  import { useTranslation } from "react-i18next"
11
- import RotationIcon from "../../icons/rotation.svg"
12
10
  import XAxisIcon from "../../icons/axis-x.svg"
13
11
  import YAxisIcon from "../../icons/axis-y.svg"
14
12
  import ZAxisIcon from "../../icons/axis-z.svg"
15
- import type { JoggingStore, DiscreteIncrementOption } from "./JoggingStore"
16
- import { JoggingOptions } from "./JoggingOptions"
17
- import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
13
+ import RotationIcon from "../../icons/rotation.svg"
18
14
  import { useReaction } from "../utils/hooks"
15
+ import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl"
19
16
  import { JoggingCartesianValues } from "./JoggingCartesianValues"
20
17
  import { JoggingJointLimitDetector } from "./JoggingJointLimitDetector"
18
+ import { JoggingOptions } from "./JoggingOptions"
19
+ import type { DiscreteIncrementOption, JoggingStore } from "./JoggingStore"
20
+ import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
21
21
 
22
22
  type JoggingCartesianOpts = {
23
23
  axis: "x" | "y" | "z"
@@ -247,11 +247,11 @@ export const JoggingCartesianTab = observer(
247
247
  ))}
248
248
  </Stack>
249
249
 
250
- {/* Velocity slider */}
251
- <JoggingVelocitySlider store={store} />
252
-
253
250
  {/* Show message if joint limits reached */}
254
251
  <JoggingJointLimitDetector store={store} />
252
+
253
+ {/* Velocity slider */}
254
+ <JoggingVelocitySlider store={store} />
255
255
  </Stack>
256
256
  )
257
257
  },
@@ -1,7 +1,7 @@
1
1
  import { Typography } from "@mui/material"
2
- import { useTranslation } from "react-i18next"
3
- import { useState } from "react"
4
2
  import isEqual from "lodash-es/isEqual"
3
+ import { useRef, useState } from "react"
4
+ import { useTranslation } from "react-i18next"
5
5
  import { useAnimationFrame } from "../utils/hooks"
6
6
  import type { JoggingStore } from "./JoggingStore"
7
7
 
@@ -20,30 +20,31 @@ export const JoggingJointLimitDetector = ({
20
20
  store.jogger.motionStream.rapidlyChangingMotionState.state
21
21
  .joint_limit_reached.limit_reached,
22
22
  )
23
+ const jointLimitsReachedRef = useRef(jointLimitsReached)
23
24
 
24
25
  useAnimationFrame(() => {
25
26
  const newLimitsReached =
26
27
  store.jogger.motionStream.rapidlyChangingMotionState.state
27
28
  .joint_limit_reached.limit_reached
28
29
 
29
- if (!isEqual(jointLimitsReached, newLimitsReached)) {
30
+ if (!isEqual(jointLimitsReachedRef.current, newLimitsReached)) {
31
+ jointLimitsReachedRef.current = newLimitsReached
30
32
  setJointLimitsReached(newLimitsReached)
31
33
  }
32
34
  })
33
35
 
34
36
  const jointLimitReachedIndices: number[] = []
35
- jointLimitsReached.forEach((limitReached, index) => {
37
+ for (const [index, limitReached] of jointLimitsReached.entries()) {
36
38
  if (limitReached) jointLimitReachedIndices.push(index)
37
- })
38
-
39
- if (!jointLimitReachedIndices.length) return null
39
+ }
40
40
 
41
41
  return (
42
42
  <Typography
43
43
  color="error"
44
44
  sx={{
45
- padding: "1rem",
45
+ margin: "0.5rem 1rem",
46
46
  textAlign: "center",
47
+ visibility: jointLimitReachedIndices.length ? "visible" : "hidden",
47
48
  }}
48
49
  >
49
50
  {t("Jogging.JointLimitsReached.lb", {
@@ -1,17 +1,17 @@
1
1
  import { Button, Paper, Stack, Tab, Tabs } from "@mui/material"
2
+ import { NovaClient } from "@wandelbots/wandelbots-js"
3
+ import { isString } from "lodash-es"
4
+ import { runInAction } from "mobx"
2
5
  import { observer, useLocalObservable } from "mobx-react-lite"
3
6
  import { useEffect } from "react"
4
- import { JoggingCartesianTab } from "./JoggingCartesianTab"
5
- import { JoggingJointTab } from "./JoggingJointTab"
6
- import { JoggingStore } from "./JoggingStore"
7
+ import { useTranslation } from "react-i18next"
8
+ import { externalizeComponent } from "../../externalizeComponent"
7
9
  import { LoadingCover } from "../LoadingCover"
8
10
  import { TransparentOverlay } from "../TransparentOverlay"
9
- import { runInAction } from "mobx"
10
- import { NovaClient } from "@wandelbots/wandelbots-js"
11
- import { externalizeComponent } from "../../externalizeComponent"
12
- import { isString } from "lodash-es"
13
11
  import { useReaction } from "../utils/hooks"
14
- import { useTranslation } from "react-i18next"
12
+ import { JoggingCartesianTab } from "./JoggingCartesianTab"
13
+ import { JoggingJointTab } from "./JoggingJointTab"
14
+ import { JoggingStore } from "./JoggingStore"
15
15
 
16
16
  export type JoggingPanelProps = {
17
17
  /** Either an existing NovaClient or the base url of a deployed Nova instance */
@@ -31,8 +31,6 @@ export type JoggingPanelProps = {
31
31
  */
32
32
  export const JoggingPanel = externalizeComponent(
33
33
  observer((props: JoggingPanelProps) => {
34
- const { t } = useTranslation()
35
-
36
34
  const nova = isString(props.nova)
37
35
  ? new NovaClient({ instanceUrl: props.nova })
38
36
  : props.nova
@@ -1,8 +1,8 @@
1
- import { Stack, Typography } from "@mui/material"
1
+ import { Stack } from "@mui/material"
2
2
  import { observer, useLocalObservable } from "mobx-react-lite"
3
- import type { JoggingStore } from "./JoggingStore"
4
- import { VelocitySlider } from "../VelocitySlider"
5
3
  import { useTranslation } from "react-i18next"
4
+ import { VelocitySlider } from "../VelocitySlider"
5
+ import type { JoggingStore } from "./JoggingStore"
6
6
 
7
7
  export const JoggingVelocitySlider = observer(
8
8
  ({ store }: { store: JoggingStore }) => {
@@ -24,8 +24,7 @@ export const JoggingVelocitySlider = observer(
24
24
  <Stack
25
25
  sx={{
26
26
  margin: "0px 20px",
27
- marginTop: "24px",
28
- marginBottom: "24px",
27
+ marginBottom: "12px",
29
28
  }}
30
29
  >
31
30
  <Stack sx={{ width: "380px", maxWidth: "90%", margin: "auto" }}>
@@ -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]}>
@@ -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_120iD({
8
- modelURL,
9
- rapidlyChangingMotionState,
10
- ...props
11
- }: RobotProps) {
5
+ FANUC_ARC_Mate_120iD.config = {
6
+ rotationOffsets: [0, Math.PI / 2, 0, 0, 0, 0],
7
+ }
8
+
9
+ export function FANUC_ARC_Mate_120iD({ 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={[0, 0, 0]}>
@@ -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_CRX10iA({
8
- modelURL,
9
- rapidlyChangingMotionState,
10
- ...props
11
- }: RobotProps) {
5
+ FANUC_CRX10iA.config = {
6
+ rotationOffsets: [0, Math.PI / 2, 0, 0, 0, 0],
7
+ }
8
+
9
+ export function FANUC_CRX10iA({ 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
  <animated.group name="CRX10iA_J00">
@@ -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 FANUC_CRX20iAL({
8
- modelURL,
9
- rapidlyChangingMotionState,
10
- ...props
11
- }: RobotProps) {
5
+ FANUC_CRX20iAL.config = {
6
+ rotationOffsets: [0, Math.PI / 2, 0, 0, 0, 0],
7
+ }
8
+
9
+ export function FANUC_CRX20iAL({ 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
  <mesh
@@ -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 FANUC_CRX25iA({
8
- modelURL,
9
- rapidlyChangingMotionState,
10
- ...props
11
- }: RobotProps) {
5
+ FANUC_CRX25iA.config = {
6
+ rotationOffsets: [0, Math.PI / 2, 0, 0, 0, 0],
7
+ }
8
+
9
+ export function FANUC_CRX25iA({ 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" position={[0, -0.37, 0]}>
33
18
  <group name="CRX25iA_L00">
@@ -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 FANUC_CRX25iAL({
8
- modelURL,
9
- rapidlyChangingMotionState,
10
- ...props
11
- }: RobotProps) {
5
+ FANUC_CRX25iAL.config = {
6
+ rotationOffsets: [0, Math.PI / 2, 0, 0, 0, 0],
7
+ }
8
+
9
+ export function FANUC_CRX25iAL({ 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
  <animated.group name="CRX10iA_J00">