@wandelbots/wandelbots-js-react-components 4.0.2 → 4.0.3-pr.feat-RB-3031-robot-animator-v2.486.8ea36f7

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 (172) hide show
  1. package/README.md +10 -107
  2. package/dist/auth0-spa-js.production.esm-1QXzndwB.js +950 -0
  3. package/dist/auth0-spa-js.production.esm-1QXzndwB.js.map +1 -0
  4. package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs +5 -0
  5. package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs.map +1 -0
  6. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +1 -1
  7. package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts.map +1 -1
  8. package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
  9. package/dist/components/3d-viewport/collider/ColliderCollection.d.ts +1 -1
  10. package/dist/components/3d-viewport/collider/ColliderCollection.d.ts.map +1 -1
  11. package/dist/components/3d-viewport/collider/ColliderElement.d.ts +1 -1
  12. package/dist/components/3d-viewport/collider/ColliderElement.d.ts.map +1 -1
  13. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts +1 -1
  14. package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts.map +1 -1
  15. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts +1 -1
  16. package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts.map +1 -1
  17. package/dist/components/ProgramStateIndicator.d.ts +3 -3
  18. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  19. package/dist/components/RobotCard.d.ts +4 -5
  20. package/dist/components/RobotCard.d.ts.map +1 -1
  21. package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
  22. package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
  23. package/dist/components/jogging/JoggingPanel.d.ts +1 -1
  24. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  25. package/dist/components/jogging/JoggingStore.d.ts +5 -10
  26. package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
  27. package/dist/components/jogging/PoseCartesianValues.d.ts +2 -2
  28. package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
  29. package/dist/components/jogging/PoseJointValues.d.ts +2 -1
  30. package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
  31. package/dist/components/robots/DHRobot.d.ts.map +1 -1
  32. package/dist/components/robots/GenericRobot.d.ts +2 -2
  33. package/dist/components/robots/GenericRobot.d.ts.map +1 -1
  34. package/dist/components/robots/Robot.d.ts +2 -4
  35. package/dist/components/robots/Robot.d.ts.map +1 -1
  36. package/dist/components/robots/RobotAnimator.d.ts +2 -2
  37. package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
  38. package/dist/components/robots/SupportedRobot.d.ts +4 -4
  39. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  40. package/dist/components/robots/manufacturerHomePositions.d.ts +1 -1
  41. package/dist/components/robots/manufacturerHomePositions.d.ts.map +1 -1
  42. package/dist/components/robots/robotModelLogic.d.ts +1 -11
  43. package/dist/components/robots/robotModelLogic.d.ts.map +1 -1
  44. package/dist/components/safetyBar/ControllerTypeIndicator.d.ts.map +1 -1
  45. package/dist/components/safetyBar/OperationModeIndicator.d.ts +2 -2
  46. package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
  47. package/dist/components/safetyBar/SafetyBar.d.ts +3 -3
  48. package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
  49. package/dist/components/safetyBar/SafetyStateIndicator.d.ts +2 -2
  50. package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
  51. package/dist/components/utils/errorHandling.d.ts.map +1 -1
  52. package/dist/index.cjs +160 -0
  53. package/dist/index.cjs.map +1 -0
  54. package/dist/index.d.ts +39 -3
  55. package/dist/index.d.ts.map +1 -1
  56. package/dist/index.js +36825 -0
  57. package/dist/index.js.map +1 -0
  58. package/package.json +32 -70
  59. package/src/components/3d-viewport/CoordinateSystemTransform.tsx +1 -1
  60. package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -1
  61. package/src/components/3d-viewport/collider/ColliderCollection.tsx +1 -1
  62. package/src/components/3d-viewport/collider/ColliderElement.tsx +1 -1
  63. package/src/components/3d-viewport/collider/CollisionSceneRenderer.tsx +1 -1
  64. package/src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts +1 -1
  65. package/src/components/AppHeader.md +1 -1
  66. package/src/components/ProgramStateIndicator.tsx +6 -3
  67. package/src/components/RobotCard.tsx +8 -5
  68. package/src/components/jogging/JoggingCartesianTab.tsx +11 -13
  69. package/src/components/jogging/JoggingJointLimitDetector.tsx +2 -2
  70. package/src/components/jogging/JoggingJointTab.tsx +4 -4
  71. package/src/components/jogging/JoggingOptions.tsx +5 -6
  72. package/src/components/jogging/JoggingPanel.tsx +3 -6
  73. package/src/components/jogging/JoggingStore.ts +39 -66
  74. package/src/components/jogging/PoseCartesianValues.tsx +4 -3
  75. package/src/components/jogging/PoseJointValues.tsx +4 -3
  76. package/src/components/robots/DHRobot.tsx +3 -2
  77. package/src/components/robots/GenericRobot.tsx +36 -97
  78. package/src/components/robots/Robot.tsx +2 -4
  79. package/src/components/robots/RobotAnimator.test.tsx +22 -7
  80. package/src/components/robots/RobotAnimator.tsx +28 -14
  81. package/src/components/robots/SupportedRobot.tsx +9 -14
  82. package/src/components/robots/manufacturerHomePositions.ts +1 -1
  83. package/src/components/robots/robotModelLogic.ts +6 -75
  84. package/src/components/safetyBar/ControllerTypeIndicator.tsx +2 -4
  85. package/src/components/safetyBar/OperationModeIndicator.tsx +5 -7
  86. package/src/components/safetyBar/SafetyBar.tsx +6 -3
  87. package/src/components/safetyBar/SafetyStateIndicator.tsx +7 -9
  88. package/src/components/utils/errorHandling.ts +0 -4
  89. package/src/i18n/locales/de/translations.json +0 -3
  90. package/src/i18n/locales/en/translations.json +0 -3
  91. package/src/index.ts +43 -4
  92. package/dist/3d.cjs.js +0 -2
  93. package/dist/3d.cjs.js.map +0 -1
  94. package/dist/3d.d.ts +0 -11
  95. package/dist/3d.d.ts.map +0 -1
  96. package/dist/3d.es.js +0 -16
  97. package/dist/3d.es.js.map +0 -1
  98. package/dist/LoadingCover-6gWr11KP.js +0 -88
  99. package/dist/LoadingCover-6gWr11KP.js.map +0 -1
  100. package/dist/LoadingCover-CukpS_aj.cjs +0 -2
  101. package/dist/LoadingCover-CukpS_aj.cjs.map +0 -1
  102. package/dist/WandelscriptEditor-7eN-Yw7m.js +0 -140
  103. package/dist/WandelscriptEditor-7eN-Yw7m.js.map +0 -1
  104. package/dist/WandelscriptEditor-D6_vS5Uk.cjs +0 -2
  105. package/dist/WandelscriptEditor-D6_vS5Uk.cjs.map +0 -1
  106. package/dist/auth0-spa-js.production.esm-BMSlxZC5.js +0 -3877
  107. package/dist/auth0-spa-js.production.esm-BMSlxZC5.js.map +0 -1
  108. package/dist/auth0-spa-js.production.esm-DZ6lsBvD.cjs +0 -5
  109. package/dist/auth0-spa-js.production.esm-DZ6lsBvD.cjs.map +0 -1
  110. package/dist/components/jogging/JoggingBlocked.d.ts +0 -7
  111. package/dist/components/jogging/JoggingBlocked.d.ts.map +0 -1
  112. package/dist/components/utils/errorHandling.test.d.ts +0 -2
  113. package/dist/components/utils/errorHandling.test.d.ts.map +0 -1
  114. package/dist/core.cjs.js +0 -2
  115. package/dist/core.cjs.js.map +0 -1
  116. package/dist/core.d.ts +0 -33
  117. package/dist/core.d.ts.map +0 -1
  118. package/dist/core.es.js +0 -54
  119. package/dist/core.es.js.map +0 -1
  120. package/dist/externalizeComponent-CkVWk2F_.cjs +0 -24
  121. package/dist/externalizeComponent-CkVWk2F_.cjs.map +0 -1
  122. package/dist/externalizeComponent-Dc3fViZA.js +0 -489
  123. package/dist/externalizeComponent-Dc3fViZA.js.map +0 -1
  124. package/dist/index.cjs.js +0 -2
  125. package/dist/index.cjs.js.map +0 -1
  126. package/dist/index.es.js +0 -69
  127. package/dist/index.es.js.map +0 -1
  128. package/dist/interpolation-BGC6adne.cjs +0 -20
  129. package/dist/interpolation-BGC6adne.cjs.map +0 -1
  130. package/dist/interpolation-CZsbXLpo.js +0 -6899
  131. package/dist/interpolation-CZsbXLpo.js.map +0 -1
  132. package/dist/lib/ConnectedMotionGroup.d.ts +0 -90
  133. package/dist/lib/ConnectedMotionGroup.d.ts.map +0 -1
  134. package/dist/lib/JoggerConnection.d.ts +0 -113
  135. package/dist/lib/JoggerConnection.d.ts.map +0 -1
  136. package/dist/lib/JoggerConnection.test.d.ts +0 -2
  137. package/dist/lib/JoggerConnection.test.d.ts.map +0 -1
  138. package/dist/lib/MotionStreamConnection.d.ts +0 -24
  139. package/dist/lib/MotionStreamConnection.d.ts.map +0 -1
  140. package/dist/lib/MotionStreamConnection.test.d.ts +0 -2
  141. package/dist/lib/MotionStreamConnection.test.d.ts.map +0 -1
  142. package/dist/lib/motionStateUpdate.d.ts +0 -7
  143. package/dist/lib/motionStateUpdate.d.ts.map +0 -1
  144. package/dist/lib/motionStateUpdate.test.d.ts +0 -2
  145. package/dist/lib/motionStateUpdate.test.d.ts.map +0 -1
  146. package/dist/manufacturerHomePositions-B04wcsF8.cjs +0 -2
  147. package/dist/manufacturerHomePositions-B04wcsF8.cjs.map +0 -1
  148. package/dist/manufacturerHomePositions-h7G6BCs7.js +0 -1038
  149. package/dist/manufacturerHomePositions-h7G6BCs7.js.map +0 -1
  150. package/dist/theming-49GSfpiH.cjs +0 -115
  151. package/dist/theming-49GSfpiH.cjs.map +0 -1
  152. package/dist/theming-Jezu_BIw.js +0 -22360
  153. package/dist/theming-Jezu_BIw.js.map +0 -1
  154. package/dist/wandelscript.cjs.js +0 -2
  155. package/dist/wandelscript.cjs.js.map +0 -1
  156. package/dist/wandelscript.d.ts +0 -2
  157. package/dist/wandelscript.d.ts.map +0 -1
  158. package/dist/wandelscript.es.js +0 -5
  159. package/dist/wandelscript.es.js.map +0 -1
  160. package/src/3d.ts +0 -15
  161. package/src/components/jogging/JoggingBlocked.tsx +0 -37
  162. package/src/components/utils/errorHandling.test.ts +0 -41
  163. package/src/core.ts +0 -33
  164. package/src/env.d.ts +0 -3
  165. package/src/lib/ConnectedMotionGroup.ts +0 -444
  166. package/src/lib/JoggerConnection.test.ts +0 -120
  167. package/src/lib/JoggerConnection.ts +0 -674
  168. package/src/lib/MotionStreamConnection.test.ts +0 -23
  169. package/src/lib/MotionStreamConnection.ts +0 -189
  170. package/src/lib/motionStateUpdate.test.ts +0 -28
  171. package/src/lib/motionStateUpdate.ts +0 -117
  172. package/src/wandelscript.ts +0 -2
