@wandelbots/wandelbots-js-react-components 6.4.0-pr.revamp.667.bd2ec84 → 6.4.0-pr.revamp.667.ca77f09

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 (154) hide show
  1. package/README.md +172 -40
  2. package/dist/3d.cjs +1 -1
  3. package/dist/3d.d.ts +3 -4
  4. package/dist/3d.js +35 -38
  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.js +2 -2
  13. package/dist/JoggingJointSlider/index.cjs +1 -1
  14. package/dist/JoggingJointSlider/index.js +1 -1
  15. package/dist/RobotControl/index.cjs +1 -1
  16. package/dist/RobotControl/index.js +2 -2
  17. package/dist/RobotControlPanel/index.cjs +1 -1
  18. package/dist/RobotControlPanel/index.d.ts +1 -1
  19. package/dist/RobotControlPanel/index.js +1 -1
  20. package/dist/RobotHeader/index.cjs +1 -1
  21. package/dist/RobotHeader/index.d.ts +3 -5
  22. package/dist/RobotHeader/index.js +6 -7
  23. package/dist/RobotScene/index.cjs +1 -1
  24. package/dist/RobotScene/index.js +3 -3
  25. package/dist/RobotView/index.cjs +1 -1
  26. package/dist/RobotView/index.js +2 -2
  27. package/dist/SafetyBar/IndicatorWithExplanation.d.ts +12 -1
  28. package/dist/SafetyBar/SafetyBar.d.ts +15 -1
  29. package/dist/SafetyBar/index.cjs +1 -1
  30. package/dist/SafetyBar/index.d.ts +0 -1
  31. package/dist/SafetyBar/index.js +3 -4
  32. package/dist/SafetyBar/robotSafetyOf.d.ts +1 -0
  33. package/dist/chunks/{ConnectedMotionGroup-BifrgwV1.js → ConnectedMotionGroup-DNYakgxy.js} +6 -5
  34. package/dist/chunks/ConnectedMotionGroup-IRTsTxwB.cjs +3 -0
  35. package/dist/chunks/{CurrentPose-CMqO8oqX.cjs → CurrentPose-CAq9e9JY.cjs} +1 -1
  36. package/dist/chunks/{CurrentPose-CdD2ZB7B.js → CurrentPose-CgdINEh2.js} +3 -3
  37. package/dist/chunks/{CurrentPoseBar-CX1xFBtm.js → CurrentPoseBar--HkZBGnN.js} +11 -11
  38. package/dist/chunks/{CurrentPoseBar-BTBAwIO4.cjs → CurrentPoseBar-DoOUfRRs.cjs} +1 -1
  39. package/dist/chunks/{JoggingButtons-aijK-3g6.js → JoggingButtons-BNOnpcTH.js} +1 -1
  40. package/dist/chunks/{JoggingButtons-BOHl7hVq.cjs → JoggingButtons-Boaym2hQ.cjs} +1 -1
  41. package/dist/chunks/{JoggingGizmo-CoKYUtXq.cjs → JoggingGizmo-CNFjpWDv.cjs} +1 -1
  42. package/dist/chunks/{JoggingGizmo-DHvrJouR.js → JoggingGizmo-RDiEVQes.js} +1 -1
  43. package/dist/chunks/{JoggingGizmoOrientation-CIvIAIeO.js → JoggingGizmoOrientation-Dzzz2gEz.js} +1 -1
  44. package/dist/chunks/{JoggingGizmoOrientation-DVcagPRJ.cjs → JoggingGizmoOrientation-laUrgY0N.cjs} +1 -1
  45. package/dist/chunks/{JoggingJointSlider-DQtt4-pa.js → JoggingJointSlider-BY-Tof8G.js} +1 -1
  46. package/dist/chunks/{JoggingJointSlider-CTFYKzsU.cjs → JoggingJointSlider-Dm3vILd3.cjs} +1 -1
  47. package/dist/chunks/{JoggingRefusedError-BIkUM6-g.js → JoggingRefusedError-C4D8_YR_.js} +5 -3
  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/{Robot-C-IWfxP9.js → Robot-B-VAYuAr.js} +5 -5
  52. package/dist/chunks/{Robot-Cfhjv9Z8.cjs → Robot-DRf8T9Zf.cjs} +1 -1
  53. package/dist/chunks/RobotActivation-CRVxXvlx.cjs +1 -0
  54. package/dist/chunks/RobotActivation-oR-8Y0iq.js +143 -0
  55. package/dist/chunks/RobotControl-Dbe50ZKM.cjs +1 -0
  56. package/dist/chunks/RobotControl-Ms1F7fFe.js +332 -0
  57. package/dist/chunks/RobotControlPanel-B7NxoHsO.cjs +1 -0
  58. package/dist/chunks/RobotControlPanel-CkQlkq8x.js +1029 -0
  59. package/dist/chunks/RobotHeader-CjOaf9s6.cjs +1 -0
  60. package/dist/chunks/RobotHeader-LSuRTDFB.js +395 -0
  61. package/dist/chunks/RobotScene-Au6zpHH1.cjs +1 -0
  62. package/dist/chunks/RobotScene-C6XEgaVR.js +1284 -0
  63. package/dist/chunks/RobotSessionProvider-CoF_tX0O.cjs +1 -0
  64. package/dist/chunks/RobotSessionProvider-DuHi-dtw.js +30 -0
  65. package/dist/chunks/{RobotView-BGYlAWj-.cjs → RobotView-Cg6JfGiY.cjs} +1 -1
  66. package/dist/chunks/{RobotView-D-v8jCM7.js → RobotView-CrAxNkyG.js} +3 -3
  67. package/dist/chunks/{robotSafetyOf-DuKKma1_.js → SafetyBar-C85BAKsL.js} +244 -215
  68. package/dist/chunks/SafetyBar-D2l81Omq.cjs +1 -0
  69. package/dist/chunks/externalizeComponent-CA_sHzyH.cjs +2 -0
  70. package/dist/chunks/{externalizeComponent-4juwPKL5.js → externalizeComponent-CChY_1bN.js} +34 -8
  71. package/dist/chunks/{useSmoothedMotionState-BSSV8aZN.js → hooks-BWoeBWLV.js} +43 -87
  72. package/dist/chunks/hooks-BXe2bNMo.cjs +1 -0
  73. package/dist/chunks/loadRobotSession-BzY9H3F8.cjs +1 -0
  74. package/dist/chunks/{loadRobotSession-GHHtv5dv.js → loadRobotSession-Ts2MumBB.js} +1065 -679
  75. package/dist/chunks/poseText-BxG4Caa-.js +48 -0
  76. package/dist/chunks/poseText-CwplkbDM.cjs +1 -0
  77. package/dist/chunks/useSmoothedMotionState-CCXmMZ0S.cjs +1 -0
  78. package/dist/chunks/useSmoothedMotionState-CELh-YJa.js +50 -0
  79. package/dist/components/VelocitySlider.d.ts +14 -1
  80. package/dist/components/connectionWarning/ConnectionWarning.d.ts +18 -4
  81. package/dist/components/connectionWarning/connectionWarningOf.d.ts +1 -11
  82. package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +7 -1
  83. package/dist/components/jogging/JoggingCartesianTab.d.ts +6 -0
  84. package/dist/components/jogging/JoggingJointTab.d.ts +5 -0
  85. package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
  86. package/dist/components/jogging/JoggingPanel.d.ts +11 -0
  87. package/dist/components/jogging/JoggingRefusedError.d.ts +8 -3
  88. package/dist/components/jogging/JoggingStore.d.ts +206 -17
  89. package/dist/components/jogging/joggingColors.d.ts +6 -0
  90. package/dist/components/robotControl/CartesianJogTab.d.ts +14 -3
  91. package/dist/components/robotControl/JogArea.d.ts +6 -3
  92. package/dist/components/robotControl/JogDisabledReason.d.ts +15 -0
  93. package/dist/components/robotControl/JointJogTab.d.ts +10 -2
  94. package/dist/components/robotControl/MoveToTab.d.ts +24 -3
  95. package/dist/components/robotControl/PoseField.d.ts +3 -1
  96. package/dist/components/robotControl/RobotControl.d.ts +3 -0
  97. package/dist/components/robotControl/RobotControlPanel.d.ts +91 -22
  98. package/dist/components/robotControl/VelocityRow.d.ts +8 -2
  99. package/dist/components/robotControl/atPose.d.ts +6 -0
  100. package/dist/components/robotControl/poseText.d.ts +13 -1
  101. package/dist/components/robotControl/units.d.ts +10 -2
  102. package/dist/components/robotControl/useRobotControlProps.d.ts +7 -4
  103. package/dist/components/robotControl/velocityText.d.ts +18 -0
  104. package/dist/components/robotHeader/ActivationSwitch.d.ts +13 -2
  105. package/dist/components/robotHeader/RobotHeader.d.ts +25 -4
  106. package/dist/components/robotHeader/robotActivationOf.d.ts +1 -8
  107. package/dist/components/robotScene/RobotScene.d.ts +7 -1
  108. package/dist/components/robots/MotionGroupVisualizer.d.ts +6 -4
  109. package/dist/components/robots/SupportedLinearAxis.d.ts +6 -4
  110. package/dist/components/robots/SupportedRobot.d.ts +7 -5
  111. package/dist/components/robots/useFrameSmoothedMotionState.d.ts +25 -0
  112. package/dist/components/utils/useSmoothedMotionState.d.ts +11 -2
  113. package/dist/core.cjs +1 -1
  114. package/dist/core.d.ts +8 -10
  115. package/dist/core.js +60 -69
  116. package/dist/index.cjs +1 -1
  117. package/dist/index.js +100 -113
  118. package/dist/lib/ConnectedMotionGroup.d.ts +11 -0
  119. package/dist/lib/ControllerStateStream.d.ts +9 -9
  120. package/dist/lib/JoggerConnection.d.ts +48 -13
  121. package/dist/lib/MotionStreamConnection.d.ts +3 -2
  122. package/dist/lib/TrajectoryExecutionStore.d.ts +58 -20
  123. package/dist/lib/controllerStateSource.d.ts +6 -5
  124. package/dist/lib/robotSession/RobotActivation.d.ts +52 -21
  125. package/dist/lib/robotSession/RobotSession.d.ts +27 -8
  126. package/dist/lib/robotSession/RobotTargetPose.d.ts +4 -2
  127. package/dist/lib/robotSession/loadRobotSession.d.ts +1 -1
  128. package/dist/lib/robotSession/robotPose.d.ts +0 -6
  129. package/dist/session.cjs +1 -1
  130. package/dist/session.d.ts +6 -6
  131. package/dist/session.js +30 -38
  132. package/package.json +22 -1
  133. package/dist/chunks/ConnectedMotionGroup-CybwJHkh.cjs +0 -3
  134. package/dist/chunks/JoggingRefusedError-BuCGsVsa.cjs +0 -1
  135. package/dist/chunks/Pose3-Ch4xVeXV.cjs +0 -1
  136. package/dist/chunks/RobotActivation-Bb0oNSBN.cjs +0 -1
  137. package/dist/chunks/RobotActivation-C0rrwpQZ.js +0 -115
  138. package/dist/chunks/RobotControl-Cv6Sr1Ni.js +0 -289
  139. package/dist/chunks/RobotControl-DFnOYMAa.cjs +0 -1
  140. package/dist/chunks/RobotControlPanel-B1_9g9D-.js +0 -850
  141. package/dist/chunks/RobotControlPanel-BpTpRBgy.cjs +0 -1
  142. package/dist/chunks/RobotScene-0ZJzXL50.cjs +0 -1
  143. package/dist/chunks/RobotScene-DpFeFpnx.js +0 -1255
  144. package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +0 -1
  145. package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +0 -25
  146. package/dist/chunks/externalizeComponent-Br_U-QAr.cjs +0 -2
  147. package/dist/chunks/loadRobotSession-DYbeNnTI.cjs +0 -1
  148. package/dist/chunks/poseText-BXUaQWnK.cjs +0 -1
  149. package/dist/chunks/poseText-pg4cxE8R.js +0 -41
  150. package/dist/chunks/robotActivationOf-B4oV10Za.cjs +0 -1
  151. package/dist/chunks/robotActivationOf-EzcT9g07.js +0 -368
  152. package/dist/chunks/robotSafetyOf-Dxm6s7Pp.cjs +0 -1
  153. package/dist/chunks/useSmoothedMotionState-B9WO73k0.cjs +0 -1
  154. package/dist/components/robotHeader/robotSafetyOf.d.ts +0 -11
