@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.
- package/README.md +172 -40
- package/dist/3d.cjs +1 -1
- package/dist/3d.d.ts +3 -4
- package/dist/3d.js +35 -38
- package/dist/CurrentPose/index.cjs +1 -1
- package/dist/CurrentPose/index.js +2 -2
- package/dist/CurrentPoseBar/index.cjs +1 -1
- package/dist/CurrentPoseBar/index.js +1 -1
- package/dist/JoggingButtons/index.cjs +1 -1
- package/dist/JoggingButtons/index.js +1 -1
- package/dist/JoggingGizmo/index.cjs +1 -1
- package/dist/JoggingGizmo/index.js +2 -2
- package/dist/JoggingJointSlider/index.cjs +1 -1
- package/dist/JoggingJointSlider/index.js +1 -1
- package/dist/RobotControl/index.cjs +1 -1
- package/dist/RobotControl/index.js +2 -2
- package/dist/RobotControlPanel/index.cjs +1 -1
- package/dist/RobotControlPanel/index.d.ts +1 -1
- package/dist/RobotControlPanel/index.js +1 -1
- package/dist/RobotHeader/index.cjs +1 -1
- package/dist/RobotHeader/index.d.ts +3 -5
- package/dist/RobotHeader/index.js +6 -7
- package/dist/RobotScene/index.cjs +1 -1
- package/dist/RobotScene/index.js +3 -3
- package/dist/RobotView/index.cjs +1 -1
- package/dist/RobotView/index.js +2 -2
- package/dist/SafetyBar/IndicatorWithExplanation.d.ts +12 -1
- package/dist/SafetyBar/SafetyBar.d.ts +15 -1
- package/dist/SafetyBar/index.cjs +1 -1
- package/dist/SafetyBar/index.d.ts +0 -1
- package/dist/SafetyBar/index.js +3 -4
- package/dist/SafetyBar/robotSafetyOf.d.ts +1 -0
- package/dist/chunks/{ConnectedMotionGroup-BifrgwV1.js → ConnectedMotionGroup-DNYakgxy.js} +6 -5
- package/dist/chunks/ConnectedMotionGroup-IRTsTxwB.cjs +3 -0
- package/dist/chunks/{CurrentPose-CMqO8oqX.cjs → CurrentPose-CAq9e9JY.cjs} +1 -1
- package/dist/chunks/{CurrentPose-CdD2ZB7B.js → CurrentPose-CgdINEh2.js} +3 -3
- package/dist/chunks/{CurrentPoseBar-CX1xFBtm.js → CurrentPoseBar--HkZBGnN.js} +11 -11
- package/dist/chunks/{CurrentPoseBar-BTBAwIO4.cjs → CurrentPoseBar-DoOUfRRs.cjs} +1 -1
- package/dist/chunks/{JoggingButtons-aijK-3g6.js → JoggingButtons-BNOnpcTH.js} +1 -1
- package/dist/chunks/{JoggingButtons-BOHl7hVq.cjs → JoggingButtons-Boaym2hQ.cjs} +1 -1
- package/dist/chunks/{JoggingGizmo-CoKYUtXq.cjs → JoggingGizmo-CNFjpWDv.cjs} +1 -1
- package/dist/chunks/{JoggingGizmo-DHvrJouR.js → JoggingGizmo-RDiEVQes.js} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-CIvIAIeO.js → JoggingGizmoOrientation-Dzzz2gEz.js} +1 -1
- package/dist/chunks/{JoggingGizmoOrientation-DVcagPRJ.cjs → JoggingGizmoOrientation-laUrgY0N.cjs} +1 -1
- package/dist/chunks/{JoggingJointSlider-DQtt4-pa.js → JoggingJointSlider-BY-Tof8G.js} +1 -1
- package/dist/chunks/{JoggingJointSlider-CTFYKzsU.cjs → JoggingJointSlider-Dm3vILd3.cjs} +1 -1
- package/dist/chunks/{JoggingRefusedError-BIkUM6-g.js → JoggingRefusedError-C4D8_YR_.js} +5 -3
- package/dist/chunks/JoggingRefusedError-DqyrfUcc.cjs +1 -0
- package/dist/chunks/Pose3-BfBNPRDM.cjs +1 -0
- package/dist/chunks/{Pose3-B_fLR-Wv.js → Pose3-DWxfC6Dj.js} +1 -2
- package/dist/chunks/{Robot-C-IWfxP9.js → Robot-B-VAYuAr.js} +5 -5
- package/dist/chunks/{Robot-Cfhjv9Z8.cjs → Robot-DRf8T9Zf.cjs} +1 -1
- package/dist/chunks/RobotActivation-CRVxXvlx.cjs +1 -0
- package/dist/chunks/RobotActivation-oR-8Y0iq.js +143 -0
- package/dist/chunks/RobotControl-Dbe50ZKM.cjs +1 -0
- package/dist/chunks/RobotControl-Ms1F7fFe.js +332 -0
- package/dist/chunks/RobotControlPanel-B7NxoHsO.cjs +1 -0
- package/dist/chunks/RobotControlPanel-CkQlkq8x.js +1029 -0
- package/dist/chunks/RobotHeader-CjOaf9s6.cjs +1 -0
- package/dist/chunks/RobotHeader-LSuRTDFB.js +395 -0
- package/dist/chunks/RobotScene-Au6zpHH1.cjs +1 -0
- package/dist/chunks/RobotScene-C6XEgaVR.js +1284 -0
- package/dist/chunks/RobotSessionProvider-CoF_tX0O.cjs +1 -0
- package/dist/chunks/RobotSessionProvider-DuHi-dtw.js +30 -0
- package/dist/chunks/{RobotView-BGYlAWj-.cjs → RobotView-Cg6JfGiY.cjs} +1 -1
- package/dist/chunks/{RobotView-D-v8jCM7.js → RobotView-CrAxNkyG.js} +3 -3
- package/dist/chunks/{robotSafetyOf-DuKKma1_.js → SafetyBar-C85BAKsL.js} +244 -215
- package/dist/chunks/SafetyBar-D2l81Omq.cjs +1 -0
- package/dist/chunks/externalizeComponent-CA_sHzyH.cjs +2 -0
- package/dist/chunks/{externalizeComponent-4juwPKL5.js → externalizeComponent-CChY_1bN.js} +34 -8
- package/dist/chunks/{useSmoothedMotionState-BSSV8aZN.js → hooks-BWoeBWLV.js} +43 -87
- package/dist/chunks/hooks-BXe2bNMo.cjs +1 -0
- package/dist/chunks/loadRobotSession-BzY9H3F8.cjs +1 -0
- package/dist/chunks/{loadRobotSession-GHHtv5dv.js → loadRobotSession-Ts2MumBB.js} +1065 -679
- package/dist/chunks/poseText-BxG4Caa-.js +48 -0
- package/dist/chunks/poseText-CwplkbDM.cjs +1 -0
- package/dist/chunks/useSmoothedMotionState-CCXmMZ0S.cjs +1 -0
- package/dist/chunks/useSmoothedMotionState-CELh-YJa.js +50 -0
- package/dist/components/VelocitySlider.d.ts +14 -1
- package/dist/components/connectionWarning/ConnectionWarning.d.ts +18 -4
- package/dist/components/connectionWarning/connectionWarningOf.d.ts +1 -11
- package/dist/components/jogging/JoggingCartesianAxisControl.d.ts +7 -1
- package/dist/components/jogging/JoggingCartesianTab.d.ts +6 -0
- package/dist/components/jogging/JoggingJointTab.d.ts +5 -0
- package/dist/components/jogging/JoggingJointValueControl.d.ts +7 -1
- package/dist/components/jogging/JoggingPanel.d.ts +11 -0
- package/dist/components/jogging/JoggingRefusedError.d.ts +8 -3
- package/dist/components/jogging/JoggingStore.d.ts +206 -17
- package/dist/components/jogging/joggingColors.d.ts +6 -0
- package/dist/components/robotControl/CartesianJogTab.d.ts +14 -3
- package/dist/components/robotControl/JogArea.d.ts +6 -3
- package/dist/components/robotControl/JogDisabledReason.d.ts +15 -0
- package/dist/components/robotControl/JointJogTab.d.ts +10 -2
- package/dist/components/robotControl/MoveToTab.d.ts +24 -3
- package/dist/components/robotControl/PoseField.d.ts +3 -1
- package/dist/components/robotControl/RobotControl.d.ts +3 -0
- package/dist/components/robotControl/RobotControlPanel.d.ts +91 -22
- package/dist/components/robotControl/VelocityRow.d.ts +8 -2
- package/dist/components/robotControl/atPose.d.ts +6 -0
- package/dist/components/robotControl/poseText.d.ts +13 -1
- package/dist/components/robotControl/units.d.ts +10 -2
- package/dist/components/robotControl/useRobotControlProps.d.ts +7 -4
- package/dist/components/robotControl/velocityText.d.ts +18 -0
- package/dist/components/robotHeader/ActivationSwitch.d.ts +13 -2
- package/dist/components/robotHeader/RobotHeader.d.ts +25 -4
- package/dist/components/robotHeader/robotActivationOf.d.ts +1 -8
- package/dist/components/robotScene/RobotScene.d.ts +7 -1
- package/dist/components/robots/MotionGroupVisualizer.d.ts +6 -4
- package/dist/components/robots/SupportedLinearAxis.d.ts +6 -4
- package/dist/components/robots/SupportedRobot.d.ts +7 -5
- package/dist/components/robots/useFrameSmoothedMotionState.d.ts +25 -0
- package/dist/components/utils/useSmoothedMotionState.d.ts +11 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +8 -10
- package/dist/core.js +60 -69
- package/dist/index.cjs +1 -1
- package/dist/index.js +100 -113
- package/dist/lib/ConnectedMotionGroup.d.ts +11 -0
- package/dist/lib/ControllerStateStream.d.ts +9 -9
- package/dist/lib/JoggerConnection.d.ts +48 -13
- package/dist/lib/MotionStreamConnection.d.ts +3 -2
- package/dist/lib/TrajectoryExecutionStore.d.ts +58 -20
- package/dist/lib/controllerStateSource.d.ts +6 -5
- package/dist/lib/robotSession/RobotActivation.d.ts +52 -21
- package/dist/lib/robotSession/RobotSession.d.ts +27 -8
- package/dist/lib/robotSession/RobotTargetPose.d.ts +4 -2
- package/dist/lib/robotSession/loadRobotSession.d.ts +1 -1
- package/dist/lib/robotSession/robotPose.d.ts +0 -6
- package/dist/session.cjs +1 -1
- package/dist/session.d.ts +6 -6
- package/dist/session.js +30 -38
- package/package.json +22 -1
- package/dist/chunks/ConnectedMotionGroup-CybwJHkh.cjs +0 -3
- package/dist/chunks/JoggingRefusedError-BuCGsVsa.cjs +0 -1
- package/dist/chunks/Pose3-Ch4xVeXV.cjs +0 -1
- package/dist/chunks/RobotActivation-Bb0oNSBN.cjs +0 -1
- package/dist/chunks/RobotActivation-C0rrwpQZ.js +0 -115
- package/dist/chunks/RobotControl-Cv6Sr1Ni.js +0 -289
- package/dist/chunks/RobotControl-DFnOYMAa.cjs +0 -1
- package/dist/chunks/RobotControlPanel-B1_9g9D-.js +0 -850
- package/dist/chunks/RobotControlPanel-BpTpRBgy.cjs +0 -1
- package/dist/chunks/RobotScene-0ZJzXL50.cjs +0 -1
- package/dist/chunks/RobotScene-DpFeFpnx.js +0 -1255
- package/dist/chunks/RobotSessionProvider--AekyPqD.cjs +0 -1
- package/dist/chunks/RobotSessionProvider-TVaKGzqa.js +0 -25
- package/dist/chunks/externalizeComponent-Br_U-QAr.cjs +0 -2
- package/dist/chunks/loadRobotSession-DYbeNnTI.cjs +0 -1
- package/dist/chunks/poseText-BXUaQWnK.cjs +0 -1
- package/dist/chunks/poseText-pg4cxE8R.js +0 -41
- package/dist/chunks/robotActivationOf-B4oV10Za.cjs +0 -1
- package/dist/chunks/robotActivationOf-EzcT9g07.js +0 -368
- package/dist/chunks/robotSafetyOf-Dxm6s7Pp.cjs +0 -1
- package/dist/chunks/useSmoothedMotionState-B9WO73k0.cjs +0 -1
- package/dist/components/robotHeader/robotSafetyOf.d.ts +0 -11
|
@@ -1,205 +1,206 @@
|
|
|
1
|
-
import { tryParseJson as
|
|
2
|
-
import { runInAction as
|
|
3
|
-
import { t as
|
|
4
|
-
import { v as
|
|
1
|
+
import { tryParseJson as b, degreesToRadians as Ct, makeErrorMessage as R } from "@wandelbots/nova-js";
|
|
2
|
+
import { runInAction as _, makeAutoObservable as j, computed as mt, when as k, autorun as X, reaction as v } from "mobx";
|
|
3
|
+
import { t as ft } from "./json-3cqBD7UQ.js";
|
|
4
|
+
import { v as H, a as N, q as tt, b as Rt, m as et, c as Pt, n as ot, e as kt, s as it, f as st, g as L, h as z, p as At, r as Jt, t as Y, i as Dt, j as Ft, k as Nt, d as nt } from "./PoseTransformer-CmuoS76S.js";
|
|
5
5
|
import { JointTypeEnum as O } from "@wandelbots/nova-js/v2";
|
|
6
|
-
import { countBy as
|
|
7
|
-
import { J as
|
|
8
|
-
import { R as
|
|
9
|
-
import { j as rt,
|
|
6
|
+
import { countBy as Lt, keyBy as F, uniqueId as Vt, isEqual as $t } from "lodash-es";
|
|
7
|
+
import { J as V, t as K, s as Gt } from "./JoggingRefusedError-C4D8_YR_.js";
|
|
8
|
+
import { R as xt, a as Ut } from "./RobotActivation-oR-8Y0iq.js";
|
|
9
|
+
import { j as rt, p as at, b as Bt, c as Wt } from "./poseText-BxG4Caa-.js";
|
|
10
10
|
function qt({
|
|
11
|
-
currentTcpPose:
|
|
11
|
+
currentTcpPose: s,
|
|
12
12
|
axis: t,
|
|
13
13
|
direction: e,
|
|
14
14
|
motion: o,
|
|
15
|
-
useToolCoordinateSystem:
|
|
15
|
+
useToolCoordinateSystem: i,
|
|
16
16
|
coordinateSystemRotation: n
|
|
17
17
|
}) {
|
|
18
|
-
const
|
|
18
|
+
const r = e === "-" ? -1 : 1;
|
|
19
19
|
if (o.type === "translate") {
|
|
20
|
-
if (!
|
|
20
|
+
if (!s.position)
|
|
21
21
|
throw new Error(
|
|
22
22
|
"Current pose has no position, cannot perform translation"
|
|
23
23
|
);
|
|
24
|
-
let d =
|
|
25
|
-
if (
|
|
26
|
-
if (!
|
|
24
|
+
let d = H(t, o.distanceMm * r);
|
|
25
|
+
if (i) {
|
|
26
|
+
if (!s.orientation)
|
|
27
27
|
throw new Error(
|
|
28
28
|
"Current pose has no orientation, cannot translate relative to tool"
|
|
29
29
|
);
|
|
30
|
-
d =
|
|
30
|
+
d = N(
|
|
31
31
|
d,
|
|
32
|
-
|
|
32
|
+
tt(s.orientation, "ROTATION_VECTOR")
|
|
33
33
|
);
|
|
34
|
-
} else n && (d =
|
|
35
|
-
const g = [...
|
|
34
|
+
} else n && (d = N(d, n));
|
|
35
|
+
const g = [...s.position];
|
|
36
36
|
return g[0] = (g[0] ?? 0) + d[0], g[1] = (g[1] ?? 0) + d[1], g[2] = (g[2] ?? 0) + d[2], {
|
|
37
37
|
position: g,
|
|
38
|
-
orientation:
|
|
38
|
+
orientation: s.orientation
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
if (!
|
|
41
|
+
if (!s.orientation)
|
|
42
42
|
throw new Error("Current pose has no orientation, cannot perform rotation");
|
|
43
|
-
const l =
|
|
44
|
-
|
|
43
|
+
const l = tt(
|
|
44
|
+
s.orientation,
|
|
45
45
|
"ROTATION_VECTOR"
|
|
46
46
|
);
|
|
47
|
-
let h =
|
|
48
|
-
!
|
|
49
|
-
const c =
|
|
47
|
+
let h = H(t, 1);
|
|
48
|
+
!i && n && (h = N(h, n));
|
|
49
|
+
const c = Rt(
|
|
50
50
|
h,
|
|
51
|
-
o.distanceRads *
|
|
52
|
-
),
|
|
51
|
+
o.distanceRads * r
|
|
52
|
+
), a = i ? et(l, c) : et(c, l);
|
|
53
53
|
return {
|
|
54
|
-
position:
|
|
55
|
-
orientation:
|
|
54
|
+
position: s.position,
|
|
55
|
+
orientation: Pt(a)
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
function G(
|
|
59
|
-
return t.length !==
|
|
58
|
+
function G(s, t, e) {
|
|
59
|
+
return t.length !== s.length ? !1 : yt(s, t, e);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
return t.length !==
|
|
61
|
+
function Ht(s, t, e) {
|
|
62
|
+
return t.length !== s.length ? !0 : yt(s, t, e);
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function yt(s, t, e) {
|
|
65
65
|
for (let o = 0; o < t.length; o++)
|
|
66
66
|
if (Math.abs(
|
|
67
|
-
(t[o] ?? 0) - (
|
|
67
|
+
(t[o] ?? 0) - (s[o] ?? 0)
|
|
68
68
|
) > e)
|
|
69
69
|
return !1;
|
|
70
70
|
return !0;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
if (
|
|
72
|
+
function Yt(s, t, e) {
|
|
73
|
+
if (s === void 0 && t || s && t === void 0 || (s == null ? void 0 : s.orientation) === void 0 || (t == null ? void 0 : t.orientation) === void 0 || (s == null ? void 0 : s.position) === void 0 || (t == null ? void 0 : t.position) === void 0)
|
|
74
74
|
return !1;
|
|
75
|
-
if (
|
|
75
|
+
if (s === void 0 || t === void 0)
|
|
76
76
|
return !0;
|
|
77
77
|
let o = 0;
|
|
78
|
-
return o += Math.abs(
|
|
78
|
+
return o += Math.abs(s.orientation[0] - t.orientation[0]), o += Math.abs(s.orientation[1] - t.orientation[1]), o += Math.abs(s.orientation[2] - t.orientation[2]), o += Math.abs(s.position[0] - t.position[0]), o += Math.abs(s.position[1] - t.position[1]), o += Math.abs(s.position[2] - t.position[2]), o <= e;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
82
|
-
|
|
80
|
+
function Kt(s, t, e) {
|
|
81
|
+
return s.coordinate_system === t.coordinate_system && s.tcp === t.tcp && Yt(
|
|
82
|
+
s.tcp_pose,
|
|
83
83
|
t.tcp_pose,
|
|
84
84
|
e
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const [e = 0, o = 0,
|
|
89
|
-
let g =
|
|
90
|
-
|
|
91
|
-
let p = g -
|
|
92
|
-
return p -= 2 * Math.PI * Math.floor((p + Math.PI) / (2 * Math.PI)), g =
|
|
87
|
+
function St(s, t) {
|
|
88
|
+
const [e = 0, o = 0, i = 0] = t, n = [e, o, i], [r = 0, l = 0, h = 0] = s, c = [r, l, h], a = st(n), d = ot(n);
|
|
89
|
+
let g = st(c), f = ot(c);
|
|
90
|
+
kt(f, d) < 0 && (g = -g, f = it(f, -1));
|
|
91
|
+
let p = g - a;
|
|
92
|
+
return p -= 2 * Math.PI * Math.floor((p + Math.PI) / (2 * Math.PI)), g = a + p, it(f, g);
|
|
93
93
|
}
|
|
94
94
|
const Qt = 2e-4;
|
|
95
|
-
function
|
|
96
|
-
const { joint_position: t, tcp_pose: e, tcp: o, coordinate_system:
|
|
97
|
-
return { joint_position: t, tcp_pose: e, tcp: o, coordinate_system:
|
|
95
|
+
function _t(s) {
|
|
96
|
+
const { joint_position: t, tcp_pose: e, tcp: o, coordinate_system: i } = s;
|
|
97
|
+
return { joint_position: t, tcp_pose: e, tcp: o, coordinate_system: i };
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return
|
|
101
|
-
|
|
99
|
+
function It(s, t) {
|
|
100
|
+
return s.tcp === t.tcp && s.coordinate_system === t.coordinate_system && s.tcp_pose === void 0 == (t.tcp_pose === void 0) && G(
|
|
101
|
+
s.joint_position,
|
|
102
102
|
t.joint_position,
|
|
103
103
|
Qt
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
const ct = 1e-4;
|
|
107
107
|
class x {
|
|
108
|
-
constructor(t, e, o,
|
|
109
|
-
this.controller = e, this.motionGroup = o, this.description =
|
|
110
|
-
var
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
108
|
+
constructor(t, e, o, i, n, r, l = "cell", h = {}) {
|
|
109
|
+
this.controller = e, this.motionGroup = o, this.description = i, this.initialMotionState = n, this.motionStateSocket = r, this.cellId = l, this.nova = L(t), this.logger = h.logger ?? console, this.rapidlyChangingMotionState = n, r.addEventListener("message", (c) => {
|
|
110
|
+
var f;
|
|
111
|
+
const a = (f = b(c.data)) == null ? void 0 : f.result;
|
|
112
|
+
if (!a)
|
|
113
113
|
throw new Error(
|
|
114
114
|
`Failed to get motion state for ${this.motionGroupId}: ${c.data}`
|
|
115
115
|
);
|
|
116
|
-
|
|
116
|
+
Kt(
|
|
117
117
|
this.rapidlyChangingMotionState,
|
|
118
|
-
|
|
118
|
+
a,
|
|
119
119
|
ct
|
|
120
|
-
) ||
|
|
121
|
-
var p,
|
|
122
|
-
this.rapidlyChangingMotionState.tcp_pose == null ? this.rapidlyChangingMotionState.tcp_pose =
|
|
123
|
-
position:
|
|
124
|
-
orientation:
|
|
125
|
-
|
|
120
|
+
) || _(() => {
|
|
121
|
+
var p, y, u;
|
|
122
|
+
this.rapidlyChangingMotionState.tcp_pose == null ? this.rapidlyChangingMotionState.tcp_pose = a.tcp_pose : (p = a.tcp_pose) != null && p.orientation && ((y = a.tcp_pose) != null && y.position) && ((u = this.rapidlyChangingMotionState.tcp_pose) != null && u.orientation) ? this.rapidlyChangingMotionState.tcp_pose = {
|
|
123
|
+
position: a.tcp_pose.position,
|
|
124
|
+
orientation: St(
|
|
125
|
+
a.tcp_pose.orientation,
|
|
126
126
|
this.rapidlyChangingMotionState.tcp_pose.orientation
|
|
127
127
|
)
|
|
128
128
|
} : this.logger.debug("Received incomplete tcp_pose, ignoring", {
|
|
129
|
-
tcpPose:
|
|
129
|
+
tcpPose: a.tcp_pose
|
|
130
130
|
});
|
|
131
|
-
}),
|
|
131
|
+
}), Ht(
|
|
132
132
|
this.rapidlyChangingMotionState.joint_position,
|
|
133
|
-
|
|
133
|
+
a.joint_position,
|
|
134
134
|
ct
|
|
135
|
-
) ||
|
|
136
|
-
this.rapidlyChangingMotionState.joint_position =
|
|
137
|
-
}),
|
|
138
|
-
this.rapidlyChangingMotionState.tcp =
|
|
139
|
-
}), this.rapidlyChangingMotionState.standstill !==
|
|
140
|
-
this.rapidlyChangingMotionState.standstill =
|
|
135
|
+
) || _(() => {
|
|
136
|
+
this.rapidlyChangingMotionState.joint_position = a.joint_position;
|
|
137
|
+
}), a.tcp !== void 0 && this.rapidlyChangingMotionState.tcp !== a.tcp && _(() => {
|
|
138
|
+
this.rapidlyChangingMotionState.tcp = a.tcp;
|
|
139
|
+
}), this.rapidlyChangingMotionState.standstill !== a.standstill && _(() => {
|
|
140
|
+
this.rapidlyChangingMotionState.standstill = a.standstill;
|
|
141
141
|
});
|
|
142
|
-
const d = this.rapidlyChangingMotionState.joint_limit_reached.limit_reached, g =
|
|
143
|
-
d.some((p,
|
|
144
|
-
this.rapidlyChangingMotionState.joint_limit_reached =
|
|
145
|
-
}), this.rapidlyChangingMotionState.execute !==
|
|
146
|
-
this.rapidlyChangingMotionState.execute =
|
|
142
|
+
const d = this.rapidlyChangingMotionState.joint_limit_reached.limit_reached, g = a.joint_limit_reached.limit_reached;
|
|
143
|
+
d.some((p, y) => p !== g[y]) && _(() => {
|
|
144
|
+
this.rapidlyChangingMotionState.joint_limit_reached = a.joint_limit_reached;
|
|
145
|
+
}), this.rapidlyChangingMotionState.execute !== a.execute && _(() => {
|
|
146
|
+
this.rapidlyChangingMotionState.execute = a.execute;
|
|
147
147
|
});
|
|
148
148
|
}), j(this, {
|
|
149
149
|
logger: !1,
|
|
150
150
|
// keepAlive: pose readouts poll it from requestAnimationFrame, which
|
|
151
151
|
// MobX does not track, and a computed nobody observes is recomputed on
|
|
152
152
|
// every read without consulting `equals`
|
|
153
|
-
readoutState:
|
|
153
|
+
readoutState: mt({ equals: It, keepAlive: !0 })
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
static async open(t, e, o = {}) {
|
|
157
|
-
var
|
|
158
|
-
const
|
|
157
|
+
var y;
|
|
158
|
+
const i = L(t), n = o.cellId ?? z(t) ?? "cell", [r, l] = e.split("@"), h = await i.api.controller.getCurrentRobotControllerState(
|
|
159
159
|
n,
|
|
160
160
|
l
|
|
161
161
|
), c = h == null ? void 0 : h.motion_groups.find(
|
|
162
|
-
(
|
|
162
|
+
(u) => u.motion_group === e
|
|
163
163
|
);
|
|
164
164
|
if (!h || !c)
|
|
165
165
|
throw new Error(
|
|
166
166
|
`Controller ${l} or motion group ${e} not found`
|
|
167
167
|
);
|
|
168
|
-
const
|
|
168
|
+
const a = i.openReconnectingWebsocket(
|
|
169
169
|
`/cells/${n}/controllers/${l}/motion-groups/${e}/state-stream`
|
|
170
|
-
), d = await
|
|
170
|
+
), d = await a.firstMessage(), g = (y = b(d.data)) == null ? void 0 : y.result;
|
|
171
171
|
if (!g)
|
|
172
172
|
throw new Error(
|
|
173
173
|
`Unable to parse initial motion state message ${d.data}`
|
|
174
174
|
);
|
|
175
|
-
const
|
|
176
|
-
|
|
175
|
+
const f = o.logger ?? console;
|
|
176
|
+
f.info("Connected motion state websocket to motion group", {
|
|
177
177
|
motionGroup: c.motion_group,
|
|
178
178
|
initialMotionState: g
|
|
179
179
|
});
|
|
180
|
-
const p = await
|
|
180
|
+
const p = await i.api.motionGroup.getMotionGroupDescription(
|
|
181
181
|
n,
|
|
182
182
|
l,
|
|
183
183
|
c.motion_group
|
|
184
184
|
);
|
|
185
185
|
return new x(
|
|
186
|
-
|
|
186
|
+
i,
|
|
187
187
|
h,
|
|
188
188
|
c,
|
|
189
189
|
p,
|
|
190
190
|
g,
|
|
191
|
-
|
|
191
|
+
a,
|
|
192
192
|
n,
|
|
193
|
-
{ logger:
|
|
193
|
+
{ logger: f }
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* What pose readouts show (joints, TCP pose): it holds the previous reading
|
|
198
|
-
* while the joints only jitter
|
|
199
|
-
*
|
|
198
|
+
* while the joints only jitter (less than 0.0002 rad), and while the TCP and
|
|
199
|
+
* the coordinate system stay. Kept alive, so it also holds for untracked
|
|
200
|
+
* reads, e.g. from requestAnimationFrame.
|
|
200
201
|
*/
|
|
201
202
|
get readoutState() {
|
|
202
|
-
return
|
|
203
|
+
return _t(this.rapidlyChangingMotionState);
|
|
203
204
|
}
|
|
204
205
|
get motionGroupId() {
|
|
205
206
|
return this.motionGroup.motion_group;
|
|
@@ -216,12 +217,12 @@ class x {
|
|
|
216
217
|
this.motionStateSocket.close();
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
|
-
const lt = "Movement request rejected. Another client is currently executing a 'Jogging' motion!",
|
|
220
|
-
function
|
|
220
|
+
const lt = "Movement request rejected. Another client is currently executing a 'Jogging' motion!", zt = 1, Zt = 5e3;
|
|
221
|
+
function Xt(s) {
|
|
221
222
|
var e;
|
|
222
|
-
return (((e =
|
|
223
|
+
return (((e = s.times) == null ? void 0 : e[s.times.length - 1]) ?? 0) * 2e3 + Zt;
|
|
223
224
|
}
|
|
224
|
-
class
|
|
225
|
+
class Z {
|
|
225
226
|
constructor(t, e = {}) {
|
|
226
227
|
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;
|
|
227
228
|
}
|
|
@@ -246,25 +247,25 @@ class H {
|
|
|
246
247
|
* `dispose()` also closes the motion stream that this function opens.
|
|
247
248
|
*/
|
|
248
249
|
static async open(t, e, o = {}) {
|
|
249
|
-
const
|
|
250
|
+
const i = await x.open(
|
|
250
251
|
t,
|
|
251
252
|
e,
|
|
252
253
|
{
|
|
253
254
|
cellId: o.cellId,
|
|
254
255
|
logger: o.logger
|
|
255
256
|
}
|
|
256
|
-
), n = new
|
|
257
|
+
), n = new Z(i, o);
|
|
257
258
|
n.ownsMotionStream = !0;
|
|
258
259
|
try {
|
|
259
260
|
await n.setJoggingMode(n.mode);
|
|
260
|
-
} catch (
|
|
261
|
-
throw n.dispose(),
|
|
261
|
+
} catch (r) {
|
|
262
|
+
throw n.dispose(), r;
|
|
262
263
|
}
|
|
263
264
|
return n;
|
|
264
265
|
}
|
|
265
266
|
getDefaultTcp(t) {
|
|
266
|
-
var o,
|
|
267
|
-
const e = (
|
|
267
|
+
var o, i;
|
|
268
|
+
const e = (i = (o = t.description.dh_parameters) == null ? void 0 : o[0]) == null ? void 0 : i.type;
|
|
268
269
|
return t.joints.length < 6 && (e === O.RevoluteJoint || e === O.PrismaticJoint) ? this.NO_TCP : this.DEFAULT_TCP;
|
|
269
270
|
}
|
|
270
271
|
// Set a new tcp or other options. If current mode is jogging, will reinitialize the jogging websocket
|
|
@@ -320,11 +321,11 @@ class H {
|
|
|
320
321
|
var e, o;
|
|
321
322
|
(e = this.endJoggingInit) == null || e.call(this), (o = this.endIncrementalMotion) == null || o.call(this);
|
|
322
323
|
const t = [this.joggingSocket, this.trajectorySocket].filter(
|
|
323
|
-
(
|
|
324
|
+
(i) => i !== null
|
|
324
325
|
);
|
|
325
|
-
return t.forEach((
|
|
326
|
-
|
|
327
|
-
}), this.joggingSocket = null, this.trajectorySocket = null, Promise.all(t.map((
|
|
326
|
+
return t.forEach((i) => {
|
|
327
|
+
i.dispose();
|
|
328
|
+
}), this.joggingSocket = null, this.trajectorySocket = null, Promise.all(t.map((i) => i.closed()));
|
|
328
329
|
}
|
|
329
330
|
// Activate jogger in one of the supported modes
|
|
330
331
|
// Will iniitialize or close websockets as necessary
|
|
@@ -348,28 +349,28 @@ class H {
|
|
|
348
349
|
`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/jogging`
|
|
349
350
|
);
|
|
350
351
|
this.joggingSocket = o;
|
|
351
|
-
let
|
|
352
|
+
let i = !1;
|
|
352
353
|
const n = setTimeout(() => {
|
|
353
|
-
|
|
354
|
+
r(
|
|
354
355
|
new Error(`Jogging initialization timeout after ${this.timeout} ms`)
|
|
355
356
|
);
|
|
356
|
-
}, this.timeout),
|
|
357
|
-
|
|
358
|
-
}, l = () =>
|
|
359
|
-
o.disposed &&
|
|
357
|
+
}, this.timeout), r = (c) => {
|
|
358
|
+
i || (i = !0, clearTimeout(n), o.removeEventListener("close", h), this.endJoggingInit === l && (this.endJoggingInit = void 0), c ? e(c) : t());
|
|
359
|
+
}, l = () => r(), h = () => {
|
|
360
|
+
o.disposed && r();
|
|
360
361
|
};
|
|
361
362
|
this.endJoggingInit = l, o.addEventListener("close", h), o.addEventListener("message", (c) => {
|
|
362
|
-
var d, g,
|
|
363
|
-
const
|
|
364
|
-
if (((d =
|
|
365
|
-
|
|
363
|
+
var d, g, f;
|
|
364
|
+
const a = b(c.data);
|
|
365
|
+
if (((d = a == null ? void 0 : a.result) == null ? void 0 : d.kind) === "INITIALIZE_RECEIVED") {
|
|
366
|
+
r();
|
|
366
367
|
return;
|
|
367
368
|
}
|
|
368
|
-
if (((g =
|
|
369
|
-
if (this.onBlocked && ((
|
|
370
|
-
|
|
369
|
+
if (((g = a == null ? void 0 : a.result) == null ? void 0 : g.kind) === "MOTION_ERROR")
|
|
370
|
+
if (this.onBlocked && ((f = a == null ? void 0 : a.result) != null && f.message.includes(lt))) {
|
|
371
|
+
r(), o.dispose(), this.onBlocked();
|
|
371
372
|
return;
|
|
372
|
-
} else this.onError ? (
|
|
373
|
+
} else this.onError ? (r(), this.onError(c.data)) : r(new Error(c.data));
|
|
373
374
|
}), o.sendJson({
|
|
374
375
|
message_type: "InitializeJoggingRequest",
|
|
375
376
|
motion_group: this.motionGroupId,
|
|
@@ -384,7 +385,7 @@ class H {
|
|
|
384
385
|
joint: t,
|
|
385
386
|
direction: e,
|
|
386
387
|
velocityValue: o,
|
|
387
|
-
velocityUnit:
|
|
388
|
+
velocityUnit: i
|
|
388
389
|
}) {
|
|
389
390
|
if (!this.joggingSocket || this.mode !== "jogging")
|
|
390
391
|
throw new Error(
|
|
@@ -447,7 +448,7 @@ class H {
|
|
|
447
448
|
*/
|
|
448
449
|
get coordinateSystemRotation() {
|
|
449
450
|
if (!(this.orientation === "tool" || !this.coordinateSystem))
|
|
450
|
-
return
|
|
451
|
+
return At(this.coordinateSystem).quaternion;
|
|
451
452
|
}
|
|
452
453
|
/**
|
|
453
454
|
* Velocity vector along one axis of the jogging frame. The API takes TCP
|
|
@@ -455,8 +456,8 @@ class H {
|
|
|
455
456
|
* {@link JoggerConnection.coordinateSystem} is rotated into world here.
|
|
456
457
|
*/
|
|
457
458
|
velocityAlongAxis(t, e) {
|
|
458
|
-
const o =
|
|
459
|
-
return
|
|
459
|
+
const o = H(t, e), i = this.coordinateSystemRotation;
|
|
460
|
+
return i ? N(o, i) : o;
|
|
460
461
|
}
|
|
461
462
|
/**
|
|
462
463
|
* Trajectory jogging:
|
|
@@ -466,12 +467,16 @@ class H {
|
|
|
466
467
|
* The axis is one of the tool in tool orientation, else one of
|
|
467
468
|
* {@link JoggerConnection.coordinateSystem} (default: world).
|
|
468
469
|
*
|
|
469
|
-
* Promise resolves only after the motion has completed: once
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
470
|
+
* Promise resolves only after the motion has completed: once NOVA reports
|
|
471
|
+
* the trajectory at its end, or no longer as running (`stop()`), and the
|
|
472
|
+
* robot stands still, or after a watchdog of twice the planned duration
|
|
473
|
+
* plus 5 s, which also ends a step that never starts. A step requested
|
|
474
|
+
* while another one runs is dropped (resolves at once). Every error (a
|
|
475
|
+
* refused or failed plan, a refused trajectory, an error of the
|
|
476
|
+
* controller, the watchdog) goes to `onError`, or without it rejects the
|
|
477
|
+
* promise. A step that the robot may no longer make (see
|
|
478
|
+
* {@link IncrementalCartesianMotionRequest.refusedReason}) rejects with a
|
|
479
|
+
* `JoggingRefusedError`.
|
|
475
480
|
*/
|
|
476
481
|
async runIncrementalCartesianMotion(t) {
|
|
477
482
|
if (this.mode !== "trajectory")
|
|
@@ -482,7 +487,7 @@ class H {
|
|
|
482
487
|
this.incrementalMotionInFlight = !0;
|
|
483
488
|
try {
|
|
484
489
|
const e = await this.planIncrementalCartesianMotion(t);
|
|
485
|
-
e && await this.executeTrajectory(e);
|
|
490
|
+
e && await this.executeTrajectory(e, t.refusedReason);
|
|
486
491
|
} finally {
|
|
487
492
|
this.incrementalMotionInFlight = !1;
|
|
488
493
|
}
|
|
@@ -498,21 +503,21 @@ class H {
|
|
|
498
503
|
currentTcpPose: t,
|
|
499
504
|
currentJoints: e,
|
|
500
505
|
velocityInRelevantUnits: o,
|
|
501
|
-
axis:
|
|
506
|
+
axis: i,
|
|
502
507
|
direction: n,
|
|
503
|
-
motion:
|
|
508
|
+
motion: r
|
|
504
509
|
}) {
|
|
505
|
-
var
|
|
510
|
+
var y, u, m;
|
|
506
511
|
const l = [], h = qt({
|
|
507
512
|
currentTcpPose: t,
|
|
508
|
-
axis:
|
|
513
|
+
axis: i,
|
|
509
514
|
direction: n,
|
|
510
|
-
motion:
|
|
515
|
+
motion: r,
|
|
511
516
|
useToolCoordinateSystem: this.orientation === "tool",
|
|
512
517
|
coordinateSystemRotation: this.coordinateSystemRotation
|
|
513
518
|
});
|
|
514
519
|
l.push({
|
|
515
|
-
limits_override:
|
|
520
|
+
limits_override: r.type === "translate" ? { tcp_velocity_limit: o } : { tcp_orientation_velocity_limit: o },
|
|
516
521
|
path: {
|
|
517
522
|
path_definition_name: "PathLine",
|
|
518
523
|
target_pose: {
|
|
@@ -528,24 +533,24 @@ class H {
|
|
|
528
533
|
);
|
|
529
534
|
return;
|
|
530
535
|
}
|
|
531
|
-
const
|
|
532
|
-
motion_group_model: ((
|
|
536
|
+
const a = this.motionStream.rapidlyChangingMotionState.tcp, d = a ? (u = (y = c.tcps) == null ? void 0 : y[a]) == null ? void 0 : u.pose : void 0, g = {
|
|
537
|
+
motion_group_model: ((m = this.options) == null ? void 0 : m.motionGroupModel) ?? c.motion_group_model,
|
|
533
538
|
cycle_time: c.cycle_time,
|
|
534
539
|
mounting: c.mounting,
|
|
535
540
|
tcp_offset: d,
|
|
536
541
|
// FIXME use proper mode's limits if set
|
|
537
542
|
global: c.operation_limits.auto_limits
|
|
538
|
-
},
|
|
543
|
+
}, f = await this.nova.api.trajectoryPlanning.planTrajectory(
|
|
539
544
|
this.cellId,
|
|
540
545
|
{
|
|
541
546
|
motion_group_setup: g,
|
|
542
547
|
start_joint_position: e,
|
|
543
548
|
motion_commands: l
|
|
544
549
|
}
|
|
545
|
-
), p =
|
|
550
|
+
), p = f.response;
|
|
546
551
|
if (!p)
|
|
547
552
|
throw new Error(
|
|
548
|
-
`Failed to plan jogging increment motion ${JSON.stringify(
|
|
553
|
+
`Failed to plan jogging increment motion ${JSON.stringify(f)}`
|
|
549
554
|
);
|
|
550
555
|
if ("error_feedback" in p) {
|
|
551
556
|
if (this.onError) {
|
|
@@ -560,131 +565,184 @@ class H {
|
|
|
560
565
|
}
|
|
561
566
|
/**
|
|
562
567
|
* Execute a planned trajectory https://portal.wandelbots.io/docs/api/v2/ui/#/operations/executeTrajectory
|
|
563
|
-
* and resolve once the robot has
|
|
564
|
-
*
|
|
568
|
+
* and resolve once the robot has run it to its end and stands still again
|
|
569
|
+
* (see {@link JoggerConnection.waitForMotionToFinish}), so that the caller
|
|
570
|
+
* -- and with it the jogging UI's motion lock -- stays blocked for the
|
|
565
571
|
* whole motion. It also resolves when the jogger closes the websocket
|
|
566
572
|
* (`setJoggingMode`, `dispose`).
|
|
567
573
|
*
|
|
568
574
|
* Each call owns its own websocket. Sharing
|
|
569
575
|
* {@link JoggerConnection.trajectorySocket} across motions meant a finishing
|
|
570
576
|
* motion closed the socket of a later one.
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
577
|
+
*
|
|
578
|
+
* `refusedReason` is asked right before the trajectory and its start go to
|
|
579
|
+
* NOVA, see {@link IncrementalCartesianMotionRequest.refusedReason}
|
|
580
|
+
*/
|
|
581
|
+
async executeTrajectory(t, e = () => null) {
|
|
582
|
+
const o = e();
|
|
583
|
+
if (o)
|
|
584
|
+
throw new V(o);
|
|
585
|
+
const i = this.nova.openReconnectingWebsocket(
|
|
574
586
|
`/cells/${this.cellId}/controllers/${this.motionStream.controllerId}/execution/trajectory`
|
|
575
587
|
);
|
|
576
|
-
this.trajectorySocket =
|
|
577
|
-
const
|
|
578
|
-
let
|
|
588
|
+
this.trajectorySocket = i;
|
|
589
|
+
const n = new AbortController();
|
|
590
|
+
let r, l;
|
|
579
591
|
try {
|
|
580
|
-
await new Promise((
|
|
581
|
-
let
|
|
582
|
-
const
|
|
583
|
-
|
|
584
|
-
},
|
|
585
|
-
if (!
|
|
586
|
-
if (
|
|
587
|
-
this.onError(
|
|
592
|
+
await new Promise((h, c) => {
|
|
593
|
+
let a = !1;
|
|
594
|
+
const d = () => {
|
|
595
|
+
a || (a = !0, h());
|
|
596
|
+
}, g = (u) => {
|
|
597
|
+
if (!a) {
|
|
598
|
+
if (a = !0, this.onError) {
|
|
599
|
+
this.onError(u), h();
|
|
588
600
|
return;
|
|
589
601
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
`Failed to execute trajectory: ${JSON.stringify(
|
|
602
|
+
c(
|
|
603
|
+
u instanceof Error ? u : new Error(
|
|
604
|
+
`Failed to execute trajectory: ${JSON.stringify(u)}`
|
|
593
605
|
)
|
|
594
606
|
);
|
|
595
607
|
}
|
|
608
|
+
}, f = () => {
|
|
609
|
+
const u = e();
|
|
610
|
+
return u ? (a || (a = !0, c(new V(u))), !0) : !1;
|
|
596
611
|
};
|
|
597
|
-
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
new Error(`Jogging motion did not complete within ${
|
|
612
|
+
l = d, this.endIncrementalMotion = d;
|
|
613
|
+
const p = Xt(t);
|
|
614
|
+
r = setTimeout(() => {
|
|
615
|
+
g(
|
|
616
|
+
new Error(`Jogging motion did not complete within ${p}ms`)
|
|
602
617
|
);
|
|
603
|
-
},
|
|
604
|
-
var
|
|
605
|
-
const
|
|
606
|
-
if (!(
|
|
607
|
-
|
|
618
|
+
}, p), i.addEventListener("message", (u) => {
|
|
619
|
+
var M, w;
|
|
620
|
+
const m = (M = b(u.data)) == null ? void 0 : M.result;
|
|
621
|
+
if (!(m != null && m.kind)) {
|
|
622
|
+
g(
|
|
608
623
|
new Error(
|
|
609
|
-
`Failed to execute trajectory: Received invalid message ${
|
|
624
|
+
`Failed to execute trajectory: Received invalid message ${u.data}`
|
|
610
625
|
)
|
|
611
626
|
);
|
|
612
627
|
return;
|
|
613
628
|
}
|
|
614
|
-
if (this.onBlocked && ((
|
|
615
|
-
this.onBlocked(),
|
|
629
|
+
if (this.onBlocked && ((w = m.message) != null && w.includes(lt))) {
|
|
630
|
+
this.onBlocked(), d();
|
|
616
631
|
return;
|
|
617
632
|
}
|
|
618
|
-
if (
|
|
619
|
-
if (
|
|
620
|
-
|
|
633
|
+
if (m.kind === "INITIALIZE_RECEIVED") {
|
|
634
|
+
if (m.add_trajectory_error || m.message) {
|
|
635
|
+
g(m);
|
|
621
636
|
return;
|
|
622
637
|
}
|
|
623
|
-
|
|
638
|
+
if (f()) return;
|
|
639
|
+
i.sendJson({
|
|
624
640
|
message_type: "StartMovementRequest",
|
|
625
641
|
direction: "DIRECTION_FORWARD"
|
|
626
642
|
});
|
|
627
|
-
} else if (
|
|
628
|
-
if (
|
|
629
|
-
|
|
643
|
+
} else if (m.kind === "START_RECEIVED") {
|
|
644
|
+
if (m.message) {
|
|
645
|
+
g(m);
|
|
630
646
|
return;
|
|
631
647
|
}
|
|
632
|
-
this.waitForMotionToFinish(
|
|
633
|
-
|
|
648
|
+
this.waitForMotionToFinish(t, n.signal).then(
|
|
649
|
+
d,
|
|
650
|
+
g
|
|
651
|
+
);
|
|
652
|
+
} else m.kind === "PAUSE_RECEIVED" ? this.waitUntilStopped(n.signal).then(d, g) : m.kind === "MOTION_ERROR" && m.message ? g(m) : g(
|
|
634
653
|
new Error(
|
|
635
|
-
`Failed to execute trajectory, cannot handle message type "${
|
|
654
|
+
`Failed to execute trajectory, cannot handle message type "${m.kind}"`
|
|
636
655
|
)
|
|
637
|
-
)
|
|
638
|
-
}), e.sendJson({
|
|
639
|
-
message_type: "InitializeMovementRequest",
|
|
640
|
-
trajectory: {
|
|
641
|
-
message_type: "TrajectoryData",
|
|
642
|
-
motion_group: this.motionGroupId,
|
|
643
|
-
data: t,
|
|
644
|
-
tcp: this.tcp
|
|
645
|
-
}
|
|
656
|
+
);
|
|
646
657
|
});
|
|
658
|
+
const y = () => {
|
|
659
|
+
f() || i.sendJson({
|
|
660
|
+
message_type: "InitializeMovementRequest",
|
|
661
|
+
trajectory: {
|
|
662
|
+
message_type: "TrajectoryData",
|
|
663
|
+
motion_group: this.motionGroupId,
|
|
664
|
+
data: t,
|
|
665
|
+
tcp: this.tcp
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
};
|
|
669
|
+
if (i.readyState === zt)
|
|
670
|
+
y();
|
|
671
|
+
else {
|
|
672
|
+
const u = () => {
|
|
673
|
+
i.removeEventListener("open", u), y();
|
|
674
|
+
};
|
|
675
|
+
i.addEventListener("open", u);
|
|
676
|
+
}
|
|
647
677
|
});
|
|
648
678
|
} finally {
|
|
649
|
-
clearTimeout(
|
|
679
|
+
clearTimeout(r), n.abort(), this.endIncrementalMotion === l && (this.endIncrementalMotion = void 0), i.dispose(), this.trajectorySocket === i && (this.trajectorySocket = null);
|
|
650
680
|
}
|
|
651
681
|
}
|
|
652
682
|
/**
|
|
653
683
|
* Resolve once the robot has finished executing a trajectory.
|
|
654
684
|
*
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
685
|
+
* What says so is the execution state in the motion stream (`execute`),
|
|
686
|
+
* which NOVA gives to follow a movement. `standstill` alone does not: it
|
|
687
|
+
* says that NOVA treats the measured joint velocities as 0, which is so
|
|
688
|
+
* before the robot picks up speed and can be so for the whole of a slow
|
|
689
|
+
* motion. A step that took `standstill` as its end closed its websocket,
|
|
690
|
+
* and with it stopped the robot, soon after the start of a 5° turn at
|
|
691
|
+
* 1 °/s.
|
|
692
|
+
*
|
|
693
|
+
* So the step is over when NOVA has run the trajectory to its end, or no
|
|
694
|
+
* longer runs it after it did (NOVA executes nothing any more), and the
|
|
695
|
+
* robot stands still. A step that never starts does not get here: the
|
|
696
|
+
* watchdog of `executeTrajectory` ends it with an error.
|
|
697
|
+
*/
|
|
698
|
+
async waitForMotionToFinish(t, e) {
|
|
699
|
+
const { locations: o } = t, i = (((o == null ? void 0 : o[0]) ?? 0) + ((o == null ? void 0 : o[o.length - 1]) ?? 0)) / 2, n = () => {
|
|
700
|
+
const r = this.executedTrajectory;
|
|
701
|
+
return (r == null ? void 0 : r.state.kind) === "END_OF_TRAJECTORY" && r.location >= i;
|
|
702
|
+
};
|
|
703
|
+
await k(() => this.isTrajectoryRunning || n(), { signal: e }), await this.waitUntilStopped(e);
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Resolve once NOVA no longer runs a trajectory and the robot stands
|
|
707
|
+
* still: at the end of the trajectory, or after a pause
|
|
708
|
+
*/
|
|
709
|
+
async waitUntilStopped(t) {
|
|
710
|
+
await k(
|
|
711
|
+
() => !this.isTrajectoryRunning && this.motionStream.rapidlyChangingMotionState.standstill,
|
|
712
|
+
{ signal: t }
|
|
713
|
+
);
|
|
714
|
+
}
|
|
715
|
+
/** The trajectory that NOVA executes now, as the motion stream reports it */
|
|
716
|
+
get executedTrajectory() {
|
|
717
|
+
var e;
|
|
718
|
+
const t = (e = this.motionStream.rapidlyChangingMotionState.execute) == null ? void 0 : e.details;
|
|
719
|
+
return (t == null ? void 0 : t.kind) === "TRAJECTORY" ? t : void 0;
|
|
720
|
+
}
|
|
721
|
+
/** Whether NOVA moves the robot along a trajectory, or is about to */
|
|
722
|
+
get isTrajectoryRunning() {
|
|
723
|
+
var e;
|
|
724
|
+
const t = (e = this.executedTrajectory) == null ? void 0 : e.state.kind;
|
|
725
|
+
return t === "RUNNING" || t === "WAIT_FOR_IO";
|
|
668
726
|
}
|
|
669
727
|
}
|
|
670
|
-
function
|
|
671
|
-
var t, e, o,
|
|
672
|
-
if (typeof
|
|
673
|
-
const
|
|
674
|
-
return
|
|
675
|
-
}
|
|
676
|
-
if (
|
|
677
|
-
const
|
|
728
|
+
function jt(s) {
|
|
729
|
+
var t, e, o, i, n;
|
|
730
|
+
if (typeof s == "string") {
|
|
731
|
+
const r = b(s);
|
|
732
|
+
return r ? jt(r) : s;
|
|
733
|
+
}
|
|
734
|
+
if (s && typeof s == "object") {
|
|
735
|
+
const r = s;
|
|
678
736
|
return (
|
|
679
737
|
// PlanTrajectoryFailedResponse: the feedback name identifies the
|
|
680
738
|
// failure cause (e.g. "FeedbackSingularity") and is translated to a
|
|
681
739
|
// friendly message by getJogErrorTranslationKey
|
|
682
|
-
((t =
|
|
740
|
+
((t = r.error_feedback) == null ? void 0 : t.error_feedback_name) || ((e = r.add_trajectory_error) == null ? void 0 : e.message) || r.message || ((i = (o = r.result) == null ? void 0 : o.add_trajectory_error) == null ? void 0 : i.message) || ((n = r.result) == null ? void 0 : n.message) || "Jogging motion failed"
|
|
683
741
|
);
|
|
684
742
|
}
|
|
685
743
|
return "Jogging motion failed";
|
|
686
744
|
}
|
|
687
|
-
const
|
|
745
|
+
const te = [
|
|
688
746
|
// Trajectory-planning failure causes, identified by the error_feedback_name
|
|
689
747
|
// of a PlanTrajectoryFailedResponse (see extractJogErrorMessage)
|
|
690
748
|
{
|
|
@@ -714,55 +772,62 @@ const Xt = [
|
|
|
714
772
|
translationKey: "Jogging.StreamStateSection.Error.PlanningFailed.lb"
|
|
715
773
|
}
|
|
716
774
|
];
|
|
717
|
-
function
|
|
775
|
+
function ee(s) {
|
|
718
776
|
var t;
|
|
719
|
-
return ((t =
|
|
777
|
+
return ((t = te.find(({ pattern: e }) => e.test(s))) == null ? void 0 : t.translationKey) ?? null;
|
|
720
778
|
}
|
|
721
|
-
const
|
|
722
|
-
function
|
|
723
|
-
var o,
|
|
779
|
+
const oe = 5, ie = 250;
|
|
780
|
+
function se(s) {
|
|
781
|
+
var o, i, n, r;
|
|
724
782
|
const t = [
|
|
725
|
-
(
|
|
726
|
-
(
|
|
783
|
+
(i = (o = s == null ? void 0 : s.manual_t1_limits) == null ? void 0 : o.tcp) == null ? void 0 : i.velocity,
|
|
784
|
+
(r = (n = s == null ? void 0 : s.manual_limits) == null ? void 0 : n.tcp) == null ? void 0 : r.velocity
|
|
727
785
|
].filter(
|
|
728
786
|
(l) => typeof l == "number" && Number.isFinite(l) && l > 0
|
|
729
787
|
);
|
|
730
|
-
return Math.min(
|
|
788
|
+
return Math.min(ie, ...t) / 10;
|
|
731
789
|
}
|
|
732
|
-
const
|
|
790
|
+
const Q = [
|
|
733
791
|
{ id: "0.1", mm: 0.1, degrees: 0.05 },
|
|
734
792
|
{ id: "1", mm: 1, degrees: 0.5 },
|
|
735
793
|
{ id: "5", mm: 5, degrees: 2.5 },
|
|
736
794
|
{ id: "10", mm: 10, degrees: 5 }
|
|
737
|
-
],
|
|
795
|
+
], ne = [
|
|
738
796
|
{ id: "continuous" },
|
|
739
|
-
...
|
|
740
|
-
],
|
|
797
|
+
...Q
|
|
798
|
+
], Ke = ["coordsys", "tool"], dt = "joggingToolStore", ht = { code: "locked" }, re = () => typeof localStorage > "u" ? void 0 : localStorage;
|
|
741
799
|
class $ {
|
|
742
|
-
constructor(t, e, o,
|
|
743
|
-
var h, c,
|
|
744
|
-
this.jogger = t, this.coordSystems = e, this.motionGroupDescription = o, this.tcps =
|
|
800
|
+
constructor(t, e, o, i, n, r = {}) {
|
|
801
|
+
var h, c, a;
|
|
802
|
+
this.jogger = t, this.coordSystems = e, this.motionGroupDescription = o, this.tcps = i, this.inverseSolverValue = n, this.selectedTabId = "cartesian", this.locks = /* @__PURE__ */ 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 = oe, 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 = O.RevoluteJoint, this.jogPress = 0, this.stoppedLast = !1, this.runningStep = null, this.disposed = !1, this.endHeldJogWatch = null, this.storage = r.storage ?? re(), this.notMoveableReason = r.notMoveableReason;
|
|
745
803
|
for (const d of e)
|
|
746
804
|
if (d.coordinate_system === "") {
|
|
747
805
|
d.coordinate_system = "world";
|
|
748
806
|
break;
|
|
749
807
|
}
|
|
750
|
-
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 =
|
|
808
|
+
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 = se(
|
|
751
809
|
o == null ? void 0 : o.operation_limits
|
|
752
|
-
), this.jointType = ((
|
|
810
|
+
), this.jointType = ((a = (c = o == null ? void 0 : o.dh_parameters) == null ? void 0 : c[0]) == null ? void 0 : a.type) ?? O.RevoluteJoint, j(
|
|
753
811
|
this,
|
|
754
|
-
{
|
|
812
|
+
{
|
|
813
|
+
storage: !1,
|
|
814
|
+
notMoveableReason: !1,
|
|
815
|
+
jogPress: !1,
|
|
816
|
+
stoppedLast: !1,
|
|
817
|
+
runningStep: !1,
|
|
818
|
+
endHeldJogWatch: !1
|
|
819
|
+
},
|
|
755
820
|
{ autoBind: !0 }
|
|
756
821
|
), this.jogger.onBlocked = () => {
|
|
757
822
|
this.block();
|
|
758
823
|
};
|
|
759
824
|
const l = this.jogger.onError;
|
|
760
825
|
this.jogger.onError = (d) => {
|
|
761
|
-
this.setLastJogError(
|
|
762
|
-
}, this.loadFromLocalStorage(), this.disposers.push(
|
|
763
|
-
|
|
826
|
+
this.setLastJogError(jt(d)), l == null || l(d);
|
|
827
|
+
}, this.loadFromLocalStorage(), this.disposers.push(X(() => this.saveToLocalStorage())), this.disposers.push(
|
|
828
|
+
X(() => {
|
|
764
829
|
const d = this.jogger.motionStream.rapidlyChangingMotionState.tcp;
|
|
765
|
-
d && d !== this.selectedTcpId &&
|
|
830
|
+
d && d !== this.selectedTcpId && _(() => {
|
|
766
831
|
this.selectedTcpId = d, this.tcpChangeInProgress = !1;
|
|
767
832
|
});
|
|
768
833
|
})
|
|
@@ -773,27 +838,27 @@ class $ {
|
|
|
773
838
|
* from the backend
|
|
774
839
|
*/
|
|
775
840
|
static async loadFor(t, e = {}) {
|
|
776
|
-
const { nova: o, cellId:
|
|
841
|
+
const { nova: o, cellId: i } = t, [n, r] = await Promise.all([
|
|
777
842
|
// Fetch coord systems so user can select between them
|
|
778
843
|
o.api.controller.listCoordinateSystems(
|
|
779
|
-
|
|
844
|
+
i,
|
|
780
845
|
t.motionStream.controllerId,
|
|
781
846
|
"ROTATION_VECTOR"
|
|
782
847
|
),
|
|
783
848
|
// Same for TCPs and other info from description
|
|
784
849
|
o.api.motionGroup.getMotionGroupDescription(
|
|
785
|
-
|
|
850
|
+
i,
|
|
786
851
|
t.motionStream.controllerId,
|
|
787
852
|
t.motionGroupId
|
|
788
853
|
)
|
|
789
854
|
]), l = await o.api.motionGroupModels.getMotionGroupKinematicModel(
|
|
790
|
-
|
|
855
|
+
r.motion_group_model
|
|
791
856
|
);
|
|
792
857
|
return $.create(
|
|
793
858
|
t,
|
|
794
859
|
{
|
|
795
860
|
coordinateSystems: n || [],
|
|
796
|
-
description:
|
|
861
|
+
description: r,
|
|
797
862
|
kinematicModel: l
|
|
798
863
|
},
|
|
799
864
|
e
|
|
@@ -806,7 +871,7 @@ class $ {
|
|
|
806
871
|
* instead of {@link JoggingStore.loadFor}.
|
|
807
872
|
*/
|
|
808
873
|
static create(t, e, o = {}) {
|
|
809
|
-
const { coordinateSystems:
|
|
874
|
+
const { coordinateSystems: i, description: n, kinematicModel: r } = e, l = Object.entries(n.tcps || {}).map(([h, c]) => ({
|
|
810
875
|
id: h,
|
|
811
876
|
readable_name: c.name,
|
|
812
877
|
position: c.pose.position,
|
|
@@ -814,20 +879,26 @@ class $ {
|
|
|
814
879
|
}));
|
|
815
880
|
return new $(
|
|
816
881
|
t,
|
|
817
|
-
|
|
882
|
+
i,
|
|
818
883
|
n,
|
|
819
884
|
l,
|
|
820
|
-
|
|
885
|
+
r.inverse_solver,
|
|
821
886
|
o
|
|
822
887
|
);
|
|
823
888
|
}
|
|
889
|
+
/**
|
|
890
|
+
* Closes the jogger's websockets. The store starts no jog afterwards: a
|
|
891
|
+
* start rejects with a {@link JoggingRefusedError} ("disconnected"), and
|
|
892
|
+
* opens nothing.
|
|
893
|
+
*/
|
|
824
894
|
dispose() {
|
|
895
|
+
this.disposed = !0;
|
|
825
896
|
for (const t of this.disposers)
|
|
826
897
|
t();
|
|
827
898
|
this.jogger.dispose();
|
|
828
899
|
}
|
|
829
900
|
get coordSystemCountByName() {
|
|
830
|
-
return
|
|
901
|
+
return Lt(this.coordSystems, (t) => t.name);
|
|
831
902
|
}
|
|
832
903
|
async deactivate() {
|
|
833
904
|
this.jogger.mode === "jogging" && await this.jogger.setJoggingMode("off");
|
|
@@ -841,12 +912,18 @@ class $ {
|
|
|
841
912
|
* Rejects with a {@link JoggingRefusedError} while the store is locked or
|
|
842
913
|
* its owner says that the robot may not move (see
|
|
843
914
|
* {@link JoggingStoreOptions}): nothing is sent to the robot then, and no
|
|
844
|
-
* jogging websocket opens.
|
|
915
|
+
* jogging websocket opens. Also when that came to be while the jogging
|
|
916
|
+
* websocket opened: the store closes it again.
|
|
845
917
|
*
|
|
846
918
|
* {@link JoggingStore.startCartesianJogging},
|
|
847
919
|
* {@link JoggingStore.startJointJogging} and
|
|
848
920
|
* {@link JoggingStore.runIncrementalCartesianJog} activate what they need
|
|
849
921
|
* themselves.
|
|
922
|
+
*
|
|
923
|
+
* @deprecated Only `JoggingPanel` (deprecated) calls it: it activates for
|
|
924
|
+
* the panel's tab. Jog with the methods above, which activate for their
|
|
925
|
+
* jog; a robot session hands the robot to jogging with
|
|
926
|
+
* `session.ensureMovementOwnership("jogging")`.
|
|
850
927
|
*/
|
|
851
928
|
async activate() {
|
|
852
929
|
return this.currentTab.id !== "cartesian" ? this.activateFor("joint") : this.activateFor(
|
|
@@ -862,24 +939,65 @@ class $ {
|
|
|
862
939
|
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({
|
|
863
940
|
tcp: this.selectedTcpId || void 0,
|
|
864
941
|
orientation: this.selectedOrientation
|
|
865
|
-
}), this.jogger.coordinateSystem = this.jogCoordSystem), await this.jogger.setJoggingMode(
|
|
866
|
-
|
|
867
|
-
|
|
942
|
+
}), this.jogger.coordinateSystem = this.jogCoordSystem), t === "cartesianStep" ? await this.jogger.setJoggingMode("trajectory") : await this.openJoggingWebsocket(), this.jogger;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Opens the jogging websocket of the jogger, unless a jog may not start
|
|
946
|
+
* (see {@link JoggingStore.refuseUnlessJoggable}). It is a movement
|
|
947
|
+
* connection, for which NOVA switches a controller to control mode by
|
|
948
|
+
* itself and holds it there: the store opens it only here, for a jog, a
|
|
949
|
+
* TCP change or its robot session.
|
|
950
|
+
*
|
|
951
|
+
* It asks before it opens the websocket, and again once it is open: that
|
|
952
|
+
* takes 0.1 to 0.5 s, in which the robot may have been deactivated or
|
|
953
|
+
* stopped. Refused then, the websocket closes again before anything moves.
|
|
954
|
+
*
|
|
955
|
+
* `reinitialize` opens it anew when it is open already, for another TCP.
|
|
956
|
+
*/
|
|
957
|
+
async openJoggingWebsocket(t = !1) {
|
|
958
|
+
this.refuseUnlessJoggable(), t ? await this.jogger.setJoggingMode("jogging", !1) : await this.jogger.setJoggingMode("jogging");
|
|
959
|
+
try {
|
|
960
|
+
this.refuseUnlessJoggable();
|
|
961
|
+
} catch (e) {
|
|
962
|
+
throw await this.deactivate(), e;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Hands the jogger to jogging: opens its jogging websocket, as a held jog
|
|
967
|
+
* does, and rejects with a {@link JoggingRefusedError} as one.
|
|
968
|
+
* @internal For the store's robot session, see
|
|
969
|
+
* `RobotSession.ensureMovementOwnership`
|
|
970
|
+
*/
|
|
971
|
+
async claimForJogging() {
|
|
972
|
+
await this.openJoggingWebsocket();
|
|
868
973
|
}
|
|
869
974
|
/**
|
|
870
|
-
* Throws a {@link JoggingRefusedError} while a jog may not start:
|
|
871
|
-
*
|
|
872
|
-
*
|
|
873
|
-
*
|
|
975
|
+
* Throws a {@link JoggingRefusedError} while a jog may not start: once
|
|
976
|
+
* the store is disposed ("disconnected"), with the
|
|
977
|
+
* owner's reason that the robot may not move, else while another client
|
|
978
|
+
* holds the jogging connection ({@link JoggingStore.blocked}), else while
|
|
979
|
+
* the store is locked. `ownLock` is the lock of the step that asks: it
|
|
980
|
+
* locks the store against other jogs, not against itself.
|
|
874
981
|
*/
|
|
875
982
|
refuseUnlessJoggable(t) {
|
|
983
|
+
const e = this.refusedReason(t);
|
|
984
|
+
if (e)
|
|
985
|
+
throw new V(e);
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Why a jog may not start now, or null: see
|
|
989
|
+
* {@link JoggingStore.refuseUnlessJoggable}. Observed while a step runs,
|
|
990
|
+
* which it stops.
|
|
991
|
+
*/
|
|
992
|
+
refusedReason(t) {
|
|
876
993
|
var o;
|
|
994
|
+
if (this.disposed) return { code: "disconnected" };
|
|
877
995
|
const e = ((o = this.notMoveableReason) == null ? void 0 : o.call(this)) ?? null;
|
|
878
|
-
if (e)
|
|
879
|
-
|
|
880
|
-
for (const
|
|
881
|
-
if (
|
|
882
|
-
|
|
996
|
+
if (e) return e;
|
|
997
|
+
if (this.blocked) return { code: "blocked" };
|
|
998
|
+
for (const i of this.locks)
|
|
999
|
+
if (i !== t) return { code: "locked" };
|
|
1000
|
+
return null;
|
|
883
1001
|
}
|
|
884
1002
|
/**
|
|
885
1003
|
* Starts jogging the TCP along an axis (`translate`) or about it
|
|
@@ -891,11 +1009,17 @@ class $ {
|
|
|
891
1009
|
* later. A press that was stopped by then, or that another press followed,
|
|
892
1010
|
* moves nothing. Rejects with a {@link JoggingRefusedError} as
|
|
893
1011
|
* {@link JoggingStore.activate} does: while the store is locked or the
|
|
894
|
-
* robot may not move
|
|
1012
|
+
* robot may not move, also when that came to be while the websocket
|
|
1013
|
+
* opened.
|
|
1014
|
+
*
|
|
1015
|
+
* A jog that moves is stopped as by its release (see
|
|
1016
|
+
* {@link JoggingStore.stopJogging}) once a jog would be refused: when the
|
|
1017
|
+
* robot may no longer move, another client takes the jogging connection or
|
|
1018
|
+
* the store gets locked. It stays stopped until the next press, also when
|
|
1019
|
+
* the reason goes away; the release still comes and changes nothing.
|
|
895
1020
|
*/
|
|
896
1021
|
async startCartesianJogging(t, e, o) {
|
|
897
|
-
|
|
898
|
-
await this.activateFor("cartesian"), s === this.jogPress && (t === "translate" ? await this.jogger.translateTCP({
|
|
1022
|
+
await this.openForHeldJog("cartesian") && (t === "translate" ? await this.jogger.translateTCP({
|
|
899
1023
|
axis: e,
|
|
900
1024
|
direction: o,
|
|
901
1025
|
velocityMmPerSec: this.translationVelocityMmPerSec
|
|
@@ -903,25 +1027,69 @@ class $ {
|
|
|
903
1027
|
axis: e,
|
|
904
1028
|
direction: o,
|
|
905
1029
|
velocityRadsPerSec: this.rotationVelocityRadsPerSec
|
|
906
|
-
}));
|
|
1030
|
+
}), this.watchHeldJog());
|
|
907
1031
|
}
|
|
908
1032
|
/**
|
|
909
1033
|
* Starts jogging one joint (by its index) until
|
|
910
1034
|
* {@link JoggingStore.stopJogging}, with the store's rotation velocity, or
|
|
911
1035
|
* its translation velocity for a linear axis. As
|
|
912
1036
|
* {@link JoggingStore.startCartesianJogging}, for a control that is held,
|
|
913
|
-
* and refused as it.
|
|
1037
|
+
* and refused and stopped as it.
|
|
914
1038
|
*/
|
|
915
1039
|
async startJointJogging(t, e) {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
const s = this.jointType === O.PrismaticJoint;
|
|
1040
|
+
if (!await this.openForHeldJog("joint")) return;
|
|
1041
|
+
const o = this.jointType === O.PrismaticJoint;
|
|
919
1042
|
await this.jogger.rotateJoints({
|
|
920
1043
|
joint: t,
|
|
921
1044
|
direction: e,
|
|
922
|
-
velocityUnit:
|
|
923
|
-
velocityValue:
|
|
924
|
-
});
|
|
1045
|
+
velocityUnit: o ? "mm/s" : "rad/s",
|
|
1046
|
+
velocityValue: o ? this.translationVelocityMmPerSec : this.rotationVelocityRadsPerSec
|
|
1047
|
+
}), this.watchHeldJog();
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Follows the held jog that moves now, until its release or the press
|
|
1051
|
+
* that follows it: stops it as its release does once a jog would be
|
|
1052
|
+
* refused, see {@link JoggingStore.startCartesianJogging}. NOVA jogs on
|
|
1053
|
+
* at the last velocity for as long as the jogging websocket is open.
|
|
1054
|
+
*/
|
|
1055
|
+
watchHeldJog() {
|
|
1056
|
+
var o;
|
|
1057
|
+
(o = this.endHeldJogWatch) == null || o.call(this);
|
|
1058
|
+
const t = v(
|
|
1059
|
+
() => this.refusedReason(),
|
|
1060
|
+
(i) => {
|
|
1061
|
+
i && this.stopJogging().catch((n) => {
|
|
1062
|
+
console.error("Failed to stop jogging:", n);
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
), e = () => {
|
|
1066
|
+
t(), this.endHeldJogWatch === e && (this.endHeldJogWatch = null);
|
|
1067
|
+
};
|
|
1068
|
+
this.endHeldJogWatch = e;
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Opens the jogging websocket for a held jog. Resolves to whether this
|
|
1072
|
+
* press is still the latest once it is open: a press that was stopped by
|
|
1073
|
+
* then, or that another press followed, moves nothing.
|
|
1074
|
+
*
|
|
1075
|
+
* A start that fails or is refused leaves no jogging websocket open. A stop
|
|
1076
|
+
* that came in the same event kept it for this start (see
|
|
1077
|
+
* {@link JoggingStore.stopJogging}), and no other stop may follow. A stop
|
|
1078
|
+
* that came while the start waited, before the websocket opened (for
|
|
1079
|
+
* `onBeforeActivate`, or for the TCP and orientation), found nothing to
|
|
1080
|
+
* close: the start closes it then, unless another press followed the
|
|
1081
|
+
* stop, which owns it.
|
|
1082
|
+
*/
|
|
1083
|
+
async openForHeldJog(t) {
|
|
1084
|
+
const e = ++this.jogPress;
|
|
1085
|
+
this.stoppedLast = !1;
|
|
1086
|
+
try {
|
|
1087
|
+
await this.activateFor(t);
|
|
1088
|
+
} catch (o) {
|
|
1089
|
+
throw (e === this.jogPress || this.stoppedLast) && await this.deactivate().catch(() => {
|
|
1090
|
+
}), o;
|
|
1091
|
+
}
|
|
1092
|
+
return e === this.jogPress ? !0 : (this.stoppedLast && await this.deactivate(), !1);
|
|
925
1093
|
}
|
|
926
1094
|
/**
|
|
927
1095
|
* Stops the jog of {@link JoggingStore.startCartesianJogging} or
|
|
@@ -931,10 +1099,14 @@ class $ {
|
|
|
931
1099
|
*
|
|
932
1100
|
* A start that comes while the robot is told to stop keeps the websocket,
|
|
933
1101
|
* e.g. a joint slider that turns around stops and starts in one event.
|
|
1102
|
+
*
|
|
1103
|
+
* A step that runs is no held jog, and is left alone: a held jog is
|
|
1104
|
+
* refused meanwhile, so the stop of its control belongs to none.
|
|
934
1105
|
*/
|
|
935
1106
|
async stopJogging() {
|
|
1107
|
+
var e;
|
|
936
1108
|
const t = ++this.jogPress;
|
|
937
|
-
await this.jogger.stop(), t === this.jogPress && await this.deactivate();
|
|
1109
|
+
this.stoppedLast = !0, (e = this.endHeldJogWatch) == null || e.call(this), this.runningStep || await this.jogger.stop(), t === this.jogPress && await this.deactivate();
|
|
938
1110
|
}
|
|
939
1111
|
/**
|
|
940
1112
|
* Moves the TCP one step along an axis (`translate`, by the increment's
|
|
@@ -949,35 +1121,103 @@ class $ {
|
|
|
949
1121
|
* {@link JoggingRefusedError} as {@link JoggingStore.activate} does: while
|
|
950
1122
|
* the store is locked, so also while another step runs, or the robot may
|
|
951
1123
|
* not move.
|
|
952
|
-
|
|
953
|
-
|
|
1124
|
+
*
|
|
1125
|
+
* A step that the robot may no longer make is stopped: when the robot may
|
|
1126
|
+
* no longer move, another client takes the jogging connection or
|
|
1127
|
+
* something else locks the store. Before its trajectory went to NOVA
|
|
1128
|
+
* (planning it takes a round trip) or was started, it rejects with a
|
|
1129
|
+
* {@link JoggingRefusedError} then; once it runs, it is paused and
|
|
1130
|
+
* resolves when the robot stands still. A stopped step stays stopped,
|
|
1131
|
+
* also when the reason goes away.
|
|
1132
|
+
*/
|
|
1133
|
+
async runIncrementalCartesianJog(t, e, o, i) {
|
|
954
1134
|
this.refuseUnlessJoggable(), await this.withOwnLock(async (n) => {
|
|
1135
|
+
const r = this.watchStep(n);
|
|
955
1136
|
try {
|
|
956
|
-
const
|
|
957
|
-
if (!
|
|
958
|
-
this.setCurrentIncrementJog({ axis: e, direction: o }), await
|
|
959
|
-
currentTcpPose:
|
|
960
|
-
currentJoints:
|
|
1137
|
+
const l = await this.activateFor("cartesianStep", n), h = l.motionStream.rapidlyChangingMotionState;
|
|
1138
|
+
if (!h.tcp_pose) return;
|
|
1139
|
+
this.setCurrentIncrementJog({ axis: e, direction: o }), await l.runIncrementalCartesianMotion({
|
|
1140
|
+
currentTcpPose: h.tcp_pose,
|
|
1141
|
+
currentJoints: h.joint_position,
|
|
961
1142
|
velocityInRelevantUnits: t === "translate" ? this.translationVelocityMmPerSec : this.rotationVelocityRadsPerSec,
|
|
962
1143
|
axis: e,
|
|
963
1144
|
direction: o,
|
|
964
|
-
motion: t === "translate" ? { type: "translate", distanceMm:
|
|
1145
|
+
motion: t === "translate" ? { type: "translate", distanceMm: i.mm } : {
|
|
965
1146
|
type: "rotate",
|
|
966
|
-
distanceRads: Ct(
|
|
967
|
-
}
|
|
1147
|
+
distanceRads: Ct(i.degrees)
|
|
1148
|
+
},
|
|
1149
|
+
// The jogger asks right before the step goes to NOVA
|
|
1150
|
+
refusedReason: r.refusedReason
|
|
968
1151
|
});
|
|
1152
|
+
} catch (l) {
|
|
1153
|
+
if (r.stoppedByStarter() && l instanceof V)
|
|
1154
|
+
return;
|
|
1155
|
+
throw l;
|
|
969
1156
|
} finally {
|
|
970
|
-
this.setCurrentIncrementJog(null), await this.deactivate();
|
|
1157
|
+
r.end(), this.setCurrentIncrementJog(null), await this.deactivate();
|
|
971
1158
|
}
|
|
972
1159
|
});
|
|
973
1160
|
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Stops the step that runs, and resolves once it is over: the robot
|
|
1163
|
+
* stands still and its trajectory websocket is closed. Resolves at once
|
|
1164
|
+
* without a step.
|
|
1165
|
+
*
|
|
1166
|
+
* With a reason, as when the robot may no longer move (see
|
|
1167
|
+
* {@link JoggingStore.runIncrementalCartesianJog}): a step that has not
|
|
1168
|
+
* gone to NOVA yet rejects with a {@link JoggingRefusedError} of it.
|
|
1169
|
+
* Without one, its starter stops it, as the release of a held jog: a step
|
|
1170
|
+
* that has not gone to NOVA yet moves nothing and resolves.
|
|
1171
|
+
* @internal For the store's robot session (a step holds the controller in
|
|
1172
|
+
* control mode, and NOVA runs it to its end, so it goes before the robot
|
|
1173
|
+
* is deactivated), and for the panel that started the step
|
|
1174
|
+
*/
|
|
1175
|
+
async stopIncrementalJog(t) {
|
|
1176
|
+
const e = this.runningStep;
|
|
1177
|
+
e && (e.stop(t), await e.over);
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Follows the step of the lock `lock` until `end`: stops it once a jog
|
|
1181
|
+
* would be refused for another reason than its own lock, see
|
|
1182
|
+
* {@link JoggingStore.runIncrementalCartesianJog}. `refusedReason` is what
|
|
1183
|
+
* the jogger asks: the reason that stopped the step, else why a jog would
|
|
1184
|
+
* be refused now.
|
|
1185
|
+
*/
|
|
1186
|
+
watchStep(t) {
|
|
1187
|
+
let e = null, o = () => {
|
|
1188
|
+
};
|
|
1189
|
+
const i = {
|
|
1190
|
+
stop: (r = ht) => {
|
|
1191
|
+
e || (e = r, this.jogger.stop().catch((l) => {
|
|
1192
|
+
console.error("Failed to stop the step:", l);
|
|
1193
|
+
}));
|
|
1194
|
+
},
|
|
1195
|
+
over: new Promise((r) => {
|
|
1196
|
+
o = r;
|
|
1197
|
+
})
|
|
1198
|
+
};
|
|
1199
|
+
this.runningStep = i;
|
|
1200
|
+
const n = v(
|
|
1201
|
+
() => this.refusedReason(t),
|
|
1202
|
+
(r) => {
|
|
1203
|
+
r && i.stop(r);
|
|
1204
|
+
}
|
|
1205
|
+
);
|
|
1206
|
+
return {
|
|
1207
|
+
refusedReason: () => e ?? this.refusedReason(t),
|
|
1208
|
+
stoppedByStarter: () => e === ht,
|
|
1209
|
+
end: () => {
|
|
1210
|
+
n(), this.runningStep === i && (this.runningStep = null), o();
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
974
1214
|
/**
|
|
975
1215
|
* Takes the user's settings from the storage (see
|
|
976
1216
|
* {@link JoggingStoreOptions}), which is `localStorage` only by default
|
|
977
1217
|
*/
|
|
978
1218
|
loadFromLocalStorage() {
|
|
979
1219
|
var o;
|
|
980
|
-
const t = (o = this.storage) == null ? void 0 : o.getItem(dt), e = t ?
|
|
1220
|
+
const t = (o = this.storage) == null ? void 0 : o.getItem(dt), e = t ? b(t) : void 0;
|
|
981
1221
|
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));
|
|
982
1222
|
}
|
|
983
1223
|
/**
|
|
@@ -999,7 +1239,7 @@ class $ {
|
|
|
999
1239
|
* shown as-is).
|
|
1000
1240
|
*/
|
|
1001
1241
|
get lastJogErrorTranslationKey() {
|
|
1002
|
-
return this.lastJogError ?
|
|
1242
|
+
return this.lastJogError ? ee(this.lastJogError) : null;
|
|
1003
1243
|
}
|
|
1004
1244
|
get localStorageSave() {
|
|
1005
1245
|
return {
|
|
@@ -1020,6 +1260,14 @@ class $ {
|
|
|
1020
1260
|
get canJogCartesian() {
|
|
1021
1261
|
return this.inverseSolver !== null;
|
|
1022
1262
|
}
|
|
1263
|
+
/**
|
|
1264
|
+
* The tabs of `JoggingPanel`: Cartesian (where the robot can jog its TCP)
|
|
1265
|
+
* and Joints
|
|
1266
|
+
*
|
|
1267
|
+
* @deprecated Only `JoggingPanel` (deprecated) reads it. Whether the robot
|
|
1268
|
+
* can jog its TCP is {@link JoggingStore.canJogCartesian}; the tab is
|
|
1269
|
+
* {@link JoggingStore.selectedTabId}.
|
|
1270
|
+
*/
|
|
1023
1271
|
get tabs() {
|
|
1024
1272
|
const t = [
|
|
1025
1273
|
{
|
|
@@ -1033,37 +1281,53 @@ class $ {
|
|
|
1033
1281
|
}), t;
|
|
1034
1282
|
}
|
|
1035
1283
|
get incrementOptions() {
|
|
1036
|
-
return
|
|
1284
|
+
return ne;
|
|
1037
1285
|
}
|
|
1038
1286
|
get discreteIncrementOptions() {
|
|
1039
|
-
return
|
|
1287
|
+
return Q;
|
|
1040
1288
|
}
|
|
1041
1289
|
get incrementOptionsById() {
|
|
1042
|
-
return
|
|
1290
|
+
return F(this.incrementOptions, (t) => t.id);
|
|
1043
1291
|
}
|
|
1292
|
+
/** @deprecated See {@link JoggingStore.tabs} */
|
|
1044
1293
|
get tabsById() {
|
|
1045
|
-
return
|
|
1294
|
+
return F(this.tabs, (t) => t.id);
|
|
1046
1295
|
}
|
|
1296
|
+
/**
|
|
1297
|
+
* The selected tab, or the first where the robot has not the selected one
|
|
1298
|
+
* (no Cartesian tab without an inverse solver)
|
|
1299
|
+
*/
|
|
1047
1300
|
get currentTab() {
|
|
1048
1301
|
return this.tabsById[this.selectedTabId] || this.tabs[0];
|
|
1049
1302
|
}
|
|
1303
|
+
/**
|
|
1304
|
+
* The index of the selected tab in {@link JoggingStore.tabs}, for the MUI
|
|
1305
|
+
* `Tabs` of `JoggingPanel`
|
|
1306
|
+
*
|
|
1307
|
+
* @deprecated See {@link JoggingStore.tabs}
|
|
1308
|
+
*/
|
|
1050
1309
|
get tabIndex() {
|
|
1051
1310
|
return this.tabs.indexOf(this.currentTab);
|
|
1052
1311
|
}
|
|
1053
1312
|
get coordSystemsById() {
|
|
1054
|
-
return
|
|
1313
|
+
return F(this.coordSystems, (t) => t.coordinate_system);
|
|
1055
1314
|
}
|
|
1056
1315
|
/**
|
|
1057
1316
|
* The id of the coordinate system to use for jogging.
|
|
1058
1317
|
* If in tool orientation, this is set to "tool", not the
|
|
1059
1318
|
* selected coordinate system.
|
|
1319
|
+
*
|
|
1320
|
+
* @deprecated Only `JoggingPanel` (deprecated) reads it: it jogs in the
|
|
1321
|
+
* coordinate system that the values are shown in. The store's own jogs
|
|
1322
|
+
* move along {@link JoggingStore.jogCoordSystem} ("Move relative to"), or
|
|
1323
|
+
* along the tool's axes in tool orientation.
|
|
1060
1324
|
*/
|
|
1061
1325
|
get activeCoordSystemId() {
|
|
1062
1326
|
return this.selectedOrientation === "tool" ? "tool" : this.selectedCoordSystemId;
|
|
1063
1327
|
}
|
|
1064
1328
|
/** The coordinate system to jog along, resolved relative to world */
|
|
1065
1329
|
get jogCoordSystem() {
|
|
1066
|
-
return
|
|
1330
|
+
return Jt(
|
|
1067
1331
|
this.jogCoordSystemId,
|
|
1068
1332
|
this.coordSystems
|
|
1069
1333
|
);
|
|
@@ -1076,7 +1340,7 @@ class $ {
|
|
|
1076
1340
|
*/
|
|
1077
1341
|
get tcpPoseInSelectedCoordSystem() {
|
|
1078
1342
|
const { tcp_pose: t, coordinate_system: e } = this.jogger.motionStream.readoutState;
|
|
1079
|
-
return !(t != null && t.position) || !t.orientation ? t :
|
|
1343
|
+
return !(t != null && t.position) || !t.orientation ? t : Y(
|
|
1080
1344
|
{
|
|
1081
1345
|
pose: {
|
|
1082
1346
|
position: t.position,
|
|
@@ -1089,7 +1353,7 @@ class $ {
|
|
|
1089
1353
|
).pose;
|
|
1090
1354
|
}
|
|
1091
1355
|
get tcpsById() {
|
|
1092
|
-
return
|
|
1356
|
+
return F(this.tcps, (t) => t.id);
|
|
1093
1357
|
}
|
|
1094
1358
|
/**
|
|
1095
1359
|
* The streamed TCP pose (its readout) as the pose of a TCP, relative to a
|
|
@@ -1098,12 +1362,12 @@ class $ {
|
|
|
1098
1362
|
* coordinate system.
|
|
1099
1363
|
*/
|
|
1100
1364
|
tcpPoseIn(t, e) {
|
|
1101
|
-
const { tcp_pose: o, tcp:
|
|
1102
|
-
if (!(!(o != null && o.position) || !o.orientation) && !(!
|
|
1365
|
+
const { tcp_pose: o, tcp: i, coordinate_system: n } = this.jogger.motionStream.readoutState, r = this.tcpsById[i || this.selectedTcpId], l = this.tcpsById[t];
|
|
1366
|
+
if (!(!(o != null && o.position) || !o.orientation) && !(!r || !l))
|
|
1103
1367
|
try {
|
|
1104
|
-
return
|
|
1368
|
+
return Y(
|
|
1105
1369
|
{
|
|
1106
|
-
pose:
|
|
1370
|
+
pose: Dt(o, r, l),
|
|
1107
1371
|
coordinateSystemId: n || "world"
|
|
1108
1372
|
},
|
|
1109
1373
|
e,
|
|
@@ -1118,7 +1382,7 @@ class $ {
|
|
|
1118
1382
|
* In tool orientation, a step moves along the tool's axes.
|
|
1119
1383
|
*/
|
|
1120
1384
|
get activeDiscreteIncrement() {
|
|
1121
|
-
return
|
|
1385
|
+
return Q.find(
|
|
1122
1386
|
(t) => t.id === this.selectedIncrementId
|
|
1123
1387
|
);
|
|
1124
1388
|
}
|
|
@@ -1138,6 +1402,13 @@ class $ {
|
|
|
1138
1402
|
maxVelocityInDisplayUnits(t) {
|
|
1139
1403
|
return t ? this.maxRotationVelocityDegPerSec : this.maxTranslationVelocityMmPerSec;
|
|
1140
1404
|
}
|
|
1405
|
+
/**
|
|
1406
|
+
* The `onChange` of the MUI `Tabs` of `JoggingPanel`
|
|
1407
|
+
*
|
|
1408
|
+
* @deprecated Only `JoggingPanel` (deprecated) calls it. Set
|
|
1409
|
+
* {@link JoggingStore.selectedTabId}; `useRobotControlProps` does that for
|
|
1410
|
+
* the tabs of `RobotControlPanel`.
|
|
1411
|
+
*/
|
|
1141
1412
|
onTabChange(t, e) {
|
|
1142
1413
|
const o = this.tabs[e] || this.tabs[0];
|
|
1143
1414
|
this.selectedTabId = o.id;
|
|
@@ -1162,36 +1433,46 @@ class $ {
|
|
|
1162
1433
|
* If the jogger is idle, a jogging websocket is briefly opened to communicate the
|
|
1163
1434
|
* TCP change. The websocket is kept open until the state-stream confirms the
|
|
1164
1435
|
* change (or a 1s timeout), to ensure the backend has time to process it.
|
|
1436
|
+
*
|
|
1437
|
+
* The jogging websocket is a movement connection, for which NOVA switches a
|
|
1438
|
+
* controller to control mode by itself. So the change rejects with a
|
|
1439
|
+
* {@link JoggingRefusedError} as a jog does, while the store is locked or
|
|
1440
|
+
* its owner says that the robot may not move: the TCP stays, and no
|
|
1441
|
+
* websocket opens (or it closes again, see {@link JoggingStore.activate}).
|
|
1442
|
+
* As for a jog, {@link JoggingStore.onBeforeActivate} ends another motion
|
|
1443
|
+
* first; when it rejects, the TCP stays.
|
|
1165
1444
|
*/
|
|
1166
1445
|
async requestTcpChange(t) {
|
|
1446
|
+
var n;
|
|
1167
1447
|
if (t === this.selectedTcpId) return;
|
|
1168
|
-
this.tcpChangeInProgress = !0;
|
|
1169
|
-
const e = this.jogger.tcp
|
|
1448
|
+
this.refuseUnlessJoggable(), this.tcpChangeInProgress = !0;
|
|
1449
|
+
const e = this.jogger.tcp;
|
|
1450
|
+
let o = !0, i = !1;
|
|
1170
1451
|
try {
|
|
1171
|
-
this.
|
|
1172
|
-
let
|
|
1173
|
-
o && await this.jogger.setJoggingMode("off"),
|
|
1174
|
-
|
|
1452
|
+
await ((n = this.onBeforeActivate) == null ? void 0 : n.call(this)), o = this.jogger.mode !== "jogging", this.jogger.tcp = t, i = !0, await this.openJoggingWebsocket(!o);
|
|
1453
|
+
let r = await this.waitForTcpConfirmation(t, 1e3);
|
|
1454
|
+
o && await this.jogger.setJoggingMode("off"), r || (r = await this.waitForTcpConfirmation(t, 2e3)), _(() => {
|
|
1455
|
+
r ? this.selectedTcpId = t : (this.jogger.tcp = e, this.selectedTcpId = this.jogger.motionStream.rapidlyChangingMotionState.tcp ?? "");
|
|
1175
1456
|
});
|
|
1176
|
-
} catch (
|
|
1177
|
-
throw o && await this.jogger.setJoggingMode("off").catch(() => {
|
|
1178
|
-
}),
|
|
1457
|
+
} catch (r) {
|
|
1458
|
+
throw i && o && await this.jogger.setJoggingMode("off").catch(() => {
|
|
1459
|
+
}), _(() => {
|
|
1179
1460
|
this.jogger.tcp = e, this.selectedTcpId = this.jogger.motionStream.rapidlyChangingMotionState.tcp ?? "";
|
|
1180
|
-
}),
|
|
1461
|
+
}), r;
|
|
1181
1462
|
} finally {
|
|
1182
|
-
|
|
1463
|
+
_(() => {
|
|
1183
1464
|
this.tcpChangeInProgress = !1;
|
|
1184
1465
|
});
|
|
1185
1466
|
}
|
|
1186
1467
|
}
|
|
1187
1468
|
waitForTcpConfirmation(t, e) {
|
|
1188
1469
|
return new Promise((o) => {
|
|
1189
|
-
const
|
|
1470
|
+
const i = setTimeout(() => {
|
|
1190
1471
|
n(), o(!1);
|
|
1191
1472
|
}, e), n = k(
|
|
1192
1473
|
() => this.jogger.motionStream.rapidlyChangingMotionState.tcp === t,
|
|
1193
1474
|
() => {
|
|
1194
|
-
clearTimeout(
|
|
1475
|
+
clearTimeout(i), o(!0);
|
|
1195
1476
|
}
|
|
1196
1477
|
);
|
|
1197
1478
|
});
|
|
@@ -1210,6 +1491,11 @@ class $ {
|
|
|
1210
1491
|
setSelectedIncrementId(t) {
|
|
1211
1492
|
this.selectedIncrementId = t;
|
|
1212
1493
|
}
|
|
1494
|
+
/**
|
|
1495
|
+
* @deprecated Only `JoggingPanel` (deprecated) calls it, for the steps it
|
|
1496
|
+
* runs itself. {@link JoggingStore.runIncrementalCartesianJog} sets
|
|
1497
|
+
* {@link JoggingStore.incrementJogInProgress} for its step.
|
|
1498
|
+
*/
|
|
1213
1499
|
setCurrentIncrementJog(t) {
|
|
1214
1500
|
this.incrementJogInProgress = t;
|
|
1215
1501
|
}
|
|
@@ -1237,10 +1523,26 @@ class $ {
|
|
|
1237
1523
|
block() {
|
|
1238
1524
|
this.blocked = !0;
|
|
1239
1525
|
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Ends {@link JoggingStore.blocked}, so that jogging can be tried again.
|
|
1528
|
+
* For a jogger that is still in jogging mode (one that an app keeps there),
|
|
1529
|
+
* it opens the jogging websocket again, unless a jog may not start: then
|
|
1530
|
+
* the jogger is switched off instead.
|
|
1531
|
+
*/
|
|
1240
1532
|
unblock() {
|
|
1241
|
-
this.blocked = !1, this.jogger.mode === "jogging"
|
|
1242
|
-
|
|
1243
|
-
|
|
1533
|
+
if (this.blocked = !1, this.jogger.mode === "jogging") {
|
|
1534
|
+
try {
|
|
1535
|
+
this.refuseUnlessJoggable();
|
|
1536
|
+
} catch {
|
|
1537
|
+
this.deactivate().catch((t) => {
|
|
1538
|
+
console.error("Failed to stop jogging:", t);
|
|
1539
|
+
});
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1542
|
+
this.jogger.initializeJoggingWebsocket().catch((t) => {
|
|
1543
|
+
console.error("Failed to initialize jogging:", t);
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1244
1546
|
}
|
|
1245
1547
|
/** Lock the UI until the given async callback resolves */
|
|
1246
1548
|
async withMotionLock(t) {
|
|
@@ -1252,7 +1554,7 @@ class $ {
|
|
|
1252
1554
|
* {@link JoggingStore.refuseUnlessJoggable})
|
|
1253
1555
|
*/
|
|
1254
1556
|
async withOwnLock(t) {
|
|
1255
|
-
const e =
|
|
1557
|
+
const e = Vt();
|
|
1256
1558
|
this.lock(e);
|
|
1257
1559
|
try {
|
|
1258
1560
|
return await t(e);
|
|
@@ -1261,7 +1563,7 @@ class $ {
|
|
|
1261
1563
|
}
|
|
1262
1564
|
}
|
|
1263
1565
|
}
|
|
1264
|
-
const
|
|
1566
|
+
const Et = 1e-4, ae = /* @__PURE__ */ new Set([
|
|
1265
1567
|
"timestamp",
|
|
1266
1568
|
"sequence_number",
|
|
1267
1569
|
"joint_position",
|
|
@@ -1271,18 +1573,22 @@ const jt = 1e-4, re = /* @__PURE__ */ new Set([
|
|
|
1271
1573
|
"tcp_pose",
|
|
1272
1574
|
"flange_velocity",
|
|
1273
1575
|
"tcp_velocity"
|
|
1274
|
-
]),
|
|
1275
|
-
class
|
|
1276
|
-
|
|
1576
|
+
]), ce = 1, gt = (s) => Array.isArray(s) && s.length === 3 && s.every((t) => typeof t == "number");
|
|
1577
|
+
class le {
|
|
1578
|
+
/**
|
|
1579
|
+
* @internal The session makes it from its `stateSource`, see
|
|
1580
|
+
* `RobotSession` and `loadRobotSession`
|
|
1581
|
+
*/
|
|
1582
|
+
constructor(t, e, o, i = {}) {
|
|
1277
1583
|
this.source = t, this.motionGroupId = e, this.lastMessageReceivedAt = Date.now(), this.lastInvalidStateMessage = null, this.connectionQuality = "good";
|
|
1278
1584
|
const n = o.motion_groups.find(
|
|
1279
|
-
(
|
|
1585
|
+
(r) => r.motion_group === e
|
|
1280
1586
|
);
|
|
1281
1587
|
if (!n)
|
|
1282
1588
|
throw new Error(
|
|
1283
1589
|
`Motion group ${e} not found in initial controller state`
|
|
1284
1590
|
);
|
|
1285
|
-
this.isVirtual =
|
|
1591
|
+
this.isVirtual = i.isVirtual ?? !1, this.onError = i.onError, this.reconnectsOnFocus = (i.reconnectOnFocus ?? !0) && typeof window < "u", this.rapidlyChangingMotionState = n, this.lastValidStateMessage = {
|
|
1286
1592
|
receivedAt: Date.now(),
|
|
1287
1593
|
data: o
|
|
1288
1594
|
}, j(
|
|
@@ -1297,7 +1603,7 @@ class ce {
|
|
|
1297
1603
|
// keepAlive: a computed nobody observes is recomputed on every read
|
|
1298
1604
|
// without consulting `equals`, so the hold would depend on a component
|
|
1299
1605
|
// happening to observe the readout at the time.
|
|
1300
|
-
readoutState:
|
|
1606
|
+
readoutState: mt({ equals: It, keepAlive: !0 })
|
|
1301
1607
|
},
|
|
1302
1608
|
{ autoBind: !0 }
|
|
1303
1609
|
), this.source.addEventListener("message", this.handleMessage), this.connectionQualityInterval = setInterval(
|
|
@@ -1311,16 +1617,16 @@ class ce {
|
|
|
1311
1617
|
}
|
|
1312
1618
|
/**
|
|
1313
1619
|
* What pose and joint readouts show. Holds the previous reading while the
|
|
1314
|
-
* joints only jitter
|
|
1315
|
-
* for untracked reads.
|
|
1620
|
+
* joints only jitter (less than 0.0002 rad), and while the TCP and the
|
|
1621
|
+
* coordinate system stay; kept alive so it also holds for untracked reads.
|
|
1316
1622
|
*/
|
|
1317
1623
|
get readoutState() {
|
|
1318
|
-
return
|
|
1624
|
+
return _t(this.rapidlyChangingMotionState);
|
|
1319
1625
|
}
|
|
1320
1626
|
/** The motion group's state in the next message of the source */
|
|
1321
1627
|
async nextMotionState() {
|
|
1322
|
-
var o,
|
|
1323
|
-
const t = await this.source.nextMessage(), e = (
|
|
1628
|
+
var o, i;
|
|
1629
|
+
const t = await this.source.nextMessage(), e = (i = (o = this.source.parse(t.data)) == null ? void 0 : o.motion_groups) == null ? void 0 : i.find((n) => n.motion_group === this.motionGroupId);
|
|
1324
1630
|
if (!e)
|
|
1325
1631
|
throw new Error(
|
|
1326
1632
|
`Failed to get motion state for ${this.motionGroupId}: ${t.data}`
|
|
@@ -1370,11 +1676,11 @@ class ce {
|
|
|
1370
1676
|
* without churning the jittery pose readings.
|
|
1371
1677
|
*/
|
|
1372
1678
|
updateRapidlyChangingMotionState(t, e) {
|
|
1373
|
-
const o = this.rapidlyChangingMotionState,
|
|
1374
|
-
for (const n of Object.keys(
|
|
1375
|
-
e != null && e.has(n) ||
|
|
1679
|
+
const o = this.rapidlyChangingMotionState, i = t;
|
|
1680
|
+
for (const n of Object.keys(i))
|
|
1681
|
+
e != null && e.has(n) || $t(o[n], i[n]) || (o[n] = i[n]);
|
|
1376
1682
|
for (const n of Object.keys(o))
|
|
1377
|
-
e != null && e.has(n) || n in
|
|
1683
|
+
e != null && e.has(n) || n in i || delete o[n];
|
|
1378
1684
|
}
|
|
1379
1685
|
setConnectionQuality(t) {
|
|
1380
1686
|
this.connectionQuality = t;
|
|
@@ -1385,7 +1691,7 @@ class ce {
|
|
|
1385
1691
|
updateConnectionQuality() {
|
|
1386
1692
|
const t = Date.now() - this.lastMessageReceivedAt, e = this.isVirtual ? 3e3 : 1e3, o = this.isVirtual ? 6e3 : 3e3;
|
|
1387
1693
|
if (t > o) {
|
|
1388
|
-
this.source.readyState ===
|
|
1694
|
+
this.source.readyState === ce && this.source.reconnect(), this.setConnectionQuality("critical");
|
|
1389
1695
|
return;
|
|
1390
1696
|
}
|
|
1391
1697
|
if (t > e) {
|
|
@@ -1394,16 +1700,21 @@ class ce {
|
|
|
1394
1700
|
}
|
|
1395
1701
|
this.setConnectionQuality("good");
|
|
1396
1702
|
}
|
|
1397
|
-
/**
|
|
1703
|
+
/**
|
|
1704
|
+
* Stops listening to the source; the source's owner closes it. The
|
|
1705
|
+
* connection is critical from then on: no state comes any more, and the
|
|
1706
|
+
* last one is not the robot's now (a robot that may move, for whatever
|
|
1707
|
+
* still reads it).
|
|
1708
|
+
*/
|
|
1398
1709
|
dispose() {
|
|
1399
|
-
this.source.removeEventListener("message", this.handleMessage), clearInterval(this.connectionQualityInterval), this.reconnectsOnFocus && window.removeEventListener("focus", this.handleWindowFocus);
|
|
1710
|
+
this.source.removeEventListener("message", this.handleMessage), clearInterval(this.connectionQualityInterval), this.reconnectsOnFocus && window.removeEventListener("focus", this.handleWindowFocus), this.setConnectionQuality("critical");
|
|
1400
1711
|
}
|
|
1401
1712
|
handleMessage(t) {
|
|
1402
|
-
var c,
|
|
1713
|
+
var c, a;
|
|
1403
1714
|
const e = this.source.parse(t.data);
|
|
1404
1715
|
if (!(e != null && e.motion_groups)) {
|
|
1405
1716
|
(c = this.onError) == null || c.call(this, {
|
|
1406
|
-
message:
|
|
1717
|
+
message: R(t.data),
|
|
1407
1718
|
url: this.source.url
|
|
1408
1719
|
}), this.setLastInvalidStateMessage(t.data);
|
|
1409
1720
|
return;
|
|
@@ -1411,11 +1722,11 @@ class ce {
|
|
|
1411
1722
|
this.lastMessageReceivedAt = Date.now();
|
|
1412
1723
|
const o = this.lastValidStateMessage.data;
|
|
1413
1724
|
(o.safety_state !== e.safety_state || o.operation_mode !== e.operation_mode || o.mode !== e.mode) && this.setLastValidStateMessage(e);
|
|
1414
|
-
const
|
|
1725
|
+
const i = e.motion_groups.find(
|
|
1415
1726
|
(d) => d.motion_group === this.motionGroupId
|
|
1416
1727
|
);
|
|
1417
|
-
if (!
|
|
1418
|
-
(
|
|
1728
|
+
if (!i) {
|
|
1729
|
+
(a = this.onError) == null || a.call(this, {
|
|
1419
1730
|
message: `Motion group ${this.motionGroupId} not found in controller state: ${JSON.stringify(t.data)}`,
|
|
1420
1731
|
url: this.source.url
|
|
1421
1732
|
}), this.setLastInvalidStateMessage(t.data);
|
|
@@ -1423,77 +1734,77 @@ class ce {
|
|
|
1423
1734
|
}
|
|
1424
1735
|
const n = !G(
|
|
1425
1736
|
this.rapidlyChangingMotionState.joint_position,
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
),
|
|
1429
|
-
if (!n && !
|
|
1737
|
+
i.joint_position,
|
|
1738
|
+
Et
|
|
1739
|
+
), r = this.rapidlyChangingMotionState.tcp !== i.tcp;
|
|
1740
|
+
if (!n && !r) {
|
|
1430
1741
|
this.updateRapidlyChangingMotionState(
|
|
1431
|
-
|
|
1432
|
-
|
|
1742
|
+
i,
|
|
1743
|
+
ae
|
|
1433
1744
|
);
|
|
1434
1745
|
return;
|
|
1435
1746
|
}
|
|
1436
|
-
const l = this.rapidlyChangingMotionState.flange_pose, h =
|
|
1437
|
-
if ((h == null ? void 0 : h.orientation) == null || !
|
|
1747
|
+
const l = this.rapidlyChangingMotionState.flange_pose, h = i.flange_pose;
|
|
1748
|
+
if ((h == null ? void 0 : h.orientation) == null || !gt(h.orientation)) {
|
|
1438
1749
|
const d = h == null ? void 0 : h.orientation;
|
|
1439
1750
|
throw new Error(
|
|
1440
1751
|
`Invalid newFlangePose.orientation: expected [number, number, number] (got ${d == null ? "null" : d.length})`
|
|
1441
1752
|
);
|
|
1442
1753
|
}
|
|
1443
|
-
if ((l == null ? void 0 : l.orientation) == null || !
|
|
1754
|
+
if ((l == null ? void 0 : l.orientation) == null || !gt(l.orientation)) {
|
|
1444
1755
|
const d = l == null ? void 0 : l.orientation;
|
|
1445
1756
|
throw new Error(
|
|
1446
1757
|
`Invalid oldFlangePose.orientation: expected [number, number, number] (got ${d == null ? "null" : d.length})`
|
|
1447
1758
|
);
|
|
1448
1759
|
}
|
|
1449
|
-
h.orientation =
|
|
1760
|
+
h.orientation = St(
|
|
1450
1761
|
h.orientation,
|
|
1451
1762
|
l.orientation
|
|
1452
|
-
), this.updateRapidlyChangingMotionState(
|
|
1763
|
+
), this.updateRapidlyChangingMotionState(i);
|
|
1453
1764
|
}
|
|
1454
1765
|
}
|
|
1455
|
-
|
|
1766
|
+
const de = [
|
|
1767
|
+
"FeedbackOutOfWorkspace",
|
|
1768
|
+
"FeedbackJointLimitExceeded",
|
|
1769
|
+
"FeedbackAxisRangeExceeded",
|
|
1770
|
+
"FeedbackNoSolutionInCurrentConfiguration"
|
|
1771
|
+
];
|
|
1772
|
+
function he(s) {
|
|
1773
|
+
return s === "FeedbackSingularity" ? "Jogging.TargetPose.Error.Singularity.lb" : s === "FeedbackCollision" ? "Jogging.TargetPose.Error.Collision.lb" : de.includes(s) ? "Jogging.TargetPose.Error.NotReachable.lb" : "Jogging.TargetPose.Error.PlanningFailed.lb";
|
|
1774
|
+
}
|
|
1775
|
+
function ge(s) {
|
|
1456
1776
|
return {
|
|
1457
1777
|
get url() {
|
|
1458
|
-
return
|
|
1778
|
+
return s.url;
|
|
1459
1779
|
},
|
|
1460
1780
|
get readyState() {
|
|
1461
|
-
return
|
|
1781
|
+
return s.readyState;
|
|
1462
1782
|
},
|
|
1463
|
-
addEventListener: (t, e) =>
|
|
1464
|
-
removeEventListener: (t, e) =>
|
|
1465
|
-
firstMessage: () =>
|
|
1466
|
-
nextMessage: () =>
|
|
1467
|
-
reconnect: () =>
|
|
1468
|
-
close: () =>
|
|
1783
|
+
addEventListener: (t, e) => s.addEventListener(t, e),
|
|
1784
|
+
removeEventListener: (t, e) => s.removeEventListener(t, e),
|
|
1785
|
+
firstMessage: () => s.firstMessage(),
|
|
1786
|
+
nextMessage: () => s.nextMessage(),
|
|
1787
|
+
reconnect: () => s.reconnect(),
|
|
1788
|
+
close: () => s.close(),
|
|
1469
1789
|
parse: (t) => {
|
|
1470
1790
|
var e;
|
|
1471
|
-
return (e =
|
|
1791
|
+
return (e = ft(t)) == null ? void 0 : e.result;
|
|
1472
1792
|
}
|
|
1473
1793
|
};
|
|
1474
1794
|
}
|
|
1475
|
-
function
|
|
1795
|
+
function ue(s, {
|
|
1476
1796
|
controllerId: t,
|
|
1477
1797
|
cellId: e,
|
|
1478
1798
|
responseRateMs: o
|
|
1479
1799
|
}) {
|
|
1480
|
-
const
|
|
1481
|
-
return
|
|
1482
|
-
|
|
1483
|
-
`/cells/${n}/controllers/${t}/state-stream${
|
|
1800
|
+
const i = L(s), n = e ?? z(s) ?? "cell", r = o === void 0 ? "" : `?response_rate=${o}`;
|
|
1801
|
+
return ge(
|
|
1802
|
+
i.openReconnectingWebsocket(
|
|
1803
|
+
`/cells/${n}/controllers/${t}/state-stream${r}`
|
|
1484
1804
|
)
|
|
1485
1805
|
);
|
|
1486
1806
|
}
|
|
1487
|
-
const
|
|
1488
|
-
"FeedbackOutOfWorkspace",
|
|
1489
|
-
"FeedbackJointLimitExceeded",
|
|
1490
|
-
"FeedbackAxisRangeExceeded",
|
|
1491
|
-
"FeedbackNoSolutionInCurrentConfiguration"
|
|
1492
|
-
];
|
|
1493
|
-
function ge(i) {
|
|
1494
|
-
return i === "FeedbackSingularity" ? "Jogging.TargetPose.Error.Singularity.lb" : i === "FeedbackCollision" ? "Jogging.TargetPose.Error.Collision.lb" : he.includes(i) ? "Jogging.TargetPose.Error.NotReachable.lb" : "Jogging.TargetPose.Error.PlanningFailed.lb";
|
|
1495
|
-
}
|
|
1496
|
-
const ue = [
|
|
1807
|
+
const pe = [
|
|
1497
1808
|
"motionGroupDescription",
|
|
1498
1809
|
"controllerConfiguration",
|
|
1499
1810
|
"kinematicModel",
|
|
@@ -1503,15 +1814,15 @@ const ue = [
|
|
|
1503
1814
|
"motionStateStream",
|
|
1504
1815
|
"controllerStateStream"
|
|
1505
1816
|
];
|
|
1506
|
-
class
|
|
1817
|
+
class Tt extends Error {
|
|
1507
1818
|
constructor(t, e, o) {
|
|
1508
1819
|
super(o), this.stepId = t, this.cause = e, this.name = "RobotLoadStepError";
|
|
1509
1820
|
}
|
|
1510
1821
|
}
|
|
1511
|
-
function B(
|
|
1512
|
-
return
|
|
1822
|
+
function B(s) {
|
|
1823
|
+
return s instanceof Tt;
|
|
1513
1824
|
}
|
|
1514
|
-
class
|
|
1825
|
+
class me {
|
|
1515
1826
|
/**
|
|
1516
1827
|
* One instance tracks one load. Concurrent loads must not share one — a load
|
|
1517
1828
|
* that has been superseded keeps reporting for a step or two before it
|
|
@@ -1519,7 +1830,7 @@ class pe {
|
|
|
1519
1830
|
* that replaced it (clearing a recorded failure, for instance).
|
|
1520
1831
|
*/
|
|
1521
1832
|
constructor(t = null, e = null) {
|
|
1522
|
-
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 =
|
|
1833
|
+
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 = pe.map((o) => ({
|
|
1523
1834
|
id: o,
|
|
1524
1835
|
status: "pending",
|
|
1525
1836
|
url: null,
|
|
@@ -1574,15 +1885,15 @@ class pe {
|
|
|
1574
1885
|
return this.steps.length > 0 && this.steps.every((t) => t.status === "succeeded");
|
|
1575
1886
|
}
|
|
1576
1887
|
}
|
|
1577
|
-
const
|
|
1578
|
-
async function
|
|
1888
|
+
const fe = 1e4;
|
|
1889
|
+
async function ut(s, t, e) {
|
|
1579
1890
|
let o;
|
|
1580
|
-
|
|
1891
|
+
s.catch(() => {
|
|
1581
1892
|
});
|
|
1582
1893
|
try {
|
|
1583
1894
|
return await Promise.race([
|
|
1584
|
-
|
|
1585
|
-
new Promise((
|
|
1895
|
+
s,
|
|
1896
|
+
new Promise((i, n) => {
|
|
1586
1897
|
o = setTimeout(() => n(new Error(e)), t);
|
|
1587
1898
|
})
|
|
1588
1899
|
]);
|
|
@@ -1590,179 +1901,180 @@ async function gt(i, t, e) {
|
|
|
1590
1901
|
clearTimeout(o);
|
|
1591
1902
|
}
|
|
1592
1903
|
}
|
|
1593
|
-
async function
|
|
1594
|
-
nova:
|
|
1904
|
+
async function ye({
|
|
1905
|
+
nova: s,
|
|
1595
1906
|
cellId: t,
|
|
1596
1907
|
controllerId: e,
|
|
1597
1908
|
motionGroupId: o,
|
|
1598
|
-
progress:
|
|
1909
|
+
progress: i,
|
|
1599
1910
|
createStateSource: n,
|
|
1600
|
-
isStale:
|
|
1601
|
-
socketTimeoutMs: l =
|
|
1911
|
+
isStale: r = () => !1,
|
|
1912
|
+
socketTimeoutMs: l = fe
|
|
1602
1913
|
}) {
|
|
1603
|
-
let h, c,
|
|
1914
|
+
let h, c, a = !1;
|
|
1604
1915
|
function d() {
|
|
1605
1916
|
h == null || h.dispose(), c == null || c.close();
|
|
1606
1917
|
}
|
|
1607
|
-
async function g(
|
|
1608
|
-
|
|
1918
|
+
async function g(f, p, y) {
|
|
1919
|
+
i.startStep(f, p);
|
|
1609
1920
|
try {
|
|
1610
|
-
const
|
|
1611
|
-
return
|
|
1612
|
-
} catch (
|
|
1613
|
-
throw
|
|
1921
|
+
const u = await y();
|
|
1922
|
+
return i.succeedStep(f), u;
|
|
1923
|
+
} catch (u) {
|
|
1924
|
+
throw i.failStep(f, u), new Tt(f, u, R(u));
|
|
1614
1925
|
}
|
|
1615
1926
|
}
|
|
1616
1927
|
try {
|
|
1617
|
-
if (
|
|
1618
|
-
const
|
|
1928
|
+
if (r()) return null;
|
|
1929
|
+
const f = `/cells/${t}/controllers/${e}/motion-groups/${o}`, p = `/cells/${t}/controllers/${e}`, y = await g(
|
|
1619
1930
|
"motionGroupDescription",
|
|
1620
|
-
`${
|
|
1621
|
-
() =>
|
|
1931
|
+
`${f}/description`,
|
|
1932
|
+
() => s.api.motionGroup.getMotionGroupDescription(
|
|
1622
1933
|
t,
|
|
1623
1934
|
e,
|
|
1624
1935
|
o
|
|
1625
1936
|
)
|
|
1626
1937
|
);
|
|
1627
|
-
if (
|
|
1628
|
-
const { configuration:
|
|
1938
|
+
if (r()) return null;
|
|
1939
|
+
const { configuration: u } = await g(
|
|
1629
1940
|
"controllerConfiguration",
|
|
1630
1941
|
p,
|
|
1631
|
-
() =>
|
|
1942
|
+
() => s.api.controller.getRobotController(t, e)
|
|
1632
1943
|
);
|
|
1633
|
-
if (
|
|
1634
|
-
const
|
|
1635
|
-
model:
|
|
1636
|
-
serialNumber:
|
|
1637
|
-
},
|
|
1944
|
+
if (r()) return null;
|
|
1945
|
+
const m = {
|
|
1946
|
+
model: y.motion_group_model,
|
|
1947
|
+
serialNumber: y.serial_number
|
|
1948
|
+
}, M = m.serialNumber ? `?serial_number=${encodeURIComponent(m.serialNumber)}` : "", w = await g(
|
|
1638
1949
|
"kinematicModel",
|
|
1639
|
-
`/experimental/motion-group-models/${encodeURIComponent(
|
|
1640
|
-
() =>
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1950
|
+
`/experimental/motion-group-models/${encodeURIComponent(m.model)}/kinematic${M}`,
|
|
1951
|
+
() => Ft(
|
|
1952
|
+
s,
|
|
1953
|
+
m.model,
|
|
1954
|
+
m.serialNumber,
|
|
1644
1955
|
"kinematic",
|
|
1645
|
-
(
|
|
1956
|
+
(S) => i.updateStepUrl("kinematicModel", S)
|
|
1646
1957
|
)
|
|
1647
1958
|
);
|
|
1648
|
-
if (
|
|
1649
|
-
const
|
|
1959
|
+
if (r()) return null;
|
|
1960
|
+
const A = await g(
|
|
1650
1961
|
"motionGroupModel",
|
|
1651
|
-
`/experimental/motion-group-models/${encodeURIComponent(
|
|
1652
|
-
() =>
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
(
|
|
1962
|
+
`/experimental/motion-group-models/${encodeURIComponent(m.model)}/description${M}`,
|
|
1963
|
+
() => Nt(
|
|
1964
|
+
s,
|
|
1965
|
+
m.model,
|
|
1966
|
+
m.serialNumber,
|
|
1967
|
+
(S) => i.updateStepUrl("motionGroupModel", S)
|
|
1657
1968
|
)
|
|
1658
1969
|
);
|
|
1659
|
-
if (
|
|
1660
|
-
const
|
|
1970
|
+
if (r()) return null;
|
|
1971
|
+
const J = await g(
|
|
1661
1972
|
"coordinateSystems",
|
|
1662
1973
|
`${p}/coordinate-systems?orientation_type=ROTATION_VECTOR`,
|
|
1663
|
-
async () => await
|
|
1974
|
+
async () => await s.api.controller.listCoordinateSystems(
|
|
1664
1975
|
t,
|
|
1665
1976
|
e,
|
|
1666
1977
|
"ROTATION_VECTOR"
|
|
1667
1978
|
) ?? []
|
|
1668
1979
|
);
|
|
1669
|
-
if (
|
|
1670
|
-
const { controllerState:
|
|
1980
|
+
if (r()) return null;
|
|
1981
|
+
const { controllerState: I, motionGroupState: D } = await g(
|
|
1671
1982
|
"controllerState",
|
|
1672
1983
|
`${p}/state`,
|
|
1673
1984
|
async () => {
|
|
1674
|
-
const
|
|
1985
|
+
const S = await s.api.controller.getCurrentRobotControllerState(
|
|
1675
1986
|
t,
|
|
1676
1987
|
e
|
|
1677
|
-
), E =
|
|
1678
|
-
(
|
|
1988
|
+
), E = S == null ? void 0 : S.motion_groups.find(
|
|
1989
|
+
(T) => T.motion_group === o
|
|
1679
1990
|
);
|
|
1680
|
-
if (!
|
|
1991
|
+
if (!S || !E)
|
|
1681
1992
|
throw new Error(
|
|
1682
1993
|
`Controller ${e} or motion group ${o} not found`
|
|
1683
1994
|
);
|
|
1684
|
-
return { controllerState:
|
|
1995
|
+
return { controllerState: S, motionGroupState: E };
|
|
1685
1996
|
}
|
|
1686
1997
|
);
|
|
1687
|
-
if (
|
|
1688
|
-
const
|
|
1998
|
+
if (r()) return null;
|
|
1999
|
+
const U = `${f}/state-stream`, { socket: Mt, initialMotionState: wt } = await g(
|
|
1689
2000
|
"motionStateStream",
|
|
1690
|
-
|
|
2001
|
+
U,
|
|
1691
2002
|
async () => {
|
|
1692
|
-
var
|
|
1693
|
-
const
|
|
1694
|
-
h =
|
|
1695
|
-
const E = await
|
|
1696
|
-
|
|
2003
|
+
var P;
|
|
2004
|
+
const S = s.openReconnectingWebsocket(U);
|
|
2005
|
+
h = S;
|
|
2006
|
+
const E = await ut(
|
|
2007
|
+
S.firstMessage(),
|
|
1697
2008
|
l,
|
|
1698
|
-
`No motion state received from ${
|
|
1699
|
-
),
|
|
1700
|
-
if (!
|
|
2009
|
+
`No motion state received from ${U} within ${l / 1e3}s`
|
|
2010
|
+
), T = (P = ft(E.data)) == null ? void 0 : P.result;
|
|
2011
|
+
if (!T)
|
|
1701
2012
|
throw new Error(
|
|
1702
2013
|
`Unable to parse initial motion state message ${E.data}`
|
|
1703
2014
|
);
|
|
1704
|
-
return { socket:
|
|
2015
|
+
return { socket: S, initialMotionState: T };
|
|
1705
2016
|
}
|
|
1706
2017
|
);
|
|
1707
|
-
if (
|
|
1708
|
-
const { source: vt, initialControllerState:
|
|
2018
|
+
if (r()) return null;
|
|
2019
|
+
const { source: vt, initialControllerState: Ot } = await g(
|
|
1709
2020
|
"controllerStateStream",
|
|
1710
2021
|
`${p}/state`,
|
|
1711
2022
|
async () => {
|
|
1712
|
-
var
|
|
1713
|
-
const
|
|
1714
|
-
c =
|
|
1715
|
-
const E = await
|
|
1716
|
-
|
|
2023
|
+
var P;
|
|
2024
|
+
const S = n({ cellId: t, controllerId: e });
|
|
2025
|
+
c = S, i.updateStepUrl("controllerStateStream", S.url);
|
|
2026
|
+
const E = await ut(
|
|
2027
|
+
S.firstMessage(),
|
|
1717
2028
|
l,
|
|
1718
|
-
`No controller state received from ${
|
|
1719
|
-
),
|
|
1720
|
-
if (!
|
|
2029
|
+
`No controller state received from ${S.url} within ${l / 1e3}s`
|
|
2030
|
+
), T = S.parse(E.data);
|
|
2031
|
+
if (!T)
|
|
1721
2032
|
throw new Error(
|
|
1722
2033
|
`Unable to parse initial controller state message ${E.data}`
|
|
1723
2034
|
);
|
|
1724
|
-
if (!((
|
|
2035
|
+
if (!((P = T.motion_groups) != null && P.some((bt) => bt.motion_group === o)))
|
|
1725
2036
|
throw new Error(
|
|
1726
|
-
`Controller state from ${
|
|
2037
|
+
`Controller state from ${S.url} does not list motion group ${o} yet`
|
|
1727
2038
|
);
|
|
1728
|
-
return { source:
|
|
2039
|
+
return { source: S, initialControllerState: T };
|
|
1729
2040
|
}
|
|
1730
2041
|
);
|
|
1731
|
-
return
|
|
1732
|
-
motionGroupDescription:
|
|
1733
|
-
controllerConfiguration:
|
|
1734
|
-
kinematicModel:
|
|
1735
|
-
motionGroupModelName:
|
|
1736
|
-
coordinateSystems:
|
|
1737
|
-
controllerState:
|
|
1738
|
-
motionGroupState:
|
|
1739
|
-
initialMotionState:
|
|
2042
|
+
return r() ? null : (a = !0, {
|
|
2043
|
+
motionGroupDescription: y,
|
|
2044
|
+
controllerConfiguration: u,
|
|
2045
|
+
kinematicModel: w,
|
|
2046
|
+
motionGroupModelName: A,
|
|
2047
|
+
coordinateSystems: J,
|
|
2048
|
+
controllerState: I,
|
|
2049
|
+
motionGroupState: D,
|
|
2050
|
+
initialMotionState: wt,
|
|
1740
2051
|
motionStateSocket: Mt,
|
|
1741
2052
|
stateSource: vt,
|
|
1742
|
-
initialControllerState:
|
|
2053
|
+
initialControllerState: Ot,
|
|
1743
2054
|
dispose: d
|
|
1744
2055
|
});
|
|
1745
2056
|
} finally {
|
|
1746
|
-
|
|
2057
|
+
a || d();
|
|
1747
2058
|
}
|
|
1748
2059
|
}
|
|
1749
|
-
const
|
|
1750
|
-
function
|
|
1751
|
-
return
|
|
2060
|
+
const C = (s) => s ?? [0, 0, 0], W = (s, t) => s.length === t.length && s.every((e, o) => e === t[o]);
|
|
2061
|
+
function Se(s, t) {
|
|
2062
|
+
return s.type === "joint" ? t.type === "joint" && W(s.joints, t.joints) : t.type === "joint" ? !1 : (s.coordinateSystemId || "world") === (t.coordinateSystemId || "world") && W(C(s.pose.position), C(t.pose.position)) && W(C(s.pose.orientation), C(t.pose.orientation));
|
|
1752
2063
|
}
|
|
1753
|
-
function
|
|
1754
|
-
return
|
|
2064
|
+
function _e(s) {
|
|
2065
|
+
return s.type === "joint" ? { type: "joint", joints: [...s.joints] } : {
|
|
1755
2066
|
type: "cartesian",
|
|
1756
2067
|
pose: {
|
|
1757
|
-
position: [...
|
|
1758
|
-
orientation: [...
|
|
2068
|
+
position: [...C(s.pose.position)],
|
|
2069
|
+
orientation: [...C(s.pose.orientation)]
|
|
1759
2070
|
},
|
|
1760
|
-
coordinateSystemId:
|
|
2071
|
+
coordinateSystemId: s.coordinateSystemId
|
|
1761
2072
|
};
|
|
1762
2073
|
}
|
|
1763
|
-
class
|
|
2074
|
+
class Ie {
|
|
2075
|
+
/** @internal The session makes it, see RobotSession */
|
|
1764
2076
|
constructor(t) {
|
|
1765
|
-
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, j(
|
|
2077
|
+
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.disposed = !1, this.disposers = [], this.logger = t.logger ?? console, j(
|
|
1766
2078
|
this,
|
|
1767
2079
|
{
|
|
1768
2080
|
socket: !1,
|
|
@@ -1772,7 +2084,7 @@ class _e {
|
|
|
1772
2084
|
},
|
|
1773
2085
|
{ autoBind: !0 }
|
|
1774
2086
|
), this.socket = this.openSocket(), this.disposers.push(
|
|
1775
|
-
|
|
2087
|
+
v(
|
|
1776
2088
|
() => this.executionState,
|
|
1777
2089
|
(e) => {
|
|
1778
2090
|
e === "END_OF_TRAJECTORY" && (this.motion = null, this.reset());
|
|
@@ -1812,6 +2124,10 @@ class _e {
|
|
|
1812
2124
|
this.velocityFor(this.plannedFor.target)
|
|
1813
2125
|
);
|
|
1814
2126
|
}
|
|
2127
|
+
/** The target of a pose of this motion group; null for another's */
|
|
2128
|
+
targetOf(t) {
|
|
2129
|
+
return "motionGroupId" in t ? t.motionGroupId !== this.jogger.motionGroupId ? null : K(t) : t;
|
|
2130
|
+
}
|
|
1815
2131
|
/** The execution state that the motion stream reports, e.g. "RUNNING" */
|
|
1816
2132
|
get executionState() {
|
|
1817
2133
|
var t, e;
|
|
@@ -1821,36 +2137,45 @@ class _e {
|
|
|
1821
2137
|
* Plans a trajectory from the current joints to the target and initializes
|
|
1822
2138
|
* it on the execution websocket. The store is "planned" once NOVA accepted
|
|
1823
2139
|
* it. Returns a planner rejection as a value; throws while the app locks
|
|
1824
|
-
* the robot
|
|
1825
|
-
*
|
|
1826
|
-
*
|
|
2140
|
+
* the robot or the robot may not move (see
|
|
2141
|
+
* `TrajectoryExecutionStoreOptions`), also when that came to be while the
|
|
2142
|
+
* planner worked, and when the planner cannot be reached. A target that
|
|
2143
|
+
* cannot be planned leaves no trajectory, also not the one before it on
|
|
2144
|
+
* the controller.
|
|
2145
|
+
*
|
|
2146
|
+
* `to` is a target, or a pose as an app saves it (`RobotPose`): its joints,
|
|
2147
|
+
* or its TCP pose in its coordinate system, planned for the selected TCP.
|
|
2148
|
+
* Throws for a pose of another motion group, and plans nothing then.
|
|
1827
2149
|
*/
|
|
1828
2150
|
async planTrajectory(t) {
|
|
1829
|
-
var
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
2151
|
+
var w, A, J;
|
|
2152
|
+
const e = this.targetOf(t);
|
|
2153
|
+
if (!e)
|
|
2154
|
+
throw new Error(
|
|
2155
|
+
`Not planning a pose of motion group "${t.motionGroupId}" for motion group "${this.jogger.motionGroupId}"`
|
|
2156
|
+
);
|
|
2157
|
+
await this.dropPlanIfRefused(), this.armed && !this.plannedTrajectory && await this.stopAndReset(), await this.ensureMovementOwnership();
|
|
2158
|
+
const o = this.motionStream.rapidlyChangingMotionState.joint_position ?? [], { cycle_time: i, mounting: n, motion_group_model: r, tcps: l } = this.motionStream.description, h = this.joggingStore.selectedTcpId, c = h ? (w = l == null ? void 0 : l[h]) == null ? void 0 : w.pose : void 0, a = {
|
|
1834
2159
|
// The model the jogger plans step jogs with: the custom copy that holds
|
|
1835
2160
|
// this robot's data, if the app gave one
|
|
1836
|
-
motion_group_model: ((
|
|
1837
|
-
cycle_time:
|
|
1838
|
-
mounting:
|
|
1839
|
-
...
|
|
1840
|
-
},
|
|
1841
|
-
let
|
|
1842
|
-
if (
|
|
1843
|
-
let I =
|
|
1844
|
-
const
|
|
1845
|
-
if (
|
|
2161
|
+
motion_group_model: ((A = this.jogger.options) == null ? void 0 : A.motionGroupModel) ?? r,
|
|
2162
|
+
cycle_time: i ?? 0,
|
|
2163
|
+
mounting: n,
|
|
2164
|
+
...c && { tcp_offset: c }
|
|
2165
|
+
}, d = this.velocityFor(e);
|
|
2166
|
+
let g;
|
|
2167
|
+
if (e.type === "cartesian") {
|
|
2168
|
+
let I = e.pose;
|
|
2169
|
+
const D = e.coordinateSystemId || "world";
|
|
2170
|
+
if (D !== "world")
|
|
1846
2171
|
try {
|
|
1847
|
-
I =
|
|
2172
|
+
I = Y(
|
|
1848
2173
|
{
|
|
1849
2174
|
pose: {
|
|
1850
2175
|
position: I.position ?? [0, 0, 0],
|
|
1851
2176
|
orientation: I.orientation ?? [0, 0, 0]
|
|
1852
2177
|
},
|
|
1853
|
-
coordinateSystemId:
|
|
2178
|
+
coordinateSystemId: D
|
|
1854
2179
|
},
|
|
1855
2180
|
"world",
|
|
1856
2181
|
this.joggingStore.coordSystems
|
|
@@ -1858,9 +2183,9 @@ class _e {
|
|
|
1858
2183
|
} catch {
|
|
1859
2184
|
return await this.dropPlan(), { ok: !1, errorFeedbackName: "FeedbackUnknown" };
|
|
1860
2185
|
}
|
|
1861
|
-
|
|
2186
|
+
g = {
|
|
1862
2187
|
limits_override: {
|
|
1863
|
-
tcp_velocity_limit:
|
|
2188
|
+
tcp_velocity_limit: d
|
|
1864
2189
|
},
|
|
1865
2190
|
path: {
|
|
1866
2191
|
target_pose: I,
|
|
@@ -1868,70 +2193,79 @@ class _e {
|
|
|
1868
2193
|
}
|
|
1869
2194
|
};
|
|
1870
2195
|
} else
|
|
1871
|
-
|
|
2196
|
+
g = {
|
|
1872
2197
|
limits_override: {
|
|
1873
|
-
joint_velocity_limits: Array(
|
|
2198
|
+
joint_velocity_limits: Array(o.length).fill(d)
|
|
1874
2199
|
},
|
|
1875
2200
|
path: {
|
|
1876
|
-
target_joint_position:
|
|
2201
|
+
target_joint_position: e.joints,
|
|
1877
2202
|
path_definition_name: "PathJointPTP"
|
|
1878
2203
|
}
|
|
1879
2204
|
};
|
|
1880
|
-
|
|
2205
|
+
_(() => {
|
|
1881
2206
|
this.lastError = null, this.trajectoryState = "planning";
|
|
1882
2207
|
});
|
|
1883
|
-
let
|
|
2208
|
+
let f;
|
|
1884
2209
|
try {
|
|
1885
|
-
|
|
2210
|
+
f = await this.jogger.nova.api.trajectoryPlanning.planTrajectory(
|
|
1886
2211
|
this.jogger.cellId,
|
|
1887
2212
|
{
|
|
1888
|
-
motion_group_setup:
|
|
1889
|
-
start_joint_position:
|
|
1890
|
-
motion_commands: [
|
|
2213
|
+
motion_group_setup: a,
|
|
2214
|
+
start_joint_position: o,
|
|
2215
|
+
motion_commands: [g]
|
|
1891
2216
|
}
|
|
1892
2217
|
);
|
|
1893
2218
|
} catch (I) {
|
|
1894
2219
|
throw await this.dropPlan(), I;
|
|
1895
2220
|
}
|
|
1896
|
-
const
|
|
1897
|
-
if ("error_feedback" in
|
|
1898
|
-
const I = ((
|
|
2221
|
+
const p = f.response;
|
|
2222
|
+
if ("error_feedback" in p) {
|
|
2223
|
+
const I = ((J = p.error_feedback) == null ? void 0 : J.error_feedback_name) ?? "FeedbackUnknown";
|
|
1899
2224
|
return await this.dropPlan(), { ok: !1, errorFeedbackName: I };
|
|
1900
2225
|
}
|
|
1901
|
-
const
|
|
1902
|
-
if (!
|
|
2226
|
+
const y = p.joint_positions, u = y[0], m = y[y.length - 1];
|
|
2227
|
+
if (!u || !m)
|
|
1903
2228
|
throw await this.dropPlan(), new Error("Trajectory returned invalid joint positions");
|
|
1904
|
-
const
|
|
2229
|
+
const M = {
|
|
1905
2230
|
message_type: "InitializeMovementRequest",
|
|
1906
2231
|
trajectory: {
|
|
1907
2232
|
message_type: "TrajectoryData",
|
|
1908
2233
|
motion_group: this.jogger.motionGroupId,
|
|
1909
|
-
tcp:
|
|
1910
|
-
data:
|
|
2234
|
+
tcp: h || void 0,
|
|
2235
|
+
data: p
|
|
1911
2236
|
}
|
|
1912
2237
|
};
|
|
1913
|
-
return this.socket.sendJson(
|
|
1914
|
-
this.armed = !0, this.plannedTrajectory = { startJoints:
|
|
2238
|
+
return await this.dropPlanIfRefused(), this.socket.sendJson(M), _(() => {
|
|
2239
|
+
this.armed = !0, this.plannedTrajectory = { startJoints: u, endJoints: m }, this.plannedFor = { target: _e(e), velocity: d };
|
|
1915
2240
|
}), { ok: !0 };
|
|
1916
2241
|
}
|
|
1917
2242
|
/**
|
|
1918
2243
|
* The Move to button is held: starts the motion along the planned
|
|
1919
2244
|
* trajectory, or goes on with a paused one. Returns whether the robot moves
|
|
1920
2245
|
* for this hold: not without a trajectory that NOVA accepted, not while
|
|
1921
|
-
* the move before it still stops,
|
|
2246
|
+
* the move before it still stops, not along a trajectory that was
|
|
1922
2247
|
* planned with another velocity than now
|
|
1923
|
-
* ({@link TrajectoryExecutionStore.isPlanOutdated})
|
|
1924
|
-
*
|
|
2248
|
+
* ({@link TrajectoryExecutionStore.isPlanOutdated}), and not while the
|
|
2249
|
+
* robot may not move or the app locks it (see
|
|
2250
|
+
* `TrajectoryExecutionStoreOptions`). Safe to repeat while held.
|
|
1925
2251
|
* {@link TrajectoryExecutionStore.release} ends the hold.
|
|
1926
2252
|
*
|
|
1927
|
-
* `
|
|
1928
|
-
*
|
|
1929
|
-
*
|
|
1930
|
-
*
|
|
2253
|
+
* `to` is where the button says it moves to, as `planTrajectory` got it:
|
|
2254
|
+
* the robot does not move along a trajectory that was planned for another
|
|
2255
|
+
* target, e.g. while the plan for the shown one is still to come or
|
|
2256
|
+
* failed, nor for a pose of another motion group. Without it, the hold
|
|
2257
|
+
* starts whatever is planned.
|
|
1931
2258
|
*/
|
|
1932
2259
|
hold(t) {
|
|
1933
|
-
|
|
1934
|
-
|
|
2260
|
+
if (!this.plannedTrajectory) return !1;
|
|
2261
|
+
if (t) {
|
|
2262
|
+
const e = this.targetOf(t);
|
|
2263
|
+
if (!e || !(this.plannedFor && Se(e, this.plannedFor.target)))
|
|
2264
|
+
return !1;
|
|
2265
|
+
}
|
|
2266
|
+
return this.motion === "starting" ? !this.releaseOnStart : this.trajectoryState === "moving" ? this.motion === "running" : this.trajectoryState !== "planned" || this.motion === "pausing" || this.executionState === "RUNNING" || // A move starts at the velocity that shows, or not at all
|
|
2267
|
+
this.isPlanOutdated || // NOVA would switch the controller to control mode for the start
|
|
2268
|
+
this.refusal() !== null ? !1 : (this.sendStart(), !0);
|
|
1935
2269
|
}
|
|
1936
2270
|
/**
|
|
1937
2271
|
* The Move to button was let go: pauses the motion. Whatever the motion
|
|
@@ -1947,7 +2281,9 @@ class _e {
|
|
|
1947
2281
|
}
|
|
1948
2282
|
/**
|
|
1949
2283
|
* Starts the motion along the planned trajectory. For a button that is
|
|
1950
|
-
* held, use {@link TrajectoryExecutionStore.hold}.
|
|
2284
|
+
* held, use {@link TrajectoryExecutionStore.hold}. Throws when nothing can
|
|
2285
|
+
* start, and while the robot may not move or the app locks it (see
|
|
2286
|
+
* `TrajectoryExecutionStoreOptions`).
|
|
1951
2287
|
*/
|
|
1952
2288
|
start() {
|
|
1953
2289
|
if (!this.plannedTrajectory)
|
|
@@ -1958,7 +2294,30 @@ class _e {
|
|
|
1958
2294
|
);
|
|
1959
2295
|
if (this.executionState === "RUNNING")
|
|
1960
2296
|
throw new Error("Cannot start trajectory: robot is already running");
|
|
1961
|
-
this.motion
|
|
2297
|
+
if (this.motion === "starting") return;
|
|
2298
|
+
const t = this.refusal();
|
|
2299
|
+
if (t)
|
|
2300
|
+
throw new Error(`Cannot start trajectory: ${t}`);
|
|
2301
|
+
this.sendStart();
|
|
2302
|
+
}
|
|
2303
|
+
/**
|
|
2304
|
+
* Why the store sends the robot no trajectory and no start now, or null:
|
|
2305
|
+
* the app locks the robot, or the robot may not move
|
|
2306
|
+
*/
|
|
2307
|
+
refusal() {
|
|
2308
|
+
var e, o, i, n;
|
|
2309
|
+
if ((o = (e = this.options).isLocked) != null && o.call(e)) return "the robot is locked";
|
|
2310
|
+
const t = (n = (i = this.options).notMoveableReason) == null ? void 0 : n.call(i);
|
|
2311
|
+
return t ? `the robot may not move (${t.code})` : null;
|
|
2312
|
+
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Drops the plan and throws while the store sends the robot no
|
|
2315
|
+
* trajectory, see {@link TrajectoryExecutionStore.planTrajectory}
|
|
2316
|
+
*/
|
|
2317
|
+
async dropPlanIfRefused() {
|
|
2318
|
+
const t = this.refusal();
|
|
2319
|
+
if (t)
|
|
2320
|
+
throw await this.dropPlan(), new Error(`Cannot plan trajectory: ${t}`);
|
|
1962
2321
|
}
|
|
1963
2322
|
/**
|
|
1964
2323
|
* Pauses the motion. Resolves once the robot stands still; the trajectory
|
|
@@ -1985,7 +2344,7 @@ class _e {
|
|
|
1985
2344
|
} catch (t) {
|
|
1986
2345
|
this.logger.warn("Failed to stop trajectory execution cleanly", t);
|
|
1987
2346
|
} finally {
|
|
1988
|
-
this.reset(), this.closeSocket(), this.socket = this.openSocket();
|
|
2347
|
+
this.reset(), this.closeSocket(), this.disposed || (this.socket = this.openSocket());
|
|
1989
2348
|
}
|
|
1990
2349
|
}
|
|
1991
2350
|
/**
|
|
@@ -2008,19 +2367,24 @@ class _e {
|
|
|
2008
2367
|
clearError() {
|
|
2009
2368
|
this.lastError = null;
|
|
2010
2369
|
}
|
|
2011
|
-
/**
|
|
2370
|
+
/**
|
|
2371
|
+
* Closes the execution websocket and stops following the motion stream.
|
|
2372
|
+
* No execution websocket opens afterwards.
|
|
2373
|
+
*/
|
|
2012
2374
|
dispose() {
|
|
2375
|
+
this.disposed = !0;
|
|
2013
2376
|
for (const t of this.disposers)
|
|
2014
2377
|
t();
|
|
2015
2378
|
this.closeSocket();
|
|
2016
2379
|
}
|
|
2017
2380
|
/**
|
|
2018
2381
|
* The velocity limit of a trajectory to a target: the jogging store's
|
|
2019
|
-
* translation velocity (mm/s) for a pose,
|
|
2020
|
-
*
|
|
2382
|
+
* translation velocity (mm/s) for a pose, and for joints the velocity
|
|
2383
|
+
* they are jogged with, which is its rotation velocity (rad/s), or its
|
|
2384
|
+
* translation velocity (mm/s) for linear axes
|
|
2021
2385
|
*/
|
|
2022
2386
|
velocityFor(t) {
|
|
2023
|
-
return t.type === "cartesian" ? this.joggingStore.translationVelocityMmPerSec : this.joggingStore.rotationVelocityRadsPerSec;
|
|
2387
|
+
return t.type === "cartesian" || this.joggingStore.jointType === O.PrismaticJoint ? this.joggingStore.translationVelocityMmPerSec : this.joggingStore.rotationVelocityRadsPerSec;
|
|
2024
2388
|
}
|
|
2025
2389
|
/** Ends continuous jogging, unless the app has its own way */
|
|
2026
2390
|
async ensureMovementOwnership() {
|
|
@@ -2051,7 +2415,7 @@ class _e {
|
|
|
2051
2415
|
* pause of its own to wait for.
|
|
2052
2416
|
*/
|
|
2053
2417
|
async settlePause() {
|
|
2054
|
-
await this.waitUntilStopped(),
|
|
2418
|
+
await this.waitUntilStopped(), _(() => {
|
|
2055
2419
|
this.motion === "pausing" && (this.motion = null, (this.trajectoryState === "moving" || this.trajectoryState === "stopping") && (this.trajectoryState = this.plannedTrajectory ? "planned" : "idle"));
|
|
2056
2420
|
});
|
|
2057
2421
|
}
|
|
@@ -2060,12 +2424,12 @@ class _e {
|
|
|
2060
2424
|
await k(() => this.motionStream.rapidlyChangingMotionState.standstill);
|
|
2061
2425
|
}
|
|
2062
2426
|
handleMessage(t) {
|
|
2063
|
-
var o,
|
|
2064
|
-
const e = (o =
|
|
2427
|
+
var o, i;
|
|
2428
|
+
const e = (o = b(t.data)) == null ? void 0 : o.result;
|
|
2065
2429
|
if (e)
|
|
2066
2430
|
switch (e.kind) {
|
|
2067
2431
|
case "INITIALIZE_RECEIVED":
|
|
2068
|
-
e.add_trajectory_error || e.message ? (this.lastError = ((
|
|
2432
|
+
e.add_trajectory_error || e.message ? (this.lastError = ((i = e.add_trajectory_error) == null ? void 0 : i.message) ?? e.message ?? "NOVA refused the trajectory", this.reset()) : this.trajectoryState = "planned";
|
|
2069
2433
|
break;
|
|
2070
2434
|
case "START_RECEIVED":
|
|
2071
2435
|
this.motion = "running", this.trajectoryState = "moving", this.releaseOnStart && (this.releaseOnStart = !1, this.sendPause(), this.settlePause());
|
|
@@ -2088,18 +2452,18 @@ class _e {
|
|
|
2088
2452
|
this.socket.removeEventListener("message", this.handleMessage), this.socket.dispose(), this.armed = !1, this.motion = null;
|
|
2089
2453
|
}
|
|
2090
2454
|
}
|
|
2091
|
-
const
|
|
2455
|
+
const je = {
|
|
2092
2456
|
a: 0,
|
|
2093
2457
|
d: 0,
|
|
2094
2458
|
alpha: 0,
|
|
2095
2459
|
theta: 0,
|
|
2096
2460
|
reverse_rotation_direction: !1
|
|
2097
2461
|
};
|
|
2098
|
-
class
|
|
2462
|
+
class Ee {
|
|
2099
2463
|
/** @internal The session makes it, see RobotSession */
|
|
2100
|
-
constructor(t, e, o,
|
|
2101
|
-
this.motionGroupDescription = t, this.controllerConfiguration = e, this.kinematicModel = o, this.resolvedMotionGroupModel =
|
|
2102
|
-
(
|
|
2464
|
+
constructor(t, e, o, i, n) {
|
|
2465
|
+
this.motionGroupDescription = t, this.controllerConfiguration = e, this.kinematicModel = o, this.resolvedMotionGroupModel = i, this.coordinateSystems = n, this.dhParameters = (t.dh_parameters ?? []).map(
|
|
2466
|
+
(r) => ({ ...je, ...r })
|
|
2103
2467
|
);
|
|
2104
2468
|
}
|
|
2105
2469
|
/** A virtual robot of NOVA's simulation, not a physical one */
|
|
@@ -2177,7 +2541,7 @@ class je {
|
|
|
2177
2541
|
return this.motionGroupDescription.tcps ?? {};
|
|
2178
2542
|
}
|
|
2179
2543
|
}
|
|
2180
|
-
const
|
|
2544
|
+
const pt = (s) => Array.isArray(s) && s.length === 3 && s.every((t) => typeof t == "number"), Te = 1e-3, Me = 0.5, we = 0.01, q = (s, t, e) => !!(s && t && G([...s], [...t], e));
|
|
2181
2545
|
class ve {
|
|
2182
2546
|
/** @internal The session makes it, see RobotSession */
|
|
2183
2547
|
constructor(t, e, o) {
|
|
@@ -2249,10 +2613,10 @@ class ve {
|
|
|
2249
2613
|
return q(
|
|
2250
2614
|
t.joints,
|
|
2251
2615
|
this.rapidlyChangingMotionState.joint_position,
|
|
2252
|
-
|
|
2616
|
+
Te
|
|
2253
2617
|
);
|
|
2254
2618
|
try {
|
|
2255
|
-
const e =
|
|
2619
|
+
const e = nt({
|
|
2256
2620
|
inputPose: this.measuredTcpPoseReference,
|
|
2257
2621
|
selectedTcpId: t.tcpPose.tcpId,
|
|
2258
2622
|
selectedCoordinateSystemId: t.tcpPose.coordSystemId,
|
|
@@ -2266,7 +2630,7 @@ class ve {
|
|
|
2266
2630
|
) && q(
|
|
2267
2631
|
t.tcpPose.pose.orientation,
|
|
2268
2632
|
e.pose.orientation,
|
|
2269
|
-
|
|
2633
|
+
we
|
|
2270
2634
|
);
|
|
2271
2635
|
} catch {
|
|
2272
2636
|
return !1;
|
|
@@ -2282,18 +2646,18 @@ class ve {
|
|
|
2282
2646
|
for (; !G(
|
|
2283
2647
|
t.joint_position,
|
|
2284
2648
|
e.joint_position,
|
|
2285
|
-
|
|
2649
|
+
Et
|
|
2286
2650
|
); )
|
|
2287
2651
|
t = e, e = await this.stream.nextMotionState();
|
|
2288
2652
|
}
|
|
2289
2653
|
tcpPoseReferenceOf(t) {
|
|
2290
|
-
var
|
|
2291
|
-
const e = (
|
|
2292
|
-
if (!e || !
|
|
2654
|
+
var i, n;
|
|
2655
|
+
const e = (i = t.tcp_pose) == null ? void 0 : i.position, o = (n = t.tcp_pose) == null ? void 0 : n.orientation;
|
|
2656
|
+
if (!e || !pt(e))
|
|
2293
2657
|
throw new Error(
|
|
2294
2658
|
`Invalid current TCP pose position for motion group ${this.stream.motionGroupId}`
|
|
2295
2659
|
);
|
|
2296
|
-
if (!o || !
|
|
2660
|
+
if (!o || !pt(o))
|
|
2297
2661
|
throw new Error(
|
|
2298
2662
|
`Invalid current TCP pose orientation for motion group ${this.stream.motionGroupId}`
|
|
2299
2663
|
);
|
|
@@ -2304,7 +2668,7 @@ class ve {
|
|
|
2304
2668
|
};
|
|
2305
2669
|
}
|
|
2306
2670
|
inSelectedFrame(t) {
|
|
2307
|
-
return
|
|
2671
|
+
return nt({
|
|
2308
2672
|
inputPose: t,
|
|
2309
2673
|
selectedTcpId: this.jogging.selectedTcpId,
|
|
2310
2674
|
selectedCoordinateSystemId: this.jogging.selectedCoordSystemId,
|
|
@@ -2313,21 +2677,21 @@ class ve {
|
|
|
2313
2677
|
});
|
|
2314
2678
|
}
|
|
2315
2679
|
}
|
|
2316
|
-
const
|
|
2680
|
+
const Oe = [
|
|
2317
2681
|
"SAFETY_STATE_ROBOT_EMERGENCY_STOP",
|
|
2318
2682
|
"SAFETY_STATE_DEVICE_EMERGENCY_STOP"
|
|
2319
|
-
],
|
|
2683
|
+
], be = ["SAFETY_STATE_NORMAL", "SAFETY_STATE_REDUCED"], Ce = [
|
|
2320
2684
|
"SAFETY_STATE_STOP",
|
|
2321
2685
|
"SAFETY_STATE_STOP_0",
|
|
2322
2686
|
"SAFETY_STATE_STOP_1",
|
|
2323
2687
|
"SAFETY_STATE_STOP_2"
|
|
2324
|
-
],
|
|
2688
|
+
], Re = [
|
|
2325
2689
|
"OPERATION_MODE_AUTO",
|
|
2326
2690
|
"OPERATION_MODE_MANUAL",
|
|
2327
2691
|
"OPERATION_MODE_MANUAL_T1",
|
|
2328
2692
|
"OPERATION_MODE_MANUAL_T2"
|
|
2329
2693
|
];
|
|
2330
|
-
class
|
|
2694
|
+
class Pe {
|
|
2331
2695
|
/** @internal The session makes it, see RobotSession */
|
|
2332
2696
|
constructor(t, e) {
|
|
2333
2697
|
this.state = t, this.activationState = e, j(
|
|
@@ -2344,15 +2708,15 @@ class Re {
|
|
|
2344
2708
|
}
|
|
2345
2709
|
/** Whether an emergency stop is active */
|
|
2346
2710
|
get isEstopActive() {
|
|
2347
|
-
return
|
|
2711
|
+
return Oe.includes(this.safetyState);
|
|
2348
2712
|
}
|
|
2349
2713
|
/** Whether the safety state allows movement */
|
|
2350
2714
|
get isMoveableSafetyState() {
|
|
2351
|
-
return
|
|
2715
|
+
return be.includes(this.safetyState);
|
|
2352
2716
|
}
|
|
2353
2717
|
/** Whether the operation mode allows movement */
|
|
2354
2718
|
get isMoveableOperationMode() {
|
|
2355
|
-
return
|
|
2719
|
+
return Re.includes(this.operationMode);
|
|
2356
2720
|
}
|
|
2357
2721
|
/**
|
|
2358
2722
|
* Whether the safety state allows switching to control mode: the moveable
|
|
@@ -2385,8 +2749,8 @@ class Re {
|
|
|
2385
2749
|
return this.isMoveableSafetyState && this.isMoveableOperationMode && this.activationState() === "active" && this.state.connectionQuality !== "critical";
|
|
2386
2750
|
}
|
|
2387
2751
|
}
|
|
2388
|
-
const
|
|
2389
|
-
class
|
|
2752
|
+
const ke = "Jogging.TargetPose.Error.MoveFailed.lb";
|
|
2753
|
+
class Ae {
|
|
2390
2754
|
/** @internal The session makes it, see RobotSession */
|
|
2391
2755
|
constructor(t, e) {
|
|
2392
2756
|
this.robot = t, this.logger = e, this.editing = !1, this.draft = "", this.confirming = !1, this.staged = null, this.moveStarted = !1, this.disposers = [], j(
|
|
@@ -2394,41 +2758,41 @@ class ke {
|
|
|
2394
2758
|
{ robot: !1, logger: !1, disposers: !1, onBeforePlan: !1 },
|
|
2395
2759
|
{ autoBind: !0 }
|
|
2396
2760
|
), this.disposers.push(
|
|
2397
|
-
|
|
2761
|
+
v(
|
|
2398
2762
|
() => this.robot.jogging.selectedTabId,
|
|
2399
2763
|
() => {
|
|
2400
2764
|
(this.editing || this.staged) && this.resetToLive();
|
|
2401
2765
|
}
|
|
2402
2766
|
)
|
|
2403
2767
|
), this.disposers.push(
|
|
2404
|
-
|
|
2768
|
+
v(
|
|
2405
2769
|
() => ({
|
|
2406
2770
|
trajectoryState: this.robot.trajectory.trajectoryState,
|
|
2407
2771
|
executionState: this.robot.trajectory.executionState,
|
|
2408
2772
|
isRobotAtStagedPose: this.isRobotAtStagedPose
|
|
2409
2773
|
}),
|
|
2410
|
-
({ trajectoryState: o, executionState:
|
|
2774
|
+
({ trajectoryState: o, executionState: i, isRobotAtStagedPose: n }) => {
|
|
2411
2775
|
if (!this.stagedPose) return;
|
|
2412
2776
|
if (o === "moving") {
|
|
2413
2777
|
this.moveStarted = !0;
|
|
2414
2778
|
return;
|
|
2415
2779
|
}
|
|
2416
|
-
(
|
|
2780
|
+
(i === "END_OF_TRAJECTORY" || this.moveStarted && n && o !== "stopping") && this.resetToLive();
|
|
2417
2781
|
}
|
|
2418
2782
|
)
|
|
2419
2783
|
), this.disposers.push(
|
|
2420
|
-
|
|
2784
|
+
v(
|
|
2421
2785
|
() => this.robot.trajectory.lastError,
|
|
2422
2786
|
(o) => {
|
|
2423
2787
|
o && this.staged && !this.staged.errorKey && (this.staged = {
|
|
2424
2788
|
...this.staged,
|
|
2425
|
-
errorKey:
|
|
2789
|
+
errorKey: ke,
|
|
2426
2790
|
errorMessage: o
|
|
2427
2791
|
});
|
|
2428
2792
|
}
|
|
2429
2793
|
)
|
|
2430
2794
|
), this.disposers.push(
|
|
2431
|
-
|
|
2795
|
+
v(
|
|
2432
2796
|
() => !this.confirming && this.robot.trajectory.trajectoryState === "planned" && this.robot.trajectory.isPlanOutdated,
|
|
2433
2797
|
(o) => {
|
|
2434
2798
|
o && this.stagedPose && this.plan(this.stagedPose);
|
|
@@ -2465,16 +2829,16 @@ class ke {
|
|
|
2465
2829
|
const n = Bt(this.draft, t.jointPose.length);
|
|
2466
2830
|
return n ? { type: "joint", motionGroupId: e, joints: n } : null;
|
|
2467
2831
|
}
|
|
2468
|
-
const o =
|
|
2832
|
+
const o = Wt(this.draft);
|
|
2469
2833
|
if (!o || !t.displayedTcpPose) return null;
|
|
2470
|
-
const
|
|
2834
|
+
const i = t.displayedTcpPoseReference;
|
|
2471
2835
|
return {
|
|
2472
2836
|
type: "cartesian",
|
|
2473
2837
|
motionGroupId: e,
|
|
2474
2838
|
tcpPose: {
|
|
2475
2839
|
pose: { position: o.position, orientation: o.orientation },
|
|
2476
|
-
coordSystemId:
|
|
2477
|
-
tcpId:
|
|
2840
|
+
coordSystemId: i.coordinateSystemId,
|
|
2841
|
+
tcpId: i.tcpId
|
|
2478
2842
|
}
|
|
2479
2843
|
};
|
|
2480
2844
|
}
|
|
@@ -2524,18 +2888,18 @@ class ke {
|
|
|
2524
2888
|
this.confirming = !0;
|
|
2525
2889
|
try {
|
|
2526
2890
|
await ((o = this.onBeforePlan) == null ? void 0 : o.call(this));
|
|
2527
|
-
const
|
|
2528
|
-
|
|
2891
|
+
const i = await this.robot.trajectory.planTrajectory(
|
|
2892
|
+
K(t)
|
|
2529
2893
|
);
|
|
2530
|
-
|
|
2894
|
+
_(() => {
|
|
2531
2895
|
this.staged = {
|
|
2532
2896
|
pose: t,
|
|
2533
2897
|
displayString: e,
|
|
2534
|
-
errorKey:
|
|
2898
|
+
errorKey: i.ok ? null : he(i.errorFeedbackName)
|
|
2535
2899
|
}, this.editing = !1, this.draft = "";
|
|
2536
2900
|
});
|
|
2537
|
-
} catch (
|
|
2538
|
-
this.logger.warn("Failed to plan trajectory to typed pose",
|
|
2901
|
+
} catch (i) {
|
|
2902
|
+
this.logger.warn("Failed to plan trajectory to typed pose", i), _(() => {
|
|
2539
2903
|
this.staged = {
|
|
2540
2904
|
pose: t,
|
|
2541
2905
|
displayString: e,
|
|
@@ -2543,7 +2907,7 @@ class ke {
|
|
|
2543
2907
|
}, this.editing = !1, this.draft = "";
|
|
2544
2908
|
});
|
|
2545
2909
|
} finally {
|
|
2546
|
-
|
|
2910
|
+
_(() => {
|
|
2547
2911
|
this.confirming = !1;
|
|
2548
2912
|
});
|
|
2549
2913
|
}
|
|
@@ -2553,12 +2917,14 @@ class ke {
|
|
|
2553
2917
|
* is, see {@link TrajectoryExecutionStore.hold}. `pose` is the pose that
|
|
2554
2918
|
* the button's panel shows: nothing moves unless that is the staged pose,
|
|
2555
2919
|
* so a panel that shows another one (its plan is still to come, or was
|
|
2556
|
-
* refused) cannot start the move to this one.
|
|
2557
|
-
*
|
|
2920
|
+
* refused) cannot start the move to this one. Nothing moves while the
|
|
2921
|
+
* robot may not move either: the staged pose stays for when it may.
|
|
2922
|
+
* Returns whether the robot moves for this hold.
|
|
2923
|
+
* {@link RobotTargetPose.releaseMove} ends the hold.
|
|
2558
2924
|
*/
|
|
2559
2925
|
holdMove(t) {
|
|
2560
2926
|
const e = this.stagedPose;
|
|
2561
|
-
return !e ||
|
|
2927
|
+
return !e || !Gt(e, t) || this.robot.notMoveableReason() ? !1 : this.robot.trajectory.hold(K(e));
|
|
2562
2928
|
}
|
|
2563
2929
|
/**
|
|
2564
2930
|
* The Move to button was let go: the robot stops, see
|
|
@@ -2593,21 +2959,21 @@ class ke {
|
|
|
2593
2959
|
return this.stagedPose ? this.robot.state.isAt(this.stagedPose) : !1;
|
|
2594
2960
|
}
|
|
2595
2961
|
}
|
|
2596
|
-
const
|
|
2962
|
+
const Je = {
|
|
2597
2963
|
getItem: () => null,
|
|
2598
2964
|
setItem: () => {
|
|
2599
2965
|
}
|
|
2600
2966
|
};
|
|
2601
|
-
class
|
|
2967
|
+
class De {
|
|
2602
2968
|
/**
|
|
2603
2969
|
* @internal Use {@link loadRobotSession}, which loads the resources and
|
|
2604
2970
|
* makes the session
|
|
2605
2971
|
*/
|
|
2606
|
-
constructor(t, e, o,
|
|
2607
|
-
const n =
|
|
2608
|
-
this.onError =
|
|
2972
|
+
constructor(t, e, o, i = {}) {
|
|
2973
|
+
const n = i.logger ?? console;
|
|
2974
|
+
this.onError = i.onError ?? (() => {
|
|
2609
2975
|
}), this.nova = t, this.motionGroupId = e.motionGroupId, this.controllerId = e.controllerId, this.cellId = e.cellId, this.stateSource = o.stateSource, this.motionStateSocket = o.motionStateSocket;
|
|
2610
|
-
const
|
|
2976
|
+
const r = new x(
|
|
2611
2977
|
t,
|
|
2612
2978
|
o.controllerState,
|
|
2613
2979
|
o.motionGroupState,
|
|
@@ -2616,13 +2982,13 @@ class Je {
|
|
|
2616
2982
|
o.motionStateSocket,
|
|
2617
2983
|
e.cellId,
|
|
2618
2984
|
{ logger: n }
|
|
2619
|
-
), l = new
|
|
2985
|
+
), l = new Z(r, {
|
|
2620
2986
|
cellId: e.cellId,
|
|
2621
2987
|
motionGroupModel: o.motionGroupModelName,
|
|
2622
2988
|
logger: n,
|
|
2623
2989
|
onError: (c) => this.onError({
|
|
2624
2990
|
kind: "jog",
|
|
2625
|
-
message:
|
|
2991
|
+
message: R(c),
|
|
2626
2992
|
url: l.motionStream.motionStateSocket.url,
|
|
2627
2993
|
cause: c
|
|
2628
2994
|
})
|
|
@@ -2635,18 +3001,18 @@ class Je {
|
|
|
2635
3001
|
kinematicModel: o.kinematicModel
|
|
2636
3002
|
},
|
|
2637
3003
|
{
|
|
2638
|
-
storage:
|
|
3004
|
+
storage: i.storage ?? Je,
|
|
2639
3005
|
// The store starts no jog while the robot may not move
|
|
2640
3006
|
notMoveableReason: () => this.jogRefusedReason
|
|
2641
3007
|
}
|
|
2642
|
-
), this.description = new
|
|
3008
|
+
), this.description = new Ee(
|
|
2643
3009
|
o.motionGroupDescription,
|
|
2644
3010
|
o.controllerConfiguration,
|
|
2645
3011
|
o.kinematicModel,
|
|
2646
3012
|
o.motionGroupModelName,
|
|
2647
3013
|
this.jogging.coordSystems
|
|
2648
3014
|
);
|
|
2649
|
-
const h = new
|
|
3015
|
+
const h = new le(
|
|
2650
3016
|
o.stateSource,
|
|
2651
3017
|
e.motionGroupId,
|
|
2652
3018
|
o.initialControllerState,
|
|
@@ -2655,39 +3021,42 @@ class Je {
|
|
|
2655
3021
|
onError: (c) => this.onError({ kind: "stream", ...c })
|
|
2656
3022
|
}
|
|
2657
3023
|
);
|
|
2658
|
-
this.state = new ve(h, this.description, this.jogging), this.activation = new
|
|
3024
|
+
this.state = new ve(h, this.description, this.jogging), this.activation = new xt(
|
|
2659
3025
|
t,
|
|
2660
3026
|
e,
|
|
2661
3027
|
this.state,
|
|
2662
3028
|
() => this.safety,
|
|
2663
3029
|
n,
|
|
2664
|
-
() => this.
|
|
2665
|
-
), this.safety = new
|
|
3030
|
+
() => this.releaseControl()
|
|
3031
|
+
), this.safety = new Pe(this.state, () => this.activation.state), this.trajectory = new Ie({
|
|
2666
3032
|
joggingStore: this.jogging,
|
|
2667
|
-
isLocked:
|
|
3033
|
+
isLocked: i.isLocked,
|
|
3034
|
+
// Move to starts no move while a jog would be refused for the robot
|
|
3035
|
+
notMoveableReason: () => this.jogRefusedReason,
|
|
2668
3036
|
ensureMovementOwnership: () => this.ensureMovementOwnership("trajectory"),
|
|
2669
3037
|
logger: n
|
|
2670
|
-
}), this.targetPose = new
|
|
3038
|
+
}), this.targetPose = new Ae(
|
|
2671
3039
|
{
|
|
2672
3040
|
motionGroupId: e.motionGroupId,
|
|
2673
3041
|
state: this.state,
|
|
2674
3042
|
jogging: this.jogging,
|
|
2675
3043
|
trajectory: this.trajectory,
|
|
2676
|
-
// A typed pose plans nothing while the robot may
|
|
2677
|
-
//
|
|
3044
|
+
// A typed pose plans nothing and moves nothing while the robot may
|
|
3045
|
+
// not move, as jogging (also while it is activating or
|
|
3046
|
+
// deactivating), or while the app is locked
|
|
2678
3047
|
notMoveableReason: () => {
|
|
2679
3048
|
var c;
|
|
2680
|
-
return this.
|
|
3049
|
+
return this.jogRefusedReason ?? ((c = i.isLocked) != null && c.call(i) ? { code: "locked" } : null);
|
|
2681
3050
|
}
|
|
2682
3051
|
},
|
|
2683
3052
|
n
|
|
2684
3053
|
), this.jogging.onBeforeActivate = async () => {
|
|
2685
3054
|
this.targetPose.staged && await this.targetPose.resetToLive();
|
|
2686
|
-
},
|
|
3055
|
+
}, i.autoActivateVirtual && this.description.isVirtual && this.activation.state === "inactive" && this.activation.activate().catch((c) => {
|
|
2687
3056
|
this.onError({
|
|
2688
3057
|
kind: "mode",
|
|
2689
|
-
message:
|
|
2690
|
-
url: c instanceof
|
|
3058
|
+
message: R(c),
|
|
3059
|
+
url: c instanceof Ut ? c.url : void 0,
|
|
2691
3060
|
cause: c
|
|
2692
3061
|
});
|
|
2693
3062
|
});
|
|
@@ -2707,21 +3076,42 @@ class Je {
|
|
|
2707
3076
|
}
|
|
2708
3077
|
/**
|
|
2709
3078
|
* Hands the robot to jogging or to a trajectory: the controller runs only
|
|
2710
|
-
* one of them at a time
|
|
3079
|
+
* one of them at a time.
|
|
3080
|
+
*
|
|
3081
|
+
* Handing it to jogging opens the jogging websocket, a movement connection
|
|
3082
|
+
* for which NOVA switches the controller to control mode by itself. So it
|
|
3083
|
+
* rejects with a `JoggingRefusedError` as a jog of {@link RobotSession.jogging}
|
|
3084
|
+
* does, while the robot may not move or its jogging store is locked.
|
|
3085
|
+
* Handing it to a trajectory opens nothing.
|
|
2711
3086
|
*/
|
|
2712
3087
|
async ensureMovementOwnership(t) {
|
|
2713
|
-
this.movementOwner !== t
|
|
3088
|
+
if (this.movementOwner !== t) {
|
|
3089
|
+
if (t === "jogging") {
|
|
3090
|
+
await this.jogging.claimForJogging();
|
|
3091
|
+
return;
|
|
3092
|
+
}
|
|
3093
|
+
await this.jogging.deactivate(), await this.jogging.jogger.setJoggingMode(t);
|
|
3094
|
+
}
|
|
2714
3095
|
}
|
|
2715
3096
|
/**
|
|
2716
|
-
* Why the jogging store starts no jog now,
|
|
2717
|
-
*
|
|
2718
|
-
*
|
|
2719
|
-
* controller is not in control mode yet, where NOVA
|
|
2720
|
-
* the
|
|
3097
|
+
* Why the jogging store starts no jog now, and Move to plans and starts
|
|
3098
|
+
* no move, or null when the robot can move. While the robot is activating
|
|
3099
|
+
* or deactivating its safety has no reason (the robot is not
|
|
3100
|
+
* deactivated). But its controller is not in control mode yet, where NOVA
|
|
3101
|
+
* would switch it for the movement request, or is about to leave it: no
|
|
3102
|
+
* jog and no move then either.
|
|
2721
3103
|
*/
|
|
2722
3104
|
get jogRefusedReason() {
|
|
2723
3105
|
return this.safety.notMoveableReason ?? (this.safety.canBeMoved ? null : { code: "deactivated" });
|
|
2724
3106
|
}
|
|
3107
|
+
/**
|
|
3108
|
+
* Hands back what holds the controller in control mode, before the robot
|
|
3109
|
+
* is deactivated: a step that runs, which is stopped and over once the
|
|
3110
|
+
* robot stands still (NOVA would run it to its end), and a planned move
|
|
3111
|
+
*/
|
|
3112
|
+
async releaseControl() {
|
|
3113
|
+
await this.jogging.stopIncrementalJog({ code: "deactivated" }), await this.releasePlannedMove();
|
|
3114
|
+
}
|
|
2725
3115
|
/**
|
|
2726
3116
|
* Drops a planned move: a staged typed pose, or a trajectory the app
|
|
2727
3117
|
* planned itself (RobotPad: to a saved pose). It holds the controller's
|
|
@@ -2737,11 +3127,11 @@ class Je {
|
|
|
2737
3127
|
this.activation.dispose(), this.targetPose.dispose(), this.state.stream.dispose(), this.trajectory.dispose(), this.stateSource.close(), this.jogging.dispose(), this.motionStateSocket.dispose();
|
|
2738
3128
|
}
|
|
2739
3129
|
}
|
|
2740
|
-
const
|
|
2741
|
-
class
|
|
3130
|
+
const Fe = [1e3, 2e3], Ne = (s) => new Promise((t) => setTimeout(t, s));
|
|
3131
|
+
class Le {
|
|
2742
3132
|
/** @internal Use {@link loadRobotSession} */
|
|
2743
|
-
constructor(t, e, o,
|
|
2744
|
-
this.nova = t, this.motionGroupId = e, this.ids = o, this.options =
|
|
3133
|
+
constructor(t, e, o, i) {
|
|
3134
|
+
this.nova = t, this.motionGroupId = e, this.ids = o, this.options = i, this.state = "loading", this.session = null, this.error = null, this.attempt = 0, this.disposed = !1, this.progress = new me(e, o.controllerId), j(
|
|
2745
3135
|
this,
|
|
2746
3136
|
{
|
|
2747
3137
|
nova: !1,
|
|
@@ -2778,7 +3168,7 @@ class Ne {
|
|
|
2778
3168
|
this.readyPromise = new Promise((e, o) => {
|
|
2779
3169
|
this.settle = { resolve: e, reject: o };
|
|
2780
3170
|
}), this.readyPromise.catch(() => {
|
|
2781
|
-
}),
|
|
3171
|
+
}), _(() => {
|
|
2782
3172
|
this.state = "loading", this.error = null;
|
|
2783
3173
|
}), this.run(t);
|
|
2784
3174
|
}
|
|
@@ -2787,107 +3177,103 @@ class Ne {
|
|
|
2787
3177
|
}
|
|
2788
3178
|
async run(t) {
|
|
2789
3179
|
var l, h;
|
|
2790
|
-
const { cellId: e, controllerId: o } = this.ids,
|
|
3180
|
+
const { cellId: e, controllerId: o } = this.ids, i = this.options.retryDelaysMs ?? Fe, n = this.options.logger ?? console, r = this.options.stateSource ?? ((c) => ue(this.nova, c));
|
|
2791
3181
|
for (let c = 0; ; c++)
|
|
2792
3182
|
try {
|
|
2793
|
-
const
|
|
3183
|
+
const a = await ye({
|
|
2794
3184
|
nova: this.nova,
|
|
2795
3185
|
cellId: e,
|
|
2796
3186
|
controllerId: o,
|
|
2797
3187
|
motionGroupId: this.motionGroupId,
|
|
2798
3188
|
progress: this.progress,
|
|
2799
|
-
createStateSource:
|
|
3189
|
+
createStateSource: r,
|
|
2800
3190
|
isStale: () => this.isStale(t),
|
|
2801
3191
|
socketTimeoutMs: this.options.socketTimeoutMs
|
|
2802
3192
|
});
|
|
2803
|
-
if (!
|
|
3193
|
+
if (!a) return;
|
|
2804
3194
|
if (this.isStale(t)) {
|
|
2805
|
-
|
|
3195
|
+
a.dispose();
|
|
2806
3196
|
return;
|
|
2807
3197
|
}
|
|
2808
3198
|
let d;
|
|
2809
3199
|
try {
|
|
2810
|
-
d = new
|
|
3200
|
+
d = new De(
|
|
2811
3201
|
this.nova,
|
|
2812
3202
|
{ cellId: e, controllerId: o, motionGroupId: this.motionGroupId },
|
|
2813
|
-
|
|
3203
|
+
a,
|
|
2814
3204
|
this.options
|
|
2815
3205
|
);
|
|
2816
3206
|
} catch (g) {
|
|
2817
|
-
throw
|
|
3207
|
+
throw a.dispose(), g;
|
|
2818
3208
|
}
|
|
2819
3209
|
if (this.isStale(t)) {
|
|
2820
3210
|
d.dispose();
|
|
2821
3211
|
return;
|
|
2822
3212
|
}
|
|
2823
|
-
|
|
3213
|
+
_(() => {
|
|
2824
3214
|
this.session = d, this.state = "ready";
|
|
2825
3215
|
}), this.settle.resolve(d);
|
|
2826
3216
|
return;
|
|
2827
|
-
} catch (
|
|
3217
|
+
} catch (a) {
|
|
2828
3218
|
if (this.isStale(t)) return;
|
|
2829
|
-
const d = B(
|
|
3219
|
+
const d = B(a) ? i[c] : void 0;
|
|
2830
3220
|
if (d === void 0) {
|
|
2831
|
-
|
|
2832
|
-
B(
|
|
3221
|
+
_(() => {
|
|
3222
|
+
B(a) ? this.progress.failStep(a.stepId, a.cause) : this.progress.failWith(a), this.state = "failed", this.error = a;
|
|
2833
3223
|
}), (h = (l = this.options).onEvent) == null || h.call(l, {
|
|
2834
3224
|
type: "loadFailed",
|
|
2835
3225
|
motionGroupId: this.motionGroupId,
|
|
2836
|
-
step: B(
|
|
2837
|
-
message:
|
|
3226
|
+
step: B(a) ? a.stepId : "unknown",
|
|
3227
|
+
message: R(a),
|
|
2838
3228
|
attempts: c + 1
|
|
2839
|
-
}), this.settle.reject(
|
|
3229
|
+
}), this.settle.reject(a);
|
|
2840
3230
|
return;
|
|
2841
3231
|
}
|
|
2842
3232
|
if (n.warn(
|
|
2843
|
-
`Retrying load of robot "${this.motionGroupId}" after: ${
|
|
2844
|
-
),
|
|
3233
|
+
`Retrying load of robot "${this.motionGroupId}" after: ${R(a)}`
|
|
3234
|
+
), _(() => {
|
|
2845
3235
|
this.progress.beginRetry(c + 1);
|
|
2846
|
-
}), await
|
|
3236
|
+
}), await Ne(d), this.isStale(t)) return;
|
|
2847
3237
|
}
|
|
2848
3238
|
}
|
|
2849
3239
|
}
|
|
2850
|
-
function Qe(
|
|
2851
|
-
return
|
|
3240
|
+
function Qe(s, t, e = {}) {
|
|
3241
|
+
return Ve(L(s), t, {
|
|
2852
3242
|
...e,
|
|
2853
|
-
cellId: e.cellId ??
|
|
3243
|
+
cellId: e.cellId ?? z(s)
|
|
2854
3244
|
});
|
|
2855
3245
|
}
|
|
2856
|
-
function
|
|
2857
|
-
const o = e.cellId ?? "cell",
|
|
2858
|
-
return new
|
|
2859
|
-
|
|
3246
|
+
function Ve(s, t, e = {}) {
|
|
3247
|
+
const o = e.cellId ?? "cell", i = e.controllerId ?? t.split("@")[1] ?? "";
|
|
3248
|
+
return new Le(
|
|
3249
|
+
s,
|
|
2860
3250
|
t,
|
|
2861
|
-
{ cellId: o, controllerId:
|
|
3251
|
+
{ cellId: o, controllerId: i },
|
|
2862
3252
|
e
|
|
2863
3253
|
);
|
|
2864
3254
|
}
|
|
2865
3255
|
export {
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
3256
|
+
le as C,
|
|
3257
|
+
Z as J,
|
|
3258
|
+
x as M,
|
|
3259
|
+
Ke as O,
|
|
3260
|
+
pe as R,
|
|
3261
|
+
Ie as T,
|
|
2872
3262
|
$ as a,
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
St as r,
|
|
2890
|
-
_t as s,
|
|
2891
|
-
Yt as t,
|
|
2892
|
-
yt as u
|
|
3263
|
+
Ee as b,
|
|
3264
|
+
ve as c,
|
|
3265
|
+
me as d,
|
|
3266
|
+
Tt as e,
|
|
3267
|
+
Pe as f,
|
|
3268
|
+
De as g,
|
|
3269
|
+
Le as h,
|
|
3270
|
+
Ae as i,
|
|
3271
|
+
B as j,
|
|
3272
|
+
G as k,
|
|
3273
|
+
Qe as l,
|
|
3274
|
+
Yt as m,
|
|
3275
|
+
Ht as n,
|
|
3276
|
+
he as p,
|
|
3277
|
+
Kt as t,
|
|
3278
|
+
St as u
|
|
2893
3279
|
};
|