@wandelbots/wandelbots-js-react-components 1.3.0 → 1.3.2

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 (168) hide show
  1. package/README.md +0 -29
  2. package/package.json +60 -43
  3. package/src/components/3d-viewport/CoordinateSystemTransform.tsx +44 -0
  4. package/src/components/3d-viewport/PresetEnvironment.tsx +78 -0
  5. package/src/components/3d-viewport/SafetyZonesRenderer.tsx +54 -0
  6. package/src/components/LoadingButton.stories.tsx +61 -0
  7. package/src/components/LoadingButton.tsx +19 -0
  8. package/src/components/LoadingCover.tsx +75 -0
  9. package/src/components/ThemeSelect.tsx +49 -0
  10. package/src/components/VelocitySlider.stories.tsx +32 -0
  11. package/src/components/VelocitySlider.tsx +52 -0
  12. package/src/components/jogging/JoggingCartesianAxisControl.stories.tsx +41 -0
  13. package/src/components/jogging/JoggingCartesianAxisControl.tsx +127 -0
  14. package/src/components/jogging/JoggingCartesianTab.tsx +265 -0
  15. package/src/components/jogging/JoggingCartesianValues.tsx +45 -0
  16. package/src/components/jogging/JoggingFreedriveTab.tsx +9 -0
  17. package/src/components/jogging/JoggingJointLimitDetector.tsx +51 -0
  18. package/src/components/jogging/JoggingJointRotationControl.stories.tsx +38 -0
  19. package/src/components/jogging/JoggingJointRotationControl.tsx +197 -0
  20. package/src/components/jogging/JoggingJointTab.tsx +93 -0
  21. package/src/components/jogging/JoggingJointValues.tsx +45 -0
  22. package/src/components/jogging/JoggingOptions.tsx +96 -0
  23. package/src/components/jogging/JoggingPanel.stories.tsx +26 -0
  24. package/src/components/jogging/JoggingPanel.tsx +148 -0
  25. package/src/components/jogging/JoggingStore.tsx +294 -0
  26. package/src/components/jogging/JoggingVelocitySlider.tsx +56 -0
  27. package/src/components/robots/ABB_1200_07_7.tsx +123 -0
  28. package/src/components/robots/AxisConfig.ts +3 -0
  29. package/src/components/robots/DHRobot.tsx +129 -0
  30. package/src/components/robots/FANUC_ARC_Mate_100iD.tsx +187 -0
  31. package/src/components/robots/FANUC_ARC_Mate_120iD.tsx +187 -0
  32. package/src/components/robots/FANUC_CRX10iA.tsx +167 -0
  33. package/src/components/robots/FANUC_CRX25iA.tsx +167 -0
  34. package/src/components/robots/FANUC_CRX25iAL.tsx +178 -0
  35. package/src/components/robots/KUKA_KR210_R2700.tsx +291 -0
  36. package/src/components/robots/KUKA_KR270_R2700.tsx +244 -0
  37. package/src/components/robots/RobotAnimator.tsx +83 -0
  38. package/src/components/robots/SupportedRobot.tsx +131 -0
  39. package/src/components/robots/UniversalRobots_UR10.tsx +112 -0
  40. package/src/components/robots/UniversalRobots_UR10e.tsx +275 -0
  41. package/src/components/robots/UniversalRobots_UR3.tsx +112 -0
  42. package/src/components/robots/UniversalRobots_UR3e.tsx +112 -0
  43. package/src/components/robots/UniversalRobots_UR5.tsx +111 -0
  44. package/src/components/robots/UniversalRobots_UR5e.tsx +280 -0
  45. package/src/components/robots/Yaskawa_AR1440.tsx +152 -0
  46. package/src/components/robots/Yaskawa_AR1730.tsx +165 -0
  47. package/src/components/robots/Yaskawa_AR2010.tsx +159 -0
  48. package/src/components/robots/Yaskawa_AR3120.tsx +160 -0
  49. package/src/components/robots/Yaskawa_AR900.tsx +121 -0
  50. package/src/components/utils/converters.ts +23 -0
  51. package/src/components/utils/errorHandling.ts +30 -0
  52. package/src/components/utils/hooks.tsx +54 -0
  53. package/src/components/utils/robotTreeQuery.ts +27 -0
  54. package/src/components/wandelscript-editor/WandelscriptEditor.stories.tsx +45 -0
  55. package/src/components/wandelscript-editor/WandelscriptEditor.tsx +114 -0
  56. package/src/components/wandelscript-editor/wandelscript.tmLanguage.ts +62 -0
  57. package/src/declarations.d.ts +10 -0
  58. package/src/i18n/config.ts +27 -0
  59. package/src/i18n/locales/de/translations.json +12 -0
  60. package/src/i18n/locales/en/translations.json +12 -0
  61. package/src/icons/arrowForwardFilled.tsx +7 -0
  62. package/src/icons/axis-x.svg +3 -0
  63. package/src/icons/axis-y.svg +3 -0
  64. package/src/icons/axis-z.svg +3 -0
  65. package/src/icons/expandFilled.tsx +11 -0
  66. package/src/icons/home.tsx +12 -0
  67. package/src/icons/infoOutlined.tsx +10 -0
  68. package/src/icons/jogging.svg +3 -0
  69. package/src/icons/robot.svg +3 -0
  70. package/src/icons/robot.tsx +14 -0
  71. package/src/icons/rotation.svg +4 -0
  72. package/src/icons/wbLogo.tsx +21 -0
  73. package/src/index.ts +7 -0
  74. package/src/themes/color.tsx +74 -0
  75. package/src/themes/theme.ts +150 -0
  76. package/src/themes/wbTheme.stories.tsx +64 -0
  77. package/src/themes/wbTheme.ts +186 -0
  78. package/dist/cjs/components/3d-viewport/SafetyZonesRenderer.d.ts +0 -2
  79. package/dist/cjs/index.js +0 -5875
  80. package/dist/cjs/types/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -10
  81. package/dist/cjs/types/components/3d-viewport/PresetEnvironment.d.ts +0 -6
  82. package/dist/cjs/types/components/3d-viewport/SafetyZonesRenderer.d.ts +0 -6
  83. package/dist/cjs/types/components/robots/ABB_1200_07_7.d.ts +0 -2
  84. package/dist/cjs/types/components/robots/AxisConfig.d.ts +0 -2
  85. package/dist/cjs/types/components/robots/DHRobot.d.ts +0 -2
  86. package/dist/cjs/types/components/robots/FANUC_ARC_Mate_100iD.d.ts +0 -2
  87. package/dist/cjs/types/components/robots/FANUC_ARC_Mate_120iD.d.ts +0 -2
  88. package/dist/cjs/types/components/robots/FANUC_CRX10iA.d.ts +0 -2
  89. package/dist/cjs/types/components/robots/FANUC_CRX25iA.d.ts +0 -2
  90. package/dist/cjs/types/components/robots/FANUC_CRX25iAL.d.ts +0 -2
  91. package/dist/cjs/types/components/robots/KUKA_KR210_R2700.d.ts +0 -2
  92. package/dist/cjs/types/components/robots/KUKA_KR270_R2700.d.ts +0 -2
  93. package/dist/cjs/types/components/robots/RobotAnimator.d.ts +0 -11
  94. package/dist/cjs/types/components/robots/SupportedRobot.d.ts +0 -14
  95. package/dist/cjs/types/components/robots/UniversalRobots_UR10.d.ts +0 -2
  96. package/dist/cjs/types/components/robots/UniversalRobots_UR10e.d.ts +0 -2
  97. package/dist/cjs/types/components/robots/UniversalRobots_UR3.d.ts +0 -2
  98. package/dist/cjs/types/components/robots/UniversalRobots_UR3e.d.ts +0 -2
  99. package/dist/cjs/types/components/robots/UniversalRobots_UR5.d.ts +0 -2
  100. package/dist/cjs/types/components/robots/UniversalRobots_UR5e.d.ts +0 -2
  101. package/dist/cjs/types/components/robots/Yaskawa_AR1440.d.ts +0 -2
  102. package/dist/cjs/types/components/robots/Yaskawa_AR1730.d.ts +0 -2
  103. package/dist/cjs/types/components/robots/Yaskawa_AR2010.d.ts +0 -2
  104. package/dist/cjs/types/components/robots/Yaskawa_AR3120.d.ts +0 -2
  105. package/dist/cjs/types/components/robots/Yaskawa_AR900.d.ts +0 -2
  106. package/dist/cjs/types/components/utils/hooks.d.ts +0 -21
  107. package/dist/cjs/types/components/utils/robotTreeQuery.d.ts +0 -5
  108. package/dist/cjs/types/components/wandelscript-editor/WandelscriptEditor.d.ts +0 -12
  109. package/dist/cjs/types/components/wandelscript-editor/WandelscriptEditor.stories.d.ts +0 -5
  110. package/dist/cjs/types/components/wandelscript-editor/wandelscript.tmLanguage.d.ts +0 -44
  111. package/dist/cjs/types/icons/arrowForwardFilled.d.ts +0 -1
  112. package/dist/cjs/types/icons/expandFilled.d.ts +0 -1
  113. package/dist/cjs/types/icons/home.d.ts +0 -1
  114. package/dist/cjs/types/icons/infoOutlined.d.ts +0 -1
  115. package/dist/cjs/types/icons/robot.d.ts +0 -1
  116. package/dist/cjs/types/icons/wbLogo.d.ts +0 -6
  117. package/dist/cjs/types/index.d.ts +0 -4
  118. package/dist/cjs/types/themes/color.d.ts +0 -9
  119. package/dist/cjs/types/themes/theme.d.ts +0 -143
  120. package/dist/cjs/types/themes/wbTheme.d.ts +0 -1
  121. package/dist/cjs/types/themes/wbTheme.stories.d.ts +0 -6
  122. package/dist/esm/components/3d-viewport/SafetyZonesRenderer.d.ts +0 -2
  123. package/dist/esm/index.js +0 -5852
  124. package/dist/esm/types/components/3d-viewport/CoordinateSystemTransform.d.ts +0 -10
  125. package/dist/esm/types/components/3d-viewport/PresetEnvironment.d.ts +0 -6
  126. package/dist/esm/types/components/3d-viewport/SafetyZonesRenderer.d.ts +0 -6
  127. package/dist/esm/types/components/robots/ABB_1200_07_7.d.ts +0 -2
  128. package/dist/esm/types/components/robots/AxisConfig.d.ts +0 -2
  129. package/dist/esm/types/components/robots/DHRobot.d.ts +0 -2
  130. package/dist/esm/types/components/robots/FANUC_ARC_Mate_100iD.d.ts +0 -2
  131. package/dist/esm/types/components/robots/FANUC_ARC_Mate_120iD.d.ts +0 -2
  132. package/dist/esm/types/components/robots/FANUC_CRX10iA.d.ts +0 -2
  133. package/dist/esm/types/components/robots/FANUC_CRX25iA.d.ts +0 -2
  134. package/dist/esm/types/components/robots/FANUC_CRX25iAL.d.ts +0 -2
  135. package/dist/esm/types/components/robots/KUKA_KR210_R2700.d.ts +0 -2
  136. package/dist/esm/types/components/robots/KUKA_KR270_R2700.d.ts +0 -2
  137. package/dist/esm/types/components/robots/RobotAnimator.d.ts +0 -11
  138. package/dist/esm/types/components/robots/SupportedRobot.d.ts +0 -14
  139. package/dist/esm/types/components/robots/UniversalRobots_UR10.d.ts +0 -2
  140. package/dist/esm/types/components/robots/UniversalRobots_UR10e.d.ts +0 -2
  141. package/dist/esm/types/components/robots/UniversalRobots_UR3.d.ts +0 -2
  142. package/dist/esm/types/components/robots/UniversalRobots_UR3e.d.ts +0 -2
  143. package/dist/esm/types/components/robots/UniversalRobots_UR5.d.ts +0 -2
  144. package/dist/esm/types/components/robots/UniversalRobots_UR5e.d.ts +0 -2
  145. package/dist/esm/types/components/robots/Yaskawa_AR1440.d.ts +0 -2
  146. package/dist/esm/types/components/robots/Yaskawa_AR1730.d.ts +0 -2
  147. package/dist/esm/types/components/robots/Yaskawa_AR2010.d.ts +0 -2
  148. package/dist/esm/types/components/robots/Yaskawa_AR3120.d.ts +0 -2
  149. package/dist/esm/types/components/robots/Yaskawa_AR900.d.ts +0 -2
  150. package/dist/esm/types/components/utils/hooks.d.ts +0 -21
  151. package/dist/esm/types/components/utils/robotTreeQuery.d.ts +0 -5
  152. package/dist/esm/types/components/wandelscript-editor/WandelscriptEditor.d.ts +0 -12
  153. package/dist/esm/types/components/wandelscript-editor/WandelscriptEditor.stories.d.ts +0 -5
  154. package/dist/esm/types/components/wandelscript-editor/wandelscript.tmLanguage.d.ts +0 -44
  155. package/dist/esm/types/icons/arrowForwardFilled.d.ts +0 -1
  156. package/dist/esm/types/icons/expandFilled.d.ts +0 -1
  157. package/dist/esm/types/icons/home.d.ts +0 -1
  158. package/dist/esm/types/icons/index.d.ts +0 -6
  159. package/dist/esm/types/icons/infoOutlined.d.ts +0 -1
  160. package/dist/esm/types/icons/robot.d.ts +0 -1
  161. package/dist/esm/types/icons/wbLogo.d.ts +0 -6
  162. package/dist/esm/types/index.d.ts +0 -4
  163. package/dist/esm/types/themes/color.d.ts +0 -9
  164. package/dist/esm/types/themes/theme.d.ts +0 -143
  165. package/dist/esm/types/themes/wbTheme.d.ts +0 -1
  166. package/dist/esm/types/themes/wbTheme.stories.d.ts +0 -6
  167. package/dist/index.d.ts +0 -33
  168. /package/{dist/cjs/types/icons/index.d.ts → src/icons/index.ts} +0 -0
