@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.4e5a9e6 → 6.4.0-pr.revamp.667.4ee5f82

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 (203) hide show
  1. package/README.md +207 -40
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +10 -3
  4. package/dist/3d.js +41 -31
  5. package/dist/CurrentPose/index.cjs +1 -1
  6. package/dist/CurrentPose/index.js +2 -2
  7. package/dist/CurrentPoseBar/index.cjs +1 -1
  8. package/dist/CurrentPoseBar/index.js +1 -1
  9. package/dist/JoggingButtons/index.cjs +1 -1
  10. package/dist/JoggingButtons/index.js +1 -1
  11. package/dist/JoggingGizmo/index.cjs +1 -1
  12. package/dist/JoggingGizmo/index.d.ts +1 -0
  13. package/dist/JoggingGizmo/index.js +2 -2
  14. package/dist/JoggingJointSlider/index.cjs +1 -1
  15. package/dist/JoggingJointSlider/index.js +1 -1
  16. package/dist/RobotControl/index.cjs +1 -1
  17. package/dist/RobotControl/index.js +2 -2
  18. package/dist/RobotControlPanel/index.cjs +1 -1
  19. package/dist/RobotControlPanel/index.d.ts +1 -1
  20. package/dist/RobotControlPanel/index.js +1 -1
  21. package/dist/RobotHeader/index.cjs +1 -1
  22. package/dist/RobotHeader/index.d.ts +2 -0
  23. package/dist/RobotHeader/index.js +6 -4
  24. package/dist/RobotScene/index.cjs +1 -0
  25. package/dist/RobotScene/index.d.ts +5 -0
  26. package/dist/RobotScene/index.js +11 -0
  27. package/dist/RobotView/index.cjs +1 -0
  28. package/dist/RobotView/index.d.ts +4 -0
  29. package/dist/RobotView/index.js +9 -0
  30. package/dist/SafetyBar/IndicatorWithExplanation.d.ts +12 -1
  31. package/dist/SafetyBar/index.cjs +1 -1
  32. package/dist/SafetyBar/index.js +1 -1
  33. package/dist/chunks/ConnectedMotionGroup-770Xppk7.cjs +3 -0
  34. package/dist/chunks/ConnectedMotionGroup-CjhZTmlT.js +1822 -0
  35. package/dist/chunks/CurrentPose-DxeimMeU.cjs +1 -0
  36. package/dist/chunks/{CurrentPose-DYKoKD2D.js → CurrentPose-jTdJrjYe.js} +13 -12
  37. package/dist/chunks/{CurrentPoseBar-Cb_Pk2jp.js → CurrentPoseBar--HkZBGnN.js} +17 -16
  38. package/dist/chunks/CurrentPoseBar-DoOUfRRs.cjs +1 -0
  39. package/dist/chunks/{JoggingButtons-DluWqNuO.js → JoggingButtons-BNOnpcTH.js} +2 -2
  40. package/dist/chunks/{JoggingButtons-DC0jII72.cjs → JoggingButtons-Boaym2hQ.cjs} +1 -1
  41. package/dist/chunks/JoggingGizmo-CNFjpWDv.cjs +1 -0
  42. package/dist/chunks/JoggingGizmo-RDiEVQes.js +847 -0
  43. package/dist/chunks/{JoggingGizmoOrientation-Bba8HLQJ.js → JoggingGizmoOrientation-Dzzz2gEz.js} +1 -1
  44. package/dist/chunks/{JoggingGizmoOrientation-l2slmUE_.cjs → JoggingGizmoOrientation-laUrgY0N.cjs} +1 -1
  45. package/dist/chunks/JoggingJointSlider-BY-Tof8G.js +378 -0
  46. package/dist/chunks/JoggingJointSlider-Dm3vILd3.cjs +1 -0
  47. package/dist/chunks/JoggingRefusedError-C4D8_YR_.js +38 -0
  48. package/dist/chunks/JoggingRefusedError-DqyrfUcc.cjs +1 -0
  49. package/dist/chunks/Pose3-BfBNPRDM.cjs +1 -0
  50. package/dist/chunks/{Pose3-B_fLR-Wv.js → Pose3-DWxfC6Dj.js} +1 -2
  51. package/dist/chunks/PoseTransformer-2QIzECOZ.cjs +1 -0
  52. package/dist/chunks/PoseTransformer-CmuoS76S.js +364 -0
  53. package/dist/chunks/Robot-BI3OpLBC.cjs +1 -0
  54. package/dist/chunks/Robot-DzVgWIyl.js +428 -0
  55. package/dist/chunks/RobotActivation-BaPImZRq.cjs +1 -0
  56. package/dist/chunks/RobotActivation-CXUp6Szs.js +131 -0
  57. package/dist/chunks/RobotControl-Do-oagek.cjs +1 -0
  58. package/dist/chunks/RobotControl-Un5D1r8T.js +318 -0
  59. package/dist/chunks/RobotControlPanel-BJ80O4ER.cjs +1 -0
  60. package/dist/chunks/RobotControlPanel-CxTEIelh.js +1019 -0
  61. package/dist/chunks/RobotScene-C1DNfxXU.js +1246 -0
  62. package/dist/chunks/RobotScene-hUDf_S6f.cjs +1 -0
  63. package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +1 -0
  64. package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +25 -0
  65. package/dist/chunks/RobotView-Cx_eOS9N.js +158 -0
  66. package/dist/chunks/RobotView-KFlt_Isi.cjs +1 -0
  67. package/dist/chunks/coordSystemLabel-BThpFG9n.cjs +1 -0
  68. package/dist/chunks/coordSystemLabel-Bfy9MUsV.js +6 -0
  69. package/dist/chunks/externalizeComponent-CA_sHzyH.cjs +2 -0
  70. package/dist/chunks/{externalizeComponent-CSzPVfuG.js → externalizeComponent-CChY_1bN.js} +66 -14
  71. package/dist/chunks/holdSafety-Cbej6-Kc.js +62 -0
  72. package/dist/chunks/holdSafety-TeMXlYQe.cjs +1 -0
  73. package/dist/chunks/joggingColors-Cqpfuw4G.cjs +1 -0
  74. package/dist/chunks/joggingColors-sb6IFdj2.js +133 -0
  75. package/dist/chunks/json-3cqBD7UQ.js +18 -0
  76. package/dist/chunks/json-Bd6uGfgP.cjs +1 -0
  77. package/dist/chunks/loadRobotSession-BRuiCc0r.cjs +1 -0
  78. package/dist/chunks/loadRobotSession-IuZ-zs8x.js +3055 -0
  79. package/dist/chunks/poseText-BxG4Caa-.js +48 -0
  80. package/dist/chunks/poseText-CwplkbDM.cjs +1 -0
  81. package/dist/chunks/robotActivationOf-BsFcsAdF.cjs +1 -0
  82. package/dist/chunks/robotActivationOf-SqnXGdFY.js +368 -0
  83. package/dist/chunks/robotSafetyOf-Cbp35lO-.cjs +1 -0
  84. package/dist/chunks/{robotSafetyOf-Dr5Q4rCp.js → robotSafetyOf-kNLaX0_5.js} +255 -228
  85. package/dist/chunks/useEveryFrame-D04ygIe7.js +116 -0
  86. package/dist/chunks/useEveryFrame-NeKiPXY-.cjs +1 -0
  87. package/dist/chunks/useSmoothedMotionState-B9WO73k0.cjs +1 -0
  88. package/dist/chunks/{useSmoothedMotionState-COMJRcOt.js → useSmoothedMotionState-BSSV8aZN.js} +74 -86
  89. package/dist/chunks/useWebGLRenderer-BozrbZz-.js +45 -0
  90. package/dist/chunks/useWebGLRenderer-CtddVDDb.cjs +1 -0
  91. package/dist/components/VelocitySlider.d.ts +14 -1
  92. package/dist/components/connectionWarning/ConnectionWarning.d.ts +21 -0
  93. package/dist/components/connectionWarning/connectionWarningOf.d.ts +18 -0
  94. package/dist/components/connectionWarning/timeAgo.d.ts +5 -0
  95. package/dist/components/jogging/JoggingButtons.d.ts +3 -1
  96. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +7 -1
  97. package/dist/components/jogging/JoggingCartesianTab.d.ts +6 -0
  98. package/dist/components/jogging/JoggingJointTab.d.ts +5 -0
  99. package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
  100. package/dist/components/jogging/JoggingPanel.d.ts +11 -0
  101. package/dist/components/jogging/JoggingRefusedError.d.ts +24 -0
  102. package/dist/components/jogging/JoggingStore.d.ts +229 -12
  103. package/dist/components/jogging/gizmo/JoggingGizmo.d.ts +14 -4
  104. package/dist/components/jogging/gizmo/RotationHandles.d.ts +3 -3
  105. package/dist/components/jogging/gizmo/gizmoShared.d.ts +19 -9
  106. package/dist/components/jogging/holdSafety.d.ts +51 -13
  107. package/dist/components/jogging/joggingColors.d.ts +6 -0
  108. package/dist/components/jogging/joint/JoggingJointSlider.d.ts +9 -5
  109. package/dist/components/jogging/joint/useJointJogHold.d.ts +10 -15
  110. package/dist/components/jogging/useHold.d.ts +17 -13
  111. package/dist/components/jogging/useJogControls.d.ts +2 -3
  112. package/dist/components/robotControl/CartesianJogTab.d.ts +14 -3
  113. package/dist/components/robotControl/HoldToMoveButton.d.ts +8 -7
  114. package/dist/components/robotControl/JogArea.d.ts +10 -4
  115. package/dist/components/robotControl/JogDisabledReason.d.ts +15 -0
  116. package/dist/components/robotControl/JointJogTab.d.ts +10 -2
  117. package/dist/components/robotControl/MoveToTab.d.ts +22 -4
  118. package/dist/components/robotControl/PoseField.d.ts +3 -1
  119. package/dist/components/robotControl/RobotControl.d.ts +3 -0
  120. package/dist/components/robotControl/RobotControlPanel.d.ts +84 -22
  121. package/dist/components/robotControl/VelocityRow.d.ts +8 -2
  122. package/dist/components/robotControl/atPose.d.ts +6 -0
  123. package/dist/components/robotControl/poseText.d.ts +13 -1
  124. package/dist/components/robotControl/units.d.ts +10 -2
  125. package/dist/components/robotControl/useRobotControlProps.d.ts +11 -2
  126. package/dist/components/robotControl/velocityText.d.ts +18 -0
  127. package/dist/components/robotHeader/robotActivationOf.d.ts +5 -0
  128. package/dist/components/robotHeader/robotSafetyOf.d.ts +8 -1
  129. package/dist/components/robotScene/JoggingAxes.d.ts +38 -0
  130. package/dist/components/robotScene/RobotScene.d.ts +28 -0
  131. package/dist/components/robotScene/RobotSceneView.d.ts +53 -0
  132. package/dist/components/robotScene/useRobotSceneProps.d.ts +18 -0
  133. package/dist/components/robotView/RobotCanvas.d.ts +42 -0
  134. package/dist/components/robotView/RobotView.d.ts +23 -0
  135. package/dist/components/robotView/WebGLUnavailable.d.ts +5 -0
  136. package/dist/components/robots/DHRobot.d.ts +1 -1
  137. package/dist/components/robots/GenericRobot.d.ts +16 -1
  138. package/dist/components/robots/LinearAxisAnimator.d.ts +1 -1
  139. package/dist/components/robots/SupportedLinearAxis.d.ts +16 -3
  140. package/dist/components/robots/SupportedRobot.d.ts +21 -3
  141. package/dist/components/robots/ghostStyle.d.ts +21 -0
  142. package/dist/components/robots/modelRotation.d.ts +14 -0
  143. package/dist/components/robots/robotModelLogic.d.ts +138 -6
  144. package/dist/components/robots/robotModelSource.d.ts +14 -1
  145. package/dist/components/utils/converters.d.ts +0 -2
  146. package/dist/components/utils/json.d.ts +4 -0
  147. package/dist/components/utils/useWebGLRenderer.d.ts +32 -0
  148. package/dist/components/utils/webglSupport.d.ts +11 -0
  149. package/dist/core.cjs +1 -1
  150. package/dist/core.d.ts +8 -5
  151. package/dist/core.js +70 -70
  152. package/dist/index.cjs +1 -1
  153. package/dist/index.js +110 -100
  154. package/dist/lib/ConnectedMotionGroup.d.ts +11 -0
  155. package/dist/lib/ControllerStateStream.d.ts +3 -8
  156. package/dist/lib/JoggerConnection.d.ts +32 -13
  157. package/dist/lib/MotionStreamConnection.d.ts +3 -2
  158. package/dist/lib/TrajectoryExecutionStore.d.ts +103 -10
  159. package/dist/lib/controllerStateSource.d.ts +6 -5
  160. package/dist/lib/incrementalCartesianMotion.d.ts +2 -2
  161. package/dist/lib/poseMath.d.ts +51 -0
  162. package/dist/lib/robotSession/RobotActivation.d.ts +43 -12
  163. package/dist/lib/robotSession/RobotLiveState.d.ts +13 -4
  164. package/dist/lib/robotSession/RobotSession.d.ts +28 -2
  165. package/dist/lib/robotSession/RobotTargetPose.d.ts +44 -8
  166. package/dist/lib/robotSession/loadRobotSession.d.ts +1 -1
  167. package/dist/lib/robotSession/robotPose.d.ts +5 -0
  168. package/dist/nats.cjs +1 -1
  169. package/dist/nats.js +1 -1
  170. package/dist/session.cjs +1 -0
  171. package/dist/session.d.ts +22 -0
  172. package/dist/session.js +37 -0
  173. package/package.json +27 -1
  174. package/dist/chunks/CurrentPose-BIPvpQLG.cjs +0 -1
  175. package/dist/chunks/CurrentPoseBar-CAEEifBY.cjs +0 -1
  176. package/dist/chunks/JoggingGizmo-DT7iX5Ka.cjs +0 -1
  177. package/dist/chunks/JoggingGizmo-Hy42DAQU.js +0 -810
  178. package/dist/chunks/JoggingJointSlider-C0lI_9W5.cjs +0 -1
  179. package/dist/chunks/JoggingJointSlider-DePZ3JHW.js +0 -406
  180. package/dist/chunks/Pose3-Ch4xVeXV.cjs +0 -1
  181. package/dist/chunks/RobotControl-C1JzXIAa.js +0 -285
  182. package/dist/chunks/RobotControl-ku4CNQCb.cjs +0 -1
  183. package/dist/chunks/RobotControlPanel-B4u3D3yO.cjs +0 -1
  184. package/dist/chunks/RobotControlPanel-Cy5LwU1h.js +0 -827
  185. package/dist/chunks/converters-BsXgcxCW.cjs +0 -1
  186. package/dist/chunks/converters-D9KpJ2HD.js +0 -47
  187. package/dist/chunks/coordSystemLabel-BJKeaGA3.cjs +0 -1
  188. package/dist/chunks/coordSystemLabel-C1jfhEh5.js +0 -29
  189. package/dist/chunks/externalizeComponent-Bl23ayrr.cjs +0 -2
  190. package/dist/chunks/holdSafety-BtoZ5We3.cjs +0 -1
  191. package/dist/chunks/holdSafety-Di1GZAWg.js +0 -37
  192. package/dist/chunks/joggingColors-CuT5u0H8.js +0 -135
  193. package/dist/chunks/joggingColors-ZDc_2UCp.cjs +0 -1
  194. package/dist/chunks/loadRobotSession-DVkuHA-V.js +0 -4624
  195. package/dist/chunks/loadRobotSession-cQNeaBOf.cjs +0 -3
  196. package/dist/chunks/robotActivationOf-DUHukd46.js +0 -371
  197. package/dist/chunks/robotActivationOf-DeJsI4H5.cjs +0 -1
  198. package/dist/chunks/robotModelSource-C2Mi0LtR.js +0 -1296
  199. package/dist/chunks/robotModelSource-D7VR89r_.cjs +0 -1
  200. package/dist/chunks/robotSafetyOf-Cb4qlwd_.cjs +0 -1
  201. package/dist/chunks/useEveryFrame-CHxg25f4.cjs +0 -1
  202. package/dist/chunks/useEveryFrame-DAuNawGP.js +0 -155
  203. package/dist/chunks/useSmoothedMotionState-Con0E5Bx.cjs +0 -1