@@ -1 +0,0 @@
1
- "use strict";const r=require("react/jsx-runtime"),t=require("react"),n=t.createContext(null);function u({session:o,children:e}){return r.jsx(n.Provider,{value:o,children:e})}function c(){return i(void 0)}function i(o){const e=t.useContext(n),s=o??e;if(!s)throw new Error("No robot session: put the component inside a RobotSessionProvider, or give it a `session`");return s}exports.RobotSessionProvider=u;exports.useRobotSession=c;exports.useRobotSessionOf=i;
@@ -1,25 +0,0 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { useContext as r, createContext as i } from "react";
3
- const n = i(null);
4
- function b({
5
- session: o,
6
- children: t
7
- }) {
8
- return /* @__PURE__ */ s(n.Provider, { value: o, children: t });
9
- }
10
- function d() {
11
- return u(void 0);
12
- }
13
- function u(o) {
14
- const t = r(n), e = o ?? t;
15
- if (!e)
16
- throw new Error(
17
- "No robot session: put the component inside a RobotSessionProvider, or give it a `session`"
18
- );
19
- return e;
20
- }
21
- export {
22
- b as R,
23
- u as a,
24
- d as u
25
- };
@@ -1,2 +0,0 @@
1
- "use strict";const o=require("react/jsx-runtime"),i=require("react"),a=require("react-i18next"),l=require("i18next"),g=require("i18next-browser-languagedetector"),s={"Jogging.Cartesian.Translation.velocityMmPerSec.lb":"{{amount}} mm/s","Jogging.Cartesian.Rotation.velocityDegPerSec.lb":"{{amount}}°/s","Jogging.Velocity.lb":"Geschwindigkeit","General.degree.variable":"{{amount}}°","General.mm.variable":"{{amount}} mm","Jogging.Blocked.ti":"Verbindung blockiert","Jogging.Blocked.lb":"Ein anderer Client kontrolliert das Jogging.","Jogging.Blocked.Reenable.bt":"Neu verbinden","Jogging.Cartesian.MotionType.lb":"Bewegungstyp","Jogging.Cartesian.Translation.bt":"Translation","Jogging.Cartesian.Rotation.bt":"Rotation","Jogging.Joints.JointValues.lb":"Gelenkwerte","Jogging.Increment.Continuous.dd":"Fortlaufend","Jogging.Cartesian.Orientation.lb":"Orientierung","Jogging.JointLimitsReached.lb":"Gelenkgrenzen für Gelenk {{jointNumbers}} erreicht","Jogging.Orientation.coordsys":"Roboterbasis","Jogging.Orientation.tool":"Werkzeug","Jogging.StreamStateSection.lb":"Status Stream:","Jogging.StreamStateSection.RUNNING.lb":"In Bewegung","Jogging.StreamStateSection.PAUSED_BY_USER.lb":"Pausiert (Nutzer)","Jogging.StreamStateSection.PAUSED_NEAR_COLLISION.lb":"Pausiert (Kollisionsnähe)","Jogging.StreamStateSection.PAUSED_NEAR_JOINT_LIMIT.lb":"Pausiert (nahe Gelenkgrenze)","Jogging.StreamStateSection.PAUSED_NEAR_SINGULARITY.lb":"Pausiert (nahe Singularität)","Jogging.StreamStateSection.PAUSED_ON_IO.lb":"Pausiert (I/O-Ereignis)","Jogging.StreamStateSection.END_OF_TRAJECTORY.lb":"Trajektorie beendet","Jogging.StreamStateSection.WAIT_FOR_IO.lb":"Warte auf I/O","Jogging.StreamStateSection.KIND_UNKNOWN.lb":"Bereit","Jogging.StreamStateSection.Error.Collision.lb":"Bewegung kann nicht geplant werden: sie würde zu einer Kollision führen","Jogging.StreamStateSection.Error.JointLimit.lb":"Bewegung kann nicht geplant werden: eine Gelenkgrenze würde überschritten","Jogging.StreamStateSection.Error.NoSolutionInConfiguration.lb":"Bewegung kann in der aktuellen Roboterkonfiguration nicht geplant werden","Jogging.StreamStateSection.Error.OutOfWorkspace.lb":"Bewegung kann nicht geplant werden: das Ziel liegt außerhalb des Arbeitsraums","Jogging.StreamStateSection.Error.PlanningFailed.lb":"Die angeforderte Bewegung konnte nicht geplant werden","Jogging.StreamStateSection.Error.Singularity.lb":"Bewegung kann nicht geplant werden: der Pfad führt durch eine Singularität. Versuche eine andere Achse oder bewege die Gelenke direkt","Jogging.TargetPose.Error.Collision.lb":"Die Bewegung zur aktuellen Pose würde eine Kollision verursachen. Bitte ändere die Posen-Koordinaten.","Jogging.TargetPose.Error.MoveFailed.lb":"Die Bewegung zu dieser Pose ist fehlgeschlagen: {{message}}","Jogging.TargetPose.Error.NotReachable.lb":"Die aktuelle Pose ist nicht erreichbar. Bitte ändere die Posen-Koordinaten.","Jogging.TargetPose.Error.PlanningFailed.lb":"Die Bewegung zu dieser Pose konnte nicht geplant werden. Bitte ändere die Posen-Koordinaten.","Jogging.TargetPose.Error.Singularity.lb":"Die aktuelle Pose würde eine Singularität erzeugen. Bitte ändere die Posen-Koordinaten.","SafetyBar.ActivationToggle.Activate.bt":"Aktivieren","SafetyBar.ActivationToggle.Activated.bt":"Aktiviert","SafetyBar.ActivationToggle.Activating.bt":"Wird aktiviert…","SafetyBar.ActivationToggle.Deactivating.bt":"Wird deaktiviert…","SafetyBar.ControllerType.Physical.lb":"Physisch","SafetyBar.ControllerType.Virtual.lb":"Virtuell","SafetyBar.MotionGroup.Physical.Explanation.lb":"<code>{{motionGroupId}}</code> ist ein physische Robotersteuerung. Für die Bewegung dieses Roboters sind <strong>Sicherheitsmaßnahmen</strong> aktiv.","SafetyBar.MotionGroup.Virtual.Explanation.lb":"<1>{{motionGroupId}}</1> ist eine virtuelle Robotersteuerung ohne physisches Gegenstück. Der Roboter kann ohne Sicherheitsmaßnahmen bewegt werden.","SafetyBar.OperationMode.Auto.Explanation.lb":"Automatischer Betriebsmodus der Robotersteuerung aktiv. Automatisierte Bewegung ohne manuelle Bestätigung freigegeben.","SafetyBar.OperationMode.Automatic.ti":"Automatisch","SafetyBar.OperationMode.Error.Explanation.lb":"Fehler beim Abrufen des Betriebsmodus. Originalhandbediengerät des Roboters verwenden, um Fehler zu lösen.","SafetyBar.OperationMode.Error.lb":"Fehler","SafetyBar.OperationMode.Manual.Explanation.lb":`Die Robotersteuerung befindet sich im manuellen Betriebsmodus.
2
- Bei einem physischen Roboter bedeutet dies im Allgemeinen, dass ein Freigabeschalter gedrückt werden muss, damit sich der Roboter erfolgreich bewegen kann.`,"SafetyBar.OperationMode.Manual.lb":"Manuell","SafetyBar.OperationMode.ti":"Betriebsmodus","SafetyBar.SafetyState.Error.Explanation.lb":"Die Robotersteuerung ist in einen unerwarteten Sicherheitszustand eingetreten.","SafetyBar.SafetyState.Error.lb":"Fehler","SafetyBar.SafetyState.Estop.lb":"NOT-AUS","SafetyBar.SafetyState.ManualActionRequired.Explanation.lb":"Die Robotersteuerung ist in einen Sicherheitszustand eingetreten, der manuelle Maßnahmen zur Behebung erfordert.","SafetyBar.SafetyState.ManualActionRequired.lb":"Aktion erforderlich","SafetyBar.SafetyState.Normal.Explanation.lb":"Die Robotersteuerung befindet sich in einem sicheren Zustand. Roboterbewegungen sind möglich.","SafetyBar.SafetyState.Normal.lb":"Sicher","SafetyBar.SafetyState.Stop.Explanation.lb":"Die Robotersteuerung ist in einen Stoppzustand übergegangen. Bis der Stoppzustand aufgelöst ist, ist keine Bewegung mehr möglich.","SafetyBar.SafetyState.Stop.lb":"Stopp","SafetyBar.SafetyState.ti":"Sicherheitszustand","SafetyBar.StopState.Estop.Explanation.lb":"NOT-AUS aktiviert. NOT-AUS freischalten, um Roboter zu bewegen.","Jogging.Increment.hlb":"Schrittgröße","Jogging.CoordinateSystem.hlb":"Koordinatensystem","Jogging.Cartesian.bt":"Kartesisch","Jogging.Joints.bt":"Gelenke","Jogging.Velocity.bt":"Geschwindigkeit","Jogging.Handle.lb":"{{handle}} verfahren","RobotControl.Title.ti":"Robotersteuerung","RobotControl.Close.bt":"Schließen","RobotControl.Tab.Translate.bt":"Verschieben","RobotControl.Tab.Rotate.bt":"Drehen","RobotControl.Tcp.lb":"TCP","RobotControl.JogFrame.lb":"Bewegen relativ zu","RobotControl.JogMode.lb":"Verfahrmodus","RobotControl.JogMode.Continuous.bt":"Fortlaufend","RobotControl.JogMode.Increment.bt":"Schrittweise","RobotControl.Velocity.lb":"Geschwindigkeit","RobotControl.StepSize.lb":"Schrittgröße","RobotControl.JogArea.ShowGizmo.bt":"Gizmo-Steuerung","RobotControl.JogArea.ShowButtons.bt":"Tasten-Steuerung","RobotControl.JogArea.Hint.HoldHandle.lb":"Griff halten zum Verfahren · Loslassen zum Stoppen","RobotControl.JogArea.Hint.HoldButton.lb":"Taste halten zum Verfahren · Loslassen zum Stoppen","RobotControl.JogArea.Hint.ClickHandle.lb":"Griff klicken für einen Schritt","RobotControl.JogArea.Hint.ClickButton.lb":"Taste klicken für einen Schritt","RobotControl.Tab.Joint.bt":"Gelenk","RobotControl.Tab.MoveTo.bt":"Bewegen zu","RobotControl.MoveTo.TargetPose.lb":"Zielpose","RobotControl.MoveTo.RelativeTo.lb":"Relativ zu","RobotControl.MoveTo.Coordinates.lb":"Koordinaten XYZ (mm) · Rotationsvektor (rad)","RobotControl.MoveTo.Copy.bt":"Kopieren","RobotControl.MoveTo.Copied.lb":"Pose kopiert","RobotControl.MoveTo.Edit.bt":"Pose bearbeiten","RobotControl.MoveTo.Cancel.bt":"Abbrechen","RobotControl.MoveTo.ConfirmEdit.lb":"Bearbeitete Pose übernehmen","RobotControl.MoveTo.InvalidPose.lb":"Bitte gültige Posen-Koordinaten eingeben.","RobotControl.MoveTo.Reset.lb":"Pose auf vorherige Position zurücksetzen","RobotControl.MoveTo.PlanAgain.lb":"Bewegung erneut planen","RobotControl.MoveTo.MoveTo.bt":"Hierhin bewegen","RobotControl.MoveTo.Moving.bt":"Bewegung aktiv…","RobotControl.MoveTo.Stopping.bt":"Anhalten","RobotControl.MoveTo.HoldToMove.lb":"Zum Bewegen gedrückt halten","RobotControl.MoveTo.AtPose.lb":"Der Roboter befindet sich bereits in dieser Pose","CurrentPose.Title.lb":"Aktuelle Position","CurrentPose.RelativeTo.lb":"Relativ zu","CurrentPose.Copy.bt":"Kopieren","CurrentPose.Copied.lb":"Pose kopiert","CurrentPose.OrientationFormat.ti":"Orientierungsformat","CurrentPose.Format.lb":"Format","CurrentPose.Format.RotationVector.lb":"Rotationsvektor","CurrentPose.Format.EulerAngles.lb":"Euler-Winkel","CurrentPose.Format.Quaternion.lb":"Quaternion","CurrentPose.AngleUnit.lb":"Winkeleinheit","CurrentPose.AngleUnit.Radians.lb":"Radiant","CurrentPose.AngleUnit.Degrees.lb":"Grad","CurrentPose.EulerConvention.lb":"Euler-Konvention","CurrentPose.EulerConvention.Intrinsic.hlb":"Intrinsische Rotationen","CurrentPose.EulerConvention.Extrinsic.hlb":"Extrinsische Rotationen","CurrentPose.EulerConvention.Intrinsic.lb":"Intrinsisch {{axes}}","CurrentPose.EulerConvention.Extrinsic.lb":"Extrinsisch {{axes}}","RobotHeader.Apps.bt":"Apps","RobotHeader.Search.bt":"Suchen","RobotHeader.MotionGroup.lb":"Bewegungsgruppe","Jogging.MoveRelativeTo.SelectedTcp.dd":"Ausgewählter TCP","ConnectionWarning.Interrupted.ti":"Verbindung unterbrochen","ConnectionWarning.LastUpdate.lb":"Kommunikation mit der Robotersteuerung nicht möglich. Die letzte Bewegungsmeldung kam {{time}}.","ConnectionWarning.ErrorState.lb":"Fehlermeldung {{time}}:","RobotView.WebGLUnavailable.ti":"3D-Ansicht nicht verfügbar","RobotView.WebGLUnavailable.pg":"Aktiviere WebGL in deinem Browser, damit das 3D-Modell angezeigt werden kann. Wird WebGL von den Grafiktreibern oder vom Browser nicht unterstützt, aktualisiere die Grafiktreiber und wechsle den Browser.","RobotView.WebGLUnavailable.Reload.bt":"Neu laden","JoggingGizmo.WebGLUnavailable.lb":"Die Gizmo-Steuerung braucht WebGL, das dieser Browser nicht bietet.","RobotControl.MoveTo.NotMoveable.Deactivated.lb":"Der Roboter ist deaktiviert.","RobotControl.MoveTo.NotMoveable.Disconnected.lb":"Keine Verbindung zum Roboter","RobotControl.MoveTo.NotMoveable.OperationMode.lb":"Der Roboter befindet sich in einem nicht beweglichen Betriebsmodus: {{value}}","RobotControl.MoveTo.NotMoveable.SafetyState.lb":"Der Roboter befindet sich in einem nicht beweglichen Sicherheitszustand: {{value}}"},b={"Jogging.Cartesian.Translation.velocityMmPerSec.lb":"{{amount}} mm/s","Jogging.Cartesian.Rotation.velocityDegPerSec.lb":"{{amount}}°/s","Jogging.Velocity.lb":"Velocity","General.degree.variable":"{{amount}}°","General.mm.variable":"{{amount}} mm","Jogging.Blocked.ti":"Connection blocked","Jogging.Blocked.lb":"Another client is currently controlling the jogging.","Jogging.Blocked.Reenable.bt":"Reconnect","Jogging.Cartesian.MotionType.lb":"Motion type","Jogging.Cartesian.Translation.bt":"Translation","Jogging.Cartesian.Rotation.bt":"Rotation","Jogging.Joints.JointValues.lb":"Joint values","Jogging.Increment.Continuous.dd":"Continuous","Jogging.Cartesian.Orientation.lb":"Orientation","Jogging.Activating.lb":"Activating jogging","Jogging.JointLimitsReached.lb":"Joint limit reached for joint {{jointNumbers}}","Jogging.Orientation.coordsys":"Robot base","Jogging.Orientation.tool":"Tool","Jogging.StreamStateSection.lb":"State stream:","Jogging.StreamStateSection.RUNNING.lb":"Running","Jogging.StreamStateSection.PAUSED_BY_USER.lb":"Paused (by user)","Jogging.StreamStateSection.PAUSED_NEAR_COLLISION.lb":"Paused (collision proximity)","Jogging.StreamStateSection.PAUSED_NEAR_JOINT_LIMIT.lb":"Paused (near joint limit)","Jogging.StreamStateSection.PAUSED_NEAR_SINGULARITY.lb":"Paused (near singularity)","Jogging.StreamStateSection.PAUSED_ON_IO.lb":"Paused (I/O event)","Jogging.StreamStateSection.END_OF_TRAJECTORY.lb":"End of trajectory","Jogging.StreamStateSection.WAIT_FOR_IO.lb":"Waiting for I/O","Jogging.StreamStateSection.KIND_UNKNOWN.lb":"Ready","Jogging.StreamStateSection.Error.Collision.lb":"Cannot plan this motion: it would cause a collision","Jogging.StreamStateSection.Error.JointLimit.lb":"Cannot plan this motion: a joint limit would be exceeded","Jogging.StreamStateSection.Error.NoSolutionInConfiguration.lb":"Cannot plan this motion in the current robot configuration","Jogging.StreamStateSection.Error.OutOfWorkspace.lb":"Cannot plan this motion: the target is outside the robot's workspace","Jogging.StreamStateSection.Error.PlanningFailed.lb":"The requested motion could not be planned","Jogging.StreamStateSection.Error.Singularity.lb":"Cannot plan this motion: the path passes through a singularity. Try a different axis or jog the joints directly","Jogging.TargetPose.Error.Collision.lb":"Moving to the current pose would cause a collision. Please change the pose coordinates.","Jogging.TargetPose.Error.MoveFailed.lb":"The move to this pose failed: {{message}}","Jogging.TargetPose.Error.NotReachable.lb":"The current pose is not reachable. Please change the pose coordinates.","Jogging.TargetPose.Error.PlanningFailed.lb":"Planning a motion to this pose failed. Please change the pose coordinates.","Jogging.TargetPose.Error.Singularity.lb":"The current pose would create a singularity. Please change the pose coordinates.","SafetyBar.ActivationToggle.Activate.bt":"Activate","SafetyBar.ActivationToggle.Activated.bt":"Activated","SafetyBar.ActivationToggle.Activating.bt":"Activating","SafetyBar.ActivationToggle.Deactivating.bt":"Deactivating","SafetyBar.ControllerType.Physical.lb":"Physical","SafetyBar.ControllerType.Virtual.lb":"Virtual","SafetyBar.MotionGroup.Physical.Explanation.lb":"<code>{{motionGroupId}}</code> is a physical robot controller. <strong>Safety precautions</strong> are active for the movement of this robot.","SafetyBar.MotionGroup.Virtual.Explanation.lb":"<1>{{motionGroupId}}</1> is a virtual robot controller with no physical counterpart. It can be freely manipulated without safety precautions.","SafetyBar.OperationMode.Auto.Explanation.lb":"Automatic operation mode active. Automated movement without manual confirmation enabled.","SafetyBar.OperationMode.Automatic.ti":"Automatic","SafetyBar.OperationMode.Error.Explanation.lb":"Failed to get operation mode. Use the original control panel to resolve the error.","SafetyBar.OperationMode.Error.lb":"Error","SafetyBar.OperationMode.Manual.Explanation.lb":"The robot controller is in manual operation mode. On a physical robot, this generally indicates that an enabling switch must be held for the robot to move successfully.","SafetyBar.OperationMode.Manual.lb":"Manual","SafetyBar.OperationMode.ti":"Operation mode","SafetyBar.SafetyState.Error.Explanation.lb":"The robot controller has entered an unexpected safety state.","SafetyBar.SafetyState.Error.lb":"Error","SafetyBar.SafetyState.Estop.lb":"E-Stop","SafetyBar.SafetyState.ManualActionRequired.Explanation.lb":"The robot controller has entered a safety state requiring manual action to resolve.","SafetyBar.SafetyState.ManualActionRequired.lb":"Action required","SafetyBar.SafetyState.Normal.Explanation.lb":"The robot controller is in a safe state. Robot movement is enabled.","SafetyBar.SafetyState.Normal.lb":"Safe","SafetyBar.SafetyState.Stop.Explanation.lb":"The robot controller has entered a stop state. Movement is no longer possible until the stop state is resolved.","SafetyBar.SafetyState.Stop.lb":"Stop","SafetyBar.SafetyState.ti":"Safety state","SafetyBar.StopState.Estop.Explanation.lb":"An emergency stop of the robot controller has been triggered. Movement of the robot is no longer possible until the estop is released.","Jogging.Increment.hlb":"Increment","Jogging.CoordinateSystem.hlb":"Coordinate system","Jogging.Cartesian.bt":"Cartesian","Jogging.Joints.bt":"Joints","Jogging.Velocity.bt":"Velocity","Jogging.Handle.lb":"Jog {{handle}}","RobotControl.Title.ti":"Robot control","RobotControl.Close.bt":"Close","RobotControl.Tab.Translate.bt":"Translate","RobotControl.Tab.Rotate.bt":"Rotate","RobotControl.Tcp.lb":"TCP","RobotControl.JogFrame.lb":"Move relative to","RobotControl.JogMode.lb":"Jog mode","RobotControl.JogMode.Continuous.bt":"Continuous","RobotControl.JogMode.Increment.bt":"Increment","RobotControl.Velocity.lb":"Velocity","RobotControl.StepSize.lb":"Step size","RobotControl.JogArea.ShowGizmo.bt":"Gizmo controls","RobotControl.JogArea.ShowButtons.bt":"Button controls","RobotControl.JogArea.Hint.HoldHandle.lb":"Hold a handle to jog · Release to stop","RobotControl.JogArea.Hint.HoldButton.lb":"Hold a button to jog · Release to stop","RobotControl.JogArea.Hint.ClickHandle.lb":"Click a handle to jog one step","RobotControl.JogArea.Hint.ClickButton.lb":"Click a button to jog one step","RobotControl.Tab.Joint.bt":"Joint","RobotControl.Tab.MoveTo.bt":"Move to","RobotControl.MoveTo.TargetPose.lb":"Target pose","RobotControl.MoveTo.RelativeTo.lb":"Relative to","RobotControl.MoveTo.Coordinates.lb":"Coordinates XYZ (mm) · Rotation vector (rad)","RobotControl.MoveTo.Copy.bt":"Copy","RobotControl.MoveTo.Copied.lb":"Pose copied","RobotControl.MoveTo.Edit.bt":"Edit pose","RobotControl.MoveTo.Cancel.bt":"Cancel","RobotControl.MoveTo.ConfirmEdit.lb":"Save pose edit","RobotControl.MoveTo.InvalidPose.lb":"Please enter valid pose coordinates.","RobotControl.MoveTo.Reset.lb":"Reset pose to previous one","RobotControl.MoveTo.PlanAgain.lb":"Plan the move again","RobotControl.MoveTo.MoveTo.bt":"Move to","RobotControl.MoveTo.Moving.bt":"Moving…","RobotControl.MoveTo.Stopping.bt":"Stopping…","RobotControl.MoveTo.HoldToMove.lb":"Click and hold to move","RobotControl.MoveTo.AtPose.lb":"Robot is already at this pose","CurrentPose.Title.lb":"Current position","CurrentPose.RelativeTo.lb":"Relative to","CurrentPose.Copy.bt":"Copy","CurrentPose.Copied.lb":"Pose copied","CurrentPose.OrientationFormat.ti":"Orientation format","CurrentPose.Format.lb":"Format","CurrentPose.Format.RotationVector.lb":"Rotation vector","CurrentPose.Format.EulerAngles.lb":"Euler angles","CurrentPose.Format.Quaternion.lb":"Quaternion","CurrentPose.AngleUnit.lb":"Angle unit","CurrentPose.AngleUnit.Radians.lb":"Radians","CurrentPose.AngleUnit.Degrees.lb":"Degrees","CurrentPose.EulerConvention.lb":"Euler convention","CurrentPose.EulerConvention.Intrinsic.hlb":"Intrinsic rotations","CurrentPose.EulerConvention.Extrinsic.hlb":"Extrinsic rotations","CurrentPose.EulerConvention.Intrinsic.lb":"Intrinsic {{axes}}","CurrentPose.EulerConvention.Extrinsic.lb":"Extrinsic {{axes}}","RobotHeader.Apps.bt":"Apps","RobotHeader.Search.bt":"Search","RobotHeader.MotionGroup.lb":"Motion group","Jogging.MoveRelativeTo.SelectedTcp.dd":"Selected TCP","ConnectionWarning.Interrupted.ti":"Connection interrupted","ConnectionWarning.LastUpdate.lb":"Communication with the robot controller interrupted. The last motion update was received {{time}}.","ConnectionWarning.ErrorState.lb":"Error message from {{time}}:","RobotView.WebGLUnavailable.ti":"3D view not available","RobotView.WebGLUnavailable.pg":"Activate WebGL in your browser to display the 3D model. If neither the browser nor graphics driver support WebGL, update the graphics driver and switch to another browser.","RobotView.WebGLUnavailable.Reload.bt":"Reload","JoggingGizmo.WebGLUnavailable.lb":"Gizmo controls need WebGL, which this browser does not provide.","RobotControl.MoveTo.NotMoveable.Deactivated.lb":"The robot must be activated first","RobotControl.MoveTo.NotMoveable.Disconnected.lb":"No connection to the robot","RobotControl.MoveTo.NotMoveable.OperationMode.lb":"The robot is in a non-moveable operation mode: {{value}}","RobotControl.MoveTo.NotMoveable.SafetyState.lb":"The robot is in a non-moveable safety state: {{value}}"},t=l.createInstance();t.use(g).init({supportedLngs:["en","de"],resources:{en:{translations:b},de:{translations:s}},ns:["translations"],defaultNS:"translations",detection:{order:["navigator","htmlTag"]}});function u(e){const n=i.memo(e);return(r=>o.jsx(c,{children:o.jsx(n,{...r})}))}const c=({children:e})=>o.jsx(a.I18nextProvider,{i18n:t,children:e});exports.externalizeComponent=u;exports.i18n=t;
@@ -1 +0,0 @@
1
- "use strict";const I=require("@wandelbots/nova-js"),m=require("mobx"),it=require("./json-Bd6uGfgP.cjs"),p=require("./PoseTransformer-2QIzECOZ.cjs"),C=require("@wandelbots/nova-js/v2"),v=require("lodash-es"),A=require("./JoggingRefusedError-BuCGsVsa.cjs"),H=require("./RobotActivation-Bb0oNSBN.cjs"),O=require("./poseText-BXUaQWnK.cjs");function wt({currentTcpPose:i,axis:t,direction:e,motion:o,useToolCoordinateSystem:s,coordinateSystemRotation:n}){const a=e==="-"?-1:1;if(o.type==="translate"){if(!i.position)throw new Error("Current pose has no position, cannot perform translation");let d=p.vectorAlongAxis(t,o.distanceMm*a);if(s){if(!i.orientation)throw new Error("Current pose has no orientation, cannot translate relative to tool");d=p.rotateVector(d,p.quaternionOfOrientation(i.orientation,"ROTATION_VECTOR"))}else n&&(d=p.rotateVector(d,n));const g=[...i.position];return g[0]=(g[0]??0)+d[0],g[1]=(g[1]??0)+d[1],g[2]=(g[2]??0)+d[2],{position:g,orientation:i.orientation}}if(!i.orientation)throw new Error("Current pose has no orientation, cannot perform rotation");const l=p.quaternionOfOrientation(i.orientation,"ROTATION_VECTOR");let h=p.vectorAlongAxis(t,1);!s&&n&&(h=p.rotateVector(h,n));const c=p.quaternionOfAxisAngle(h,o.distanceRads*a),r=s?p.multiplyQuaternions(l,c):p.multiplyQuaternions(c,l);return{position:i.position,orientation:p.rotationVectorOfQuaternion(r)}}function J(i,t,e){return t.length!==i.length?!1:nt(i,t,e)}function st(i,t,e){return t.length!==i.length?!0:nt(i,t,e)}function nt(i,t,e){for(let o=0;o<t.length;o++)if(Math.abs((t[o]??0)-(i[o]??0))>e)return!1;return!0}function rt(i,t,e){if(i===void 0&&t||i&&t===void 0||(i==null?void 0:i.orientation)===void 0||(t==null?void 0:t.orientation)===void 0||(i==null?void 0:i.position)===void 0||(t==null?void 0:t.position)===void 0)return!1;if(i===void 0||t===void 0)return!0;let o=0;return o+=Math.abs(i.orientation[0]-t.orientation[0]),o+=Math.abs(i.orientation[1]-t.orientation[1]),o+=Math.abs(i.orientation[2]-t.orientation[2]),o+=Math.abs(i.position[0]-t.position[0]),o+=Math.abs(i.position[1]-t.position[1]),o+=Math.abs(i.position[2]-t.position[2]),o<=e}function at(i,t,e){return i.coordinate_system===t.coordinate_system&&i.tcp===t.tcp&&rt(i.tcp_pose,t.tcp_pose,e)}function q(i,t){const[e=0,o=0,s=0]=t,n=[e,o,s],[a=0,l=0,h=0]=i,c=[a,l,h],r=p.vectorLength(n),d=p.normalizeVector(n);let g=p.vectorLength(c),u=p.normalizeVector(c);p.dotVectors(u,d)<0&&(g=-g,u=p.scaleVector(u,-1));let y=g-r;return y-=2*Math.PI*Math.floor((y+Math.PI)/(2*Math.PI)),g=r+y,p.scaleVector(u,g)}const Ot=2e-4;function W(i){const{joint_position:t,tcp_pose:e,tcp:o,coordinate_system:s}=i;return{joint_position:t,tcp_pose:e,tcp:o,coordinate_system:s}}function K(i,t){return i.tcp===t.tcp&&i.coordinate_system===t.coordinate_system&&i.tcp_pose===void 0==(t.tcp_pose===void 0)&&J(i.joint_position,t.joint_position,Ot)}const z=1e-4;class D{constructor(t,e,o,s,n,a,l="cell",h={}){this.controller=e,this.motionGroup=o,this.description=s,this.initialMotionState=n,this.motionStateSocket=a,this.cellId=l,this.nova=p.createNovaClient(t),this.logger=h.logger??console,this.rapidlyChangingMotionState=n,a.addEventListener("message",c=>{var u;const r=(u=I.tryParseJson(c.data))==null?void 0:u.result;if(!r)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${c.data}`);at(this.rapidlyChangingMotionState,r,z)||m.runInAction(()=>{var y,f,_;this.rapidlyChangingMotionState.tcp_pose==null?this.rapidlyChangingMotionState.tcp_pose=r.tcp_pose:(y=r.tcp_pose)!=null&&y.orientation&&((f=r.tcp_pose)!=null&&f.position)&&((_=this.rapidlyChangingMotionState.tcp_pose)!=null&&_.orientation)?this.rapidlyChangingMotionState.tcp_pose={position:r.tcp_pose.position,orientation:q(r.tcp_pose.orientation,this.rapidlyChangingMotionState.tcp_pose.orientation)}:this.logger.debug("Received incomplete tcp_pose, ignoring",{tcpPose:r.tcp_pose})}),st(this.rapidlyChangingMotionState.joint_position,r.joint_position,z)||m.runInAction(()=>{this.rapidlyChangingMotionState.joint_position=r.joint_position}),r.tcp!==void 0&&this.rapidlyChangingMotionState.tcp!==r.tcp&&m.runInAction(()=>{this.rapidlyChangingMotionState.tcp=r.tcp}),this.rapidlyChangingMotionState.standstill!==r.standstill&&m.runInAction(()=>{this.rapidlyChangingMotionState.standstill=r.standstill});const d=this.rapidlyChangingMotionState.joint_limit_reached.limit_reached,g=r.joint_limit_reached.limit_reached;d.some((y,f)=>y!==g[f])&&m.runInAction(()=>{this.rapidlyChangingMotionState.joint_limit_reached=r.joint_limit_reached}),this.rapidlyChangingMotionState.execute!==r.execute&&m.runInAction(()=>{this.rapidlyChangingMotionState.execute=r.execute})}),m.makeAutoObservable(this,{logger:!1,readoutState:m.computed({equals:K,keepAlive:!0})})}static async open(t,e,o={}){var f;const s=p.createNovaClient(t),n=o.cellId??p.cellIdOf(t)??"cell",[a,l]=e.split("@"),h=await s.api.controller.getCurrentRobotControllerState(n,l),c=h==null?void 0:h.motion_groups.find(_=>_.motion_group===e);if(!h||!c)throw new Error(`Controller ${l} or motion group ${e} not found`);const r=s.openReconnectingWebsocket(`/cells/${n}/controllers/${l}/motion-groups/${e}/state-stream`),d=await r.firstMessage(),g=(f=I.tryParseJson(d.data))==null?void 0:f.result;if(!g)throw new Error(`Unable to parse initial motion state message ${d.data}`);const u=o.logger??console;u.info("Connected motion state websocket to motion group",{motionGroup:c.motion_group,initialMotionState:g});const y=await s.api.motionGroup.getMotionGroupDescription(n,l,c.motion_group);return new D(s,h,c,y,g,r,n,{logger:u})}get readoutState(){return W(this.rapidlyChangingMotionState)}get motionGroupId(){return this.motionGroup.motion_group}get controllerId(){return this.controller.controller}get joints(){return this.initialMotionState.joint_position.map((t,e)=>({index:e}))}dispose(){this.motionStateSocket.close()}}const Z="Movement request rejected. Another client is currently executing a 'Jogging' motion!",bt=500,Ct=5e3;function Rt(i){var e;return(((e=i.times)==null?void 0:e[i.times.length-1])??0)*2e3+Ct}class ${constructor(t,e={}){this.motionStream=t,this.options=e,this.DEFAULT_MODE="off",this.DEFAULT_TCP="Flange",this.NO_TCP=void 0,this.DEFAULT_INIT_TIMEOUT=5e3,this.DEFAULT_ORIENTATION="coordsys",this.mode="off",this.joggingSocket=null,this.trajectorySocket=null,this.timeout=this.DEFAULT_INIT_TIMEOUT,this.incrementalMotionInFlight=!1,this.ownsMotionStream=!1,this.tcp=(e==null?void 0:e.tcp)||t.motionGroup.tcp||this.getDefaultTcp(t),this.coordinateSystem=e==null?void 0:e.coordinateSystem,this.orientation=(e==null?void 0:e.orientation)||this.DEFAULT_ORIENTATION,this.timeout=(e==null?void 0:e.timeout)||this.DEFAULT_INIT_TIMEOUT,this.mode=(e==null?void 0:e.mode)||this.DEFAULT_MODE,this.onError=e==null?void 0:e.onError,this.logger=(e==null?void 0:e.logger)??console}static async open(t,e,o={}){const s=await D.open(t,e,{cellId:o.cellId,logger:o.logger}),n=new $(s,o);n.ownsMotionStream=!0;try{await n.setJoggingMode(n.mode)}catch(a){throw n.dispose(),a}return n}getDefaultTcp(t){var o,s;const e=(s=(o=t.description.dh_parameters)==null?void 0:o[0])==null?void 0:s.type;return t.joints.length<6&&(e===C.JointTypeEnum.RevoluteJoint||e===C.JointTypeEnum.PrismaticJoint)?this.NO_TCP:this.DEFAULT_TCP}async setOptions(t){return t.tcp&&(this.tcp=t.tcp),t.orientation&&(this.orientation=t.orientation),"coordinateSystem"in t&&(this.coordinateSystem=t.coordinateSystem),t.timeout&&(this.timeout=t.timeout),t.mode&&(this.mode=t.mode),t.onError&&(this.onError=t.onError),this.setJoggingMode(this.mode,!1)}get motionGroupId(){return this.motionStream.motionGroupId}get nova(){return this.motionStream.nova}get cellId(){return this.motionStream.cellId}get numJoints(){return this.motionStream.joints.length}async stop(){if(this.joggingSocket){const t=new Array(this.numJoints).fill(0);this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:t})}this.trajectorySocket&&this.trajectorySocket.sendJson({message_type:"PauseMovementRequest"})}async dispose(){const t=this.closeJoggingSockets();return this.ownsMotionStream&&this.motionStream.dispose(),t}closeJoggingSockets(){var e,o;(e=this.endJoggingInit)==null||e.call(this),(o=this.endIncrementalMotion)==null||o.call(this);const t=[this.joggingSocket,this.trajectorySocket].filter(s=>s!==null);return t.forEach(s=>{s.dispose()}),this.joggingSocket=null,this.trajectorySocket=null,Promise.all(t.map(s=>s.closed()))}async setJoggingMode(t,e=!0){if(!(this.mode===t&&e)&&(this.closeJoggingSockets(),this.mode=t,this.mode==="jogging"))return this.initializeJoggingWebsocket()}async initializeJoggingWebsocket(){return new Promise((t,e)=>{const o=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/jogging`);this.joggingSocket=o;let s=!1;const n=setTimeout(()=>{a(new Error(`Jogging initialization timeout after ${this.timeout} ms`))},this.timeout),a=c=>{s||(s=!0,clearTimeout(n),o.removeEventListener("close",h),this.endJoggingInit===l&&(this.endJoggingInit=void 0),c?e(c):t())},l=()=>a(),h=()=>{o.disposed&&a()};this.endJoggingInit=l,o.addEventListener("close",h),o.addEventListener("message",c=>{var d,g,u;const r=I.tryParseJson(c.data);if(((d=r==null?void 0:r.result)==null?void 0:d.kind)==="INITIALIZE_RECEIVED"){a();return}if(((g=r==null?void 0:r.result)==null?void 0:g.kind)==="MOTION_ERROR")if(this.onBlocked&&((u=r==null?void 0:r.result)!=null&&u.message.includes(Z))){a(),o.dispose(),this.onBlocked();return}else this.onError?(a(),this.onError(c.data)):a(new Error(c.data))}),o.sendJson({message_type:"InitializeJoggingRequest",motion_group:this.motionGroupId,...this.tcp?{tcp:this.tcp}:{}})})}async rotateJoints({joint:t,direction:e,velocityValue:o,velocityUnit:s}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Joint jogging websocket not connected; create one by setting jogging mode to 'jogging'");const n=new Array(this.numJoints).fill(0);n[t]=e==="-"?-o:o,this.joggingSocket.sendJson({message_type:"JointVelocityRequest",velocity:n})}async translateTCP({axis:t,direction:e,velocityMmPerSec:o}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:this.velocityAlongAxis(t,e==="-"?-o:o),rotation:[0,0,0],use_tool_coordinate_system:this.orientation==="tool"})}async rotateTCP({axis:t,direction:e,velocityRadsPerSec:o}){if(!this.joggingSocket||this.mode!=="jogging")throw new Error("Continuous jogging websocket not connected; create one by setting jogging mode to 'jogging'");this.joggingSocket.sendJson({message_type:"TcpVelocityRequest",translation:[0,0,0],rotation:this.velocityAlongAxis(t,e==="-"?-o:o),use_tool_coordinate_system:this.orientation==="tool"})}get coordinateSystemRotation(){if(!(this.orientation==="tool"||!this.coordinateSystem))return p.poseOfFrame(this.coordinateSystem).quaternion}velocityAlongAxis(t,e){const o=p.vectorAlongAxis(t,e),s=this.coordinateSystemRotation;return s?p.rotateVector(o,s):o}async runIncrementalCartesianMotion(t){if(this.mode!=="trajectory")throw new Error("Set jogging mode to 'trajectory' to run incremental cartesian motions");if(!this.incrementalMotionInFlight){this.incrementalMotionInFlight=!0;try{const e=await this.planIncrementalCartesianMotion(t);e&&await this.executeTrajectory(e)}finally{this.incrementalMotionInFlight=!1}}}async planIncrementalCartesianMotion({currentTcpPose:t,currentJoints:e,velocityInRelevantUnits:o,axis:s,direction:n,motion:a}){var f,_,E;const l=[],h=wt({currentTcpPose:t,axis:s,direction:n,motion:a,useToolCoordinateSystem:this.orientation==="tool",coordinateSystemRotation:this.coordinateSystemRotation});l.push({limits_override:a.type==="translate"?{tcp_velocity_limit:o}:{tcp_orientation_velocity_limit:o},path:{path_definition_name:"PathLine",target_pose:{position:h.position,orientation:h.orientation}}});const c=this.motionStream.description;if(c.cycle_time===void 0){this.logger.warn("Current motion group has no cycle time, cannot plan jogging motion");return}const r=this.motionStream.rapidlyChangingMotionState.tcp,d=r?(_=(f=c.tcps)==null?void 0:f[r])==null?void 0:_.pose:void 0,g={motion_group_model:((E=this.options)==null?void 0:E.motionGroupModel)??c.motion_group_model,cycle_time:c.cycle_time,mounting:c.mounting,tcp_offset:d,global:c.operation_limits.auto_limits},u=await this.nova.api.trajectoryPlanning.planTrajectory(this.cellId,{motion_group_setup:g,start_joint_position:e,motion_commands:l}),y=u.response;if(!y)throw new Error(`Failed to plan jogging increment motion ${JSON.stringify(u)}`);if("error_feedback"in y){if(this.onError){this.onError(y);return}throw new Error(`Failed to plan jogging increment motion: ${JSON.stringify(y.error_feedback)}`)}return y}async executeTrajectory(t){const e=this.nova.openReconnectingWebsocket(`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);this.trajectorySocket=e;const o=new AbortController;let s,n;try{await new Promise((a,l)=>{let h=!1;const c=()=>{h||(h=!0,a())},r=g=>{if(!h){if(h=!0,this.onError){this.onError(g),a();return}l(g instanceof Error?g:new Error(`Failed to execute trajectory: ${JSON.stringify(g)}`))}};n=c,this.endIncrementalMotion=c;const d=Rt(t);s=setTimeout(()=>{r(new Error(`Jogging motion did not complete within ${d}ms`))},d),e.addEventListener("message",g=>{var y,f;const u=(y=I.tryParseJson(g.data))==null?void 0:y.result;if(!(u!=null&&u.kind)){r(new Error(`Failed to execute trajectory: Received invalid message ${g.data}`));return}if(this.onBlocked&&((f=u.message)!=null&&f.includes(Z))){this.onBlocked(),c();return}if(u.kind==="INITIALIZE_RECEIVED"){if(u.add_trajectory_error||u.message){r(u);return}e.sendJson({message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"})}else if(u.kind==="START_RECEIVED"){if(u.message){r(u);return}this.waitForMotionToFinish(o.signal).then(c,r)}else u.kind==="PAUSE_RECEIVED"||(u.kind==="MOTION_ERROR"&&u.message?r(u):r(new Error(`Failed to execute trajectory, cannot handle message type "${u.kind}"`)))}),e.sendJson({message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.motionGroupId,data:t,tcp:this.tcp}})})}finally{clearTimeout(s),o.abort(),this.endIncrementalMotion===n&&(this.endIncrementalMotion=void 0),e.dispose(),this.trajectorySocket===e&&(this.trajectorySocket=null)}}async waitForMotionToFinish(t){const e=()=>this.motionStream.rapidlyChangingMotionState.standstill;await m.when(()=>!e(),{timeout:bt,signal:t}).catch(()=>{}),await m.when(e,{signal:t})}}function ct(i){var t,e,o,s,n;if(typeof i=="string"){const a=I.tryParseJson(i);return a?ct(a):i}if(i&&typeof i=="object"){const a=i;return((t=a.error_feedback)==null?void 0:t.error_feedback_name)||((e=a.add_trajectory_error)==null?void 0:e.message)||a.message||((s=(o=a.result)==null?void 0:o.add_trajectory_error)==null?void 0:s.message)||((n=a.result)==null?void 0:n.message)||"Jogging motion failed"}return"Jogging motion failed"}const Pt=[{pattern:/^FeedbackSingularity$/,translationKey:"Jogging.StreamStateSection.Error.Singularity.lb"},{pattern:/^FeedbackJointLimitExceeded$/,translationKey:"Jogging.StreamStateSection.Error.JointLimit.lb"},{pattern:/^FeedbackOutOfWorkspace$/,translationKey:"Jogging.StreamStateSection.Error.OutOfWorkspace.lb"},{pattern:/^FeedbackCollision$/,translationKey:"Jogging.StreamStateSection.Error.Collision.lb"},{pattern:/^FeedbackNoSolutionInCurrentConfiguration$/,translationKey:"Jogging.StreamStateSection.Error.NoSolutionInConfiguration.lb"},{pattern:/^Feedback\w+$/,translationKey:"Jogging.StreamStateSection.Error.PlanningFailed.lb"}];function At(i){var t;return((t=Pt.find(({pattern:e})=>e.test(i)))==null?void 0:t.translationKey)??null}const kt=5,Jt=250;function Dt(i){var o,s,n,a;const t=[(s=(o=i==null?void 0:i.manual_t1_limits)==null?void 0:o.tcp)==null?void 0:s.velocity,(a=(n=i==null?void 0:i.manual_limits)==null?void 0:n.tcp)==null?void 0:a.velocity].filter(l=>typeof l=="number"&&Number.isFinite(l)&&l>0);return Math.min(Jt,...t)/10}const U=[{id:"0.1",mm:.1,degrees:.05},{id:"1",mm:1,degrees:.5},{id:"5",mm:5,degrees:2.5},{id:"10",mm:10,degrees:5}],Nt=[{id:"continuous"},...U],Lt=["coordsys","tool"],X="joggingToolStore",Ft=()=>typeof localStorage>"u"?void 0:localStorage;class k{constructor(t,e,o,s,n,a={}){var h,c,r;this.jogger=t,this.coordSystems=e,this.motionGroupDescription=o,this.tcps=s,this.inverseSolverValue=n,this.selectedTabId="cartesian",this.locks=new Set,this.blocked=!1,this.selectedCoordSystemId="world",this.jogCoordSystemId="world",this.selectedTcpId="",this.tcpChangeInProgress=!1,this.selectedOrientation="coordsys",this.selectedIncrementId="continuous",this.selectedCartesianMotionType="translate",this.incrementJogInProgress=null,this.lastJogError=null,this.onBeforeActivate=null,this.rotationVelocityDegPerSec=kt,this.minTranslationVelocityMmPerSec=1,this.maxTranslationVelocityMmPerSec=250,this.minRotationVelocityDegPerSec=1,this.maxRotationVelocityDegPerSec=60,this.showCoordSystemSelect=!1,this.showTcpSelect=!0,this.showOrientationSelect=!0,this.showIncrementSelect=!0,this.showTabIcons=!1,this.showVelocitySliderLabel=!0,this.showVelocityLegend=!1,this.showJointsLegend=!1,this.disposers=[],this.inverseSolver=void 0,this.jointType=C.JointTypeEnum.RevoluteJoint,this.jogPress=0,this.storage=a.storage??Ft(),this.notMoveableReason=a.notMoveableReason;for(const d of e)if(d.coordinate_system===""){d.coordinate_system="world";break}this.selectedCoordSystemId=((h=e[0])==null?void 0:h.coordinate_system)||"world",this.jogCoordSystemId=this.selectedCoordSystemId,this.selectedTcpId=t.motionStream.rapidlyChangingMotionState.tcp??"",this.tcpChangeInProgress=this.tcps.length>0&&!this.selectedTcpId,this.inverseSolver=n,this.translationVelocityMmPerSec=Dt(o==null?void 0:o.operation_limits),this.jointType=((r=(c=o==null?void 0:o.dh_parameters)==null?void 0:c[0])==null?void 0:r.type)??C.JointTypeEnum.RevoluteJoint,m.makeAutoObservable(this,{storage:!1,notMoveableReason:!1,jogPress:!1},{autoBind:!0}),this.jogger.onBlocked=()=>{this.block()};const l=this.jogger.onError;this.jogger.onError=d=>{this.setLastJogError(ct(d)),l==null||l(d)},this.loadFromLocalStorage(),this.disposers.push(m.autorun(()=>this.saveToLocalStorage())),this.disposers.push(m.autorun(()=>{const d=this.jogger.motionStream.rapidlyChangingMotionState.tcp;d&&d!==this.selectedTcpId&&m.runInAction(()=>{this.selectedTcpId=d,this.tcpChangeInProgress=!1})}))}static async loadFor(t,e={}){const{nova:o,cellId:s}=t,[n,a]=await Promise.all([o.api.controller.listCoordinateSystems(s,t.motionStream.controllerId,"ROTATION_VECTOR"),o.api.motionGroup.getMotionGroupDescription(s,t.motionStream.controllerId,t.motionGroupId)]),l=await o.api.motionGroupModels.getMotionGroupKinematicModel(a.motion_group_model);return k.create(t,{coordinateSystems:n||[],description:a,kinematicModel:l},e)}static create(t,e,o={}){const{coordinateSystems:s,description:n,kinematicModel:a}=e,l=Object.entries(n.tcps||{}).map(([h,c])=>({id:h,readable_name:c.name,position:c.pose.position,orientation:c.pose.orientation}));return new k(t,s,n,l,a.inverse_solver,o)}dispose(){for(const t of this.disposers)t();this.jogger.dispose()}get coordSystemCountByName(){return v.countBy(this.coordSystems,t=>t.name)}async deactivate(){this.jogger.mode==="jogging"&&await this.jogger.setJoggingMode("off")}async activate(){return this.currentTab.id!=="cartesian"?this.activateFor("joint"):this.activateFor(this.activeDiscreteIncrement?"cartesianStep":"cartesian")}async activateFor(t,e){var o;return this.refuseUnlessJoggable(e),this.lastJogError=null,await((o=this.onBeforeActivate)==null?void 0:o.call(this)),this.refuseUnlessJoggable(e),t!=="joint"&&((this.jogger.tcp!==this.selectedTcpId||this.jogger.orientation!==this.selectedOrientation)&&await this.jogger.setOptions({tcp:this.selectedTcpId||void 0,orientation:this.selectedOrientation}),this.jogger.coordinateSystem=this.jogCoordSystem),await this.jogger.setJoggingMode(t==="cartesianStep"?"trajectory":"jogging"),this.jogger}refuseUnlessJoggable(t){var o;const e=((o=this.notMoveableReason)==null?void 0:o.call(this))??null;if(e)throw new A.JoggingRefusedError(e);for(const s of this.locks)if(s!==t)throw new A.JoggingRefusedError({code:"locked"})}async startCartesianJogging(t,e,o){const s=++this.jogPress;await this.activateFor("cartesian"),s===this.jogPress&&(t==="translate"?await this.jogger.translateTCP({axis:e,direction:o,velocityMmPerSec:this.translationVelocityMmPerSec}):await this.jogger.rotateTCP({axis:e,direction:o,velocityRadsPerSec:this.rotationVelocityRadsPerSec}))}async startJointJogging(t,e){const o=++this.jogPress;if(await this.activateFor("joint"),o!==this.jogPress)return;const s=this.jointType===C.JointTypeEnum.PrismaticJoint;await this.jogger.rotateJoints({joint:t,direction:e,velocityUnit:s?"mm/s":"rad/s",velocityValue:s?this.translationVelocityMmPerSec:this.rotationVelocityRadsPerSec})}async stopJogging(){const t=++this.jogPress;await this.jogger.stop(),t===this.jogPress&&await this.deactivate()}async runIncrementalCartesianJog(t,e,o,s){this.refuseUnlessJoggable(),await this.withOwnLock(async n=>{try{const a=await this.activateFor("cartesianStep",n),l=a.motionStream.rapidlyChangingMotionState;if(!l.tcp_pose)return;this.setCurrentIncrementJog({axis:e,direction:o}),await a.runIncrementalCartesianMotion({currentTcpPose:l.tcp_pose,currentJoints:l.joint_position,velocityInRelevantUnits:t==="translate"?this.translationVelocityMmPerSec:this.rotationVelocityRadsPerSec,axis:e,direction:o,motion:t==="translate"?{type:"translate",distanceMm:s.mm}:{type:"rotate",distanceRads:I.degreesToRadians(s.degrees)}})}finally{this.setCurrentIncrementJog(null),await this.deactivate()}})}loadFromLocalStorage(){var o;const t=(o=this.storage)==null?void 0:o.getItem(X),e=t?I.tryParseJson(t):void 0;e&&(this.tabsById[e.selectedTabId]&&(this.selectedTabId=e.selectedTabId),this.coordSystemsById[e.selectedCoordSystemId]&&(this.selectedCoordSystemId=e.selectedCoordSystemId),this.coordSystemsById[e.jogCoordSystemId]&&(this.jogCoordSystemId=e.jogCoordSystemId),this.incrementOptionsById[e.selectedIncrementId]&&(this.selectedIncrementId=e.selectedIncrementId),["translate","rotate"].includes(e.selectedCartesianMotionType)&&(this.selectedCartesianMotionType=e.selectedCartesianMotionType),["coordsys","tool"].includes(e.selectedOrientation)&&(this.selectedOrientation=e.selectedOrientation))}saveToLocalStorage(){var t;(t=this.storage)==null||t.setItem(X,JSON.stringify(this.localStorageSave))}get isLocked(){return this.locks.size>0}get lastJogErrorTranslationKey(){return this.lastJogError?At(this.lastJogError):null}get localStorageSave(){return{selectedTabId:this.selectedTabId,selectedCoordSystemId:this.selectedCoordSystemId,jogCoordSystemId:this.jogCoordSystemId,selectedOrientation:this.selectedOrientation,selectedIncrementId:this.selectedIncrementId,selectedCartesianMotionType:this.selectedCartesianMotionType}}get canJogCartesian(){return this.inverseSolver!==null}get tabs(){const t=[{id:"joint",label:"Joints"}];return this.canJogCartesian&&t.unshift({id:"cartesian",label:"Cartesian"}),t}get incrementOptions(){return Nt}get discreteIncrementOptions(){return U}get incrementOptionsById(){return v.keyBy(this.incrementOptions,t=>t.id)}get tabsById(){return v.keyBy(this.tabs,t=>t.id)}get currentTab(){return this.tabsById[this.selectedTabId]||this.tabs[0]}get tabIndex(){return this.tabs.indexOf(this.currentTab)}get coordSystemsById(){return v.keyBy(this.coordSystems,t=>t.coordinate_system)}get activeCoordSystemId(){return this.selectedOrientation==="tool"?"tool":this.selectedCoordSystemId}get jogCoordSystem(){return p.resolveCoordinateSystemInWorld(this.jogCoordSystemId,this.coordSystems)}get tcpPoseInSelectedCoordSystem(){const{tcp_pose:t,coordinate_system:e}=this.jogger.motionStream.readoutState;return!(t!=null&&t.position)||!t.orientation?t:p.transformPoseToCoordinateSystem({pose:{position:t.position,orientation:t.orientation},coordinateSystemId:e||"world"},this.selectedCoordSystemId,this.coordSystems).pose}get tcpsById(){return v.keyBy(this.tcps,t=>t.id)}tcpPoseIn(t,e){const{tcp_pose:o,tcp:s,coordinate_system:n}=this.jogger.motionStream.readoutState,a=this.tcpsById[s||this.selectedTcpId],l=this.tcpsById[t];if(!(!(o!=null&&o.position)||!o.orientation)&&!(!a||!l))try{return p.transformPoseToCoordinateSystem({pose:p.transformPoseToTcp(o,a,l),coordinateSystemId:n||"world"},e,this.coordSystems).pose}catch{return}}get activeDiscreteIncrement(){return U.find(t=>t.id===this.selectedIncrementId)}get rotationVelocityRadsPerSec(){return this.rotationVelocityDegPerSec*Math.PI/180}velocityInDisplayUnits(t){return t?this.rotationVelocityDegPerSec:this.translationVelocityMmPerSec}minVelocityInDisplayUnits(t){return t?this.minRotationVelocityDegPerSec:this.minTranslationVelocityMmPerSec}maxVelocityInDisplayUnits(t){return t?this.maxRotationVelocityDegPerSec:this.maxTranslationVelocityMmPerSec}onTabChange(t,e){const o=this.tabs[e]||this.tabs[0];this.selectedTabId=o.id}setSelectedCoordSystemId(t){this.selectedCoordSystemId=t}setSelectedTcpId(t){this.requestTcpChange(t).catch(e=>{console.error("Failed to change TCP:",e)})}async requestTcpChange(t){if(t===this.selectedTcpId)return;this.tcpChangeInProgress=!0;const e=this.jogger.tcp,o=this.jogger.mode!=="jogging";try{this.jogger.tcp=t,o?await this.jogger.setJoggingMode("jogging"):await this.jogger.setJoggingMode("jogging",!1);let s=await this.waitForTcpConfirmation(t,1e3);o&&await this.jogger.setJoggingMode("off"),s||(s=await this.waitForTcpConfirmation(t,2e3)),m.runInAction(()=>{s?this.selectedTcpId=t:(this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??"")})}catch(s){throw o&&await this.jogger.setJoggingMode("off").catch(()=>{}),m.runInAction(()=>{this.jogger.tcp=e,this.selectedTcpId=this.jogger.motionStream.rapidlyChangingMotionState.tcp??""}),s}finally{m.runInAction(()=>{this.tcpChangeInProgress=!1})}}waitForTcpConfirmation(t,e){return new Promise(o=>{const s=setTimeout(()=>{n(),o(!1)},e),n=m.when(()=>this.jogger.motionStream.rapidlyChangingMotionState.tcp===t,()=>{clearTimeout(s),o(!0)})})}setSelectedOrientation(t){this.selectedOrientation=t}setMoveRelativeToSelectedTcp(){this.selectedOrientation="tool"}setMoveRelativeToCoordSystem(t){this.selectedOrientation="coordsys",this.jogCoordSystemId=t}setSelectedIncrementId(t){this.selectedIncrementId=t}setCurrentIncrementJog(t){this.incrementJogInProgress=t}setLastJogError(t){this.lastJogError=t}setVelocityFromSlider(t,e){!Number.isFinite(t)||t<this.minVelocityInDisplayUnits(e)||t>this.maxVelocityInDisplayUnits(e)||(e?this.rotationVelocityDegPerSec=t:this.translationVelocityMmPerSec=t)}setSelectedCartesianMotionType(t){this.selectedCartesianMotionType=t}lock(t){this.locks.add(t)}unlock(t){this.locks.delete(t)}block(){this.blocked=!0}unblock(){this.blocked=!1,this.jogger.mode==="jogging"&&this.jogger.initializeJoggingWebsocket().catch(t=>{console.error("Failed to initialize jogging:",t)})}async withMotionLock(t){return this.withOwnLock(()=>t())}async withOwnLock(t){const e=v.uniqueId();this.lock(e);try{return await t(e)}finally{this.unlock(e)}}}const Y=1e-4,Vt=new Set(["timestamp","sequence_number","joint_position","joint_torque","joint_current","flange_pose","tcp_pose","flange_velocity","tcp_velocity"]),xt=1,tt=i=>Array.isArray(i)&&i.length===3&&i.every(t=>typeof t=="number");class lt{constructor(t,e,o,s={}){this.source=t,this.motionGroupId=e,this.lastMessageReceivedAt=Date.now(),this.lastInvalidStateMessage=null,this.connectionQuality="good";const n=o.motion_groups.find(a=>a.motion_group===e);if(!n)throw new Error(`Motion group ${e} not found in initial controller state`);this.isVirtual=s.isVirtual??!1,this.onError=s.onError,this.reconnectsOnFocus=(s.reconnectOnFocus??!0)&&typeof window<"u",this.rapidlyChangingMotionState=n,this.lastValidStateMessage={receivedAt:Date.now(),data:o},m.makeAutoObservable(this,{source:!1,lastMessageReceivedAt:!1,connectionQualityInterval:!1,isVirtual:!1,onError:!1,reconnectsOnFocus:!1,readoutState:m.computed({equals:K,keepAlive:!0})},{autoBind:!0}),this.source.addEventListener("message",this.handleMessage),this.connectionQualityInterval=setInterval(this.updateConnectionQuality,500),this.reconnectsOnFocus&&window.addEventListener("focus",this.handleWindowFocus)}get controllerState(){return this.lastValidStateMessage.data}get readoutState(){return W(this.rapidlyChangingMotionState)}async nextMotionState(){var o,s;const t=await this.source.nextMessage(),e=(s=(o=this.source.parse(t.data))==null?void 0:o.motion_groups)==null?void 0:s.find(n=>n.motion_group===this.motionGroupId);if(!e)throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${t.data}`);return e}setLastInvalidStateMessage(t){this.lastInvalidStateMessage={receivedAt:Date.now(),data:t}}setLastValidStateMessage(t){this.lastValidStateMessage={receivedAt:Date.now(),data:t}}updateRapidlyChangingMotionState(t,e){const o=this.rapidlyChangingMotionState,s=t;for(const n of Object.keys(s))e!=null&&e.has(n)||v.isEqual(o[n],s[n])||(o[n]=s[n]);for(const n of Object.keys(o))e!=null&&e.has(n)||n in s||delete o[n]}setConnectionQuality(t){this.connectionQuality=t}handleWindowFocus(){this.source.reconnect()}updateConnectionQuality(){const t=Date.now()-this.lastMessageReceivedAt,e=this.isVirtual?3e3:1e3,o=this.isVirtual?6e3:3e3;if(t>o){this.source.readyState===xt&&this.source.reconnect(),this.setConnectionQuality("critical");return}if(t>e){this.setConnectionQuality("struggling");return}this.setConnectionQuality("good")}dispose(){this.source.removeEventListener("message",this.handleMessage),clearInterval(this.connectionQualityInterval),this.reconnectsOnFocus&&window.removeEventListener("focus",this.handleWindowFocus)}handleMessage(t){var c,r;const e=this.source.parse(t.data);if(!(e!=null&&e.motion_groups)){(c=this.onError)==null||c.call(this,{message:I.makeErrorMessage(t.data),url:this.source.url}),this.setLastInvalidStateMessage(t.data);return}this.lastMessageReceivedAt=Date.now();const o=this.lastValidStateMessage.data;(o.safety_state!==e.safety_state||o.operation_mode!==e.operation_mode||o.mode!==e.mode)&&this.setLastValidStateMessage(e);const s=e.motion_groups.find(d=>d.motion_group===this.motionGroupId);if(!s){(r=this.onError)==null||r.call(this,{message:`Motion group ${this.motionGroupId} not found in controller state: ${JSON.stringify(t.data)}`,url:this.source.url}),this.setLastInvalidStateMessage(t.data);return}const n=!J(this.rapidlyChangingMotionState.joint_position,s.joint_position,Y),a=this.rapidlyChangingMotionState.tcp!==s.tcp;if(!n&&!a){this.updateRapidlyChangingMotionState(s,Vt);return}const l=this.rapidlyChangingMotionState.flange_pose,h=s.flange_pose;if((h==null?void 0:h.orientation)==null||!tt(h.orientation)){const d=h==null?void 0:h.orientation;throw new Error(`Invalid newFlangePose.orientation: expected [number, number, number] (got ${d==null?"null":d.length})`)}if((l==null?void 0:l.orientation)==null||!tt(l.orientation)){const d=l==null?void 0:l.orientation;throw new Error(`Invalid oldFlangePose.orientation: expected [number, number, number] (got ${d==null?"null":d.length})`)}h.orientation=q(h.orientation,l.orientation),this.updateRapidlyChangingMotionState(s)}}function $t(i){return{get url(){return i.url},get readyState(){return i.readyState},addEventListener:(t,e)=>i.addEventListener(t,e),removeEventListener:(t,e)=>i.removeEventListener(t,e),firstMessage:()=>i.firstMessage(),nextMessage:()=>i.nextMessage(),reconnect:()=>i.reconnect(),close:()=>i.close(),parse:t=>{var e;return(e=it.tryParseJson(t))==null?void 0:e.result}}}function dt(i,{controllerId:t,cellId:e,responseRateMs:o}){const s=p.createNovaClient(i),n=e??p.cellIdOf(i)??"cell",a=o===void 0?"":`?response_rate=${o}`;return $t(s.openReconnectingWebsocket(`/cells/${n}/controllers/${t}/state-stream${a}`))}const Gt=["FeedbackOutOfWorkspace","FeedbackJointLimitExceeded","FeedbackAxisRangeExceeded","FeedbackNoSolutionInCurrentConfiguration"];function ht(i){return i==="FeedbackSingularity"?"Jogging.TargetPose.Error.Singularity.lb":i==="FeedbackCollision"?"Jogging.TargetPose.Error.Collision.lb":Gt.includes(i)?"Jogging.TargetPose.Error.NotReachable.lb":"Jogging.TargetPose.Error.PlanningFailed.lb"}const gt=["motionGroupDescription","controllerConfiguration","kinematicModel","motionGroupModel","coordinateSystems","controllerState","motionStateStream","controllerStateStream"];class Q extends Error{constructor(t,e,o){super(o),this.stepId=t,this.cause=e,this.name="RobotLoadStepError"}}function x(i){return i instanceof Q}class ut{constructor(t=null,e=null){this.motionGroupId=null,this.controllerId=null,this.steps=[],this.retryAttempt=0,this.fatalError=null,this.currentStepStartedAt=null,this.motionGroupId=t,this.controllerId=e,this.steps=gt.map(o=>({id:o,status:"pending",url:null,error:null})),m.makeAutoObservable(this,{},{autoBind:!0})}beginRetry(t){for(const e of this.steps)e.status="pending",e.url=null,e.error=null;this.retryAttempt=t,this.fatalError=null,this.currentStepStartedAt=null}stepById(t){return this.steps.find(e=>e.id===t)}startStep(t,e){const o=this.stepById(t);o&&(o.status="running",o.url=e,o.error=null,this.currentStepStartedAt=Date.now())}updateStepUrl(t,e){const o=this.stepById(t);o&&(o.url=e)}succeedStep(t){const e=this.stepById(t);e&&(e.status="succeeded",this.currentStepStartedAt=null)}failStep(t,e){const o=this.stepById(t);o&&(o.status="failed",o.error=e,this.currentStepStartedAt=null)}failWith(t){this.fatalError=t,this.currentStepStartedAt=null}get totalCount(){return this.steps.length}get succeededCount(){return this.steps.filter(t=>t.status==="succeeded").length}get runningStep(){return this.steps.find(t=>t.status==="running")}get failedStep(){return this.steps.find(t=>t.status==="failed")}get isFailed(){return this.fatalError!==null||this.failedStep!==void 0}get isComplete(){return this.steps.length>0&&this.steps.every(t=>t.status==="succeeded")}}const Bt=1e4;async function et(i,t,e){let o;i.catch(()=>{});try{return await Promise.race([i,new Promise((s,n)=>{o=setTimeout(()=>n(new Error(e)),t)})])}finally{clearTimeout(o)}}async function Ut({nova:i,cellId:t,controllerId:e,motionGroupId:o,progress:s,createStateSource:n,isStale:a=()=>!1,socketTimeoutMs:l=Bt}){let h,c,r=!1;function d(){h==null||h.dispose(),c==null||c.close()}async function g(u,y,f){s.startStep(u,y);try{const _=await f();return s.succeedStep(u),_}catch(_){throw s.failStep(u,_),new Q(u,_,I.makeErrorMessage(_))}}try{if(a())return null;const u=`/cells/${t}/controllers/${e}/motion-groups/${o}`,y=`/cells/${t}/controllers/${e}`,f=await g("motionGroupDescription",`${u}/description`,()=>i.api.motionGroup.getMotionGroupDescription(t,e,o));if(a())return null;const{configuration:_}=await g("controllerConfiguration",y,()=>i.api.controller.getRobotController(t,e));if(a())return null;const E={model:f.motion_group_model,serialNumber:f.serial_number},R=E.serialNumber?`?serial_number=${encodeURIComponent(E.serialNumber)}`:"",N=await g("kinematicModel",`/experimental/motion-group-models/${encodeURIComponent(E.model)}/kinematic${R}`,()=>p.getMotionGroupModelResource(i,E.model,E.serialNumber,"kinematic",S=>s.updateStepUrl("kinematicModel",S)));if(a())return null;const L=await g("motionGroupModel",`/experimental/motion-group-models/${encodeURIComponent(E.model)}/description${R}`,()=>p.resolveMotionGroupModelName(i,E.model,E.serialNumber,S=>s.updateStepUrl("motionGroupModel",S)));if(a())return null;const F=await g("coordinateSystems",`${y}/coordinate-systems?orientation_type=ROTATION_VECTOR`,async()=>await i.api.controller.listCoordinateSystems(t,e,"ROTATION_VECTOR")??[]);if(a())return null;const{controllerState:V,motionGroupState:j}=await g("controllerState",`${y}/state`,async()=>{const S=await i.api.controller.getCurrentRobotControllerState(t,e),T=S==null?void 0:S.motion_groups.find(M=>M.motion_group===o);if(!S||!T)throw new Error(`Controller ${e} or motion group ${o} not found`);return{controllerState:S,motionGroupState:T}});if(a())return null;const w=`${u}/state-stream`,{socket:Et,initialMotionState:jt}=await g("motionStateStream",w,async()=>{var P;const S=i.openReconnectingWebsocket(w);h=S;const T=await et(S.firstMessage(),l,`No motion state received from ${w} within ${l/1e3}s`),M=(P=it.tryParseJson(T.data))==null?void 0:P.result;if(!M)throw new Error(`Unable to parse initial motion state message ${T.data}`);return{socket:S,initialMotionState:M}});if(a())return null;const{source:Tt,initialControllerState:Mt}=await g("controllerStateStream",`${y}/state`,async()=>{var P;const S=n({cellId:t,controllerId:e});c=S,s.updateStepUrl("controllerStateStream",S.url);const T=await et(S.firstMessage(),l,`No controller state received from ${S.url} within ${l/1e3}s`),M=S.parse(T.data);if(!M)throw new Error(`Unable to parse initial controller state message ${T.data}`);if(!((P=M.motion_groups)!=null&&P.some(vt=>vt.motion_group===o)))throw new Error(`Controller state from ${S.url} does not list motion group ${o} yet`);return{source:S,initialControllerState:M}});return a()?null:(r=!0,{motionGroupDescription:f,controllerConfiguration:_,kinematicModel:N,motionGroupModelName:L,coordinateSystems:F,controllerState:V,motionGroupState:j,initialMotionState:jt,motionStateSocket:Et,stateSource:Tt,initialControllerState:Mt,dispose:d})}finally{r||d()}}const b=i=>i??[0,0,0],G=(i,t)=>i.length===t.length&&i.every((e,o)=>e===t[o]);function qt(i,t){return i.type==="joint"?t.type==="joint"&&G(i.joints,t.joints):t.type==="joint"?!1:(i.coordinateSystemId||"world")===(t.coordinateSystemId||"world")&&G(b(i.pose.position),b(t.pose.position))&&G(b(i.pose.orientation),b(t.pose.orientation))}function Wt(i){return i.type==="joint"?{type:"joint",joints:[...i.joints]}:{type:"cartesian",pose:{position:[...b(i.pose.position)],orientation:[...b(i.pose.orientation)]},coordinateSystemId:i.coordinateSystemId}}class mt{constructor(t){this.options=t,this.plannedTrajectory=null,this.trajectoryState="idle",this.lastError=null,this.armed=!1,this.plannedFor=null,this.motion=null,this.releaseOnStart=!1,this.disposers=[],this.logger=t.logger??console,m.makeAutoObservable(this,{socket:!1,disposers:!1,logger:!1,options:!1},{autoBind:!0}),this.socket=this.openSocket(),this.disposers.push(m.reaction(()=>this.executionState,e=>{e==="END_OF_TRAJECTORY"&&(this.motion=null,this.reset())}))}get joggingStore(){return this.options.joggingStore}get jogger(){return this.options.joggingStore.jogger}get motionStream(){return this.options.joggingStore.jogger.motionStream}get holdsExecutionSession(){return this.armed}get isPlanOutdated(){return this.plannedFor!==null&&!Object.is(this.plannedFor.velocity,this.velocityFor(this.plannedFor.target))}get executionState(){var t,e;return(e=(t=this.motionStream.rapidlyChangingMotionState.execute)==null?void 0:t.details)==null?void 0:e.state.kind}async planTrajectory(t){var R,N,L,F,V;if((N=(R=this.options).isLocked)!=null&&N.call(R))throw await this.dropPlan(),new Error("Cannot plan trajectory: the robot is locked");this.armed&&!this.plannedTrajectory&&await this.stopAndReset(),await this.ensureMovementOwnership();const e=this.motionStream.rapidlyChangingMotionState.joint_position??[],{cycle_time:o,mounting:s,motion_group_model:n,tcps:a}=this.motionStream.description,l=this.joggingStore.selectedTcpId,h=l?(L=a==null?void 0:a[l])==null?void 0:L.pose:void 0,c={motion_group_model:((F=this.jogger.options)==null?void 0:F.motionGroupModel)??n,cycle_time:o??0,mounting:s,...h&&{tcp_offset:h}},r=this.velocityFor(t);let d;if(t.type==="cartesian"){let j=t.pose;const w=t.coordinateSystemId||"world";if(w!=="world")try{j=p.transformPoseToCoordinateSystem({pose:{position:j.position??[0,0,0],orientation:j.orientation??[0,0,0]},coordinateSystemId:w},"world",this.joggingStore.coordSystems).pose}catch{return await this.dropPlan(),{ok:!1,errorFeedbackName:"FeedbackUnknown"}}d={limits_override:{tcp_velocity_limit:r},path:{target_pose:j,path_definition_name:"PathCartesianPTP"}}}else d={limits_override:{joint_velocity_limits:Array(e.length).fill(r)},path:{target_joint_position:t.joints,path_definition_name:"PathJointPTP"}};m.runInAction(()=>{this.lastError=null,this.trajectoryState="planning"});let g;try{g=await this.jogger.nova.api.trajectoryPlanning.planTrajectory(this.jogger.cellId,{motion_group_setup:c,start_joint_position:e,motion_commands:[d]})}catch(j){throw await this.dropPlan(),j}const u=g.response;if("error_feedback"in u){const j=((V=u.error_feedback)==null?void 0:V.error_feedback_name)??"FeedbackUnknown";return await this.dropPlan(),{ok:!1,errorFeedbackName:j}}const y=u.joint_positions,f=y[0],_=y[y.length-1];if(!f||!_)throw await this.dropPlan(),new Error("Trajectory returned invalid joint positions");const E={message_type:"InitializeMovementRequest",trajectory:{message_type:"TrajectoryData",motion_group:this.jogger.motionGroupId,tcp:l||void 0,data:u}};return this.socket.sendJson(E),m.runInAction(()=>{this.armed=!0,this.plannedTrajectory={startJoints:f,endJoints:_},this.plannedFor={target:Wt(t),velocity:r}}),{ok:!0}}hold(t){return!this.plannedTrajectory||t&&!(this.plannedFor&&qt(t,this.plannedFor.target))?!1:this.motion==="starting"?!this.releaseOnStart:this.trajectoryState==="moving"?this.motion==="running":this.trajectoryState!=="planned"||this.motion==="pausing"||this.executionState==="RUNNING"||this.isPlanOutdated?!1:(this.sendStart(),!0)}async release(){this.motion==="starting"?(this.releaseOnStart=!0,await m.when(()=>this.motion!=="starting")):this.motion==="running"&&this.sendPause(),this.motion==="pausing"&&await this.settlePause()}start(){if(!this.plannedTrajectory)throw new Error("Cannot start trajectory: no planned trajectory exists");if(this.trajectoryState!=="planned")throw new Error(`Cannot start trajectory: expected state "planned", got "${this.trajectoryState}"`);if(this.executionState==="RUNNING")throw new Error("Cannot start trajectory: robot is already running");this.motion!=="starting"&&this.sendStart()}async pause(){if(this.trajectoryState!=="moving")throw new Error(`Cannot pause trajectory: expected state "moving", got "${this.trajectoryState}"`);this.sendPause(),await this.settlePause()}async stopAndReset(){try{(this.executionState==="RUNNING"||this.trajectoryState==="moving"||this.motion)&&(this.sendPause(),await this.waitUntilStopped())}catch(t){this.logger.warn("Failed to stop trajectory execution cleanly",t)}finally{this.reset(),this.closeSocket(),this.socket=this.openSocket()}}reset(){this.plannedTrajectory=null,this.plannedFor=null,this.trajectoryState="idle"}async dropPlan(){this.armed?await this.stopAndReset():this.reset()}clearError(){this.lastError=null}dispose(){for(const t of this.disposers)t();this.closeSocket()}velocityFor(t){return t.type==="cartesian"?this.joggingStore.translationVelocityMmPerSec:this.joggingStore.rotationVelocityRadsPerSec}async ensureMovementOwnership(){if(this.options.ensureMovementOwnership){await this.options.ensureMovementOwnership();return}this.jogger.mode!=="trajectory"&&(await this.joggingStore.deactivate(),await this.jogger.setJoggingMode("trajectory"))}sendStart(){const t={message_type:"StartMovementRequest",direction:"DIRECTION_FORWARD"};this.socket.sendJson(t),this.motion="starting",this.releaseOnStart=!1}sendPause(){if(this.motion==="pausing")return;const t={message_type:"PauseMovementRequest"};this.socket.sendJson(t),this.motion="pausing"}async settlePause(){await this.waitUntilStopped(),m.runInAction(()=>{this.motion==="pausing"&&(this.motion=null,(this.trajectoryState==="moving"||this.trajectoryState==="stopping")&&(this.trajectoryState=this.plannedTrajectory?"planned":"idle"))})}async waitUntilStopped(){await m.when(()=>this.motionStream.rapidlyChangingMotionState.standstill)}handleMessage(t){var o,s;const e=(o=I.tryParseJson(t.data))==null?void 0:o.result;if(e)switch(e.kind){case"INITIALIZE_RECEIVED":e.add_trajectory_error||e.message?(this.lastError=((s=e.add_trajectory_error)==null?void 0:s.message)??e.message??"NOVA refused the trajectory",this.reset()):this.trajectoryState="planned";break;case"START_RECEIVED":this.motion="running",this.trajectoryState="moving",this.releaseOnStart&&(this.releaseOnStart=!1,this.sendPause(),this.settlePause());break;case"PAUSE_RECEIVED":this.trajectoryState==="moving"&&(this.trajectoryState="stopping");break;case"MOTION_ERROR":this.lastError=e.message,this.motion==="starting"&&(this.motion=null),this.reset();break}}openSocket(){const t=this.jogger.nova.openReconnectingWebsocket(`/cells/${this.jogger.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`);return t.addEventListener("message",this.handleMessage),t}closeSocket(){this.socket.removeEventListener("message",this.handleMessage),this.socket.dispose(),this.armed=!1,this.motion=null}}const Kt={a:0,d:0,alpha:0,theta:0,reverse_rotation_direction:!1};class pt{constructor(t,e,o,s,n){this.motionGroupDescription=t,this.controllerConfiguration=e,this.kinematicModel=o,this.resolvedMotionGroupModel=s,this.coordinateSystems=n,this.dhParameters=(t.dh_parameters??[]).map(a=>({...Kt,...a}))}get isVirtual(){return this.controllerConfiguration.kind==="VirtualController"}get motionGroupModel(){return this.motionGroupDescription.motion_group_model}get serialNumber(){return this.motionGroupDescription.serial_number}get inverseSolver(){return this.kinematicModel.inverse_solver}get jointType(){var t,e;return((e=(t=this.motionGroupDescription.dh_parameters)==null?void 0:t[0])==null?void 0:e.type)??C.JointTypeEnum.RevoluteJoint}get jointLimits(){var t;return((t=this.motionGroupDescription.operation_limits.auto_limits)==null?void 0:t.joints)??[]}get safetyZones(){return this.motionGroupDescription.safety_zones}get safetyLinkColliders(){return this.motionGroupDescription.safety_link_colliders}get safetyToolColliders(){return this.motionGroupDescription.safety_tool_colliders}get kinematicChainOffset(){return this.kinematicModel.kinematic_chain_offset??this.motionGroupDescription.kinematic_chain_offset??null}get flangeOffset(){return this.kinematicModel.flange_offset??this.motionGroupDescription.flange_offset??null}get mounting(){return this.motionGroupDescription.mounting??null}get tcps(){return Object.entries(this.motionGroupDescription.tcps??{}).map(([t,e])=>({id:t,name:e.name}))}get tcpOffsetsById(){return this.motionGroupDescription.tcps??{}}}const ot=i=>Array.isArray(i)&&i.length===3&&i.every(t=>typeof t=="number"),Yt=.001,Qt=.5,Ht=.01,B=(i,t,e)=>!!(i&&t&&J([...i],[...t],e));class yt{constructor(t,e,o){this.stream=t,this.description=e,this.jogging=o,m.makeAutoObservable(this,{stream:!1,description:!1,jogging:!1},{autoBind:!0})}get controllerState(){return this.stream.controllerState}get rapidlyChangingMotionState(){return this.stream.rapidlyChangingMotionState}get readoutState(){return this.stream.readoutState}get jointPose(){return this.stream.readoutState.joint_position}get connectionQuality(){return this.stream.connectionQuality}get lastValidStateMessage(){return this.stream.lastValidStateMessage}get lastInvalidStateMessage(){return this.stream.lastInvalidStateMessage}get measuredTcpPoseReference(){return this.tcpPoseReferenceOf(this.rapidlyChangingMotionState)}get displayedTcpPoseReference(){return this.inSelectedFrame(this.measuredTcpPoseReference)}get displayedTcpPose(){return this.readoutState.tcp_pose?this.inSelectedFrame(this.tcpPoseReferenceOf(this.readoutState)).pose:null}isAt(t){if(t.type==="joint")return B(t.joints,this.rapidlyChangingMotionState.joint_position,Yt);try{const e=p.deriveSelectedTcpPose({inputPose:this.measuredTcpPoseReference,selectedTcpId:t.tcpPose.tcpId,selectedCoordinateSystemId:t.tcpPose.coordSystemId,tcpOffsetsById:this.description.tcpOffsetsById,coordinateSystems:this.jogging.coordSystems});return B(t.tcpPose.pose.position,e.pose.position,Qt)&&B(t.tcpPose.pose.orientation,e.pose.orientation,Ht)}catch{return!1}}nextMotionState(){return this.stream.nextMotionState()}async waitUntilStopped(){let t=await this.stream.nextMotionState(),e=await this.stream.nextMotionState();for(;!J(t.joint_position,e.joint_position,Y);)t=e,e=await this.stream.nextMotionState()}tcpPoseReferenceOf(t){var s,n;const e=(s=t.tcp_pose)==null?void 0:s.position,o=(n=t.tcp_pose)==null?void 0:n.orientation;if(!e||!ot(e))throw new Error(`Invalid current TCP pose position for motion group ${this.stream.motionGroupId}`);if(!o||!ot(o))throw new Error(`Invalid current TCP pose orientation for motion group ${this.stream.motionGroupId}`);return{pose:{position:e,orientation:o},tcpId:t.tcp??"",coordinateSystemId:t.coordinate_system??"world"}}inSelectedFrame(t){return p.deriveSelectedTcpPose({inputPose:t,selectedTcpId:this.jogging.selectedTcpId,selectedCoordinateSystemId:this.jogging.selectedCoordSystemId,tcpOffsetsById:this.description.tcpOffsetsById,coordinateSystems:this.jogging.coordSystems})}}const zt=["SAFETY_STATE_ROBOT_EMERGENCY_STOP","SAFETY_STATE_DEVICE_EMERGENCY_STOP"],Zt=["SAFETY_STATE_NORMAL","SAFETY_STATE_REDUCED"],Xt=["SAFETY_STATE_STOP","SAFETY_STATE_STOP_0","SAFETY_STATE_STOP_1","SAFETY_STATE_STOP_2"],te=["OPERATION_MODE_AUTO","OPERATION_MODE_MANUAL","OPERATION_MODE_MANUAL_T1","OPERATION_MODE_MANUAL_T2"];class ft{constructor(t,e){this.state=t,this.activationState=e,m.makeAutoObservable(this,{state:!1,activationState:!1},{autoBind:!0})}get safetyState(){return this.state.controllerState.safety_state}get operationMode(){return this.state.controllerState.operation_mode}get isEstopActive(){return zt.includes(this.safetyState)}get isMoveableSafetyState(){return Zt.includes(this.safetyState)}get isMoveableOperationMode(){return te.includes(this.operationMode)}get isActivatableSafetyState(){return this.isMoveableSafetyState||Xt.includes(this.safetyState)}get activationBlockedReason(){return this.isEstopActive?`an emergency stop is active (${this.safetyState})`:this.isActivatableSafetyState?this.isMoveableOperationMode?null:`the operation mode is ${this.operationMode}`:`the safety state is ${this.safetyState}`}get canBeActive(){return this.activationBlockedReason===null}get notMoveableReason(){return this.state.connectionQuality==="critical"?{code:"disconnected"}:this.isMoveableSafetyState?this.isMoveableOperationMode?this.activationState()==="inactive"?{code:"deactivated"}:null:{code:"operation_mode",value:this.operationMode}:{code:"safety_state",value:this.safetyState}}get canBeMoved(){return this.isMoveableSafetyState&&this.isMoveableOperationMode&&this.activationState()==="active"&&this.state.connectionQuality!=="critical"}}const ee="Jogging.TargetPose.Error.MoveFailed.lb";class St{constructor(t,e){this.robot=t,this.logger=e,this.editing=!1,this.draft="",this.confirming=!1,this.staged=null,this.moveStarted=!1,this.disposers=[],m.makeAutoObservable(this,{robot:!1,logger:!1,disposers:!1,onBeforePlan:!1},{autoBind:!0}),this.disposers.push(m.reaction(()=>this.robot.jogging.selectedTabId,()=>{(this.editing||this.staged)&&this.resetToLive()})),this.disposers.push(m.reaction(()=>({trajectoryState:this.robot.trajectory.trajectoryState,executionState:this.robot.trajectory.executionState,isRobotAtStagedPose:this.isRobotAtStagedPose}),({trajectoryState:o,executionState:s,isRobotAtStagedPose:n})=>{if(!this.stagedPose)return;if(o==="moving"){this.moveStarted=!0;return}(s==="END_OF_TRAJECTORY"||this.moveStarted&&n&&o!=="stopping")&&this.resetToLive()})),this.disposers.push(m.reaction(()=>this.robot.trajectory.lastError,o=>{o&&this.staged&&!this.staged.errorKey&&(this.staged={...this.staged,errorKey:ee,errorMessage:o})})),this.disposers.push(m.reaction(()=>!this.confirming&&this.robot.trajectory.trajectoryState==="planned"&&this.robot.trajectory.isPlanOutdated,o=>{o&&this.stagedPose&&this.plan(this.stagedPose)}))}dispose(){for(const t of this.disposers)t()}get phase(){return this.editing?"editing":this.staged?this.staged.errorKey?"error":"staged":"view"}get isJointTab(){return this.robot.jogging.selectedTabId==="joint"}get liveDisplayString(){if(this.isJointTab)return O.jointsToText(this.robot.state.jointPose);const t=this.robot.state.displayedTcpPose;return t?O.poseToText(t):""}get displayString(){var t;return((t=this.staged)==null?void 0:t.displayString)??this.liveDisplayString}get parsedDraft(){const{state:t,motionGroupId:e}=this.robot;if(this.isJointTab){const n=O.parseJointsText(this.draft,t.jointPose.length);return n?{type:"joint",motionGroupId:e,joints:n}:null}const o=O.parsePoseText(this.draft);if(!o||!t.displayedTcpPose)return null;const s=t.displayedTcpPoseReference;return{type:"cartesian",motionGroupId:e,tcpPose:{pose:{position:o.position,orientation:o.orientation},coordSystemId:s.coordinateSystemId,tcpId:s.tcpId}}}get draftValid(){return this.parsedDraft!==null}beginEdit(){this.draft=this.displayString,this.editing=!0}setDraft(t){this.draft=t}cancelEdit(){this.editing=!1,this.draft=""}async confirmEdit(){const t=this.parsedDraft;t&&await this.plan(t)}async plan(t){var o;if(this.confirming)return;if(this.robot.notMoveableReason()){await this.dropStaged();return}const e=t.type==="joint"?O.jointsToText(t.joints):O.poseToText(t.tcpPose.pose);this.confirming=!0;try{await((o=this.onBeforePlan)==null?void 0:o.call(this));const s=await this.robot.trajectory.planTrajectory(A.trajectoryTargetOf(t));m.runInAction(()=>{this.staged={pose:t,displayString:e,errorKey:s.ok?null:ht(s.errorFeedbackName)},this.editing=!1,this.draft=""})}catch(s){this.logger.warn("Failed to plan trajectory to typed pose",s),m.runInAction(()=>{this.staged={pose:t,displayString:e,errorKey:"Jogging.TargetPose.Error.PlanningFailed.lb"},this.editing=!1,this.draft=""})}finally{m.runInAction(()=>{this.confirming=!1})}}holdMove(t){const e=this.stagedPose;return!e||!A.sameRobotPose(e,t)?!1:this.robot.trajectory.hold(A.trajectoryTargetOf(e))}async releaseMove(){await this.robot.trajectory.release()}async resetToLive(){this.editing=!1,this.draft="",await this.dropStaged()}async dropStaged(){const t=this.staged;this.staged=null,this.moveStarted=!1,t&&(!t.errorKey||this.robot.trajectory.holdsExecutionSession)&&await this.robot.trajectory.stopAndReset()}clear(){this.editing=!1,this.staged=null}get stagedPose(){return!this.staged||this.staged.errorKey?null:this.staged.pose}get isRobotAtStagedPose(){return this.stagedPose?this.robot.state.isAt(this.stagedPose):!1}}const oe={getItem:()=>null,setItem:()=>{}};class _t{constructor(t,e,o,s={}){const n=s.logger??console;this.onError=s.onError??(()=>{}),this.nova=t,this.motionGroupId=e.motionGroupId,this.controllerId=e.controllerId,this.cellId=e.cellId,this.stateSource=o.stateSource,this.motionStateSocket=o.motionStateSocket;const a=new D(t,o.controllerState,o.motionGroupState,o.motionGroupDescription,o.initialMotionState,o.motionStateSocket,e.cellId,{logger:n}),l=new $(a,{cellId:e.cellId,motionGroupModel:o.motionGroupModelName,logger:n,onError:c=>this.onError({kind:"jog",message:I.makeErrorMessage(c),url:l.motionStream.motionStateSocket.url,cause:c})});this.jogging=k.create(l,{coordinateSystems:o.coordinateSystems,description:o.motionGroupDescription,kinematicModel:o.kinematicModel},{storage:s.storage??oe,notMoveableReason:()=>this.jogRefusedReason}),this.description=new pt(o.motionGroupDescription,o.controllerConfiguration,o.kinematicModel,o.motionGroupModelName,this.jogging.coordSystems);const h=new lt(o.stateSource,e.motionGroupId,o.initialControllerState,{isVirtual:this.description.isVirtual,onError:c=>this.onError({kind:"stream",...c})});this.state=new yt(h,this.description,this.jogging),this.activation=new H.RobotActivation(t,e,this.state,()=>this.safety,n,()=>this.releasePlannedMove()),this.safety=new ft(this.state,()=>this.activation.state),this.trajectory=new mt({joggingStore:this.jogging,isLocked:s.isLocked,ensureMovementOwnership:()=>this.ensureMovementOwnership("trajectory"),logger:n}),this.targetPose=new St({motionGroupId:e.motionGroupId,state:this.state,jogging:this.jogging,trajectory:this.trajectory,notMoveableReason:()=>{var c;return this.safety.notMoveableReason??((c=s.isLocked)!=null&&c.call(s)?{code:"locked"}:null)}},n),this.jogging.onBeforeActivate=async()=>{this.targetPose.staged&&await this.targetPose.resetToLive()},s.autoActivateVirtual&&this.description.isVirtual&&this.activation.state==="inactive"&&this.activation.activate().catch(c=>{this.onError({kind:"mode",message:I.makeErrorMessage(c),url:c instanceof H.RobotModeChangeError?c.url:void 0,cause:c})})}reportError(t){this.onError(t)}get movementOwner(){return this.jogging.jogger.mode}async ensureMovementOwnership(t){this.movementOwner!==t&&(await this.jogging.deactivate(),await this.jogging.jogger.setJoggingMode(t))}get jogRefusedReason(){return this.safety.notMoveableReason??(this.safety.canBeMoved?null:{code:"deactivated"})}async releasePlannedMove(){this.targetPose.staged&&await this.targetPose.resetToLive(),(this.trajectory.plannedTrajectory||this.trajectory.trajectoryState!=="idle"||this.trajectory.holdsExecutionSession)&&await this.trajectory.stopAndReset()}dispose(){this.activation.dispose(),this.targetPose.dispose(),this.state.stream.dispose(),this.trajectory.dispose(),this.stateSource.close(),this.jogging.dispose(),this.motionStateSocket.dispose()}}const ie=[1e3,2e3],se=i=>new Promise(t=>setTimeout(t,i));class It{constructor(t,e,o,s){this.nova=t,this.motionGroupId=e,this.ids=o,this.options=s,this.state="loading",this.session=null,this.error=null,this.attempt=0,this.disposed=!1,this.progress=new ut(e,o.controllerId),m.makeAutoObservable(this,{nova:!1,ids:!1,options:!1,attempt:!1,disposed:!1,readyPromise:!1,settle:!1,progress:!1},{autoBind:!0}),this.start()}get ready(){return this.readyPromise}retry(){this.disposed||this.state!=="failed"||this.start()}dispose(){var t;this.disposed||(this.disposed=!0,this.attempt++,(t=this.session)==null||t.dispose(),this.session=null,this.settle.reject(new Error("The robot session load was disposed")))}start(){this.attempt++;const t=this.attempt;this.readyPromise=new Promise((e,o)=>{this.settle={resolve:e,reject:o}}),this.readyPromise.catch(()=>{}),m.runInAction(()=>{this.state="loading",this.error=null}),this.run(t)}isStale(t){return this.disposed||t!==this.attempt}async run(t){var l,h;const{cellId:e,controllerId:o}=this.ids,s=this.options.retryDelaysMs??ie,n=this.options.logger??console,a=this.options.stateSource??(c=>dt(this.nova,c));for(let c=0;;c++)try{const r=await Ut({nova:this.nova,cellId:e,controllerId:o,motionGroupId:this.motionGroupId,progress:this.progress,createStateSource:a,isStale:()=>this.isStale(t),socketTimeoutMs:this.options.socketTimeoutMs});if(!r)return;if(this.isStale(t)){r.dispose();return}let d;try{d=new _t(this.nova,{cellId:e,controllerId:o,motionGroupId:this.motionGroupId},r,this.options)}catch(g){throw r.dispose(),g}if(this.isStale(t)){d.dispose();return}m.runInAction(()=>{this.session=d,this.state="ready"}),this.settle.resolve(d);return}catch(r){if(this.isStale(t))return;const d=x(r)?s[c]:void 0;if(d===void 0){m.runInAction(()=>{x(r)?this.progress.failStep(r.stepId,r.cause):this.progress.failWith(r),this.state="failed",this.error=r}),(h=(l=this.options).onEvent)==null||h.call(l,{type:"loadFailed",motionGroupId:this.motionGroupId,step:x(r)?r.stepId:"unknown",message:I.makeErrorMessage(r),attempts:c+1}),this.settle.reject(r);return}if(n.warn(`Retrying load of robot "${this.motionGroupId}" after: ${I.makeErrorMessage(r)}`),m.runInAction(()=>{this.progress.beginRetry(c+1)}),await se(d),this.isStale(t))return}}}function ne(i,t,e={}){return re(p.createNovaClient(i),t,{...e,cellId:e.cellId??p.cellIdOf(i)})}function re(i,t,e={}){const o=e.cellId??"cell",s=e.controllerId??t.split("@")[1]??"";return new It(i,t,{cellId:o,controllerId:s},e)}exports.ControllerStateStream=lt;exports.JoggerConnection=$;exports.JoggingStore=k;exports.MOTION_DELTA_THRESHOLD=Y;exports.MotionStreamConnection=D;exports.ORIENTATION_IDS=Lt;exports.ROBOT_LOAD_STEP_IDS=gt;exports.RobotDescription=pt;exports.RobotLiveState=yt;exports.RobotLoadProgress=ut;exports.RobotLoadStepError=Q;exports.RobotSafety=ft;exports.RobotSession=_t;exports.RobotSessionLoad=It;exports.RobotTargetPose=St;exports.TrajectoryExecutionStore=mt;exports.controllerStateWebsocket=dt;exports.isRobotLoadStepError=x;exports.jointValuesEqual=J;exports.jointValuesUnchanged=st;exports.loadRobotSession=ne;exports.planErrorTranslationKey=ht;exports.poseEqual=rt;exports.readoutOf=W;exports.readoutsEqual=K;exports.tcpMotionEqual=at;exports.unwrapRotationVector=q;
@@ -1 +0,0 @@
1
- "use strict";const T=/^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/,c=(n,t)=>Number.parseFloat(n.toFixed(t));function a(n,t={}){const i=t.positionPrecision??1,r=t.rotationPrecision??4,e=o=>[0,1,2].map(s=>(o==null?void 0:o[s])??0);return`(${[...e(n.position).map(o=>c(o,i)),...e(n.orientation).map(o=>c(o,r))].join(", ")})`}function m(n){return`[${n.map(t=>c(t,4)).join(", ")}]`}function f(n,t,i){let r=n.trim();const e=r.startsWith(t),o=r.endsWith(i);if(e!==o||(e&&(r=r.slice(1,-1)),r.trim()===""))return null;const s=[];for(const u of r.split(",")){const p=u.trim();if(!T.test(p))return null;const l=Number(p);if(!Number.isFinite(l))return null;s.push(l)}return s}function x(n){const t=f(n,"(",")");if((t==null?void 0:t.length)!==6)return null;const[i,r,e,o,s,u]=t;return{position:[i,r,e],orientation:[o,s,u]}}function d(n,t){const i=f(n,"[","]");return(i==null?void 0:i.length)!==t?null:i}exports.jointsToText=m;exports.parseJointsText=d;exports.parsePoseText=x;exports.poseToText=a;
@@ -1,41 +0,0 @@
1
- const f = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/, c = (n, t) => Number.parseFloat(n.toFixed(t));
2
- function m(n, t = {}) {
3
- const i = t.positionPrecision ?? 1, r = t.rotationPrecision ?? 4, e = (o) => [0, 1, 2].map((s) => (o == null ? void 0 : o[s]) ?? 0);
4
- return `(${[
5
- ...e(n.position).map((o) => c(o, i)),
6
- ...e(n.orientation).map((o) => c(o, r))
7
- ].join(", ")})`;
8
- }
9
- function d(n) {
10
- return `[${n.map((t) => c(t, 4)).join(", ")}]`;
11
- }
12
- function l(n, t, i) {
13
- let r = n.trim();
14
- const e = r.startsWith(t), o = r.endsWith(i);
15
- if (e !== o || (e && (r = r.slice(1, -1)), r.trim() === "")) return null;
16
- const s = [];
17
- for (const u of r.split(",")) {
18
- const p = u.trim();
19
- if (!f.test(p)) return null;
20
- const a = Number(p);
21
- if (!Number.isFinite(a)) return null;
22
- s.push(a);
23
- }
24
- return s;
25
- }
26
- function x(n) {
27
- const t = l(n, "(", ")");
28
- if ((t == null ? void 0 : t.length) !== 6) return null;
29
- const [i, r, e, o, s, u] = t;
30
- return { position: [i, r, e], orientation: [o, s, u] };
31
- }
32
- function T(n, t) {
33
- const i = l(n, "[", "]");
34
- return (i == null ? void 0 : i.length) !== t ? null : i;
35
- }
36
- export {
37
- x as a,
38
- m as b,
39
- d as j,
40
- T as p
41
- };
@@ -1 +0,0 @@
1
- "use strict";const e=require("react/jsx-runtime"),g=require("@mui/material/Box"),q=require("@mui/material/Paper"),v=require("@mui/material/Tooltip"),p=require("@mui/material/Typography"),C=require("@wandelbots/icons/WifiOff"),x=require("react"),h=require("react-i18next"),S=require("./externalizeComponent-Br_U-QAr.cjs"),u=require("@mui/material/Stack"),A=require("./robotSafetyOf-Dxm6s7Pp.cjs"),I=require("./SmallSelect-Dcsd7_6_.cjs"),T=require("@mui/material/CircularProgress"),W=require("@mui/material/Switch"),R=require("@mui/icons-material/Apps"),j=require("@mui/material/Button"),k=require("@mui/material/ButtonGroup"),z=require("@mui/material/Menu"),B=require("@mui/material/MenuItem"),M=require("@wandelbots/design-tokens"),O=require("@wandelbots/icons/SearchFilled"),E=require("./RobotActivation-Bb0oNSBN.cjs"),H=[["day",86400],["hour",3600],["minute",60],["second",1]];function F(n,o,r){const i=Math.max(0,Math.floor((o-n)/1e3)),[a,s]=H.find(([,c])=>i>=c)??["second",1];return new Intl.RelativeTimeFormat(r,{numeric:"auto"}).format(-Math.floor(i/s),a)}function P(n){const[o,r]=x.useState(Date.now);return x.useEffect(()=>{if(!n)return;r(Date.now());const i=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(i)},[n]),o}const D=S.externalizeComponent(function({quality:o,lastMessageAt:r,lastInvalidMessage:i}){const{t:a,i18n:s}=h.useTranslation(),c=o==="critical",l=P(c);if(!c)return null;const d=m=>F(m,l,s.language),t=i&&i.receivedAt>r?i:null;return e.jsx(v,{placement:"bottom-end",slotProps:{popper:{sx:{[`& .${v.tooltipClasses.tooltip}`]:{maxWidth:"340px",padding:0,maxHeight:"80vh",overflowY:"auto",borderRadius:"10px",border:1,borderColor:"divider"}}}},title:e.jsxs(q,{elevation:8,sx:{padding:"14px"},children:[e.jsx(p,{fontSize:"14px",children:a("ConnectionWarning.LastUpdate.lb",{time:d(r)})}),t&&e.jsxs(p,{fontSize:"14px",marginTop:"1rem",children:[a("ConnectionWarning.ErrorState.lb",{time:d(t.receivedAt)}),e.jsx("pre",{style:{fontSize:"12px",whiteSpace:"pre-wrap",wordWrap:"break-word",margin:"4px 0 0"},children:String(t.data)})]})]}),children:e.jsx(g,{component:"span",role:"img","aria-label":a("ConnectionWarning.Interrupted.ti"),sx:{display:"inline-flex",cursor:"pointer",color:"error.main"},children:e.jsx(C.WifiOff,{size:20})})})});function N(n){const{connectionQuality:o,lastValidStateMessage:r,lastInvalidStateMessage:i}=n.state;return{quality:o,lastMessageAt:r.receivedAt,lastInvalidMessage:i}}function U({state:n,disabled:o=!1,onToggle:r}){const{t:i}=h.useTranslation(),a=x.useId(),s=n==="activating"||n==="deactivating",c={inactive:i("SafetyBar.ActivationToggle.Activate.bt"),activating:i("SafetyBar.ActivationToggle.Activating.bt"),active:i("SafetyBar.ActivationToggle.Activated.bt"),deactivating:i("SafetyBar.ActivationToggle.Deactivating.bt")}[n];return e.jsxs(u,{direction:"row","data-testid":"robot-activation",sx:{gap:"4px",alignItems:"center"},children:[e.jsx(W,{size:"small",checked:n==="active"||n==="deactivating",disabled:s||o,onChange:()=>r(),slotProps:{input:{role:"switch","aria-labelledby":a}}}),e.jsx(p,{id:a,variant:"body2",color:"text.secondary",noWrap:!0,sx:{letterSpacing:"0.17px"},children:c}),s&&e.jsx(T,{size:16})]})}const w={minWidth:0,padding:"4px 10px",color:"text.primary","& svg":{width:"16px",height:"16px"}};function G({appIcon:n,appName:o,apps:r,onAppSelect:i,onSearch:a}){const{t:s}=h.useTranslation(),[c,l]=x.useState(null);function d(t){l(null),t.onClick?t.onClick():t.href&&(window.location.href=t.href),i==null||i(t)}return e.jsxs(u,{direction:"row",sx:{gap:"8px",alignItems:"center"},children:[e.jsxs(k,{variant:"outlined",color:"secondary",sx:t=>({borderRadius:"10px",boxShadow:t.shadows[2],"& .MuiButtonGroup-grouped":{borderColor:t.palette.divider}}),children:[e.jsx(j,{"aria-label":s("RobotHeader.Apps.bt"),"aria-haspopup":"menu","aria-expanded":c!==null,disabled:r.length===0,onClick:t=>l(t.currentTarget),sx:w,children:e.jsx(R,{})}),a&&e.jsx(j,{"aria-label":s("RobotHeader.Search.bt"),onClick:a,sx:w,children:e.jsx(O.SearchFilled,{})})]}),e.jsxs(u,{direction:"row",sx:{gap:"4px",alignItems:"center"},children:[n&&e.jsx(g,{sx:{display:"flex","& svg":{width:"25px",height:"25px"}},children:n}),e.jsx(p,{component:"h1",noWrap:!0,sx:{fontFamily:M.FontFamilyBrand,fontWeight:700,fontSize:"16px",letterSpacing:"0.24px"},children:o})]}),e.jsx(z,{anchorEl:c,open:c!==null,onClose:()=>l(null),sx:{"& .MuiPaper-root":{minWidth:200,mt:1}},children:r.map(t=>e.jsxs(B,{onClick:()=>d(t),children:[t.icon&&e.jsx(g,{sx:{display:"flex",alignItems:"center",mr:2},children:t.icon}),t.name]},t.id))})]})}const L={position:"absolute",width:"1px",height:"1px",margin:"-1px",padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},V=S.externalizeComponent(({appIcon:n,appName:o,apps:r=[],onAppSelect:i,onSearch:a,motionGroup:s,safety:c,activation:l,actions:d,sx:t})=>{const{t:m}=h.useTranslation(),f=x.useId();return e.jsxs(u,{component:"header",direction:"row","data-testid":"robot-header",sx:[y=>{var b;return{alignItems:"center",justifyContent:"space-between",gap:"24px",padding:"8px 24px",minHeight:"52px",boxSizing:"border-box",background:(b=y.palette.backgroundPaperElevation)==null?void 0:b[1]}},...Array.isArray(t)?t:[t]],children:[e.jsx(G,{appIcon:n,appName:o,apps:r,onAppSelect:i,onSearch:a}),e.jsxs(u,{direction:"row",sx:{gap:"20px",alignItems:"center"},children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(g,{component:"span",id:f,sx:L,children:m("RobotHeader.MotionGroup.lb")}),e.jsx(I.SmallSelect,{labelId:f,width:"240px",...s})]}),c&&e.jsx(A.SafetyBar,{...c}),l&&e.jsx(U,{...l})]}),e.jsx(u,{direction:"row",sx:{gap:"24px",alignItems:"center"},children:d})]})});function Y(n){return{state:n.activation.state,disabled:!n.safety.canBeActive,onToggle:()=>{n.activation.toggle().catch(o=>{n.reportError({kind:"mode",message:o instanceof Error?o.message:String(o),url:o instanceof E.RobotModeChangeError?o.url:void 0,cause:o})})}}}exports.ConnectionWarning=D;exports.RobotHeader=V;exports.connectionWarningOf=N;exports.robotActivationOf=Y;