@wandelbots/wandelbots-js-react-components 1.17.3 → 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.
- package/dist/components/robots/ABB_1200_07_7.d.ts +7 -2
- package/dist/components/robots/ABB_1200_07_7.d.ts.map +1 -1
- package/dist/components/robots/DHRobot.d.ts.map +1 -1
- package/dist/components/robots/FANUC_ARC_Mate_100iD.d.ts +7 -2
- package/dist/components/robots/FANUC_ARC_Mate_100iD.d.ts.map +1 -1
- package/dist/components/robots/FANUC_ARC_Mate_120iD.d.ts +7 -2
- package/dist/components/robots/FANUC_ARC_Mate_120iD.d.ts.map +1 -1
- package/dist/components/robots/FANUC_CRX10iA.d.ts +7 -2
- package/dist/components/robots/FANUC_CRX10iA.d.ts.map +1 -1
- package/dist/components/robots/FANUC_CRX20iAL.d.ts +7 -2
- package/dist/components/robots/FANUC_CRX20iAL.d.ts.map +1 -1
- package/dist/components/robots/FANUC_CRX25iA.d.ts +7 -2
- package/dist/components/robots/FANUC_CRX25iA.d.ts.map +1 -1
- package/dist/components/robots/FANUC_CRX25iAL.d.ts +7 -2
- package/dist/components/robots/FANUC_CRX25iAL.d.ts.map +1 -1
- package/dist/components/robots/KUKA_KR16_R2010_2.d.ts +7 -2
- package/dist/components/robots/KUKA_KR16_R2010_2.d.ts.map +1 -1
- package/dist/components/robots/KUKA_KR210_R2700.d.ts +7 -2
- package/dist/components/robots/KUKA_KR210_R2700.d.ts.map +1 -1
- package/dist/components/robots/KUKA_KR270_R2700.d.ts +7 -2
- package/dist/components/robots/KUKA_KR270_R2700.d.ts.map +1 -1
- package/dist/components/robots/Robot.d.ts +3 -3
- package/dist/components/robots/Robot.d.ts.map +1 -1
- package/dist/components/robots/RobotAnimator.d.ts +7 -4
- package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
- package/dist/components/robots/SupportedRobot.d.ts +1 -5
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/robots/UniversalRobots_UR10.d.ts +2 -2
- package/dist/components/robots/UniversalRobots_UR10.d.ts.map +1 -1
- package/dist/components/robots/UniversalRobots_UR10e.d.ts +2 -2
- package/dist/components/robots/UniversalRobots_UR10e.d.ts.map +1 -1
- package/dist/components/robots/UniversalRobots_UR3.d.ts +2 -2
- package/dist/components/robots/UniversalRobots_UR3.d.ts.map +1 -1
- package/dist/components/robots/UniversalRobots_UR3e.d.ts +2 -2
- package/dist/components/robots/UniversalRobots_UR3e.d.ts.map +1 -1
- package/dist/components/robots/UniversalRobots_UR5.d.ts +2 -2
- package/dist/components/robots/UniversalRobots_UR5.d.ts.map +1 -1
- package/dist/components/robots/UniversalRobots_UR5e.d.ts +2 -2
- package/dist/components/robots/UniversalRobots_UR5e.d.ts.map +1 -1
- package/dist/components/robots/Yaskawa_AR1440.d.ts +8 -2
- package/dist/components/robots/Yaskawa_AR1440.d.ts.map +1 -1
- package/dist/components/robots/Yaskawa_AR1730.d.ts +8 -2
- package/dist/components/robots/Yaskawa_AR1730.d.ts.map +1 -1
- package/dist/components/robots/Yaskawa_AR2010.d.ts +8 -2
- package/dist/components/robots/Yaskawa_AR2010.d.ts.map +1 -1
- package/dist/components/robots/Yaskawa_AR3120.d.ts +8 -2
- package/dist/components/robots/Yaskawa_AR3120.d.ts.map +1 -1
- package/dist/components/robots/Yaskawa_AR900.d.ts +7 -2
- package/dist/components/robots/Yaskawa_AR900.d.ts.map +1 -1
- package/dist/components/robots/Yaskawa_GP50.d.ts +7 -2
- package/dist/components/robots/Yaskawa_GP50.d.ts.map +1 -1
- package/dist/components/robots/types.d.ts +17 -0
- package/dist/components/robots/types.d.ts.map +1 -0
- package/dist/index.cjs +32 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8940 -9298
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/robots/ABB_1200_07_7.tsx +7 -22
- package/src/components/robots/DHRobot.tsx +34 -33
- package/src/components/robots/FANUC_ARC_Mate_100iD.tsx +7 -22
- package/src/components/robots/FANUC_ARC_Mate_120iD.tsx +7 -22
- package/src/components/robots/FANUC_CRX10iA.tsx +7 -22
- package/src/components/robots/FANUC_CRX20iAL.tsx +7 -22
- package/src/components/robots/FANUC_CRX25iA.tsx +7 -22
- package/src/components/robots/FANUC_CRX25iAL.tsx +7 -22
- package/src/components/robots/KUKA_KR16_R2010_2.tsx +19 -34
- package/src/components/robots/KUKA_KR210_R2700.tsx +7 -23
- package/src/components/robots/KUKA_KR270_R2700.tsx +7 -23
- package/src/components/robots/Robot.tsx +3 -3
- package/src/components/robots/RobotAnimator.tsx +32 -21
- package/src/components/robots/SupportedRobot.tsx +93 -103
- package/src/components/robots/UniversalRobots_UR10.tsx +3 -20
- package/src/components/robots/UniversalRobots_UR10e.tsx +2 -19
- package/src/components/robots/UniversalRobots_UR3.tsx +2 -19
- package/src/components/robots/UniversalRobots_UR3e.tsx +3 -20
- package/src/components/robots/UniversalRobots_UR5.tsx +3 -20
- package/src/components/robots/UniversalRobots_UR5e.tsx +3 -20
- package/src/components/robots/Yaskawa_AR1440.tsx +8 -24
- package/src/components/robots/Yaskawa_AR1730.tsx +8 -24
- package/src/components/robots/Yaskawa_AR2010.tsx +8 -24
- package/src/components/robots/Yaskawa_AR3120.tsx +8 -24
- package/src/components/robots/Yaskawa_AR900.tsx +7 -22
- package/src/components/robots/Yaskawa_GP50.tsx +7 -24
- package/src/components/robots/types.ts +19 -0
|
@@ -1,59 +1,69 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react"
|
|
2
1
|
import { Globals, useSpring } from "@react-spring/three"
|
|
3
2
|
import { useThree } from "@react-three/fiber"
|
|
3
|
+
import type { MotionGroupStateResponse } from "@wandelbots/wandelbots-api-client"
|
|
4
|
+
import React, { useRef } from "react"
|
|
4
5
|
import type * as THREE from "three"
|
|
6
|
+
import { useAutorun } from "../utils/hooks"
|
|
5
7
|
import {
|
|
6
8
|
getAllJointsByName,
|
|
7
9
|
type RobotSceneJoint,
|
|
8
10
|
} from "../utils/robotTreeQuery"
|
|
9
|
-
import type {
|
|
10
|
-
import { useAutorun } from "../utils/hooks"
|
|
11
|
+
import type { RobotModelConfig } from "./types"
|
|
11
12
|
|
|
12
13
|
type RobotAnimatorProps = {
|
|
13
14
|
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
14
|
-
|
|
15
|
-
onRotationChanged: (joints: THREE.Object3D[], jointValues: number[]) => void
|
|
15
|
+
onRotationChanged?: (joints: THREE.Object3D[], jointValues: number[]) => void
|
|
16
16
|
jointCollector?: (rootObject: THREE.Object3D) => RobotSceneJoint[]
|
|
17
|
+
robotConfig?: RobotModelConfig
|
|
18
|
+
children: React.ReactNode
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export default function RobotAnimator({
|
|
20
22
|
rapidlyChangingMotionState,
|
|
21
|
-
robotRootObjectName,
|
|
22
|
-
onRotationChanged,
|
|
23
23
|
jointCollector,
|
|
24
|
+
onRotationChanged,
|
|
25
|
+
robotConfig,
|
|
26
|
+
children,
|
|
24
27
|
}: RobotAnimatorProps) {
|
|
25
28
|
Globals.assign({ frameLoop: "always" })
|
|
26
29
|
const jointValues = useRef<number[]>([])
|
|
27
30
|
const jointObjects = useRef<THREE.Object3D[]>([])
|
|
28
|
-
const {
|
|
31
|
+
const { invalidate } = useThree()
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// From this object the tree is traversed and all joints are extracted (ordered ASC)
|
|
33
|
-
const sceneObject = scene.getObjectByName(robotRootObjectName)
|
|
34
|
-
if (!sceneObject) {
|
|
35
|
-
return
|
|
36
|
-
}
|
|
33
|
+
function setGroupRef(group: THREE.Group | null) {
|
|
34
|
+
if (!group) return
|
|
37
35
|
|
|
38
36
|
jointObjects.current = jointCollector
|
|
39
|
-
? jointCollector(
|
|
40
|
-
: getAllJointsByName(
|
|
37
|
+
? jointCollector(group)
|
|
38
|
+
: getAllJointsByName(group)
|
|
41
39
|
|
|
42
40
|
// Set initial position
|
|
43
41
|
setRotation()
|
|
44
42
|
invalidate()
|
|
45
|
-
}
|
|
43
|
+
}
|
|
46
44
|
|
|
47
45
|
function updateJoints(newJointValues: number[]) {
|
|
48
46
|
jointValues.current = newJointValues
|
|
49
47
|
setSpring.start(Object.assign({}, jointValues.current) as any)
|
|
50
48
|
}
|
|
51
49
|
|
|
50
|
+
const rotationSign = robotConfig?.rotationSign || [1, 1, 1, 1, 1, 1]
|
|
51
|
+
const rotationOffsets = robotConfig?.rotationOffsets || [0, 0, 0, 0, 0, 0]
|
|
52
|
+
|
|
52
53
|
function setRotation() {
|
|
53
|
-
const updatedJointValues = jointObjects.current.map((
|
|
54
|
+
const updatedJointValues = jointObjects.current.map((_, objectIndex) =>
|
|
54
55
|
(axisValues as any)[objectIndex].get(),
|
|
55
56
|
)
|
|
56
|
-
|
|
57
|
+
|
|
58
|
+
if (onRotationChanged) {
|
|
59
|
+
onRotationChanged(jointObjects.current, updatedJointValues)
|
|
60
|
+
} else {
|
|
61
|
+
for (const [index, object] of jointObjects.current.entries()) {
|
|
62
|
+
object.rotation.y =
|
|
63
|
+
rotationSign[index]! * updatedJointValues[index]! +
|
|
64
|
+
rotationOffsets[index]!
|
|
65
|
+
}
|
|
66
|
+
}
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
useAutorun(() => {
|
|
@@ -78,5 +88,6 @@ export default function RobotAnimator({
|
|
|
78
88
|
setRotation()
|
|
79
89
|
},
|
|
80
90
|
}))
|
|
81
|
-
|
|
91
|
+
|
|
92
|
+
return <group ref={setGroupRef}>{children}</group>
|
|
82
93
|
}
|
|
@@ -1,50 +1,47 @@
|
|
|
1
1
|
import { Suspense, useCallback, useEffect, useRef } from "react"
|
|
2
2
|
|
|
3
|
+
import { ABB_1200_07_7 } from "./ABB_1200_07_7"
|
|
4
|
+
import { FANUC_ARC_Mate_100iD } from "./FANUC_ARC_Mate_100iD"
|
|
5
|
+
import { FANUC_ARC_Mate_120iD } from "./FANUC_ARC_Mate_120iD"
|
|
6
|
+
import { FANUC_CRX10iA } from "./FANUC_CRX10iA"
|
|
7
|
+
import { FANUC_CRX20iAL } from "./FANUC_CRX20iAL"
|
|
8
|
+
import { FANUC_CRX25iA } from "./FANUC_CRX25iA"
|
|
9
|
+
import { FANUC_CRX25iAL } from "./FANUC_CRX25iAL"
|
|
10
|
+
import { KUKA_KR16_R2010_2 } from "./KUKA_KR16_R2010_2"
|
|
11
|
+
import { KUKA_KR210_R2700 } from "./KUKA_KR210_R2700"
|
|
12
|
+
import { KUKA_KR270_R2700 } from "./KUKA_KR270_R2700"
|
|
13
|
+
import { UniversalRobots_UR10 } from "./UniversalRobots_UR10"
|
|
14
|
+
import { UniversalRobots_UR10e } from "./UniversalRobots_UR10e"
|
|
3
15
|
import { UniversalRobots_UR3 } from "./UniversalRobots_UR3"
|
|
4
16
|
import { UniversalRobots_UR3e } from "./UniversalRobots_UR3e"
|
|
5
17
|
import { UniversalRobots_UR5 } from "./UniversalRobots_UR5"
|
|
6
18
|
import { UniversalRobots_UR5e } from "./UniversalRobots_UR5e"
|
|
7
|
-
import { UniversalRobots_UR10 } from "./UniversalRobots_UR10"
|
|
8
|
-
import { UniversalRobots_UR10e } from "./UniversalRobots_UR10e"
|
|
9
|
-
import { Yaskawa_AR900 } from "./Yaskawa_AR900"
|
|
10
19
|
import { Yaskawa_AR1440 } from "./Yaskawa_AR1440"
|
|
11
20
|
import { Yaskawa_AR1730 } from "./Yaskawa_AR1730"
|
|
12
21
|
import { Yaskawa_AR2010 } from "./Yaskawa_AR2010"
|
|
13
22
|
import { Yaskawa_AR3120 } from "./Yaskawa_AR3120"
|
|
23
|
+
import { Yaskawa_AR900 } from "./Yaskawa_AR900"
|
|
14
24
|
import { Yaskawa_GP50 } from "./Yaskawa_GP50"
|
|
15
|
-
import { FANUC_CRX10iA } from "./FANUC_CRX10iA"
|
|
16
|
-
import { FANUC_CRX20iAL } from "./FANUC_CRX20iAL"
|
|
17
|
-
import { FANUC_CRX25iA } from "./FANUC_CRX25iA"
|
|
18
|
-
import { FANUC_CRX25iAL } from "./FANUC_CRX25iAL"
|
|
19
|
-
import { KUKA_KR210_R2700 } from "./KUKA_KR210_R2700"
|
|
20
|
-
import { KUKA_KR270_R2700 } from "./KUKA_KR270_R2700"
|
|
21
|
-
import { KUKA_KR16_R2010_2 } from "./KUKA_KR16_R2010_2"
|
|
22
|
-
import { FANUC_ARC_Mate_100iD } from "./FANUC_ARC_Mate_100iD"
|
|
23
|
-
import { FANUC_ARC_Mate_120iD } from "./FANUC_ARC_Mate_120iD"
|
|
24
|
-
import { ABB_1200_07_7 } from "./ABB_1200_07_7"
|
|
25
25
|
|
|
26
26
|
import type { GroupProps } from "@react-three/fiber"
|
|
27
27
|
import type {
|
|
28
|
-
MotionGroupStateResponse,
|
|
29
28
|
DHParameter,
|
|
29
|
+
MotionGroupStateResponse,
|
|
30
30
|
} from "@wandelbots/wandelbots-api-client"
|
|
31
31
|
import { DHRobot } from "./DHRobot"
|
|
32
32
|
|
|
33
|
-
import * as THREE from "three"
|
|
34
33
|
import { ErrorBoundary } from "react-error-boundary"
|
|
35
|
-
import
|
|
34
|
+
import * as THREE from "three"
|
|
36
35
|
import { externalizeComponent } from "../../externalizeComponent"
|
|
36
|
+
import ConsoleFilter from "../ConsoleFilter"
|
|
37
|
+
import RobotAnimator from "./RobotAnimator"
|
|
38
|
+
import type { RobotModelComponent } from "./types"
|
|
37
39
|
|
|
38
40
|
export type DHRobotProps = {
|
|
39
41
|
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
40
42
|
dhParameters: Array<DHParameter>
|
|
41
43
|
} & GroupProps
|
|
42
44
|
|
|
43
|
-
export type RobotProps = {
|
|
44
|
-
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
45
|
-
modelURL: string
|
|
46
|
-
} & GroupProps
|
|
47
|
-
|
|
48
45
|
export type SupportedRobotProps = {
|
|
49
46
|
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
50
47
|
modelFromController: string
|
|
@@ -66,107 +63,93 @@ export const SupportedRobot = externalizeComponent(
|
|
|
66
63
|
isGhost = false,
|
|
67
64
|
...props
|
|
68
65
|
}: SupportedRobotProps) => {
|
|
69
|
-
let Robot
|
|
66
|
+
let Robot: RobotModelComponent | null = null
|
|
70
67
|
|
|
71
|
-
const robotRef = useRef<THREE.Group>(
|
|
68
|
+
const robotRef = useRef<THREE.Group>()
|
|
72
69
|
|
|
73
70
|
const setRobotRef = useCallback(
|
|
74
71
|
(instance: THREE.Group | null) => {
|
|
75
|
-
if (instance
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
isGhost &&
|
|
80
|
-
robotRef.current &&
|
|
81
|
-
robotRef.current.children.length > 0
|
|
82
|
-
) {
|
|
83
|
-
addGhosts()
|
|
84
|
-
}
|
|
85
|
-
}
|
|
72
|
+
if (!instance) return
|
|
73
|
+
robotRef.current = instance
|
|
74
|
+
|
|
75
|
+
if (isGhost) applyGhostStyle()
|
|
86
76
|
},
|
|
87
77
|
[isGhost],
|
|
88
78
|
)
|
|
89
79
|
|
|
90
|
-
const
|
|
91
|
-
if (robotRef.current
|
|
92
|
-
robotRef.current.traverse((obj) => {
|
|
93
|
-
if (obj instanceof THREE.Mesh && !obj.userData.isGhost) {
|
|
94
|
-
if (obj.material instanceof THREE.Material) {
|
|
95
|
-
obj.material.colorWrite = false
|
|
96
|
-
}
|
|
80
|
+
const applyGhostStyle = () => {
|
|
81
|
+
if (!robotRef.current || robotRef.current.userData.isGhost) return
|
|
97
82
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
83
|
+
robotRef.current.traverse((obj) => {
|
|
84
|
+
if (obj instanceof THREE.Mesh) {
|
|
85
|
+
if (obj.material instanceof THREE.Material) {
|
|
86
|
+
obj.material.colorWrite = true
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Create a clone of the mesh
|
|
90
|
+
const depth = obj.clone()
|
|
91
|
+
const ghost = obj.clone()
|
|
101
92
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
93
|
+
depth.material = new THREE.MeshStandardMaterial({
|
|
94
|
+
depthTest: true,
|
|
95
|
+
depthWrite: true,
|
|
96
|
+
colorWrite: false,
|
|
97
|
+
polygonOffset: true,
|
|
98
|
+
polygonOffsetFactor: 1,
|
|
99
|
+
})
|
|
100
|
+
depth.userData.isGhost = true
|
|
110
101
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
102
|
+
// Set the material for the ghost mesh
|
|
103
|
+
ghost.material = new THREE.MeshStandardMaterial({
|
|
104
|
+
color: "#D91433",
|
|
105
|
+
opacity: 0.3,
|
|
106
|
+
depthTest: true,
|
|
107
|
+
depthWrite: false,
|
|
108
|
+
transparent: true,
|
|
109
|
+
polygonOffset: true,
|
|
110
|
+
polygonOffsetFactor: -1,
|
|
111
|
+
})
|
|
112
|
+
ghost.userData.isGhost = true
|
|
122
113
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
114
|
+
if (obj.parent) {
|
|
115
|
+
obj.parent.add(depth)
|
|
116
|
+
obj.parent.add(ghost)
|
|
127
117
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
robotRef.current.userData.isGhost = true
|
|
131
122
|
}
|
|
132
123
|
|
|
133
|
-
const
|
|
134
|
-
if (robotRef.current)
|
|
135
|
-
const objectsToRemove: THREE.Object3D[] = []
|
|
124
|
+
const removeGhostStyle = () => {
|
|
125
|
+
if (!robotRef.current || !robotRef.current.userData.isGhost) return
|
|
136
126
|
|
|
137
|
-
|
|
138
|
-
if (obj instanceof THREE.Mesh) {
|
|
139
|
-
if (obj.material instanceof THREE.Material) {
|
|
140
|
-
obj.material.colorWrite = true
|
|
141
|
-
}
|
|
142
|
-
}
|
|
127
|
+
const objectsToRemove: THREE.Object3D[] = []
|
|
143
128
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
obj.userData &&
|
|
148
|
-
obj.userData.isGhost !== undefined &&
|
|
149
|
-
obj.userData.isGhost
|
|
150
|
-
) {
|
|
129
|
+
robotRef.current.traverse((obj) => {
|
|
130
|
+
if (obj instanceof THREE.Mesh) {
|
|
131
|
+
if (obj.userData?.isGhost) {
|
|
151
132
|
objectsToRemove.push(obj)
|
|
133
|
+
} else if (obj.material instanceof THREE.Material) {
|
|
134
|
+
obj.material.colorWrite = true
|
|
152
135
|
}
|
|
153
|
-
}
|
|
136
|
+
}
|
|
137
|
+
})
|
|
154
138
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
139
|
+
objectsToRemove.forEach((obj) => {
|
|
140
|
+
if (obj.parent) {
|
|
141
|
+
obj.parent.remove(obj)
|
|
142
|
+
}
|
|
143
|
+
})
|
|
160
144
|
|
|
161
|
-
|
|
162
|
-
}
|
|
145
|
+
robotRef.current.userData.isGhost = true
|
|
163
146
|
}
|
|
164
147
|
|
|
165
148
|
useEffect(() => {
|
|
166
149
|
if (isGhost) {
|
|
167
|
-
|
|
150
|
+
applyGhostStyle()
|
|
168
151
|
} else {
|
|
169
|
-
|
|
152
|
+
removeGhostStyle()
|
|
170
153
|
}
|
|
171
154
|
}, [isGhost])
|
|
172
155
|
|
|
@@ -245,7 +228,7 @@ export const SupportedRobot = externalizeComponent(
|
|
|
245
228
|
break
|
|
246
229
|
default:
|
|
247
230
|
console.warn(`Unknown robot type: ${modelFromController}`)
|
|
248
|
-
Robot =
|
|
231
|
+
Robot = null
|
|
249
232
|
}
|
|
250
233
|
|
|
251
234
|
return (
|
|
@@ -268,12 +251,19 @@ export const SupportedRobot = externalizeComponent(
|
|
|
268
251
|
}
|
|
269
252
|
>
|
|
270
253
|
<group ref={setRobotRef}>
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
254
|
+
{Robot ? (
|
|
255
|
+
<RobotAnimator
|
|
256
|
+
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
257
|
+
robotConfig={Robot.config}
|
|
258
|
+
>
|
|
259
|
+
<Robot modelURL={getModel(modelFromController)} {...props} />
|
|
260
|
+
</RobotAnimator>
|
|
261
|
+
) : (
|
|
262
|
+
<DHRobot
|
|
263
|
+
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
264
|
+
dhParameters={dhParameters}
|
|
265
|
+
/>
|
|
266
|
+
)}
|
|
277
267
|
</group>
|
|
278
268
|
</Suspense>
|
|
279
269
|
<ConsoleFilter />
|
|
@@ -1,31 +1,14 @@
|
|
|
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 UniversalRobots_UR10({
|
|
8
|
-
modelURL,
|
|
9
|
-
rapidlyChangingMotionState,
|
|
10
|
-
...props
|
|
11
|
-
}: RobotProps) {
|
|
5
|
+
export function UniversalRobots_UR10({ modelURL, ...props }: RobotModelProps) {
|
|
12
6
|
const gltf = useGLTF(modelURL) as any
|
|
13
7
|
const nodes = gltf.nodes
|
|
14
8
|
const materials = gltf.materials
|
|
15
9
|
|
|
16
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
17
|
-
jointObjects.forEach(
|
|
18
|
-
(object, index) => (object.rotation.y = jointValues[index]!),
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
10
|
return (
|
|
23
11
|
<>
|
|
24
|
-
<RobotAnimator
|
|
25
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
26
|
-
robotRootObjectName="Scene"
|
|
27
|
-
onRotationChanged={setRotation}
|
|
28
|
-
/>
|
|
29
12
|
<group {...props} dispose={null}>
|
|
30
13
|
<group name="Scene">
|
|
31
14
|
<animated.group name="UNIVERSALROBOTS_UR10CB3_J00">
|
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
import { animated } from "@react-spring/three"
|
|
2
2
|
import { useGLTF } from "@react-three/drei"
|
|
3
|
-
import type {
|
|
4
|
-
import RobotAnimator from "./RobotAnimator"
|
|
5
|
-
import type * as THREE from "three"
|
|
3
|
+
import type { RobotModelProps } from "./types"
|
|
6
4
|
|
|
7
|
-
export function UniversalRobots_UR10e({
|
|
8
|
-
modelURL,
|
|
9
|
-
rapidlyChangingMotionState,
|
|
10
|
-
...props
|
|
11
|
-
}: RobotProps) {
|
|
5
|
+
export function UniversalRobots_UR10e({ modelURL, ...props }: RobotModelProps) {
|
|
12
6
|
const gltf = useGLTF(modelURL) as any
|
|
13
7
|
const nodes = gltf.nodes
|
|
14
8
|
const materials = gltf.materials
|
|
15
9
|
|
|
16
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
17
|
-
jointObjects.forEach(
|
|
18
|
-
(object, index) => (object.rotation.y = jointValues[index]!),
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
10
|
return (
|
|
23
11
|
<>
|
|
24
|
-
<RobotAnimator
|
|
25
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
26
|
-
robotRootObjectName="Scene"
|
|
27
|
-
onRotationChanged={setRotation}
|
|
28
|
-
/>
|
|
29
12
|
<group {...props} dispose={null}>
|
|
30
13
|
<group name="Scene">
|
|
31
14
|
<group name="UR10e" rotation={[Math.PI / 2, 0, 0]}>
|
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
import { animated } from "@react-spring/three"
|
|
2
2
|
import { useGLTF } from "@react-three/drei"
|
|
3
|
-
import type
|
|
4
|
-
import type { RobotProps } from "./SupportedRobot"
|
|
5
|
-
import RobotAnimator from "./RobotAnimator"
|
|
3
|
+
import type { RobotModelProps } from "./types"
|
|
6
4
|
|
|
7
|
-
export function UniversalRobots_UR3({
|
|
8
|
-
modelURL,
|
|
9
|
-
rapidlyChangingMotionState,
|
|
10
|
-
...props
|
|
11
|
-
}: RobotProps) {
|
|
5
|
+
export function UniversalRobots_UR3({ modelURL, ...props }: RobotModelProps) {
|
|
12
6
|
const gltf = useGLTF(modelURL) as any
|
|
13
7
|
const nodes = gltf.nodes
|
|
14
8
|
const materials = gltf.materials
|
|
15
9
|
|
|
16
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
17
|
-
jointObjects.forEach(
|
|
18
|
-
(object, index) => (object.rotation.y = jointValues[index]!),
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
10
|
return (
|
|
23
11
|
<>
|
|
24
|
-
<RobotAnimator
|
|
25
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
26
|
-
robotRootObjectName="Scene"
|
|
27
|
-
onRotationChanged={setRotation}
|
|
28
|
-
/>
|
|
29
12
|
<group {...props} dispose={null}>
|
|
30
13
|
<group name="Scene">
|
|
31
14
|
<group name="UR3" rotation={[Math.PI / 2, 0, 0]}>
|
|
@@ -1,31 +1,14 @@
|
|
|
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
|
|
2
|
+
import { useGLTF } from "@react-three/drei"
|
|
3
|
+
import type { RobotModelProps } from "./types"
|
|
6
4
|
|
|
7
|
-
export function UniversalRobots_UR3e({
|
|
8
|
-
modelURL,
|
|
9
|
-
rapidlyChangingMotionState,
|
|
10
|
-
...props
|
|
11
|
-
}: RobotProps) {
|
|
5
|
+
export function UniversalRobots_UR3e({ modelURL, ...props }: RobotModelProps) {
|
|
12
6
|
const gltf = useGLTF(modelURL) as any
|
|
13
7
|
const nodes = gltf.nodes
|
|
14
8
|
const materials = gltf.materials
|
|
15
9
|
|
|
16
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
17
|
-
jointObjects.forEach(
|
|
18
|
-
(object, index) => (object.rotation.y = jointValues[index]!),
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
10
|
return (
|
|
23
11
|
<>
|
|
24
|
-
<RobotAnimator
|
|
25
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
26
|
-
robotRootObjectName="Scene"
|
|
27
|
-
onRotationChanged={setRotation}
|
|
28
|
-
/>
|
|
29
12
|
<group {...props} dispose={null}>
|
|
30
13
|
<group name="Scene">
|
|
31
14
|
<animated.group name="UR3e" rotation={[Math.PI / 2, 0, 0]}>
|
|
@@ -1,31 +1,14 @@
|
|
|
1
|
-
import { useGLTF } from "@react-three/drei"
|
|
2
|
-
import type * as THREE from "three"
|
|
3
1
|
import { animated } from "@react-spring/three"
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { useGLTF } from "@react-three/drei"
|
|
3
|
+
import type { RobotModelProps } from "./types"
|
|
6
4
|
|
|
7
|
-
export function UniversalRobots_UR5({
|
|
8
|
-
modelURL,
|
|
9
|
-
rapidlyChangingMotionState,
|
|
10
|
-
...props
|
|
11
|
-
}: RobotProps) {
|
|
5
|
+
export function UniversalRobots_UR5({ modelURL, ...props }: RobotModelProps) {
|
|
12
6
|
const gltf = useGLTF(modelURL) as any
|
|
13
7
|
const nodes = gltf.nodes
|
|
14
8
|
const materials = gltf.materials
|
|
15
9
|
|
|
16
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
17
|
-
jointObjects.forEach(
|
|
18
|
-
(object, index) => (object.rotation.y = jointValues[index]!),
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
10
|
return (
|
|
23
11
|
<>
|
|
24
|
-
<RobotAnimator
|
|
25
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
26
|
-
robotRootObjectName="Scene"
|
|
27
|
-
onRotationChanged={setRotation}
|
|
28
|
-
/>
|
|
29
12
|
<group {...props} dispose={null}>
|
|
30
13
|
<group name="Scene">
|
|
31
14
|
<animated.group name="UNIVERSALROBOTS_UR5CB3_J00">
|
|
@@ -1,31 +1,14 @@
|
|
|
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
|
|
2
|
+
import { useGLTF } from "@react-three/drei"
|
|
3
|
+
import type { RobotModelProps } from "./types"
|
|
6
4
|
|
|
7
|
-
export function UniversalRobots_UR5e({
|
|
8
|
-
modelURL,
|
|
9
|
-
rapidlyChangingMotionState,
|
|
10
|
-
...props
|
|
11
|
-
}: RobotProps) {
|
|
5
|
+
export function UniversalRobots_UR5e({ modelURL, ...props }: RobotModelProps) {
|
|
12
6
|
const gltf = useGLTF(modelURL) as any
|
|
13
7
|
const nodes = gltf.nodes
|
|
14
8
|
const materials = gltf.materials
|
|
15
9
|
|
|
16
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
17
|
-
jointObjects.forEach(
|
|
18
|
-
(object, index) => (object.rotation.y = jointValues[index]!),
|
|
19
|
-
)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
10
|
return (
|
|
23
11
|
<>
|
|
24
|
-
<RobotAnimator
|
|
25
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
26
|
-
robotRootObjectName="Scene"
|
|
27
|
-
onRotationChanged={setRotation}
|
|
28
|
-
/>
|
|
29
12
|
<group {...props} dispose={null}>
|
|
30
13
|
<group name="Scene">
|
|
31
14
|
<group name="UR5e" rotation={[Math.PI / 2, 0, 0]}>
|
|
@@ -1,36 +1,20 @@
|
|
|
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
|
|
2
|
+
import { useGLTF } from "@react-three/drei"
|
|
3
|
+
import type { RobotModelProps } from "./types"
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Yaskawa_AR1440.config = {
|
|
6
|
+
rotationOffsets: [0, -Math.PI / 2, 0, 0, 0, 0],
|
|
7
|
+
rotationSign: [1, -1, 1, 1, 1, 1],
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Yaskawa_AR1440({ modelURL, ...props }: RobotModelProps) {
|
|
12
11
|
const gltf = useGLTF(modelURL) as any
|
|
13
12
|
|
|
14
13
|
const nodes = gltf.nodes
|
|
15
14
|
const materials = gltf.materials
|
|
16
|
-
const rotationOffsets = [0, -Math.PI / 2, 0, 0, 0, 0]
|
|
17
|
-
const rotationSign = [1, -1, 1, 1, 1, 1]
|
|
18
|
-
|
|
19
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
20
|
-
jointObjects.forEach(
|
|
21
|
-
(object, index) =>
|
|
22
|
-
(object.rotation.y =
|
|
23
|
-
rotationSign[index]! * jointValues[index]! + rotationOffsets[index]!),
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
15
|
|
|
27
16
|
return (
|
|
28
17
|
<>
|
|
29
|
-
<RobotAnimator
|
|
30
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
31
|
-
robotRootObjectName="Scene"
|
|
32
|
-
onRotationChanged={setRotation}
|
|
33
|
-
/>
|
|
34
18
|
<group {...props} dispose={null}>
|
|
35
19
|
<group name="Scene">
|
|
36
20
|
<group name="AR1440" rotation={[Math.PI / 2, 0, 0]}>
|
|
@@ -1,36 +1,20 @@
|
|
|
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
|
|
2
|
+
import { useGLTF } from "@react-three/drei"
|
|
3
|
+
import type { RobotModelProps } from "./types"
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
Yaskawa_AR1730.config = {
|
|
6
|
+
rotationOffsets: [0, -Math.PI / 2, 0, 0, 0, 0],
|
|
7
|
+
rotationSign: [1, -1, 1, 1, 1, 1],
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Yaskawa_AR1730({ modelURL, ...props }: RobotModelProps) {
|
|
12
11
|
const gltf = useGLTF(modelURL) as any
|
|
13
12
|
|
|
14
13
|
const nodes = gltf.nodes
|
|
15
14
|
const materials = gltf.materials
|
|
16
|
-
const rotationOffsets = [0, -Math.PI / 2, 0, 0, 0, 0]
|
|
17
|
-
const rotationSign = [1, -1, 1, 1, 1, 1]
|
|
18
|
-
|
|
19
|
-
function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
|
|
20
|
-
jointObjects.forEach(
|
|
21
|
-
(object, index) =>
|
|
22
|
-
(object.rotation.y =
|
|
23
|
-
rotationSign[index]! * jointValues[index]! + rotationOffsets[index]!),
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
15
|
|
|
27
16
|
return (
|
|
28
17
|
<>
|
|
29
|
-
<RobotAnimator
|
|
30
|
-
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
31
|
-
robotRootObjectName="Scene"
|
|
32
|
-
onRotationChanged={setRotation}
|
|
33
|
-
/>
|
|
34
18
|
<group {...props} dispose={null}>
|
|
35
19
|
<group name="Scene">
|
|
36
20
|
<animated.group name="AR1730_J00">
|