@@ -1,1038 +0,0 @@
1
- import { j as t, e as K } from "./externalizeComponent-Dc3fViZA.js";
2
- import * as m from "three";
3
- import { Matrix4 as F, Vector3 as E, Quaternion as ie } from "three";
4
- import { ConvexGeometry as X } from "three-stdlib";
5
- import { useThree as ae, useFrame as le, Canvas as B } from "@react-three/fiber";
6
- import { Environment as ce, Lightformer as R, Line as Z, useGLTF as ue, Bounds as W } from "@react-three/drei";
7
- import { useTheme as fe, Card as de, Box as y, Typography as $, Divider as N, Button as H } from "@mui/material";
8
- import { observer as he } from "mobx-react-lite";
9
- import me, { useRef as _, useEffect as I, useCallback as v, useState as G, Suspense as pe } from "react";
10
- import { useTranslation as xe } from "react-i18next";
11
- import { N as ge, V as ye, b as J, M as j } from "./interpolation-CZsbXLpo.js";
12
- import { ErrorBoundary as je } from "react-error-boundary";
13
- function we(e) {
14
- switch (e.shape_type) {
15
- case "convex_hull":
16
- return new X(
17
- e.vertices.map(
18
- (r) => new m.Vector3(
19
- r[0] / 1e3,
20
- r[1] / 1e3,
21
- r[2] / 1e3
22
- )
23
- )
24
- );
25
- case "box":
26
- return new m.BoxGeometry(
27
- e.size_x / 1e3,
28
- e.size_y / 1e3,
29
- e.size_z / 1e3
30
- );
31
- case "sphere":
32
- return new m.SphereGeometry(e.radius / 1e3);
33
- case "capsule":
34
- return new m.CapsuleGeometry(
35
- e.radius / 1e3,
36
- e.cylinder_height / 1e3
37
- );
38
- case "cylinder":
39
- return new m.CylinderGeometry(
40
- e.radius / 1e3,
41
- e.radius / 1e3,
42
- e.height / 1e3
43
- );
44
- case "rectangle":
45
- return new m.BoxGeometry(e.size_x / 1e3, e.size_y / 1e3, 0);
46
- default:
47
- return console.warn(`${e.shape_type} is not supported`), new m.BufferGeometry();
48
- }
49
- }
50
- function be({
51
- name: e,
52
- collider: n,
53
- children: r
54
- }) {
55
- var c, a;
56
- const s = ((c = n.pose) == null ? void 0 : c.position) ?? [0, 0, 0], o = ((a = n.pose) == null ? void 0 : a.orientation) ?? [0, 0, 0];
57
- return n.margin && console.warn(`${e} margin is not supported`), /* @__PURE__ */ t.jsx(
58
- "mesh",
59
- {
60
- name: e,
61
- position: new m.Vector3(
62
- s[0],
63
- s[1],
64
- s[2]
65
- ).divideScalar(1e3),
66
- rotation: new m.Euler(o[0], o[1], o[2], "XYZ"),
67
- geometry: we(n.shape),
68
- children: r
69
- }
70
- );
71
- }
72
- function Me({
73
- name: e,
74
- colliders: n,
75
- meshChildrenProvider: r,
76
- ...s
77
- }) {
78
- return /* @__PURE__ */ t.jsx("group", { name: e, ...s, children: Object.entries(n).map(([o, c]) => /* @__PURE__ */ t.jsx(
79
- be,
80
- {
81
- name: o,
82
- collider: c,
83
- children: r(o, c)
84
- },
85
- o
86
- )) });
87
- }
88
- function Ze({
89
- scene: e,
90
- meshChildrenProvider: n
91
- }) {
92
- const r = e.colliders;
93
- return /* @__PURE__ */ t.jsx("group", { children: r && /* @__PURE__ */ t.jsx(
94
- Me,
95
- {
96
- meshChildrenProvider: n,
97
- colliders: r
98
- }
99
- ) });
100
- }
101
- function Y() {
102
- return /* @__PURE__ */ t.jsx(ce, { children: /* @__PURE__ */ t.jsx(Re, {}) });
103
- }
104
- function Re({ positions: e = [2, 0, 2, 0, 2, 0, 2, 0] }) {
105
- return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
106
- /* @__PURE__ */ t.jsx(
107
- R,
108
- {
109
- intensity: 5,
110
- "rotation-x": Math.PI / 2,
111
- position: [0, 5, -9],
112
- scale: [10, 10, 1]
113
- }
114
- ),
115
- /* @__PURE__ */ t.jsx("group", { rotation: [0, 0.5, 0], children: /* @__PURE__ */ t.jsx("group", { children: e.map((n, r) => /* @__PURE__ */ t.jsx(
116
- R,
117
- {
118
- form: "circle",
119
- intensity: 5,
120
- rotation: [Math.PI / 2, 0, 0],
121
- position: [n, 4, r * 4],
122
- scale: [3, 1, 1]
123
- },
124
- r
125
- )) }) }),
126
- /* @__PURE__ */ t.jsx(
127
- R,
128
- {
129
- intensity: 40,
130
- "rotation-y": Math.PI / 2,
131
- position: [-5, 1, -1],
132
- scale: [20, 0.1, 1]
133
- }
134
- ),
135
- /* @__PURE__ */ t.jsx(
136
- R,
137
- {
138
- intensity: 20,
139
- "rotation-y": -Math.PI,
140
- position: [-5, -2, -1],
141
- scale: [20, 0.1, 1]
142
- }
143
- ),
144
- /* @__PURE__ */ t.jsx(
145
- R,
146
- {
147
- "rotation-y": Math.PI / 2,
148
- position: [-5, -1, -1],
149
- scale: [20, 0.5, 1],
150
- intensity: 5
151
- }
152
- ),
153
- /* @__PURE__ */ t.jsx(
154
- R,
155
- {
156
- "rotation-y": -Math.PI / 2,
157
- position: [10, 1, 0],
158
- scale: [20, 1, 1],
159
- intensity: 10
160
- }
161
- ),
162
- /* @__PURE__ */ t.jsx(
163
- R,
164
- {
165
- form: "ring",
166
- color: "white",
167
- intensity: 5,
168
- scale: 10,
169
- position: [-15, 4, -18],
170
- target: [0, 0, 0]
171
- }
172
- )
173
- ] });
174
- }
175
- function ve(e) {
176
- if (e.length < 3)
177
- return console.log("Not enough vertices to define a plane"), { isCoplanar: !1 };
178
- const n = new m.Vector3(e[0].x, e[0].y, e[0].z), r = new m.Vector3(e[1].x, e[1].y, e[1].z), s = new m.Vector3(e[2].x, e[2].y, e[2].z), o = new m.Vector3().subVectors(r, n), c = new m.Vector3().subVectors(s, n), a = new m.Vector3().crossVectors(o, c).normalize();
179
- for (let f = 3; f < e.length; f++) {
180
- const i = new m.Vector3(e[f].x, e[f].y, e[f].z), d = new m.Vector3().subVectors(i, n), h = a.dot(d);
181
- if (Math.abs(h) > 1e-6)
182
- return console.log("Vertices are not on the same plane"), { isCoplanar: !1 };
183
- }
184
- return { isCoplanar: !0, normal: a };
185
- }
186
- function Qe({
187
- safetyZones: e,
188
- ...n
189
- }) {
190
- return /* @__PURE__ */ t.jsx("group", { ...n, children: e.map((r, s) => {
191
- let o = [];
192
- return r.geometry && (r.geometry.compound ? o = r.geometry.compound.child_geometries : r.geometry.convex_hull && (o = [r.geometry])), o.map((c, a) => {
193
- if (!c.convex_hull) return null;
194
- const f = c.convex_hull.vertices.map(
195
- (h) => new m.Vector3(h.x / 1e3, h.y / 1e3, h.z / 1e3)
196
- ), i = ve(f);
197
- if (i.isCoplanar && i.normal) {
198
- const l = new m.Vector3().addVectors(
199
- f[0],
200
- i.normal.multiplyScalar(1e-4)
201
- );
202
- f.push(l);
203
- }
204
- let d;
205
- try {
206
- d = new X(f);
207
- } catch (h) {
208
- return console.log("Error creating ConvexGeometry:", h), null;
209
- }
210
- return /* @__PURE__ */ t.jsx("mesh", { geometry: d, children: /* @__PURE__ */ t.jsx(
211
- "meshStandardMaterial",
212
- {
213
- attach: "material",
214
- color: "#009f4d",
215
- opacity: 0.2,
216
- depthTest: !1,
217
- depthWrite: !1,
218
- transparent: !0,
219
- polygonOffset: !0,
220
- polygonOffsetFactor: -a
221
- },
222
- s
223
- ) }, `${s}-${a}`);
224
- });
225
- }) });
226
- }
227
- function et({
228
- trajectory: e,
229
- ...n
230
- }) {
231
- var s;
232
- const r = ((s = e.trajectory) == null ? void 0 : s.map((o) => o.tcp_pose ? new m.Vector3(
233
- o.tcp_pose.position.x / 1e3,
234
- o.tcp_pose.position.z / 1e3,
235
- -o.tcp_pose.position.y / 1e3
236
- ) : null).filter((o) => o !== null)) || [];
237
- return /* @__PURE__ */ t.jsx("group", { ...n, children: r.length > 0 && /* @__PURE__ */ t.jsx(
238
- Z,
239
- {
240
- points: r,
241
- lineWidth: 3,
242
- polygonOffset: !0,
243
- polygonOffsetFactor: 10,
244
- polygonOffsetUnits: 10
245
- }
246
- ) });
247
- }
248
- const D = /* @__PURE__ */ new Map();
249
- async function Q(e) {
250
- if (D.has(e))
251
- return D.get(e);
252
- const n = (async () => {
253
- var c;
254
- const s = new ge({ instanceUrl: "" }), o = s.api.motionGroupModels;
255
- (c = o.axios) != null && c.interceptors && o.axios.interceptors.request.use((a) => {
256
- var f;
257
- return (f = a.url) != null && f.includes("/glb") && (a.responseType = "blob"), a;
258
- });
259
- try {
260
- const a = await s.api.motionGroupModels.getMotionGroupGlbModel(e);
261
- return URL.createObjectURL(a);
262
- } catch (a) {
263
- throw console.error("Failed to fetch model:", a), a;
264
- }
265
- })();
266
- return D.set(e, n), n;
267
- }
268
- function _e(e) {
269
- function n(r) {
270
- return r.children.length === 0 ? [r] : [r, ...r.children.flatMap((s) => n(s))];
271
- }
272
- return n(e).filter((r) => te(r));
273
- }
274
- function ee(e) {
275
- return e.name.endsWith("_FLG");
276
- }
277
- function te(e) {
278
- return /_J[0-9]+$/.test(e.name);
279
- }
280
- function Ge(e, n) {
281
- let r;
282
- function s(o) {
283
- if (ee(o)) {
284
- if (r)
285
- throw Error(
286
- `Found multiple flange groups in robot model ${n}; first ${r.name} then ${o.name}. Only one _FLG group is allowed.`
287
- );
288
- r = o;
289
- }
290
- te(o), o.children.map(s);
291
- }
292
- if (s(e.scene), !r)
293
- throw Error(
294
- `No flange group found in robot model ${n}. Flange must be identified with a name ending in _FLG.`
295
- );
296
- return { gltf: e };
297
- }
298
- function re({
299
- rapidlyChangingMotionState: e,
300
- dhParameters: n,
301
- onRotationChanged: r,
302
- children: s
303
- }) {
304
- const o = _([]), c = _([]), a = _(null), { invalidate: f } = ae();
305
- I(() => {
306
- const l = e.joint_position.filter(
307
- (u) => u !== void 0
308
- );
309
- return a.current = new ye(l, {
310
- tension: 120,
311
- // Controls spring stiffness - higher values create faster, more responsive motion
312
- friction: 20,
313
- // Controls damping - higher values reduce oscillation and create smoother settling
314
- threshold: 1e-3
315
- }), () => {
316
- var u;
317
- (u = a.current) == null || u.destroy();
318
- };
319
- }, []), le((l, u) => {
320
- if (a.current) {
321
- const p = a.current.update(u);
322
- d(), p || f();
323
- }
324
- });
325
- function i(l) {
326
- l && (c.current = _e(l), d(), f());
327
- }
328
- function d() {
329
- var u;
330
- const l = ((u = a.current) == null ? void 0 : u.getCurrentValues()) || [];
331
- if (r)
332
- r(c.current, l);
333
- else
334
- for (const [p, x] of c.current.entries()) {
335
- const g = n[p], b = g.theta || 0, M = g.reverse_rotation_direction ? -1 : 1;
336
- x.rotation.y = M * (l[p] || 0) + b;
337
- }
338
- }
339
- const h = v(() => {
340
- var u;
341
- const l = e.joint_position.filter(
342
- (p) => p !== void 0
343
- );
344
- o.current = l, (u = a.current) == null || u.setTarget(l);
345
- }, [e]);
346
- return I(() => {
347
- requestAnimationFrame(() => {
348
- h();
349
- });
350
- }, [e, h]), /* @__PURE__ */ t.jsx("group", { ref: i, children: s });
351
- }
352
- const Ie = "line", Fe = "mesh";
353
- function Ve({
354
- rapidlyChangingMotionState: e,
355
- dhParameters: n,
356
- ...r
357
- }) {
358
- const s = new F(), o = _([]), c = _([]);
359
- me.useEffect(() => {
360
- o.current = new Array(n.length).fill(null), c.current = new Array(n.length).fill(null);
361
- }, [n.length]);
362
- function a(d, h) {
363
- const l = new E(), u = new ie(), p = new E();
364
- s.decompose(l, u, p);
365
- const x = l.clone(), g = new F().makeRotationY(
366
- d.theta + h * (d.reverse_rotation_direction ? -1 : 1)
367
- ).multiply(new F().makeTranslation(0, d.d / 1e3, 0)).multiply(new F().makeTranslation(d.a / 1e3, 0, 0)).multiply(new F().makeRotationX(d.alpha));
368
- return s.multiply(g), s.decompose(l, u, p), { a: x, b: l };
369
- }
370
- function f(d, h, l, u) {
371
- if (!n)
372
- return;
373
- const p = n[d];
374
- if (!p)
375
- return;
376
- const { a: x, b: g } = a(p, u);
377
- h.geometry.setPositions([x.toArray(), g.toArray()].flat()), l.position.set(g.x, g.y, g.z);
378
- }
379
- function i(d, h) {
380
- s.identity();
381
- for (let l = 0; l < Math.min(d.length, h.length); l++) {
382
- const u = o.current[l], p = c.current[l];
383
- u && p && f(l, u, p, h[l]);
384
- }
385
- }
386
- return /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsx(
387
- re,
388
- {
389
- rapidlyChangingMotionState: e,
390
- dhParameters: n,
391
- onRotationChanged: i,
392
- children: /* @__PURE__ */ t.jsxs("group", { ...r, name: "Scene", children: [
393
- /* @__PURE__ */ t.jsxs("mesh", { children: [
394
- /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
395
- /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
396
- ] }),
397
- n.map((d, h) => {
398
- const { a: l, b: u } = a(
399
- d,
400
- e.joint_position[h] ?? 0
401
- ), p = `dhrobot_J0${h}`;
402
- return /* @__PURE__ */ t.jsxs("group", { name: p, children: [
403
- /* @__PURE__ */ t.jsx(
404
- Z,
405
- {
406
- ref: (x) => {
407
- o.current[h] = x;
408
- },
409
- name: Ie,
410
- points: [l, u],
411
- color: "white",
412
- lineWidth: 5
413
- }
414
- ),
415
- /* @__PURE__ */ t.jsxs(
416
- "mesh",
417
- {
418
- ref: (x) => {
419
- c.current[h] = x;
420
- },
421
- name: Fe,
422
- position: u,
423
- children: [
424
- /* @__PURE__ */ t.jsx("sphereGeometry", { args: [0.01, 32, 32] }),
425
- /* @__PURE__ */ t.jsx("meshStandardMaterial", { color: "black", depthTest: !0 })
426
- ]
427
- },
428
- "mesh_" + h
429
- )
430
- ] }, p);
431
- })
432
- ] })
433
- }
434
- ) });
435
- }
436
- const Le = console.warn;
437
- function Se() {
438
- return I(() => {
439
- console.warn = (e) => {
440
- e !== "Cannot call the manual advancement of rafz whilst frameLoop is not set as demand" && Le(e);
441
- };
442
- }, []), /* @__PURE__ */ t.jsx(t.Fragment, {});
443
- }
444
- function Te(e) {
445
- return e.type === "Mesh";
446
- }
447
- function Ce({
448
- url: e,
449
- flangeRef: n,
450
- postModelRender: r,
451
- ...s
452
- }) {
453
- const o = ue(e);
454
- let c;
455
- try {
456
- c = Ge(o, "robot.glb").gltf;
457
- } catch (i) {
458
- throw i;
459
- }
460
- const a = v(
461
- (i) => {
462
- i && r && r();
463
- },
464
- [r]
465
- );
466
- function f(i) {
467
- try {
468
- return Te(i) ? i.geometry ? /* @__PURE__ */ t.jsx(
469
- "mesh",
470
- {
471
- name: i.name,
472
- geometry: i.geometry,
473
- material: i.material,
474
- position: i.position,
475
- rotation: i.rotation
476
- },
477
- i.uuid
478
- ) : /* @__PURE__ */ t.jsx("group", { name: i.name, position: i.position, rotation: i.rotation }, i.uuid) : /* @__PURE__ */ t.jsx(
479
- "group",
480
- {
481
- name: i.name,
482
- position: i.position,
483
- rotation: i.rotation,
484
- ref: ee(i) ? n : void 0,
485
- children: i.children.map(f)
486
- },
487
- i.uuid
488
- );
489
- } catch (d) {
490
- return console.warn("Error rendering node", i.name, d), null;
491
- }
492
- }
493
- return /* @__PURE__ */ t.jsx("group", { ...s, dispose: null, ref: a, children: f(c.scene) });
494
- }
495
- function De({
496
- modelURL: e,
497
- flangeRef: n,
498
- postModelRender: r,
499
- ...s
500
- }) {
501
- const [o, c] = G(null);
502
- return I(() => {
503
- (async () => {
504
- try {
505
- if (typeof e == "string")
506
- c(e);
507
- else {
508
- const f = await e;
509
- c(f);
510
- }
511
- } catch (f) {
512
- console.error("Failed to resolve model URL:", f);
513
- }
514
- })();
515
- }, [e]), o ? /* @__PURE__ */ t.jsx(
516
- Ce,
517
- {
518
- url: o,
519
- flangeRef: n,
520
- postModelRender: r,
521
- ...s
522
- }
523
- ) : null;
524
- }
525
- const ke = (e, n) => {
526
- e.userData.isGhost || (e.traverse((r) => {
527
- if (r instanceof m.Mesh) {
528
- r.material instanceof m.Material && (r.material.colorWrite = !1);
529
- const s = r.clone(), o = r.clone();
530
- s.material = new m.MeshStandardMaterial({
531
- depthTest: !0,
532
- depthWrite: !0,
533
- colorWrite: !1,
534
- polygonOffset: !0,
535
- polygonOffsetFactor: -1,
536
- side: m.DoubleSide
537
- }), s.userData.isGhost = !0, o.material = new m.MeshStandardMaterial({
538
- color: n,
539
- opacity: 0.3,
540
- depthTest: !0,
541
- depthWrite: !1,
542
- transparent: !0,
543
- polygonOffset: !0,
544
- polygonOffsetFactor: -2,
545
- side: m.DoubleSide
546
- }), o.userData.isGhost = !0, r.parent && (r.parent.add(s), r.parent.add(o));
547
- }
548
- }), e.userData.isGhost = !0);
549
- }, Ae = (e) => {
550
- if (!e.userData.isGhost) return;
551
- const n = [];
552
- e.traverse((r) => {
553
- var s;
554
- r instanceof m.Mesh && ((s = r.userData) != null && s.isGhost ? n.push(r) : r.material instanceof m.Material && (r.material.colorWrite = !0));
555
- }), n.forEach((r) => {
556
- r.parent && r.parent.remove(r);
557
- }), e.userData.isGhost = !1;
558
- }, Pe = K(
559
- ({
560
- rapidlyChangingMotionState: e,
561
- modelFromController: n,
562
- dhParameters: r,
563
- getModel: s = Q,
564
- flangeRef: o,
565
- postModelRender: c,
566
- transparentColor: a,
567
- ...f
568
- }) => {
569
- const [i, d] = G(null), h = v((u) => {
570
- d(u);
571
- }, []);
572
- I(() => {
573
- i && (a ? ke(i, a) : Ae(i));
574
- }, [i, a]);
575
- const l = /* @__PURE__ */ t.jsx(
576
- Ve,
577
- {
578
- rapidlyChangingMotionState: e,
579
- dhParameters: r,
580
- ...f
581
- }
582
- );
583
- return /* @__PURE__ */ t.jsxs(
584
- je,
585
- {
586
- fallback: l,
587
- onError: (u) => {
588
- console.warn(u);
589
- },
590
- children: [
591
- /* @__PURE__ */ t.jsx(pe, { fallback: l, children: /* @__PURE__ */ t.jsx("group", { ref: h, children: /* @__PURE__ */ t.jsx(
592
- re,
593
- {
594
- rapidlyChangingMotionState: e,
595
- dhParameters: r,
596
- children: /* @__PURE__ */ t.jsx(
597
- De,
598
- {
599
- modelURL: (() => {
600
- const u = s(n);
601
- if (!u) {
602
- const p = new Blob([], { type: "model/gltf-binary" }), x = new File([p], `${n}.glb`, { type: "model/gltf-binary" });
603
- return Promise.resolve(URL.createObjectURL(x));
604
- }
605
- return u;
606
- })(),
607
- postModelRender: c,
608
- flangeRef: o,
609
- ...f
610
- }
611
- )
612
- }
613
- ) }) }),
614
- /* @__PURE__ */ t.jsx(Se, {})
615
- ]
616
- }
617
- );
618
- }
619
- );
620
- function ze({
621
- connectedMotionGroup: e,
622
- getModel: n = Q,
623
- flangeRef: r,
624
- transparentColor: s,
625
- postModelRender: o,
626
- ...c
627
- }) {
628
- return e.dhParameters ? /* @__PURE__ */ t.jsx(
629
- Pe,
630
- {
631
- rapidlyChangingMotionState: e.rapidlyChangingMotionState,
632
- modelFromController: e.modelFromController || "",
633
- dhParameters: e.dhParameters,
634
- getModel: n,
635
- flangeRef: r,
636
- transparentColor: s,
637
- postModelRender: o,
638
- ...c
639
- }
640
- ) : null;
641
- }
642
- const tt = K(
643
- he(
644
- ({
645
- robotName: e,
646
- programState: n,
647
- safetyState: r,
648
- operationMode: s,
649
- driveToHomeEnabled: o = !1,
650
- onDriveToHomePress: c,
651
- onDriveToHomeRelease: a,
652
- connectedMotionGroup: f,
653
- robotComponent: i = ze,
654
- customContentComponent: d,
655
- className: h
656
- }) => {
657
- var P;
658
- const l = fe(), { t: u } = xe(), [p, x] = G(!1), g = _(null), b = _(null), [M, ne] = G(!1), [V, oe] = G({ width: 400, height: 600 }), [Ue, se] = G(0);
659
- I(() => {
660
- const C = () => {
661
- if (b.current) {
662
- const { offsetWidth: O, offsetHeight: U } = b.current;
663
- ne(O > U), oe({ width: O, height: U });
664
- }
665
- };
666
- C();
667
- const z = new ResizeObserver(C);
668
- return b.current && z.observe(b.current), () => {
669
- z.disconnect();
670
- };
671
- }, []);
672
- const k = v(() => {
673
- se((C) => C + 1);
674
- }, []), L = v(() => {
675
- !o || !c || (x(!0), c());
676
- }, [o, c]), S = v(() => {
677
- !o || !a || (x(!1), a());
678
- }, [o, a]), A = v(() => {
679
- p && a && (x(!1), a());
680
- }, [p, a]), w = M ? V.width < 350 : V.height < 200, T = M ? V.height < 310 : V.height < 450;
681
- return /* @__PURE__ */ t.jsx(
682
- de,
683
- {
684
- ref: b,
685
- className: h,
686
- sx: {
687
- width: "100%",
688
- height: "100%",
689
- display: "flex",
690
- flexDirection: M ? "row" : "column",
691
- position: "relative",
692
- overflow: "hidden",
693
- minWidth: { xs: 180, sm: 220, md: 250 },
694
- minHeight: M ? { xs: 200, sm: 240, md: 260 } : { xs: 150, sm: 180, md: 220 },
695
- // Allow progressive hiding in portrait mode
696
- border: `1px solid ${l.palette.divider}`,
697
- borderRadius: "18px",
698
- boxShadow: "none",
699
- backgroundColor: ((P = l.palette.backgroundPaperElevation) == null ? void 0 : P[8]) || "#2A2A3F",
700
- backgroundImage: "none"
701
- // Override any gradient from elevation
702
- },
703
- children: M ? /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
704
- /* @__PURE__ */ t.jsx(
705
- y,
706
- {
707
- sx: {
708
- flex: "0 0 50%",
709
- position: "relative",
710
- height: "100%",
711
- minHeight: "100%",
712
- maxHeight: "100%",
713
- borderRadius: 1,
714
- m: { xs: 1.5, sm: 2, md: 3 },
715
- mr: { xs: 0.75, sm: 1, md: 1.5 },
716
- overflow: "hidden",
717
- // Prevent content from affecting container size
718
- display: w ? "none" : "block"
719
- },
720
- children: !w && /* @__PURE__ */ t.jsxs(
721
- B,
722
- {
723
- orthographic: !0,
724
- camera: {
725
- position: [3, 2, 3],
726
- zoom: 1
727
- },
728
- shadows: !0,
729
- frameloop: "demand",
730
- style: {
731
- borderRadius: l.shape.borderRadius,
732
- width: "100%",
733
- height: "100%",
734
- background: "transparent",
735
- position: "absolute",
736
- top: 0,
737
- left: 0
738
- },
739
- dpr: [1, 2],
740
- gl: { alpha: !0, antialias: !0 },
741
- children: [
742
- /* @__PURE__ */ t.jsx(Y, {}),
743
- /* @__PURE__ */ t.jsx(W, { fit: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
744
- i,
745
- {
746
- connectedMotionGroup: f,
747
- postModelRender: k
748
- }
749
- ) })
750
- ]
751
- }
752
- )
753
- }
754
- ),
755
- /* @__PURE__ */ t.jsxs(
756
- y,
757
- {
758
- sx: {
759
- flex: "1",
760
- display: "flex",
761
- flexDirection: "column",
762
- justifyContent: "flex-start",
763
- width: w ? "100%" : "50%"
764
- },
765
- children: [
766
- /* @__PURE__ */ t.jsxs(
767
- y,
768
- {
769
- sx: {
770
- p: { xs: 1.5, sm: 2, md: 3 },
771
- pb: { xs: 1, sm: 1.5, md: 2 },
772
- textAlign: "left"
773
- },
774
- children: [
775
- /* @__PURE__ */ t.jsx($, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
776
- /* @__PURE__ */ t.jsx(
777
- J,
778
- {
779
- programState: n,
780
- safetyState: r,
781
- operationMode: s
782
- }
783
- )
784
- ]
785
- }
786
- ),
787
- /* @__PURE__ */ t.jsxs(
788
- y,
789
- {
790
- sx: {
791
- p: { xs: 1.5, sm: 2, md: 3 },
792
- pt: 0,
793
- flex: "1",
794
- display: "flex",
795
- flexDirection: "column",
796
- justifyContent: "space-between"
797
- },
798
- children: [
799
- !T && d && /* @__PURE__ */ t.jsxs(y, { children: [
800
- /* @__PURE__ */ t.jsx(d, {}),
801
- /* @__PURE__ */ t.jsx(
802
- N,
803
- {
804
- sx: {
805
- mt: 1,
806
- mb: 0,
807
- borderColor: l.palette.divider,
808
- opacity: 0.5
809
- }
810
- }
811
- )
812
- ] }),
813
- /* @__PURE__ */ t.jsx(
814
- y,
815
- {
816
- sx: {
817
- mt: !T && d ? "auto" : 0
818
- },
819
- children: /* @__PURE__ */ t.jsx(
820
- y,
821
- {
822
- sx: {
823
- display: "flex",
824
- justifyContent: "flex-start",
825
- mt: { xs: 1, sm: 1.5, md: 2 },
826
- mb: { xs: 0.5, sm: 0.75, md: 1 }
827
- },
828
- children: /* @__PURE__ */ t.jsx(
829
- H,
830
- {
831
- ref: g,
832
- variant: "contained",
833
- color: "secondary",
834
- size: "small",
835
- disabled: !o,
836
- onMouseDown: L,
837
- onMouseUp: S,
838
- onMouseLeave: A,
839
- onTouchStart: L,
840
- onTouchEnd: S,
841
- sx: {
842
- textTransform: "none",
843
- px: 1.5,
844
- py: 0.5
845
- },
846
- children: u("RobotCard.DriveToHome.bt")
847
- }
848
- )
849
- }
850
- )
851
- }
852
- )
853
- ]
854
- }
855
- )
856
- ]
857
- }
858
- )
859
- ] }) : /* @__PURE__ */ t.jsx(t.Fragment, { children: /* @__PURE__ */ t.jsxs(
860
- y,
861
- {
862
- sx: {
863
- p: 3,
864
- height: "100%",
865
- display: "flex",
866
- flexDirection: "column"
867
- },
868
- children: [
869
- /* @__PURE__ */ t.jsxs(y, { children: [
870
- /* @__PURE__ */ t.jsx($, { variant: "h6", component: "h2", sx: { mb: 1 }, children: e }),
871
- /* @__PURE__ */ t.jsx(
872
- J,
873
- {
874
- programState: n,
875
- safetyState: r,
876
- operationMode: s
877
- }
878
- )
879
- ] }),
880
- /* @__PURE__ */ t.jsx(
881
- y,
882
- {
883
- sx: {
884
- flex: w ? 0 : 1,
885
- position: "relative",
886
- minHeight: w ? 0 : { xs: 120, sm: 150, md: 200 },
887
- height: w ? 0 : "auto",
888
- borderRadius: 1,
889
- overflow: "hidden",
890
- display: w ? "none" : "block"
891
- },
892
- children: !w && /* @__PURE__ */ t.jsxs(
893
- B,
894
- {
895
- orthographic: !0,
896
- camera: {
897
- position: [3, 2, 3],
898
- zoom: 1
899
- },
900
- shadows: !0,
901
- frameloop: "demand",
902
- style: {
903
- borderRadius: l.shape.borderRadius,
904
- width: "100%",
905
- height: "100%",
906
- background: "transparent",
907
- position: "absolute"
908
- },
909
- dpr: [1, 2],
910
- gl: { alpha: !0, antialias: !0 },
911
- children: [
912
- /* @__PURE__ */ t.jsx(Y, {}),
913
- /* @__PURE__ */ t.jsx(W, { fit: !0, clip: !0, observe: !0, margin: 1, maxDuration: 1, children: /* @__PURE__ */ t.jsx(
914
- i,
915
- {
916
- connectedMotionGroup: f,
917
- postModelRender: k
918
- }
919
- ) })
920
- ]
921
- }
922
- )
923
- }
924
- ),
925
- /* @__PURE__ */ t.jsxs(y, { children: [
926
- !T && d && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
927
- /* @__PURE__ */ t.jsx(d, {}),
928
- /* @__PURE__ */ t.jsx(
929
- N,
930
- {
931
- sx: {
932
- mt: 1,
933
- mb: 0,
934
- borderColor: l.palette.divider,
935
- opacity: 0.5
936
- }
937
- }
938
- )
939
- ] }),
940
- /* @__PURE__ */ t.jsx(
941
- y,
942
- {
943
- sx: {
944
- display: "flex",
945
- justifyContent: "flex-start",
946
- mt: !T && d ? { xs: 1, sm: 2, md: 5 } : { xs: 0.5, sm: 1, md: 2 },
947
- mb: { xs: 0.5, sm: 0.75, md: 1 }
948
- },
949
- children: /* @__PURE__ */ t.jsx(
950
- H,
951
- {
952
- ref: g,
953
- variant: "contained",
954
- color: "secondary",
955
- size: "small",
956
- disabled: !o,
957
- onMouseDown: L,
958
- onMouseUp: S,
959
- onMouseLeave: A,
960
- onTouchStart: L,
961
- onTouchEnd: S,
962
- sx: {
963
- textTransform: "none",
964
- px: 1.5,
965
- py: 0.5
966
- },
967
- children: u("RobotCard.DriveToHome.bt")
968
- }
969
- )
970
- }
971
- )
972
- ] })
973
- ]
974
- }
975
- ) })
976
- }
977
- );
978
- }
979
- )
980
- ), rt = Array(6).fill(2 * Math.PI), q = {
981
- [j.Abb]: [0, 0, 0, 0, Math.PI / 2, 0, 0],
982
- [j.Fanuc]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
983
- [j.Yaskawa]: [0, 0, 0, 0, -Math.PI / 2, 0, 0],
984
- [j.Kuka]: [
985
- 0,
986
- -Math.PI / 2,
987
- Math.PI / 2,
988
- 0,
989
- Math.PI / 2,
990
- 0,
991
- 0
992
- ],
993
- [j.Universalrobots]: [
994
- 0,
995
- -Math.PI / 2,
996
- -Math.PI / 2,
997
- -Math.PI / 2,
998
- Math.PI / 2,
999
- -Math.PI / 2,
1000
- 0
1001
- ]
1002
- };
1003
- function Oe(e) {
1004
- const [n] = e.split("_");
1005
- switch (n) {
1006
- case "ABB":
1007
- return j.Abb;
1008
- case "FANUC":
1009
- return j.Fanuc;
1010
- case "YASKAWA":
1011
- return j.Yaskawa;
1012
- case "KUKA":
1013
- return j.Kuka;
1014
- case "UniversalRobots":
1015
- return j.Universalrobots;
1016
- default:
1017
- return null;
1018
- }
1019
- }
1020
- function nt(e, n) {
1021
- const r = Oe(e);
1022
- return r && r in q ? q[r] : n || null;
1023
- }
1024
- export {
1025
- Ze as C,
1026
- q as M,
1027
- Y as P,
1028
- ze as R,
1029
- Qe as S,
1030
- et as T,
1031
- tt as a,
1032
- Pe as b,
1033
- Q as c,
1034
- rt as d,
1035
- Oe as e,
1036
- nt as g
1037
- };
1038
- //# sourceMappingURL=manufacturerHomePositions-h7G6BCs7.js.map