@@ -0,0 +1,364 @@
1
+ import { isAxiosError as C } from "axios";
2
+ import { Nova as w } from "@wandelbots/nova-js/v2";
3
+ import { keyBy as j } from "lodash-es";
4
+ function z(n) {
5
+ const t = n.api.opts.axiosInstance;
6
+ if (!t)
7
+ throw new Error("Nova API client has no configured HTTP transport");
8
+ return t;
9
+ }
10
+ function O(n, t) {
11
+ const o = n.api.opts.baseOptions ?? {}, r = { ...o, ...t };
12
+ return (o.headers || t.headers) && (r.headers = {
13
+ ...o.headers,
14
+ ...t.headers
15
+ }), (o.params || t.params) && (r.params = {
16
+ ...o.params,
17
+ ...t.params
18
+ }), r;
19
+ }
20
+ async function H(n, t, o, r) {
21
+ var s;
22
+ if (!o) return t;
23
+ const e = `/experimental/motion-group-models/${encodeURIComponent(t)}/description`;
24
+ r == null || r(`${e}?serial_number=${encodeURIComponent(o)}`);
25
+ try {
26
+ return (await z(n).get(
27
+ e,
28
+ O(n, { params: { serial_number: o } })
29
+ )).data.name;
30
+ } catch (i) {
31
+ if (!C(i) || ((s = i.response) == null ? void 0 : s.status) !== 404)
32
+ throw i;
33
+ return t;
34
+ }
35
+ }
36
+ async function Y(n, t, o, r, e) {
37
+ var u;
38
+ const s = z(n), i = `/motion-group-models/${encodeURIComponent(t)}/${r}`, c = r === "glb" ? { responseType: "blob" } : {};
39
+ if (o) {
40
+ const _ = `/experimental${i}`;
41
+ e == null || e(
42
+ `${_}?serial_number=${encodeURIComponent(o)}`
43
+ );
44
+ try {
45
+ return (await s.get(
46
+ _,
47
+ O(n, {
48
+ ...c,
49
+ params: { serial_number: o }
50
+ })
51
+ )).data;
52
+ } catch (p) {
53
+ if (!C(p) || ((u = p.response) == null ? void 0 : u.status) !== 404)
54
+ throw p;
55
+ }
56
+ }
57
+ return e == null || e(i), (await s.get(
58
+ i,
59
+ O(n, c)
60
+ )).data;
61
+ }
62
+ function G(n) {
63
+ return n instanceof w ? n : typeof n == "string" ? new w({ instanceUrl: n }) : new w({
64
+ instanceUrl: n.config.instanceUrl,
65
+ accessToken: n.accessToken ?? n.config.accessToken ?? void 0
66
+ });
67
+ }
68
+ function J(n) {
69
+ return typeof n == "string" ? void 0 : n.config.cellId;
70
+ }
71
+ const d = { x: 0, y: 0, z: 0, w: 1 }, M = { x: 0, y: 1, z: 2 };
72
+ function h([n, t, o]) {
73
+ return Math.sqrt(n * n + t * t + o * o);
74
+ }
75
+ function m([n, t, o], r) {
76
+ return [n * r, t * r, o * r];
77
+ }
78
+ function E(n) {
79
+ return m(n, 1 / (h(n) || 1));
80
+ }
81
+ function Z(n, t) {
82
+ return n[0] * t[0] + n[1] * t[1] + n[2] * t[2];
83
+ }
84
+ function b(n, t) {
85
+ const o = [0, 0, 0];
86
+ return o[M[n]] = t, o;
87
+ }
88
+ function A([n, t, o], { x: r, y: e, z: s, w: i }) {
89
+ const c = 2 * (e * o - s * t), a = 2 * (s * n - r * o), u = 2 * (r * t - e * n);
90
+ return [
91
+ n + i * c + e * u - s * a,
92
+ t + i * a + s * c - r * u,
93
+ o + i * u + r * a - e * c
94
+ ];
95
+ }
96
+ function R(n, t) {
97
+ const o = t / 2, r = Math.sin(o);
98
+ return {
99
+ x: n[0] * r,
100
+ y: n[1] * r,
101
+ z: n[2] * r,
102
+ w: Math.cos(o)
103
+ };
104
+ }
105
+ function v(n, t) {
106
+ return {
107
+ x: n.x * t.w + n.w * t.x + n.y * t.z - n.z * t.y,
108
+ y: n.y * t.w + n.w * t.y + n.z * t.x - n.x * t.z,
109
+ z: n.z * t.w + n.w * t.z + n.x * t.y - n.y * t.x,
110
+ w: n.w * t.w - n.x * t.x - n.y * t.y - n.z * t.z
111
+ };
112
+ }
113
+ function Q(n) {
114
+ const { x: t, y: o, z: r, w: e } = n, s = Math.sqrt(t * t + o * o + r * r + e * e);
115
+ if (s === 0)
116
+ return d;
117
+ const i = 1 / s;
118
+ return { x: t * i, y: o * i, z: r * i, w: e * i };
119
+ }
120
+ function D({ x: n, y: t, z: o, w: r }) {
121
+ return { x: -n, y: -t, z: -o, w: r };
122
+ }
123
+ function $(n, t) {
124
+ if (t === "QUATERNION" && n) {
125
+ const [o = 0, r = 0, e = 0, s = 1] = n;
126
+ return { x: o, y: r, z: e, w: s };
127
+ }
128
+ if (t === "ROTATION_VECTOR" && n) {
129
+ if (n.length < 3)
130
+ throw new Error(
131
+ `Invalid rotation vector length: ${n.length}. Expected at least 3 values.`
132
+ );
133
+ const [o = 0, r = 0, e = 0] = n, s = [o, r, e];
134
+ return R(
135
+ E(s),
136
+ h(s)
137
+ );
138
+ }
139
+ return console.warn(
140
+ `Unsupported rotation type '${t}'. Only QUATERNION and ROTATION_VECTOR are supported for now.`
141
+ ), d;
142
+ }
143
+ function K({ x: n, y: t, z: o, w: r }) {
144
+ const e = [n, t, o], s = 2 * Math.atan2(h(e), Math.abs(r)), i = (r >= 0 ? 1 : 0) - (r < 0 ? 1 : 0);
145
+ return m(m(E(e), i), s);
146
+ }
147
+ function I(n) {
148
+ return [(n == null ? void 0 : n[0]) ?? 0, (n == null ? void 0 : n[1]) ?? 0, (n == null ? void 0 : n[2]) ?? 0];
149
+ }
150
+ function k(n) {
151
+ return {
152
+ position: I(n.position),
153
+ quaternion: n.orientation ? $(n.orientation, "ROTATION_VECTOR") : d
154
+ };
155
+ }
156
+ function f(n) {
157
+ return {
158
+ position: I(n.position),
159
+ quaternion: n.orientation ? $(
160
+ n.orientation,
161
+ n.orientation_type ?? "ROTATION_VECTOR"
162
+ ) : d
163
+ };
164
+ }
165
+ function l(n, t) {
166
+ const o = A(t.position, n.quaternion);
167
+ return {
168
+ position: [
169
+ n.position[0] + o[0],
170
+ n.position[1] + o[1],
171
+ n.position[2] + o[2]
172
+ ],
173
+ quaternion: Q(
174
+ v(n.quaternion, t.quaternion)
175
+ )
176
+ };
177
+ }
178
+ function N(n) {
179
+ const t = D(n.quaternion);
180
+ return {
181
+ position: m(A(n.position, t), -1),
182
+ quaternion: t
183
+ };
184
+ }
185
+ function T({ position: n, quaternion: t }) {
186
+ return {
187
+ position: [...n],
188
+ orientation: K(t)
189
+ };
190
+ }
191
+ function x(n) {
192
+ const t = n.lastIndexOf("On");
193
+ return t > 0 ? n.slice(0, t) : n;
194
+ }
195
+ function U(n, t) {
196
+ const o = n[t];
197
+ if (o)
198
+ return o;
199
+ const r = x(t), e = n[r];
200
+ if (e)
201
+ return e;
202
+ const s = Object.keys(n).filter(
203
+ (c) => x(c) === r
204
+ );
205
+ if (s.length !== 1)
206
+ return;
207
+ const i = s[0];
208
+ return i ? n[i] : void 0;
209
+ }
210
+ const P = {
211
+ coordinate_system: "world",
212
+ name: "world",
213
+ reference_coordinate_system: "",
214
+ position: [0, 0, 0],
215
+ orientation: [0, 0, 0],
216
+ orientation_type: "ROTATION_VECTOR"
217
+ };
218
+ function V(n) {
219
+ const t = j(
220
+ n.map((e) => ({
221
+ ...e,
222
+ coordinate_system: e.coordinate_system || "world"
223
+ })),
224
+ "coordinate_system"
225
+ );
226
+ t.world ?? (t.world = P);
227
+ const o = {}, r = (e) => {
228
+ const s = o[e];
229
+ if (s)
230
+ return s;
231
+ const i = U(t, e);
232
+ if (!i)
233
+ throw new Error(
234
+ `Unknown coordinate system ${e}. Known coordinate systems are: ${Object.keys(t).join(", ")}`
235
+ );
236
+ const c = i.reference_coordinate_system || "world";
237
+ let a;
238
+ if (c === "world")
239
+ a = i;
240
+ else {
241
+ const u = r(c);
242
+ a = {
243
+ ...i,
244
+ ...T(
245
+ l(f(u), f(i))
246
+ ),
247
+ orientation_type: "ROTATION_VECTOR",
248
+ reference_coordinate_system: u.reference_coordinate_system
249
+ };
250
+ }
251
+ return o[e] = a, a;
252
+ };
253
+ return Object.fromEntries(
254
+ Object.keys(t).map((e) => [
255
+ e,
256
+ r(e)
257
+ ])
258
+ );
259
+ }
260
+ function y(n, t) {
261
+ const o = U(
262
+ n,
263
+ t || "world"
264
+ );
265
+ if (!o)
266
+ throw new Error(
267
+ `Unknown coordinate system ${t}. Known coordinate systems are: ${Object.keys(n).join(", ")}`
268
+ );
269
+ return o;
270
+ }
271
+ function B(n, t) {
272
+ return y(
273
+ V(t),
274
+ n
275
+ );
276
+ }
277
+ function S(n, t, o) {
278
+ if (n.coordinateSystemId === t)
279
+ return n;
280
+ const r = V(o), e = y(
281
+ r,
282
+ n.coordinateSystemId || "world"
283
+ ), s = y(
284
+ r,
285
+ t
286
+ );
287
+ if (e.coordinate_system === s.coordinate_system)
288
+ return {
289
+ ...n,
290
+ coordinateSystemId: s.coordinate_system
291
+ };
292
+ const i = l(
293
+ N(f(s)),
294
+ l(f(e), k(n.pose))
295
+ );
296
+ return {
297
+ ...n,
298
+ pose: T(i),
299
+ coordinateSystemId: s.coordinate_system
300
+ };
301
+ }
302
+ function L(n, t, o) {
303
+ return T(
304
+ l(
305
+ l(k(n), N(f(t))),
306
+ f(o)
307
+ )
308
+ );
309
+ }
310
+ function g(n, t) {
311
+ const o = n == null ? void 0 : n[t];
312
+ if (!o)
313
+ throw new Error(
314
+ `Unknown TCP ${t}. Known TCPs are: ${Object.keys(n ?? {}).join(", ")}`
315
+ );
316
+ return {
317
+ position: o.pose.position ?? [0, 0, 0],
318
+ orientation: o.pose.orientation ?? [0, 0, 0],
319
+ orientation_type: "ROTATION_VECTOR"
320
+ };
321
+ }
322
+ function q({
323
+ inputPose: n,
324
+ selectedTcpId: t,
325
+ selectedCoordinateSystemId: o,
326
+ tcpOffsetsById: r,
327
+ coordinateSystems: e
328
+ }) {
329
+ const s = t && t !== n.tcpId ? {
330
+ ...n,
331
+ pose: L(
332
+ n.pose,
333
+ g(r, n.tcpId),
334
+ g(r, t)
335
+ ),
336
+ tcpId: t
337
+ } : n;
338
+ return o ? S(
339
+ s,
340
+ o,
341
+ e
342
+ ) : s;
343
+ }
344
+ export {
345
+ A as a,
346
+ R as b,
347
+ K as c,
348
+ q as d,
349
+ Z as e,
350
+ h as f,
351
+ G as g,
352
+ J as h,
353
+ L as i,
354
+ Y as j,
355
+ H as k,
356
+ v as m,
357
+ E as n,
358
+ f as p,
359
+ $ as q,
360
+ B as r,
361
+ m as s,
362
+ S as t,
363
+ b as v
364
+ };
@@ -0,0 +1 @@
1
+ "use strict";const c=require("react/jsx-runtime"),f=require("three"),I=require("three-stdlib"),A=require("@react-three/drei"),O=require("react"),b=require("./RobotScene-hUDf_S6f.cjs");function E(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const u=E(f);function k(e){switch(e.shape_type){case"convex_hull":return new I.ConvexGeometry(e.vertices.map(n=>new u.Vector3(n[0]/1e3,n[1]/1e3,n[2]/1e3)));case"box":return new u.BoxGeometry(e.size_x/1e3,e.size_y/1e3,e.size_z/1e3);case"sphere":return new u.SphereGeometry(e.radius/1e3);case"capsule":return new u.CapsuleGeometry(e.radius/1e3,e.cylinder_height/1e3);case"cylinder":return new u.CylinderGeometry(e.radius/1e3,e.radius/1e3,e.height/1e3);case"rectangle":return new u.BoxGeometry(e.size_x/1e3,e.size_y/1e3,0);default:return console.warn(`${e.shape_type} is not supported`),new u.BufferGeometry}}function F({name:e,collider:o,children:n}){var a,s;const r=((a=o.pose)==null?void 0:a.position)??[0,0,0],i=((s=o.pose)==null?void 0:s.orientation)??[0,0,0];return o.margin&&console.warn(`${e} margin is not supported`),c.jsx("mesh",{name:e,position:new u.Vector3(r[0],r[1],r[2]).divideScalar(1e3),rotation:new u.Euler(i[0],i[1],i[2],"XYZ"),geometry:k(o.shape),children:n})}function N({name:e,colliders:o,meshChildrenProvider:n,...r}){return c.jsx("group",{name:e,...r,children:Object.entries(o).map(([i,a])=>c.jsx(F,{name:i,collider:a,children:n(i,a)},i))})}function V({scene:e,meshChildrenProvider:o}){const n=e.colliders;return c.jsx("group",{children:n&&c.jsx(N,{meshChildrenProvider:o,colliders:n})})}function v(e){const o=(e==null?void 0:e.position)??[],n=(e==null?void 0:e.orientation)??[],r=new f.Vector3(n[0]??0,n[1]??0,n[2]??0),i=r.length(),a=i>0?new f.Quaternion().setFromAxisAngle(r.normalize(),i):new f.Quaternion;return new f.Matrix4().compose(new f.Vector3(o[0]??0,o[1]??0,o[2]??0).divideScalar(1e3),a,new f.Vector3(1,1,1))}function q(e,o=null,n=[]){const r=v(o);return e.map((i,a)=>{const s=r.clone(),t=(i.reverse_rotation_direction?-1:1)*(n[a]??0),l=i.type==="PRISMATIC_JOINT",m=(i.theta??0)+(l?0:t),d=(i.d??0)+(l?t:0);return r.multiply(new f.Matrix4().makeRotationZ(m)).multiply(new f.Matrix4().makeTranslation((i.a??0)/1e3,0,d/1e3)).multiply(new f.Matrix4().makeRotationX(i.alpha??0)),s})}const T="#ff4b4b",L="#2fa8ff",Q="#8a8d9e",z=96,H=.15,U=new u.Vector3(0,1,0),B=.2,D=2;function J(e){const{lower_limit:o,upper_limit:n}=e??{};return typeof o!="number"||typeof n!="number"||!Number.isFinite(o)||!Number.isFinite(n)||!(o<n)?null:{lower_limit:o,upper_limit:n}}function j({base:e,direction:o,size:n,color:r,opacity:i}){const a=new u.Quaternion().setFromUnitVectors(U,o.clone().normalize()),s=e.clone().addScaledVector(o.clone().normalize(),n/2);return c.jsxs("mesh",{position:s,quaternion:a,renderOrder:10,children:[c.jsx("coneGeometry",{args:[n*.35,n,16]}),c.jsx("meshBasicMaterial",{color:r,depthTest:!1,transparent:!0,opacity:i})]})}function P({points:e,color:o,width:n,opacity:r}){return c.jsx(A.Line,{points:e,color:o,lineWidth:n,depthTest:!1,transparent:!0,opacity:r,renderOrder:10})}function G(e,o){const n=[...e];let r=o;for(;n.length>1;){const i=n[n.length-1],a=n[n.length-2],s=i.distanceTo(a);if(s>r)return n[n.length-1]=i.clone().lerp(a,r/s),n;r-=s,n.pop()}return n}function W(e,o,n,r){const i=n*e,a=n*o,s=Math.abs(a-i),t=Math.max(2,Math.ceil(s/(2*Math.PI)*z));return Array.from({length:t+1},(l,m)=>{const d=i+(a-i)*m/t,p=s*m/t/(2*Math.PI),h=r*(1+H*p);return new u.Vector3(Math.cos(d)*h,Math.sin(d)*h,0)})}function X(e,o,n,r){const i=e.theta??0,a=e.d??0,s=e.type==="PRISMATIC_JOINT",t=e.reverse_rotation_direction?-1:1,{lower_limit:l,upper_limit:m}=o;return O.useMemo(()=>{const d=new u.Matrix4().makeRotationZ(i).multiply(new u.Matrix4().makeTranslation(0,0,s?a/1e3:0)),p=(M,_,S)=>new u.Vector3(M,_,S).applyMatrix4(d),h=new u.Vector3().applyMatrix4(d),g=p(0,0,n),x=(s?[p(n*.25,0,t*l/1e3),p(n*.25,0,t*m/1e3)]:W(l,m,t,n*.6)).map(M=>s?M:M.applyMatrix4(d)),y=p(s?n*.25:n*.6,0,0),C=x.slice(1).reduce((M,_,S)=>M+_.distanceTo(x[S]),0),R=Math.min(r,C/3),w=G(G(x,R).reverse(),R).reverse();return{axisPoints:[h,g],axisTip:g,origin:h,restPoints:[h,y],range:x,limitPoints:w,rangeStart:w[0],rangeEnd:w[w.length-1]}},[i,a,s,t,n,l,m,r])}function Y({frame:e,dh:o,limit:n,size:r,emphasis:i}){const a=i==="highlighted"?D:1,s=i==="dimmed"?B:1,t=r*.2*(i==="highlighted"?1.4:1),l=2*a,{axisPoints:m,axisTip:d,origin:p,restPoints:h,range:g,limitPoints:x,rangeStart:y,rangeEnd:C}=X(o,n,r,t),{position:R,quaternion:w}=O.useMemo(()=>{const M=new u.Vector3,_=new u.Quaternion;return e.decompose(M,_,new u.Vector3),{position:M,quaternion:_}},[e]);return c.jsxs("group",{position:R,quaternion:w,children:[c.jsx(P,{points:m,color:L,width:l,opacity:s}),c.jsx(j,{base:d,direction:d.clone().sub(p),size:t,color:L,opacity:s}),c.jsx(P,{points:h,color:Q,width:1.5*a,opacity:s}),c.jsx(P,{points:x,color:T,width:l,opacity:s}),c.jsx(j,{base:y,direction:g[0].clone().sub(y),size:y.distanceTo(g[0]),color:T,opacity:s}),c.jsx(j,{base:C,direction:g[g.length-1].clone().sub(C),size:C.distanceTo(g[g.length-1]),color:T,opacity:s})]})}function Z({dhParameters:e,chainOffset:o=null,limits:n,jointPositions:r,size:i=.15,highlightedJoint:a=null}){const s=O.useMemo(()=>q(e,o,r),[e,o,r]);return c.jsx("group",{children:s.map((t,l)=>{const m=J(n[l]);return m?c.jsx(Y,{frame:t,dh:e[l],limit:m,size:i,emphasis:a===null?"normal":a===l?"highlighted":"dimmed"},l):null})})}function $({trajectory:e,...o}){const n=(e==null?void 0:e.map(r=>{if(r.position&&r.position.length>=3){const[i,a,s]=r.position;if(Number.isFinite(i)&&Number.isFinite(a)&&Number.isFinite(s))return new u.Vector3(i/1e3,s/1e3,-a/1e3)}return null}).filter(r=>r!==null))||[];return c.jsx("group",{...o,children:n.length>0&&c.jsx(A.Line,{points:n,lineWidth:3,polygonOffset:!0,polygonOffsetFactor:10,polygonOffsetUnits:10})})}function K({motionGroup:e,connectedMotionGroup:o,getModel:n,flangeRef:r,transparentColor:i,postModelRender:a,...s}){const t=e??o,l=t==null?void 0:t.nova,m=O.useCallback((g,x,y)=>b.defaultGetModel(g,l,y),[l]),d=n??m;if(!(t!=null&&t.dhParameters))return null;const p=t.modelFromController||"";return p?c.jsx(b.SupportedLinearAxis,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:p,dhParameters:t.dhParameters,serialNumber:t.serialNumber,kinematicChainOffset:t.kinematicChainOffset,getModel:d,flangeRef:r,transparentColor:i,postModelRender:a,chainOffsetPosition:t.mountingPosition,chainOffsetQuaternion:t.mountingQuaternion,...s}):c.jsx(b.DHLinearAxis,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,dhParameters:t.dhParameters,chainOffsetPosition:t.mountingPosition,chainOffsetQuaternion:t.mountingQuaternion,...s})}function ee({motionGroup:e,connectedMotionGroup:o,getModel:n,flangeRef:r,transparentColor:i,postModelRender:a,...s}){const t=e??o,l=t==null?void 0:t.nova,m=O.useCallback((d,p,h)=>b.defaultGetModel(d,l,h),[l]);return t!=null&&t.dhParameters?c.jsx(b.SupportedRobot,{rapidlyChangingMotionState:t.rapidlyChangingMotionState,modelFromController:t.modelFromController||"",dhParameters:t.dhParameters,serialNumber:t.serialNumber,kinematicChainOffset:t.kinematicChainOffset,getModel:n??m,flangeRef:r,transparentColor:i,postModelRender:a,chainOffsetPosition:t.mountingPosition,chainOffsetQuaternion:t.mountingQuaternion,...s}):null}exports.CollisionSceneRenderer=V;exports.JointLimitGizmo=Z;exports.LinearAxis=K;exports.Robot=ee;exports.TrajectoryRenderer=$;