@@ -0,0 +1,159 @@
1
+ import { useGLTF } from "@react-three/drei"
2
+ import type * as THREE from "three"
3
+ import type { RobotProps } from "./SupportedRobot"
4
+ import { animated } from "@react-spring/three"
5
+ import RobotAnimator from "./RobotAnimator"
6
+
7
+ export function Yaskawa_AR2010({ modelURL, connectedMotionGroup, ...props }: RobotProps) {
8
+ const gltf = useGLTF(modelURL) as any
9
+ const nodes = gltf.nodes
10
+ const materials = gltf.materials
11
+ const rotationOffsets = [0, -Math.PI / 2, 0, 0, 0, 0]
12
+ const rotationSign = [1, -1, 1, 1, 1, 1]
13
+
14
+ function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
15
+ jointObjects.forEach(
16
+ (object, index) =>
17
+ (object.rotation.y =
18
+ rotationSign[index]! * jointValues[index]! + rotationOffsets[index]!),
19
+ )
20
+ }
21
+
22
+ return (
23
+ <>
24
+ <RobotAnimator
25
+ connectedMotionGroup={connectedMotionGroup}
26
+ robotRootObjectName="Scene"
27
+ onRotationChanged={setRotation}
28
+ />
29
+ <group {...props} dispose={null}>
30
+ <group name="Scene">
31
+ <group name="AR2010" rotation={[Math.PI / 2, 0, 0]}>
32
+ <animated.group name="AR2010_J01" rotation={[-Math.PI / 2, 0, 0]}>
33
+ <animated.group
34
+ name="AR2010_J02"
35
+ position={[0.15, 0, 0]}
36
+ rotation={[Math.PI / 2, 0, Math.PI]}
37
+ >
38
+ <animated.group
39
+ name="AR2010_J03"
40
+ position={[0.76, 0, 0]}
41
+ rotation={[Math.PI, 0, 0]}
42
+ >
43
+ <animated.group
44
+ name="AR2010_J04"
45
+ position={[0.2, 0, 0]}
46
+ rotation={[-Math.PI / 2, 0, 0]}
47
+ >
48
+ <animated.group
49
+ name="AR2010_J05"
50
+ position={[0, -1.082, 0]}
51
+ rotation={[Math.PI / 2, 0, 0]}
52
+ >
53
+ <animated.group
54
+ name="AR2010_J06"
55
+ rotation={[-Math.PI / 2, 0, 0]}
56
+ >
57
+ <group
58
+ name="AR2010_FLG"
59
+ position={[0, -0.1, 0]}
60
+ rotation={[-Math.PI, 0, 0]}
61
+ ></group>
62
+ <group name="AR2010_L06">
63
+ <mesh
64
+ name="AR2010_06001"
65
+ castShadow
66
+ receiveShadow
67
+ geometry={nodes.AR2010_06001.geometry}
68
+ material={materials.yaskawaBlueMetall}
69
+ />
70
+ <mesh
71
+ name="AR2010_06001_1"
72
+ castShadow
73
+ receiveShadow
74
+ geometry={nodes.AR2010_06001_1.geometry}
75
+ material={materials.metall}
76
+ />
77
+ </group>
78
+ </animated.group>
79
+ <mesh
80
+ name="AR2010_L05"
81
+ castShadow
82
+ receiveShadow
83
+ geometry={nodes.AR2010_L05.geometry}
84
+ material={materials.yaskawaBlueMetall}
85
+ />
86
+ </animated.group>
87
+ <group name="AR2010_L04">
88
+ <mesh
89
+ name="AR2010_04001"
90
+ castShadow
91
+ receiveShadow
92
+ geometry={nodes.AR2010_04001.geometry}
93
+ material={materials.yaskawaBlueMetall}
94
+ />
95
+ <mesh
96
+ name="AR2010_04001_1"
97
+ castShadow
98
+ receiveShadow
99
+ geometry={nodes.AR2010_04001_1.geometry}
100
+ material={materials.white}
101
+ />
102
+ </group>
103
+ </animated.group>
104
+ <group name="AR2010_L03">
105
+ <mesh
106
+ name="AR2010_03001"
107
+ castShadow
108
+ receiveShadow
109
+ geometry={nodes.AR2010_03001.geometry}
110
+ material={materials.yaskawaBlueMetall}
111
+ />
112
+ <mesh
113
+ name="AR2010_03001_1"
114
+ castShadow
115
+ receiveShadow
116
+ geometry={nodes.AR2010_03001_1.geometry}
117
+ material={materials.blackMetall}
118
+ />
119
+ </group>
120
+ </animated.group>
121
+ <mesh
122
+ name="AR2010_L02"
123
+ castShadow
124
+ receiveShadow
125
+ geometry={nodes.AR2010_L02.geometry}
126
+ material={materials.yaskawaBlueMetall}
127
+ />
128
+ </animated.group>
129
+ <group name="AR2010_L01">
130
+ <mesh
131
+ name="AR2010_01001"
132
+ castShadow
133
+ receiveShadow
134
+ geometry={nodes.AR2010_01001.geometry}
135
+ material={materials.yaskawaBlueMetall}
136
+ />
137
+ <mesh
138
+ name="AR2010_01001_1"
139
+ castShadow
140
+ receiveShadow
141
+ geometry={nodes.AR2010_01001_1.geometry}
142
+ material={materials.blackMetall}
143
+ />
144
+ </group>
145
+ </animated.group>
146
+ <mesh
147
+ name="AR2010_L00"
148
+ castShadow
149
+ receiveShadow
150
+ geometry={nodes.AR2010_L00.geometry}
151
+ material={materials.yaskawaBlueMetall}
152
+ rotation={[-Math.PI / 2, 0, 0]}
153
+ />
154
+ </group>
155
+ </group>
156
+ </group>
157
+ </>
158
+ )
159
+ }
@@ -0,0 +1,160 @@
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
+ import { animated } from "@react-spring/three"
6
+
7
+ export function Yaskawa_AR3120({ modelURL, connectedMotionGroup, ...props }: RobotProps) {
8
+ const gltf = useGLTF(modelURL) as any
9
+
10
+ const nodes = gltf.nodes
11
+ const materials = gltf.materials
12
+ const rotationOffsets = [0, -Math.PI / 2, 0, 0, 0, 0]
13
+ const rotationSign = [1, -1, 1, 1, 1, 1]
14
+
15
+ function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
16
+ jointObjects.forEach(
17
+ (object, index) =>
18
+ (object.rotation.y =
19
+ rotationSign[index]! * jointValues[index]! + rotationOffsets[index]!),
20
+ )
21
+ }
22
+
23
+ return (
24
+ <>
25
+ <RobotAnimator
26
+ connectedMotionGroup={connectedMotionGroup}
27
+ robotRootObjectName="Scene"
28
+ onRotationChanged={setRotation}
29
+ />
30
+ <group {...props} dispose={null}>
31
+ <group name="Scene">
32
+ <animated.group name="AR3120_J00">
33
+ <animated.group
34
+ name="AR3120_J01"
35
+ position={[0.145, 0, 0]}
36
+ rotation={[-Math.PI / 2, -Math.PI / 2, 0]}
37
+ >
38
+ <animated.group
39
+ name="AR3120_J02"
40
+ position={[1.15, 0, 0]}
41
+ rotation={[-Math.PI, 0, 0]}
42
+ >
43
+ <animated.group
44
+ name="AR3120_J03"
45
+ position={[0.25, 0, 0]}
46
+ rotation={[-Math.PI / 2, 0, 0]}
47
+ >
48
+ <animated.group
49
+ name="AR3120_J04"
50
+ position={[0, -1.812, 0]}
51
+ rotation={[Math.PI / 2, 0, 0]}
52
+ >
53
+ <animated.group
54
+ name="AR3120_J05"
55
+ rotation={[-Math.PI / 2, 0, 0]}
56
+ >
57
+ <group
58
+ name="AR3120_FLG"
59
+ position={[0, -0.1, 0]}
60
+ rotation={[-Math.PI, 0, 0]}
61
+ />
62
+ <mesh
63
+ name="AR3120_L06"
64
+ castShadow
65
+ receiveShadow
66
+ geometry={nodes.AR3120_L06.geometry}
67
+ material={materials["Metal.001"]}
68
+ rotation={[Math.PI / 2, -Math.PI / 2, 0]}
69
+ />
70
+ </animated.group>
71
+ <mesh
72
+ name="AR3120_L05"
73
+ castShadow
74
+ receiveShadow
75
+ geometry={nodes.AR3120_L05.geometry}
76
+ material={materials["Blue.001"]}
77
+ rotation={[Math.PI / 2, 0, Math.PI / 2]}
78
+ />
79
+ </animated.group>
80
+ <group
81
+ name="AR3120_L04"
82
+ rotation={[Math.PI / 2, -Math.PI / 2, 0]}
83
+ >
84
+ <mesh
85
+ name="R_AXIS_GP20HL001"
86
+ castShadow
87
+ receiveShadow
88
+ geometry={nodes.R_AXIS_GP20HL001.geometry}
89
+ material={materials["Blue.001"]}
90
+ />
91
+ <mesh
92
+ name="R_AXIS_GP20HL001_1"
93
+ castShadow
94
+ receiveShadow
95
+ geometry={nodes.R_AXIS_GP20HL001_1.geometry}
96
+ material={materials["White.001"]}
97
+ />
98
+ </group>
99
+ </animated.group>
100
+ <group name="AR3120_L03" rotation={[Math.PI, 0, -Math.PI / 2]}>
101
+ <mesh
102
+ name="Mesh_3001"
103
+ castShadow
104
+ receiveShadow
105
+ geometry={nodes.Mesh_3001.geometry}
106
+ material={materials["Blue.001"]}
107
+ />
108
+ <mesh
109
+ name="Mesh_3001_1"
110
+ castShadow
111
+ receiveShadow
112
+ geometry={nodes.Mesh_3001_1.geometry}
113
+ material={materials["Black.001"]}
114
+ />
115
+ </group>
116
+ </animated.group>
117
+ <mesh
118
+ name="AR3120_L02"
119
+ castShadow
120
+ receiveShadow
121
+ geometry={nodes.AR3120_L02.geometry}
122
+ material={materials["Blue.001"]}
123
+ position={[0, -0.146, 0]}
124
+ rotation={[Math.PI, 0, 0]}
125
+ />
126
+ </animated.group>
127
+ <group
128
+ name="AR3120_L01"
129
+ position={[0, -0.228, 0]}
130
+ rotation={[0, -1.571, 0]}
131
+ >
132
+ <mesh
133
+ name="S_AXIS_GP20HL001"
134
+ castShadow
135
+ receiveShadow
136
+ geometry={nodes.S_AXIS_GP20HL001.geometry}
137
+ material={materials["Blue.001"]}
138
+ />
139
+ <mesh
140
+ name="S_AXIS_GP20HL001_1"
141
+ castShadow
142
+ receiveShadow
143
+ geometry={nodes.S_AXIS_GP20HL001_1.geometry}
144
+ material={materials["Black.001"]}
145
+ />
146
+ </group>
147
+ </animated.group>
148
+ <mesh
149
+ name="AR3120_L00"
150
+ castShadow
151
+ receiveShadow
152
+ geometry={nodes.AR3120_L00.geometry}
153
+ material={materials["Blue.001"]}
154
+ position={[0, -0.54, 0]}
155
+ />
156
+ </group>
157
+ </group>
158
+ </>
159
+ )
160
+ }
@@ -0,0 +1,121 @@
1
+ import { useGLTF } from "@react-three/drei"
2
+ import type * as THREE from "three"
3
+ import type { RobotProps } from "./SupportedRobot"
4
+ import { animated } from "@react-spring/three"
5
+ import RobotAnimator from "./RobotAnimator"
6
+
7
+ export function Yaskawa_AR900({ modelURL, connectedMotionGroup, ...props }: RobotProps) {
8
+ const gltf = useGLTF(modelURL) as any
9
+ const nodes = gltf.nodes
10
+ const materials = gltf.materials
11
+ const rotationOffsets = [0, -Math.PI / 2, 0, 0, 0, 0]
12
+
13
+ function setRotation(jointObjects: THREE.Object3D[], jointValues: number[]) {
14
+ jointObjects.forEach(
15
+ (object, index) =>
16
+ (object.rotation.y = jointValues[index]! + rotationOffsets[index]!),
17
+ )
18
+ }
19
+
20
+ return (
21
+ <>
22
+ <RobotAnimator
23
+ connectedMotionGroup={connectedMotionGroup}
24
+ robotRootObjectName="Scene"
25
+ onRotationChanged={setRotation}
26
+ />
27
+ <group {...props} dispose={null}>
28
+ <group name="Scene">
29
+ <group name="AR900" rotation={[Math.PI / 2, 0, 0]}>
30
+ <animated.group name="AR900_J01" rotation={[-Math.PI / 2, 0, 0]}>
31
+ <animated.group
32
+ name="AR900_J02"
33
+ position={[0.04, 0, 0]}
34
+ rotation={[-Math.PI / 2, -Math.PI / 2, 0]}
35
+ >
36
+ <animated.group
37
+ name="AR900_J03"
38
+ position={[0.445, 0, 0]}
39
+ rotation={[-Math.PI, 0, 0]}
40
+ >
41
+ <animated.group
42
+ name="AR900_J04"
43
+ position={[0.04, 0, 0]}
44
+ rotation={[-Math.PI / 2, 0, 0]}
45
+ >
46
+ <animated.group
47
+ name="AR900_J05"
48
+ position={[0, -0.44, 0]}
49
+ rotation={[Math.PI / 2, 0, 0]}
50
+ >
51
+ <animated.group
52
+ name="AR900_J06"
53
+ rotation={[-Math.PI / 2, 0, 0]}
54
+ >
55
+ <group
56
+ name="AR900_FLG"
57
+ position={[0, -0.08, 0]}
58
+ rotation={[-Math.PI, 0, 0]}
59
+ />
60
+ <mesh
61
+ name="AR900_L06"
62
+ castShadow
63
+ receiveShadow
64
+ geometry={nodes.AR900_L06.geometry}
65
+ material={materials["#BBA474.001"]}
66
+ />
67
+ </animated.group>
68
+ <mesh
69
+ name="AR900_L05"
70
+ castShadow
71
+ receiveShadow
72
+ geometry={nodes.AR900_L05.geometry}
73
+ material={materials["#0056b9.001"]}
74
+ />
75
+ </animated.group>
76
+ <mesh
77
+ name="AR900_L04"
78
+ castShadow
79
+ receiveShadow
80
+ geometry={nodes.AR900_L04.geometry}
81
+ material={materials["#0056b9.001"]}
82
+ />
83
+ </animated.group>
84
+ <mesh
85
+ name="AR900_L03"
86
+ castShadow
87
+ receiveShadow
88
+ geometry={nodes.AR900_L03.geometry}
89
+ material={materials["#0056b9.001"]}
90
+ />
91
+ </animated.group>
92
+ <mesh
93
+ name="AR900_L02"
94
+ castShadow
95
+ receiveShadow
96
+ geometry={nodes.AR900_L02.geometry}
97
+ material={materials["#0056b9.001"]}
98
+ />
99
+ </animated.group>
100
+ <mesh
101
+ name="AR900_L01"
102
+ castShadow
103
+ receiveShadow
104
+ geometry={nodes.AR900_L01.geometry}
105
+ material={materials["#0056b9.001"]}
106
+ />
107
+ </animated.group>
108
+ <mesh
109
+ name="AR900_L00"
110
+ castShadow
111
+ receiveShadow
112
+ geometry={nodes.AR900_L00.geometry}
113
+ material={materials["#0056b9.001"]}
114
+ rotation={[-Math.PI / 2, 0, 0]}
115
+ />
116
+ </group>
117
+ </group>
118
+ </group>
119
+ </>
120
+ )
121
+ }
@@ -0,0 +1,23 @@
1
+ export function radiansToDegree(radians: number): number {
2
+ return radians * (180 / Math.PI)
3
+ }
4
+
5
+ export function degreesToRadians(degrees: number): number {
6
+ return degrees * (Math.PI / 180)
7
+ }
8
+
9
+ export function tryParseJson(json: unknown): any {
10
+ try {
11
+ return JSON.parse(json as string)
12
+ } catch {
13
+ return undefined
14
+ }
15
+ }
16
+
17
+ export function tryStringifyJson(json: unknown): string | undefined {
18
+ try {
19
+ return JSON.stringify(json)
20
+ } catch {
21
+ return undefined
22
+ }
23
+ }
@@ -0,0 +1,30 @@
1
+ import { AxiosError } from "axios"
2
+ import { tryStringifyJson } from "./converters"
3
+
4
+ export function delay(ms: number) {
5
+ return new Promise((resolve) => setTimeout(resolve, ms))
6
+ }
7
+
8
+ export function makeShortErrorMessage(err: unknown) {
9
+ if (err instanceof AxiosError && err.code === "ERR_NETWORK") {
10
+ return "Failed to connect to the server. Please check your internet connection."
11
+ } else if (err instanceof AxiosError && err.response) {
12
+ return `${err.response?.status} ${err.response?.statusText}: ${JSON.stringify(err.response?.data)}`
13
+ } else if (err instanceof Error) {
14
+ return err.message
15
+ } else {
16
+ return `Unexpected error: ${err}`
17
+ }
18
+ }
19
+
20
+ export function makeErrorMessage(err: unknown) {
21
+ if (err instanceof AxiosError && err.code === "ERR_NETWORK") {
22
+ return "Failed to connect to the server. Please check your internet connection."
23
+ } else if (err instanceof AxiosError && err.response) {
24
+ return `${err.response?.status} ${err.response?.statusText} from ${err.response?.config.url}: ${JSON.stringify(err.response?.data)}`
25
+ } else if (err instanceof Error) {
26
+ return err.message
27
+ } else {
28
+ return `Unexpected error: ${tryStringifyJson(err) || err}`
29
+ }
30
+ }
@@ -0,0 +1,54 @@
1
+ import { autorun, reaction } from "mobx"
2
+ import { useEffect, type EffectCallback } from "react"
3
+
4
+ /**
5
+ * Run code once on component mount. Shorthand for useEffect(effect, []).
6
+ */
7
+ export function useMounted(effect: EffectCallback) {
8
+ useEffect(effect, [])
9
+ }
10
+
11
+ /**
12
+ * Initialize a mobx autorun watcher on component mount, and
13
+ * clean it up when the component unmounts.
14
+ */
15
+ export function useAutorun(view: Parameters<typeof autorun>[0]) {
16
+ useMounted(() => {
17
+ return autorun(view)
18
+ })
19
+ }
20
+
21
+ /**
22
+ * Initialize a mobx reaction watcher on component mount, and
23
+ * clean it up when the component unmounts.
24
+ */
25
+ export function useReaction<T>(
26
+ expression: Parameters<typeof reaction<T>>[0],
27
+ effect: Parameters<typeof reaction<T>>[1],
28
+ opts?: Parameters<typeof reaction<T>>[2],
29
+ ) {
30
+ useMounted(() => {
31
+ return reaction(expression, effect, opts)
32
+ })
33
+ }
34
+
35
+ /**
36
+ * Run a callback on every animation frame. Cleans up
37
+ * after component unmount.
38
+ */
39
+ export function useAnimationFrame(callback: () => void) {
40
+ return useMounted(() => {
41
+ let frameId: number
42
+
43
+ function frame() {
44
+ callback()
45
+ frameId = requestAnimationFrame(frame)
46
+ }
47
+
48
+ frameId = requestAnimationFrame(frame)
49
+
50
+ return () => {
51
+ cancelAnimationFrame(frameId)
52
+ }
53
+ })
54
+ }
@@ -0,0 +1,27 @@
1
+ import type * as THREE from "three"
2
+
3
+ export type RobotSceneJoint = THREE.Object3D
4
+
5
+ export const defaultJointNamePattern = "(^joint_[0-9]+$)|(_J[0-9]+$)"
6
+
7
+ export function getAllObjects(root: THREE.Object3D): THREE.Object3D[] {
8
+ if (root.children.length === 0) {
9
+ return [root]
10
+ }
11
+ return [root, ...root.children.flatMap((child) => getAllObjects(child))]
12
+ }
13
+
14
+ function isObjectAJointByName(name: string, jointNamePattern?: string) {
15
+ // e.g. abc_J05 => joint 5
16
+ // or joint_5 => joint 5
17
+ return new RegExp(jointNamePattern ?? defaultJointNamePattern).test(name)
18
+ }
19
+
20
+ export function getAllJointsByName(
21
+ rootObject: THREE.Object3D,
22
+ jointNamePattern?: string,
23
+ ): RobotSceneJoint[] {
24
+ return getAllObjects(rootObject).filter((object) =>
25
+ isObjectAJointByName(object.name, jointNamePattern),
26
+ )
27
+ }
@@ -0,0 +1,45 @@
1
+ import { Meta, StoryObj } from "@storybook/react";
2
+ import { WandelscriptEditor } from "./WandelscriptEditor";
3
+
4
+ const meta: Meta<typeof WandelscriptEditor> = {
5
+ component: WandelscriptEditor,
6
+ };
7
+ export default meta;
8
+
9
+ const defaultCode = `start = [832, -452, 289] # The start position of the edge
10
+ end = [817, 168, 288] # The end position of the edge
11
+ point_a = [602, 163, -100] # Any point on the left plane (looking from start to end)
12
+ point_b = [1033, 173, -100] # Any point on the right plane (looking from start to end)
13
+ radius = 20 # the desired radius of the final edge
14
+ spacing = 10 # the distance between to zig-zag corners
15
+
16
+ n = int(distance(start, end) / spacing)
17
+
18
+ edge_poses = find_edge(start, end, point_a, start, end,point_b)
19
+ plane_orientations = {to_orientation(edge_poses[0]), to_orientation(edge_poses[1])}
20
+ center_rotation = interpolate(plane_orientations[0], plane_orientations[1], 0.5)
21
+
22
+ offset = [0, 0, -radius, 0, 0, 0]
23
+ offset_from_axis = center_rotation ::[0, 0, distance_from_corner(edge_poses[0], edge_poses[1], radius), 0, 0, 0]:: ~center_rotation
24
+
25
+ move via p2p() to to_pose(start)::offset_from_axis :: plane_orientations[0] :: offset
26
+ for i = 0..<int(n / 2) - 1:
27
+ a = interpolate(to_pose(start), to_pose(end),(2 * i + 1) / n ) ::offset_from_axis :: center_rotation :: offset
28
+ b = interpolate(to_pose(start), to_pose(end),(2 * i + 2) / n ) ::offset_from_axis :: plane_orientations[modulo(i + 1, 2)] :: offset
29
+ move via arc(a) to b
30
+ if i == 10:
31
+ test_pose = planned_pose()
32
+ `;
33
+
34
+ export const Editor: StoryObj<typeof WandelscriptEditor> = {
35
+ args: {
36
+ code: defaultCode,
37
+ },
38
+ render: (props) => {
39
+ return (
40
+ <div style={{ height: "400px" }}>
41
+ <WandelscriptEditor {...props} />
42
+ </div>
43
+ );
44
+ },
45
+ };