@wandelbots/nova-js 3.2.0 → 3.3.0
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 +32 -136
- package/dist/AutoReconnectingWebsocket-Qcrbm3Kb.d.cts +69 -0
- package/dist/AutoReconnectingWebsocket-Qcrbm3Kb.d.cts.map +1 -0
- package/dist/AutoReconnectingWebsocket-dHe-kceU.d.mts +69 -0
- package/dist/AutoReconnectingWebsocket-dHe-kceU.d.mts.map +1 -0
- package/dist/LoginWithAuth0-CBD9BXXz.cjs +264 -0
- package/dist/LoginWithAuth0-CBD9BXXz.cjs.map +1 -0
- package/dist/LoginWithAuth0-wQB-Sol1.mjs +217 -0
- package/dist/LoginWithAuth0-wQB-Sol1.mjs.map +1 -0
- package/dist/NovaClient-B8XM3OPO.mjs +2057 -0
- package/dist/NovaClient-B8XM3OPO.mjs.map +1 -0
- package/dist/NovaClient-CV7ooIkD.d.cts +349 -0
- package/dist/NovaClient-CV7ooIkD.d.cts.map +1 -0
- package/dist/NovaClient-D2EItmiH.cjs +2137 -0
- package/dist/NovaClient-D2EItmiH.cjs.map +1 -0
- package/dist/NovaClient-qJnHcx2s.d.mts +349 -0
- package/dist/NovaClient-qJnHcx2s.d.mts.map +1 -0
- package/dist/index.cjs +42 -386
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +73 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +36 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/v1/index.cjs +190 -2940
- package/dist/lib/v1/index.cjs.map +1 -1
- package/dist/lib/v1/index.d.cts +62 -0
- package/dist/lib/v1/index.d.cts.map +1 -0
- package/dist/lib/v1/index.d.mts +62 -0
- package/dist/lib/v1/index.d.mts.map +1 -0
- package/dist/lib/v1/index.mjs +182 -0
- package/dist/lib/v1/index.mjs.map +1 -0
- package/dist/lib/v2/index.cjs +1821 -1468
- package/dist/lib/v2/index.cjs.map +1 -1
- package/dist/lib/v2/index.d.cts +118 -0
- package/dist/lib/v2/index.d.cts.map +1 -0
- package/dist/lib/v2/index.d.mts +118 -0
- package/dist/lib/v2/index.d.mts.map +1 -0
- package/dist/lib/v2/index.mjs +1822 -0
- package/dist/lib/v2/index.mjs.map +1 -0
- package/package.json +21 -19
- package/src/LoginWithAuth0.ts +12 -12
- package/src/index.ts +2 -0
- package/src/lib/converters.ts +5 -23
- package/src/lib/v1/MotionStreamConnection.ts +0 -1
- package/src/lib/v1/NovaClient.ts +18 -0
- package/src/lib/v1/index.ts +6 -0
- package/src/lib/v1/mock/MockNovaInstance.ts +0 -1
- package/src/lib/v1/wandelscriptUtils.ts +22 -0
- package/src/lib/v2/NovaClient.ts +14 -7
- package/src/lib/v2/index.ts +1 -0
- package/src/lib/v2/mock/MockNovaInstance.ts +411 -21
- package/src/lib/v2/wandelscriptUtils.ts +27 -0
- package/dist/LoginWithAuth0.d.ts +0 -7
- package/dist/LoginWithAuth0.d.ts.map +0 -1
- package/dist/chunk-B2C22PTK.js +0 -53
- package/dist/chunk-B2C22PTK.js.map +0 -1
- package/dist/chunk-I3PUV6ZD.js +0 -286
- package/dist/chunk-I3PUV6ZD.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -60
- package/dist/index.js.map +0 -1
- package/dist/lib/AutoReconnectingWebsocket.d.ts +0 -43
- package/dist/lib/AutoReconnectingWebsocket.d.ts.map +0 -1
- package/dist/lib/availableStorage.d.ts +0 -15
- package/dist/lib/availableStorage.d.ts.map +0 -1
- package/dist/lib/converters.d.ts +0 -26
- package/dist/lib/converters.d.ts.map +0 -1
- package/dist/lib/errorHandling.d.ts +0 -15
- package/dist/lib/errorHandling.d.ts.map +0 -1
- package/dist/lib/v1/ConnectedMotionGroup.d.ts +0 -77
- package/dist/lib/v1/ConnectedMotionGroup.d.ts.map +0 -1
- package/dist/lib/v1/JoggerConnection.d.ts +0 -94
- package/dist/lib/v1/JoggerConnection.d.ts.map +0 -1
- package/dist/lib/v1/MotionStreamConnection.d.ts +0 -26
- package/dist/lib/v1/MotionStreamConnection.d.ts.map +0 -1
- package/dist/lib/v1/NovaCellAPIClient.d.ts +0 -68
- package/dist/lib/v1/NovaCellAPIClient.d.ts.map +0 -1
- package/dist/lib/v1/NovaClient.d.ts +0 -67
- package/dist/lib/v1/NovaClient.d.ts.map +0 -1
- package/dist/lib/v1/ProgramStateConnection.d.ts +0 -57
- package/dist/lib/v1/ProgramStateConnection.d.ts.map +0 -1
- package/dist/lib/v1/getLatestTrajectories.d.ts +0 -4
- package/dist/lib/v1/getLatestTrajectories.d.ts.map +0 -1
- package/dist/lib/v1/index.d.ts +0 -9
- package/dist/lib/v1/index.d.ts.map +0 -1
- package/dist/lib/v1/index.js +0 -2653
- package/dist/lib/v1/index.js.map +0 -1
- package/dist/lib/v1/mock/MockNovaInstance.d.ts +0 -13
- package/dist/lib/v1/mock/MockNovaInstance.d.ts.map +0 -1
- package/dist/lib/v1/motionStateUpdate.d.ts +0 -4
- package/dist/lib/v1/motionStateUpdate.d.ts.map +0 -1
- package/dist/lib/v2/NovaCellAPIClient.d.ts +0 -62
- package/dist/lib/v2/NovaCellAPIClient.d.ts.map +0 -1
- package/dist/lib/v2/NovaClient.d.ts +0 -60
- package/dist/lib/v2/NovaClient.d.ts.map +0 -1
- package/dist/lib/v2/index.d.ts +0 -4
- package/dist/lib/v2/index.d.ts.map +0 -1
- package/dist/lib/v2/index.js +0 -1196
- package/dist/lib/v2/index.js.map +0 -1
- package/dist/lib/v2/mock/MockNovaInstance.d.ts +0 -13
- package/dist/lib/v2/mock/MockNovaInstance.d.ts.map +0 -1
package/dist/lib/v2/index.cjs
CHANGED
|
@@ -1,1479 +1,1832 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __export = (target, all) => {
|
|
26
|
-
for (var name in all)
|
|
27
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
-
};
|
|
29
|
-
var __copyProps = (to, from, except, desc) => {
|
|
30
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
-
for (let key of __getOwnPropNames(from))
|
|
32
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
|
-
}
|
|
35
|
-
return to;
|
|
36
|
-
};
|
|
37
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
38
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
39
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
40
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
41
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
42
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
43
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
44
|
-
mod
|
|
45
|
-
));
|
|
46
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
47
|
-
var __async = (__this, __arguments, generator) => {
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
49
|
-
var fulfilled = (value) => {
|
|
50
|
-
try {
|
|
51
|
-
step(generator.next(value));
|
|
52
|
-
} catch (e) {
|
|
53
|
-
reject(e);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var rejected = (value) => {
|
|
57
|
-
try {
|
|
58
|
-
step(generator.throw(value));
|
|
59
|
-
} catch (e) {
|
|
60
|
-
reject(e);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
64
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
65
|
-
});
|
|
66
|
-
};
|
|
1
|
+
const require_LoginWithAuth0 = require('../../LoginWithAuth0-CBD9BXXz.cjs');
|
|
2
|
+
let axios = require("axios");
|
|
3
|
+
axios = require_LoginWithAuth0.__toESM(axios);
|
|
4
|
+
let url_join = require("url-join");
|
|
5
|
+
url_join = require_LoginWithAuth0.__toESM(url_join);
|
|
6
|
+
let path_to_regexp = require("path-to-regexp");
|
|
7
|
+
path_to_regexp = require_LoginWithAuth0.__toESM(path_to_regexp);
|
|
8
|
+
let __wandelbots_nova_api_v2 = require("@wandelbots/nova-api/v2");
|
|
67
9
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
module.exports = __toCommonJS(v2_exports);
|
|
75
|
-
__reExport(v2_exports, require("@wandelbots/nova-api/v2"), module.exports);
|
|
76
|
-
|
|
77
|
-
// src/lib/v2/NovaCellAPIClient.ts
|
|
78
|
-
var import_v2 = require("@wandelbots/nova-api/v2");
|
|
79
|
-
var import_axios = __toESM(require("axios"), 1);
|
|
10
|
+
//#region src/lib/v2/NovaCellAPIClient.ts
|
|
11
|
+
/**
|
|
12
|
+
* API client providing type-safe access to all the Nova API REST endpoints
|
|
13
|
+
* associated with a specific cell id.
|
|
14
|
+
*/
|
|
80
15
|
var NovaCellAPIClient = class {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
__spreadProps(__spreadValues({}, this.opts), {
|
|
144
|
-
isJsonMime: (mime) => {
|
|
145
|
-
return mime === "application/json";
|
|
146
|
-
}
|
|
147
|
-
}),
|
|
148
|
-
(_a = this.opts.basePath) != null ? _a : "",
|
|
149
|
-
(_b = this.opts.axiosInstance) != null ? _b : import_axios.default.create()
|
|
150
|
-
);
|
|
151
|
-
for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) {
|
|
152
|
-
if (key !== "constructor" && typeof apiClient[key] === "function") {
|
|
153
|
-
const originalFunction = apiClient[key];
|
|
154
|
-
apiClient[key] = (...args) => {
|
|
155
|
-
return originalFunction.apply(apiClient, args).then((res) => res.data);
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return apiClient;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
// src/lib/v2/NovaClient.ts
|
|
164
|
-
var import_axios3 = __toESM(require("axios"), 1);
|
|
165
|
-
var import_url_join = __toESM(require("url-join"), 1);
|
|
166
|
-
|
|
167
|
-
// src/LoginWithAuth0.ts
|
|
168
|
-
var DOMAIN_SUFFIX = "wandelbots.io";
|
|
169
|
-
var auth0ConfigMap = {
|
|
170
|
-
dev: {
|
|
171
|
-
domain: `https://auth.portal.dev.${DOMAIN_SUFFIX}`,
|
|
172
|
-
clientId: "fLbJD0RLp5r2Dpucm5j8BjwMR6Hunfha"
|
|
173
|
-
},
|
|
174
|
-
stg: {
|
|
175
|
-
domain: `https://auth.portal.stg.${DOMAIN_SUFFIX}`,
|
|
176
|
-
clientId: "joVDeD9e786WzFNSGCqoVq7HNkWt5j6s"
|
|
177
|
-
},
|
|
178
|
-
prod: {
|
|
179
|
-
domain: `https://auth.portal.${DOMAIN_SUFFIX}`,
|
|
180
|
-
clientId: "J7WJUi38xVQdJAEBNRT9Xw1b0fXDb4J2"
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
var getAuth0Config = (instanceUrl) => {
|
|
184
|
-
if (instanceUrl.includes(`dev.${DOMAIN_SUFFIX}`)) return auth0ConfigMap.dev;
|
|
185
|
-
if (instanceUrl.includes(`stg.${DOMAIN_SUFFIX}`)) return auth0ConfigMap.stg;
|
|
186
|
-
if (instanceUrl.includes(DOMAIN_SUFFIX)) return auth0ConfigMap.prod;
|
|
187
|
-
throw new Error(
|
|
188
|
-
"Unsupported instance URL. Cannot determine Auth0 configuration."
|
|
189
|
-
);
|
|
16
|
+
constructor(cellId, opts) {
|
|
17
|
+
this.cellId = cellId;
|
|
18
|
+
this.opts = opts;
|
|
19
|
+
this.system = this.withUnwrappedResponsesOnly(__wandelbots_nova_api_v2.SystemApi);
|
|
20
|
+
this.cell = this.withUnwrappedResponsesOnly(__wandelbots_nova_api_v2.CellApi);
|
|
21
|
+
this.motionGroup = this.withCellId(__wandelbots_nova_api_v2.MotionGroupApi);
|
|
22
|
+
this.motionGroupModels = this.withCellId(__wandelbots_nova_api_v2.MotionGroupModelsApi);
|
|
23
|
+
this.controller = this.withCellId(__wandelbots_nova_api_v2.ControllerApi);
|
|
24
|
+
this.controllerIOs = this.withCellId(__wandelbots_nova_api_v2.ControllerInputsOutputsApi);
|
|
25
|
+
this.trajectoryPlanning = this.withCellId(__wandelbots_nova_api_v2.TrajectoryPlanningApi);
|
|
26
|
+
this.trajectoryExecution = this.withCellId(__wandelbots_nova_api_v2.TrajectoryExecutionApi);
|
|
27
|
+
this.trajectoryCaching = this.withCellId(__wandelbots_nova_api_v2.TrajectoryCachingApi);
|
|
28
|
+
this.application = this.withCellId(__wandelbots_nova_api_v2.ApplicationApi);
|
|
29
|
+
this.applicationGlobal = this.withUnwrappedResponsesOnly(__wandelbots_nova_api_v2.ApplicationApi);
|
|
30
|
+
this.jogging = this.withCellId(__wandelbots_nova_api_v2.JoggingApi);
|
|
31
|
+
this.kinematics = this.withCellId(__wandelbots_nova_api_v2.KinematicsApi);
|
|
32
|
+
this.busInputsOutputs = this.withCellId(__wandelbots_nova_api_v2.BUSInputsOutputsApi);
|
|
33
|
+
this.virtualController = this.withCellId(__wandelbots_nova_api_v2.VirtualControllerApi);
|
|
34
|
+
this.virtualControllerBehavior = this.withCellId(__wandelbots_nova_api_v2.VirtualControllerBehaviorApi);
|
|
35
|
+
this.virtualControllerIOs = this.withCellId(__wandelbots_nova_api_v2.VirtualControllerInputsOutputsApi);
|
|
36
|
+
this.storeObject = this.withCellId(__wandelbots_nova_api_v2.StoreObjectApi);
|
|
37
|
+
this.storeCollisionComponents = this.withCellId(__wandelbots_nova_api_v2.StoreCollisionComponentsApi);
|
|
38
|
+
this.storeCollisionSetups = this.withCellId(__wandelbots_nova_api_v2.StoreCollisionSetupsApi);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Some TypeScript sorcery which alters the API class methods so you don't
|
|
42
|
+
* have to pass the cell id to every single one, and de-encapsulates the
|
|
43
|
+
* response data
|
|
44
|
+
*/
|
|
45
|
+
withCellId(ApiConstructor) {
|
|
46
|
+
const apiClient = new ApiConstructor({
|
|
47
|
+
...this.opts,
|
|
48
|
+
isJsonMime: (mime) => {
|
|
49
|
+
return mime === "application/json";
|
|
50
|
+
}
|
|
51
|
+
}, this.opts.basePath ?? "", this.opts.axiosInstance ?? axios.default.create());
|
|
52
|
+
for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) if (key !== "constructor" && typeof apiClient[key] === "function") {
|
|
53
|
+
const originalFunction = apiClient[key];
|
|
54
|
+
apiClient[key] = (...args) => {
|
|
55
|
+
return originalFunction.apply(apiClient, [this.cellId, ...args]).then((res) => res.data);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return apiClient;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* As withCellId, but only does the response unwrapping
|
|
62
|
+
*/
|
|
63
|
+
withUnwrappedResponsesOnly(ApiConstructor) {
|
|
64
|
+
const apiClient = new ApiConstructor({
|
|
65
|
+
...this.opts,
|
|
66
|
+
isJsonMime: (mime) => {
|
|
67
|
+
return mime === "application/json";
|
|
68
|
+
}
|
|
69
|
+
}, this.opts.basePath ?? "", this.opts.axiosInstance ?? axios.default.create());
|
|
70
|
+
for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient))) if (key !== "constructor" && typeof apiClient[key] === "function") {
|
|
71
|
+
const originalFunction = apiClient[key];
|
|
72
|
+
apiClient[key] = (...args) => {
|
|
73
|
+
return originalFunction.apply(apiClient, args).then((res) => res.data);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return apiClient;
|
|
77
|
+
}
|
|
190
78
|
};
|
|
191
|
-
var loginWithAuth0 = (instanceUrl) => __async(null, null, function* () {
|
|
192
|
-
var _a;
|
|
193
|
-
if (typeof window === "undefined") {
|
|
194
|
-
throw new Error(
|
|
195
|
-
`Access token must be set to use NovaClient when not in a browser environment.`
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
const auth0Config = getAuth0Config(instanceUrl);
|
|
199
|
-
if (new URL(instanceUrl).origin === window.location.origin) {
|
|
200
|
-
window.location.reload();
|
|
201
|
-
throw new Error(
|
|
202
|
-
"Failed to reload page to get auth details, please refresh manually"
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
const { Auth0Client } = yield import("@auth0/auth0-spa-js");
|
|
206
|
-
const auth0Client = new Auth0Client({
|
|
207
|
-
domain: auth0Config.domain,
|
|
208
|
-
clientId: (_a = auth0Config.clientId) != null ? _a : "",
|
|
209
|
-
useRefreshTokens: false,
|
|
210
|
-
authorizationParams: {
|
|
211
|
-
audience: "nova-api",
|
|
212
|
-
redirect_uri: window.location.origin
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
if (window.location.search.includes("code=") && window.location.search.includes("state=")) {
|
|
216
|
-
const { appState } = yield auth0Client.handleRedirectCallback();
|
|
217
|
-
window.history.replaceState(
|
|
218
|
-
{},
|
|
219
|
-
document.title,
|
|
220
|
-
(appState == null ? void 0 : appState.returnTo) || window.location.pathname
|
|
221
|
-
);
|
|
222
|
-
} else {
|
|
223
|
-
yield auth0Client.loginWithRedirect();
|
|
224
|
-
}
|
|
225
|
-
const accessToken = yield auth0Client.getTokenSilently();
|
|
226
|
-
return accessToken;
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
// src/lib/AutoReconnectingWebsocket.ts
|
|
230
|
-
var import_reconnecting_websocket = __toESM(require("reconnecting-websocket"), 1);
|
|
231
|
-
var AutoReconnectingWebsocket = class extends import_reconnecting_websocket.default {
|
|
232
|
-
constructor(targetUrl, opts = {}) {
|
|
233
|
-
console.log("Opening websocket to", targetUrl);
|
|
234
|
-
super(() => this.targetUrl || targetUrl, void 0, {
|
|
235
|
-
startClosed: true
|
|
236
|
-
});
|
|
237
|
-
this.opts = opts;
|
|
238
|
-
this.disposed = false;
|
|
239
|
-
Object.defineProperty(this, "url", {
|
|
240
|
-
get() {
|
|
241
|
-
return this.targetUrl;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
this.targetUrl = targetUrl;
|
|
245
|
-
this.addEventListener("open", () => {
|
|
246
|
-
console.log(`Websocket to ${this.url} opened`);
|
|
247
|
-
});
|
|
248
|
-
this.addEventListener("message", (ev) => {
|
|
249
|
-
if (!this.receivedFirstMessage) {
|
|
250
|
-
this.receivedFirstMessage = ev;
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
this.addEventListener("close", () => {
|
|
254
|
-
console.log(`Websocket to ${this.url} closed`);
|
|
255
|
-
});
|
|
256
|
-
const origReconnect = this.reconnect;
|
|
257
|
-
this.reconnect = () => {
|
|
258
|
-
if (this.opts.mock) {
|
|
259
|
-
this.opts.mock.handleWebsocketConnection(this);
|
|
260
|
-
} else {
|
|
261
|
-
origReconnect.apply(this);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
this.reconnect();
|
|
265
|
-
}
|
|
266
|
-
changeUrl(targetUrl) {
|
|
267
|
-
this.receivedFirstMessage = void 0;
|
|
268
|
-
this.targetUrl = targetUrl;
|
|
269
|
-
this.reconnect();
|
|
270
|
-
}
|
|
271
|
-
sendJson(data) {
|
|
272
|
-
if (this.opts.mock) {
|
|
273
|
-
this.opts.mock.handleWebsocketMessage(this, JSON.stringify(data));
|
|
274
|
-
} else {
|
|
275
|
-
this.send(JSON.stringify(data));
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Permanently close this websocket and indicate that
|
|
280
|
-
* this object should not be used again.
|
|
281
|
-
**/
|
|
282
|
-
dispose() {
|
|
283
|
-
this.close();
|
|
284
|
-
this.disposed = true;
|
|
285
|
-
if (this.opts.onDispose) {
|
|
286
|
-
this.opts.onDispose();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Returns a promise that resolves once the websocket
|
|
291
|
-
* is in the OPEN state. */
|
|
292
|
-
opened() {
|
|
293
|
-
return __async(this, null, function* () {
|
|
294
|
-
return new Promise((resolve, reject) => {
|
|
295
|
-
if (this.readyState === WebSocket.OPEN) {
|
|
296
|
-
resolve();
|
|
297
|
-
} else {
|
|
298
|
-
this.addEventListener("open", () => resolve());
|
|
299
|
-
this.addEventListener("error", reject);
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Returns a promise that resolves once the websocket
|
|
306
|
-
* is in the CLOSED state. */
|
|
307
|
-
closed() {
|
|
308
|
-
return __async(this, null, function* () {
|
|
309
|
-
return new Promise((resolve, reject) => {
|
|
310
|
-
if (this.readyState === WebSocket.CLOSED) {
|
|
311
|
-
resolve();
|
|
312
|
-
} else {
|
|
313
|
-
this.addEventListener("close", () => resolve());
|
|
314
|
-
this.addEventListener("error", reject);
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Returns a promise that resolves when the first message
|
|
321
|
-
* is received from the websocket. Resolves immediately if
|
|
322
|
-
* the first message has already been received.
|
|
323
|
-
*/
|
|
324
|
-
firstMessage() {
|
|
325
|
-
return __async(this, null, function* () {
|
|
326
|
-
if (this.receivedFirstMessage) {
|
|
327
|
-
return this.receivedFirstMessage;
|
|
328
|
-
}
|
|
329
|
-
return new Promise((resolve, reject) => {
|
|
330
|
-
const onMessage = (ev) => {
|
|
331
|
-
this.receivedFirstMessage = ev;
|
|
332
|
-
this.removeEventListener("message", onMessage);
|
|
333
|
-
this.removeEventListener("error", onError);
|
|
334
|
-
resolve(ev);
|
|
335
|
-
};
|
|
336
|
-
const onError = (ev) => {
|
|
337
|
-
this.removeEventListener("message", onMessage);
|
|
338
|
-
this.removeEventListener("error", onError);
|
|
339
|
-
reject(ev);
|
|
340
|
-
};
|
|
341
|
-
this.addEventListener("message", onMessage);
|
|
342
|
-
this.addEventListener("error", onError);
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Returns a promise that resolves when the next message
|
|
348
|
-
* is received from the websocket.
|
|
349
|
-
*/
|
|
350
|
-
nextMessage() {
|
|
351
|
-
return __async(this, null, function* () {
|
|
352
|
-
return new Promise((resolve, reject) => {
|
|
353
|
-
const onMessage = (ev) => {
|
|
354
|
-
this.removeEventListener("message", onMessage);
|
|
355
|
-
this.removeEventListener("error", onError);
|
|
356
|
-
resolve(ev);
|
|
357
|
-
};
|
|
358
|
-
const onError = (ev) => {
|
|
359
|
-
this.removeEventListener("message", onMessage);
|
|
360
|
-
this.removeEventListener("error", onError);
|
|
361
|
-
reject(ev);
|
|
362
|
-
};
|
|
363
|
-
this.addEventListener("message", onMessage);
|
|
364
|
-
this.addEventListener("error", onError);
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
// src/lib/availableStorage.ts
|
|
371
|
-
var AvailableStorage = class {
|
|
372
|
-
constructor() {
|
|
373
|
-
this.available = typeof window !== "undefined" && !!window.localStorage;
|
|
374
|
-
}
|
|
375
|
-
getJSON(key) {
|
|
376
|
-
if (!this.available) return null;
|
|
377
|
-
const result = window.localStorage.getItem(key);
|
|
378
|
-
if (result === null) return null;
|
|
379
|
-
try {
|
|
380
|
-
return JSON.parse(result);
|
|
381
|
-
} catch (err) {
|
|
382
|
-
return null;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
setJSON(key, obj) {
|
|
386
|
-
if (!this.available) return null;
|
|
387
|
-
window.localStorage.setItem(key, JSON.stringify(obj));
|
|
388
|
-
}
|
|
389
|
-
delete(key) {
|
|
390
|
-
if (!this.available) return null;
|
|
391
|
-
window.localStorage.removeItem(key);
|
|
392
|
-
}
|
|
393
|
-
setString(key, value) {
|
|
394
|
-
if (!this.available) return null;
|
|
395
|
-
window.localStorage.setItem(key, value);
|
|
396
|
-
}
|
|
397
|
-
getString(key) {
|
|
398
|
-
if (!this.available) return null;
|
|
399
|
-
return window.localStorage.getItem(key);
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
var availableStorage = new AvailableStorage();
|
|
403
79
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/lib/v2/mock/MockNovaInstance.ts
|
|
82
|
+
/**
|
|
83
|
+
* Ultra-simplified mock Nova server for testing stuff
|
|
84
|
+
*/
|
|
407
85
|
var MockNovaInstance = class {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
86
|
+
constructor() {
|
|
87
|
+
this.connections = [];
|
|
88
|
+
}
|
|
89
|
+
async handleAPIRequest(config) {
|
|
90
|
+
const apiHandlers = [
|
|
91
|
+
{
|
|
92
|
+
method: "GET",
|
|
93
|
+
path: "/cells/:cellId/controllers/:controllerId/state",
|
|
94
|
+
handle() {
|
|
95
|
+
return {
|
|
96
|
+
mode: "MODE_CONTROL",
|
|
97
|
+
last_error: [],
|
|
98
|
+
timestamp: "2025-10-16T09:19:26.634534092Z",
|
|
99
|
+
sequence_number: 1054764,
|
|
100
|
+
controller: "mock-ur5e",
|
|
101
|
+
operation_mode: "OPERATION_MODE_AUTO",
|
|
102
|
+
safety_state: "SAFETY_STATE_NORMAL",
|
|
103
|
+
velocity_override: 100,
|
|
104
|
+
motion_groups: [{
|
|
105
|
+
timestamp: "2025-10-16T09:19:26.634534092Z",
|
|
106
|
+
sequence_number: 1054764,
|
|
107
|
+
motion_group: "0@mock-ur5e",
|
|
108
|
+
controller: "mock-ur5e",
|
|
109
|
+
joint_position: [
|
|
110
|
+
1.487959623336792,
|
|
111
|
+
-1.8501918315887451,
|
|
112
|
+
1.8003005981445312,
|
|
113
|
+
6.034560203552246,
|
|
114
|
+
1.4921919107437134,
|
|
115
|
+
1.593459963798523
|
|
116
|
+
],
|
|
117
|
+
joint_limit_reached: { limit_reached: [
|
|
118
|
+
false,
|
|
119
|
+
false,
|
|
120
|
+
false,
|
|
121
|
+
false,
|
|
122
|
+
false,
|
|
123
|
+
false
|
|
124
|
+
] },
|
|
125
|
+
joint_torque: [],
|
|
126
|
+
joint_current: [
|
|
127
|
+
0,
|
|
128
|
+
0,
|
|
129
|
+
0,
|
|
130
|
+
0,
|
|
131
|
+
0,
|
|
132
|
+
0
|
|
133
|
+
],
|
|
134
|
+
flange_pose: {
|
|
135
|
+
position: [
|
|
136
|
+
107.6452433732927,
|
|
137
|
+
-409.0402987746852,
|
|
138
|
+
524.2402132330305
|
|
139
|
+
],
|
|
140
|
+
orientation: [
|
|
141
|
+
.9874434028353319,
|
|
142
|
+
-.986571714997442,
|
|
143
|
+
1.3336589451098142
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
tcp: "Flange",
|
|
147
|
+
tcp_pose: {
|
|
148
|
+
position: [
|
|
149
|
+
107.6452433732927,
|
|
150
|
+
-409.0402987746852,
|
|
151
|
+
524.2402132330305
|
|
152
|
+
],
|
|
153
|
+
orientation: [
|
|
154
|
+
.9874434028353319,
|
|
155
|
+
-.986571714997442,
|
|
156
|
+
1.3336589451098142
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
payload: "",
|
|
160
|
+
coordinate_system: "",
|
|
161
|
+
standstill: true
|
|
162
|
+
}]
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
method: "GET",
|
|
168
|
+
path: "/cells/:cellId/controllers/:controllerId/coordinate-systems",
|
|
169
|
+
handle() {
|
|
170
|
+
return [{
|
|
171
|
+
coordinate_system: "",
|
|
172
|
+
name: "world",
|
|
173
|
+
reference_coordinate_system: "",
|
|
174
|
+
position: [
|
|
175
|
+
0,
|
|
176
|
+
0,
|
|
177
|
+
0
|
|
178
|
+
],
|
|
179
|
+
orientation: [
|
|
180
|
+
0,
|
|
181
|
+
0,
|
|
182
|
+
0
|
|
183
|
+
],
|
|
184
|
+
orientation_type: "ROTATION_VECTOR"
|
|
185
|
+
}, {
|
|
186
|
+
coordinate_system: "CS-0",
|
|
187
|
+
name: "Default-CS",
|
|
188
|
+
reference_coordinate_system: "",
|
|
189
|
+
position: [
|
|
190
|
+
0,
|
|
191
|
+
0,
|
|
192
|
+
0
|
|
193
|
+
],
|
|
194
|
+
orientation: [
|
|
195
|
+
0,
|
|
196
|
+
0,
|
|
197
|
+
0
|
|
198
|
+
],
|
|
199
|
+
orientation_type: "ROTATION_VECTOR"
|
|
200
|
+
}];
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
method: "GET",
|
|
205
|
+
path: "/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description",
|
|
206
|
+
handle() {
|
|
207
|
+
return {
|
|
208
|
+
motion_group_model: "UniversalRobots_UR5e",
|
|
209
|
+
mounting: {
|
|
210
|
+
position: [
|
|
211
|
+
0,
|
|
212
|
+
0,
|
|
213
|
+
0
|
|
214
|
+
],
|
|
215
|
+
orientation: [
|
|
216
|
+
0,
|
|
217
|
+
0,
|
|
218
|
+
0
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
tcps: {
|
|
222
|
+
Flange: {
|
|
223
|
+
name: "Default-Flange",
|
|
224
|
+
pose: {
|
|
225
|
+
position: [
|
|
226
|
+
0,
|
|
227
|
+
0,
|
|
228
|
+
0
|
|
229
|
+
],
|
|
230
|
+
orientation: [
|
|
231
|
+
0,
|
|
232
|
+
0,
|
|
233
|
+
0
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"complex-tcp-position": {
|
|
238
|
+
name: "Complex TCP Position",
|
|
239
|
+
pose: {
|
|
240
|
+
position: [
|
|
241
|
+
-200,
|
|
242
|
+
300,
|
|
243
|
+
150
|
|
244
|
+
],
|
|
245
|
+
orientation: [
|
|
246
|
+
-.12139440409113832,
|
|
247
|
+
-.06356210998212003,
|
|
248
|
+
-.2023240068185639
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"offset-150mm-xy": {
|
|
253
|
+
name: "-150mm XY Offset",
|
|
254
|
+
pose: {
|
|
255
|
+
position: [
|
|
256
|
+
-150,
|
|
257
|
+
-150,
|
|
258
|
+
0
|
|
259
|
+
],
|
|
260
|
+
orientation: [
|
|
261
|
+
0,
|
|
262
|
+
0,
|
|
263
|
+
0
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"rotated-90deg-z": {
|
|
268
|
+
name: "90° Z Axis Rotation",
|
|
269
|
+
pose: {
|
|
270
|
+
position: [
|
|
271
|
+
0,
|
|
272
|
+
0,
|
|
273
|
+
0
|
|
274
|
+
],
|
|
275
|
+
orientation: [
|
|
276
|
+
0,
|
|
277
|
+
0,
|
|
278
|
+
1.5708
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
payloads: { "FPay-0": {
|
|
284
|
+
name: "FPay-0",
|
|
285
|
+
payload: 0,
|
|
286
|
+
center_of_mass: [
|
|
287
|
+
0,
|
|
288
|
+
0,
|
|
289
|
+
0
|
|
290
|
+
],
|
|
291
|
+
moment_of_inertia: [
|
|
292
|
+
0,
|
|
293
|
+
0,
|
|
294
|
+
0
|
|
295
|
+
]
|
|
296
|
+
} },
|
|
297
|
+
cycle_time: 8,
|
|
298
|
+
dh_parameters: [
|
|
299
|
+
{
|
|
300
|
+
alpha: 1.5707963267948966,
|
|
301
|
+
d: 162.25
|
|
302
|
+
},
|
|
303
|
+
{ a: -425 },
|
|
304
|
+
{ a: -392.2 },
|
|
305
|
+
{
|
|
306
|
+
alpha: 1.5707963267948966,
|
|
307
|
+
d: 133.3
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
alpha: -1.5707963267948966,
|
|
311
|
+
d: 99.7
|
|
312
|
+
},
|
|
313
|
+
{ d: 99.6 }
|
|
314
|
+
],
|
|
315
|
+
operation_limits: {
|
|
316
|
+
auto_limits: {
|
|
317
|
+
joints: [
|
|
318
|
+
{
|
|
319
|
+
position: {
|
|
320
|
+
lower_limit: -6.283185307179586,
|
|
321
|
+
upper_limit: 6.283185307179586
|
|
322
|
+
},
|
|
323
|
+
velocity: 3.34159255027771,
|
|
324
|
+
acceleration: 40,
|
|
325
|
+
torque: 150
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
position: {
|
|
329
|
+
lower_limit: -6.283185307179586,
|
|
330
|
+
upper_limit: 6.283185307179586
|
|
331
|
+
},
|
|
332
|
+
velocity: 3.34159255027771,
|
|
333
|
+
acceleration: 40,
|
|
334
|
+
torque: 150
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
position: {
|
|
338
|
+
lower_limit: -6.283185307179586,
|
|
339
|
+
upper_limit: 6.283185307179586
|
|
340
|
+
},
|
|
341
|
+
velocity: 3.34159255027771,
|
|
342
|
+
acceleration: 40,
|
|
343
|
+
torque: 150
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
position: {
|
|
347
|
+
lower_limit: -6.283185307179586,
|
|
348
|
+
upper_limit: 6.283185307179586
|
|
349
|
+
},
|
|
350
|
+
velocity: 3.34159255027771,
|
|
351
|
+
acceleration: 40,
|
|
352
|
+
torque: 28
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
position: {
|
|
356
|
+
lower_limit: -6.283185307179586,
|
|
357
|
+
upper_limit: 6.283185307179586
|
|
358
|
+
},
|
|
359
|
+
velocity: 3.34159255027771,
|
|
360
|
+
acceleration: 40,
|
|
361
|
+
torque: 28
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
position: {
|
|
365
|
+
lower_limit: -6.283185307179586,
|
|
366
|
+
upper_limit: 6.283185307179586
|
|
367
|
+
},
|
|
368
|
+
velocity: 3.34159255027771,
|
|
369
|
+
acceleration: 40,
|
|
370
|
+
torque: 28
|
|
371
|
+
}
|
|
372
|
+
],
|
|
373
|
+
tcp: { velocity: 5e3 },
|
|
374
|
+
elbow: { velocity: 5e3 },
|
|
375
|
+
flange: { velocity: 5e3 }
|
|
376
|
+
},
|
|
377
|
+
manual_limits: {
|
|
378
|
+
joints: [
|
|
379
|
+
{
|
|
380
|
+
position: {
|
|
381
|
+
lower_limit: -6.283185307179586,
|
|
382
|
+
upper_limit: 6.283185307179586
|
|
383
|
+
},
|
|
384
|
+
velocity: 3.34159255027771,
|
|
385
|
+
acceleration: 40,
|
|
386
|
+
torque: 150
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
position: {
|
|
390
|
+
lower_limit: -6.283185307179586,
|
|
391
|
+
upper_limit: 6.283185307179586
|
|
392
|
+
},
|
|
393
|
+
velocity: 3.34159255027771,
|
|
394
|
+
acceleration: 40,
|
|
395
|
+
torque: 150
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
position: {
|
|
399
|
+
lower_limit: -6.283185307179586,
|
|
400
|
+
upper_limit: 6.283185307179586
|
|
401
|
+
},
|
|
402
|
+
velocity: 3.34159255027771,
|
|
403
|
+
acceleration: 40,
|
|
404
|
+
torque: 150
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
position: {
|
|
408
|
+
lower_limit: -6.283185307179586,
|
|
409
|
+
upper_limit: 6.283185307179586
|
|
410
|
+
},
|
|
411
|
+
velocity: 3.34159255027771,
|
|
412
|
+
acceleration: 40,
|
|
413
|
+
torque: 28
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
position: {
|
|
417
|
+
lower_limit: -6.283185307179586,
|
|
418
|
+
upper_limit: 6.283185307179586
|
|
419
|
+
},
|
|
420
|
+
velocity: 3.34159255027771,
|
|
421
|
+
acceleration: 40,
|
|
422
|
+
torque: 28
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
position: {
|
|
426
|
+
lower_limit: -6.283185307179586,
|
|
427
|
+
upper_limit: 6.283185307179586
|
|
428
|
+
},
|
|
429
|
+
velocity: 3.34159255027771,
|
|
430
|
+
acceleration: 40,
|
|
431
|
+
torque: 28
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
tcp: { velocity: 5e3 }
|
|
435
|
+
},
|
|
436
|
+
manual_t1_limits: {
|
|
437
|
+
joints: [
|
|
438
|
+
{
|
|
439
|
+
position: {
|
|
440
|
+
lower_limit: -6.283185307179586,
|
|
441
|
+
upper_limit: 6.283185307179586
|
|
442
|
+
},
|
|
443
|
+
velocity: 3.34159255027771,
|
|
444
|
+
acceleration: 40,
|
|
445
|
+
torque: 150
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
position: {
|
|
449
|
+
lower_limit: -6.283185307179586,
|
|
450
|
+
upper_limit: 6.283185307179586
|
|
451
|
+
},
|
|
452
|
+
velocity: 3.34159255027771,
|
|
453
|
+
acceleration: 40,
|
|
454
|
+
torque: 150
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
position: {
|
|
458
|
+
lower_limit: -6.283185307179586,
|
|
459
|
+
upper_limit: 6.283185307179586
|
|
460
|
+
},
|
|
461
|
+
velocity: 3.34159255027771,
|
|
462
|
+
acceleration: 40,
|
|
463
|
+
torque: 150
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
position: {
|
|
467
|
+
lower_limit: -6.283185307179586,
|
|
468
|
+
upper_limit: 6.283185307179586
|
|
469
|
+
},
|
|
470
|
+
velocity: 3.34159255027771,
|
|
471
|
+
acceleration: 40,
|
|
472
|
+
torque: 28
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
position: {
|
|
476
|
+
lower_limit: -6.283185307179586,
|
|
477
|
+
upper_limit: 6.283185307179586
|
|
478
|
+
},
|
|
479
|
+
velocity: 3.34159255027771,
|
|
480
|
+
acceleration: 40,
|
|
481
|
+
torque: 28
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
position: {
|
|
485
|
+
lower_limit: -6.283185307179586,
|
|
486
|
+
upper_limit: 6.283185307179586
|
|
487
|
+
},
|
|
488
|
+
velocity: 3.34159255027771,
|
|
489
|
+
acceleration: 40,
|
|
490
|
+
torque: 28
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
tcp: { velocity: 5e3 }
|
|
494
|
+
},
|
|
495
|
+
manual_t2_limits: {
|
|
496
|
+
joints: [
|
|
497
|
+
{
|
|
498
|
+
position: {
|
|
499
|
+
lower_limit: -6.283185307179586,
|
|
500
|
+
upper_limit: 6.283185307179586
|
|
501
|
+
},
|
|
502
|
+
velocity: 3.34159255027771,
|
|
503
|
+
acceleration: 40,
|
|
504
|
+
torque: 150
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
position: {
|
|
508
|
+
lower_limit: -6.283185307179586,
|
|
509
|
+
upper_limit: 6.283185307179586
|
|
510
|
+
},
|
|
511
|
+
velocity: 3.34159255027771,
|
|
512
|
+
acceleration: 40,
|
|
513
|
+
torque: 150
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
position: {
|
|
517
|
+
lower_limit: -6.283185307179586,
|
|
518
|
+
upper_limit: 6.283185307179586
|
|
519
|
+
},
|
|
520
|
+
velocity: 3.34159255027771,
|
|
521
|
+
acceleration: 40,
|
|
522
|
+
torque: 150
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
position: {
|
|
526
|
+
lower_limit: -6.283185307179586,
|
|
527
|
+
upper_limit: 6.283185307179586
|
|
528
|
+
},
|
|
529
|
+
velocity: 3.34159255027771,
|
|
530
|
+
acceleration: 40,
|
|
531
|
+
torque: 28
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
position: {
|
|
535
|
+
lower_limit: -6.283185307179586,
|
|
536
|
+
upper_limit: 6.283185307179586
|
|
537
|
+
},
|
|
538
|
+
velocity: 3.34159255027771,
|
|
539
|
+
acceleration: 40,
|
|
540
|
+
torque: 28
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
position: {
|
|
544
|
+
lower_limit: -6.283185307179586,
|
|
545
|
+
upper_limit: 6.283185307179586
|
|
546
|
+
},
|
|
547
|
+
velocity: 3.34159255027771,
|
|
548
|
+
acceleration: 40,
|
|
549
|
+
torque: 28
|
|
550
|
+
}
|
|
551
|
+
],
|
|
552
|
+
tcp: { velocity: 5e3 }
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
serial_number: "WBVirtualRobot"
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
method: "GET",
|
|
561
|
+
path: "/cells/:cellId/controllers",
|
|
562
|
+
handle() {
|
|
563
|
+
return { controllers: [{
|
|
564
|
+
controller: "mock-ur5e",
|
|
565
|
+
model_name: "UniversalRobots::Controller",
|
|
566
|
+
host: "mock-ur5e",
|
|
567
|
+
allow_software_install_on_controller: true,
|
|
568
|
+
motion_groups: [{
|
|
569
|
+
motion_group: "0@mock-ur5e",
|
|
570
|
+
name_from_controller: "UR5e",
|
|
571
|
+
active: false,
|
|
572
|
+
model_from_controller: "UniversalRobots_UR5e"
|
|
573
|
+
}],
|
|
574
|
+
has_error: false,
|
|
575
|
+
error_details: ""
|
|
576
|
+
}] };
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
method: "GET",
|
|
581
|
+
path: "/cells/:cellId/controllers/:controllerId",
|
|
582
|
+
handle() {
|
|
583
|
+
return {
|
|
584
|
+
configuration: {
|
|
585
|
+
kind: "VirtualController",
|
|
586
|
+
manufacturer: "universalrobots",
|
|
587
|
+
type: "universalrobots-ur5e"
|
|
588
|
+
},
|
|
589
|
+
name: "mock-ur5"
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
method: "GET",
|
|
595
|
+
path: "/cells/:cellId/motion-groups/:motionGroupId/specification",
|
|
596
|
+
handle() {
|
|
597
|
+
return {
|
|
598
|
+
dh_parameters: [
|
|
599
|
+
{
|
|
600
|
+
alpha: 1.5707963267948966,
|
|
601
|
+
theta: 0,
|
|
602
|
+
a: 0,
|
|
603
|
+
d: 162.25,
|
|
604
|
+
reverse_rotation_direction: false
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
alpha: 0,
|
|
608
|
+
theta: 0,
|
|
609
|
+
a: -425,
|
|
610
|
+
d: 0,
|
|
611
|
+
reverse_rotation_direction: false
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
alpha: 0,
|
|
615
|
+
theta: 0,
|
|
616
|
+
a: -392.2,
|
|
617
|
+
d: 0,
|
|
618
|
+
reverse_rotation_direction: false
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
alpha: 1.5707963267948966,
|
|
622
|
+
theta: 0,
|
|
623
|
+
a: 0,
|
|
624
|
+
d: 133.3,
|
|
625
|
+
reverse_rotation_direction: false
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
alpha: -1.5707963267948966,
|
|
629
|
+
theta: 0,
|
|
630
|
+
a: 0,
|
|
631
|
+
d: 99.7,
|
|
632
|
+
reverse_rotation_direction: false
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
alpha: 0,
|
|
636
|
+
theta: 0,
|
|
637
|
+
a: 0,
|
|
638
|
+
d: 99.6,
|
|
639
|
+
reverse_rotation_direction: false
|
|
640
|
+
}
|
|
641
|
+
],
|
|
642
|
+
mechanical_joint_limits: [
|
|
643
|
+
{
|
|
644
|
+
joint: "JOINTNAME_AXIS_1",
|
|
645
|
+
lower_limit: -6.335545063018799,
|
|
646
|
+
upper_limit: 6.335545063018799,
|
|
647
|
+
unlimited: false
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
joint: "JOINTNAME_AXIS_2",
|
|
651
|
+
lower_limit: -6.335545063018799,
|
|
652
|
+
upper_limit: 6.335545063018799,
|
|
653
|
+
unlimited: false
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
joint: "JOINTNAME_AXIS_3",
|
|
657
|
+
lower_limit: -6.335545063018799,
|
|
658
|
+
upper_limit: 6.335545063018799,
|
|
659
|
+
unlimited: false
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
joint: "JOINTNAME_AXIS_4",
|
|
663
|
+
lower_limit: -6.335545063018799,
|
|
664
|
+
upper_limit: 6.335545063018799,
|
|
665
|
+
unlimited: false
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
joint: "JOINTNAME_AXIS_5",
|
|
669
|
+
lower_limit: -6.335545063018799,
|
|
670
|
+
upper_limit: 6.335545063018799,
|
|
671
|
+
unlimited: false
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
joint: "JOINTNAME_AXIS_6",
|
|
675
|
+
lower_limit: -6.335545063018799,
|
|
676
|
+
upper_limit: 6.335545063018799,
|
|
677
|
+
unlimited: false
|
|
678
|
+
}
|
|
679
|
+
]
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
method: "GET",
|
|
685
|
+
path: "/cells/:cellId/motion-groups/:motionGroupId/safety-setup",
|
|
686
|
+
handle() {
|
|
687
|
+
return {
|
|
688
|
+
safety_settings: [{
|
|
689
|
+
safety_state: "SAFETY_NORMAL",
|
|
690
|
+
settings: {
|
|
691
|
+
joint_position_limits: [
|
|
692
|
+
{
|
|
693
|
+
joint: "JOINTNAME_AXIS_1",
|
|
694
|
+
lower_limit: -2.96705961227417,
|
|
695
|
+
upper_limit: 2.96705961227417,
|
|
696
|
+
unlimited: false
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
joint: "JOINTNAME_AXIS_2",
|
|
700
|
+
lower_limit: -1.7453292608261108,
|
|
701
|
+
upper_limit: 2.7925267219543457,
|
|
702
|
+
unlimited: false
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
joint: "JOINTNAME_AXIS_3",
|
|
706
|
+
lower_limit: -3.3161256313323975,
|
|
707
|
+
upper_limit: .40142571926116943,
|
|
708
|
+
unlimited: false
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
joint: "JOINTNAME_AXIS_4",
|
|
712
|
+
lower_limit: -3.4906585216522217,
|
|
713
|
+
upper_limit: 3.4906585216522217,
|
|
714
|
+
unlimited: false
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
joint: "JOINTNAME_AXIS_5",
|
|
718
|
+
lower_limit: -2.4434609413146973,
|
|
719
|
+
upper_limit: 2.4434609413146973,
|
|
720
|
+
unlimited: false
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
joint: "JOINTNAME_AXIS_6",
|
|
724
|
+
lower_limit: -4.71238899230957,
|
|
725
|
+
upper_limit: 4.71238899230957,
|
|
726
|
+
unlimited: false
|
|
727
|
+
}
|
|
728
|
+
],
|
|
729
|
+
joint_velocity_limits: [
|
|
730
|
+
{
|
|
731
|
+
joint: "JOINTNAME_AXIS_1",
|
|
732
|
+
limit: 3.1415927410125732
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
joint: "JOINTNAME_AXIS_2",
|
|
736
|
+
limit: 3.1415927410125732
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
joint: "JOINTNAME_AXIS_3",
|
|
740
|
+
limit: 3.4906585216522217
|
|
741
|
+
},
|
|
742
|
+
{
|
|
743
|
+
joint: "JOINTNAME_AXIS_4",
|
|
744
|
+
limit: 6.108652591705322
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
joint: "JOINTNAME_AXIS_5",
|
|
748
|
+
limit: 6.108652591705322
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
joint: "JOINTNAME_AXIS_6",
|
|
752
|
+
limit: 6.981317043304443
|
|
753
|
+
}
|
|
754
|
+
],
|
|
755
|
+
joint_acceleration_limits: [],
|
|
756
|
+
joint_torque_limits: [],
|
|
757
|
+
tcp_velocity_limit: 1800
|
|
758
|
+
}
|
|
759
|
+
}],
|
|
760
|
+
safety_zones: [
|
|
761
|
+
{
|
|
762
|
+
id: 1,
|
|
763
|
+
priority: 0,
|
|
764
|
+
geometry: {
|
|
765
|
+
compound: { child_geometries: [
|
|
766
|
+
{
|
|
767
|
+
convex_hull: { vertices: [
|
|
768
|
+
{ vertex: [
|
|
769
|
+
-800,
|
|
770
|
+
-1330,
|
|
771
|
+
-1820
|
|
772
|
+
] },
|
|
773
|
+
{ vertex: [
|
|
774
|
+
1650,
|
|
775
|
+
-1330,
|
|
776
|
+
-1820
|
|
777
|
+
] },
|
|
778
|
+
{ vertex: [
|
|
779
|
+
1650,
|
|
780
|
+
1330,
|
|
781
|
+
-1820
|
|
782
|
+
] },
|
|
783
|
+
{ vertex: [
|
|
784
|
+
-800,
|
|
785
|
+
1330,
|
|
786
|
+
-1820
|
|
787
|
+
] }
|
|
788
|
+
] },
|
|
789
|
+
init_pose: {
|
|
790
|
+
position: [
|
|
791
|
+
0,
|
|
792
|
+
0,
|
|
793
|
+
0
|
|
794
|
+
],
|
|
795
|
+
orientation: [
|
|
796
|
+
0,
|
|
797
|
+
0,
|
|
798
|
+
0,
|
|
799
|
+
1
|
|
800
|
+
]
|
|
801
|
+
},
|
|
802
|
+
id: "box"
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
convex_hull: { vertices: [
|
|
806
|
+
{ vertex: [
|
|
807
|
+
-800,
|
|
808
|
+
-1330,
|
|
809
|
+
-1820
|
|
810
|
+
] },
|
|
811
|
+
{ vertex: [
|
|
812
|
+
1650,
|
|
813
|
+
-1330,
|
|
814
|
+
-1820
|
|
815
|
+
] },
|
|
816
|
+
{ vertex: [
|
|
817
|
+
1650,
|
|
818
|
+
-1330,
|
|
819
|
+
1500
|
|
820
|
+
] },
|
|
821
|
+
{ vertex: [
|
|
822
|
+
-800,
|
|
823
|
+
-1330,
|
|
824
|
+
1500
|
|
825
|
+
] }
|
|
826
|
+
] },
|
|
827
|
+
init_pose: {
|
|
828
|
+
position: [
|
|
829
|
+
0,
|
|
830
|
+
0,
|
|
831
|
+
0
|
|
832
|
+
],
|
|
833
|
+
orientation: [
|
|
834
|
+
0,
|
|
835
|
+
0,
|
|
836
|
+
0,
|
|
837
|
+
1
|
|
838
|
+
]
|
|
839
|
+
},
|
|
840
|
+
id: "box"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
convex_hull: { vertices: [
|
|
844
|
+
{ vertex: [
|
|
845
|
+
-800,
|
|
846
|
+
-1330,
|
|
847
|
+
-1820
|
|
848
|
+
] },
|
|
849
|
+
{ vertex: [
|
|
850
|
+
-800,
|
|
851
|
+
1330,
|
|
852
|
+
-1820
|
|
853
|
+
] },
|
|
854
|
+
{ vertex: [
|
|
855
|
+
-800,
|
|
856
|
+
1330,
|
|
857
|
+
1500
|
|
858
|
+
] },
|
|
859
|
+
{ vertex: [
|
|
860
|
+
-800,
|
|
861
|
+
-1330,
|
|
862
|
+
1500
|
|
863
|
+
] }
|
|
864
|
+
] },
|
|
865
|
+
init_pose: {
|
|
866
|
+
position: [
|
|
867
|
+
0,
|
|
868
|
+
0,
|
|
869
|
+
0
|
|
870
|
+
],
|
|
871
|
+
orientation: [
|
|
872
|
+
0,
|
|
873
|
+
0,
|
|
874
|
+
0,
|
|
875
|
+
1
|
|
876
|
+
]
|
|
877
|
+
},
|
|
878
|
+
id: "box"
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
convex_hull: { vertices: [
|
|
882
|
+
{ vertex: [
|
|
883
|
+
1650,
|
|
884
|
+
1330,
|
|
885
|
+
1500
|
|
886
|
+
] },
|
|
887
|
+
{ vertex: [
|
|
888
|
+
-800,
|
|
889
|
+
1330,
|
|
890
|
+
1500
|
|
891
|
+
] },
|
|
892
|
+
{ vertex: [
|
|
893
|
+
-800,
|
|
894
|
+
-1330,
|
|
895
|
+
1500
|
|
896
|
+
] },
|
|
897
|
+
{ vertex: [
|
|
898
|
+
1650,
|
|
899
|
+
-1330,
|
|
900
|
+
1500
|
|
901
|
+
] }
|
|
902
|
+
] },
|
|
903
|
+
init_pose: {
|
|
904
|
+
position: [
|
|
905
|
+
0,
|
|
906
|
+
0,
|
|
907
|
+
0
|
|
908
|
+
],
|
|
909
|
+
orientation: [
|
|
910
|
+
0,
|
|
911
|
+
0,
|
|
912
|
+
0,
|
|
913
|
+
1
|
|
914
|
+
]
|
|
915
|
+
},
|
|
916
|
+
id: "box"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
convex_hull: { vertices: [
|
|
920
|
+
{ vertex: [
|
|
921
|
+
1650,
|
|
922
|
+
1330,
|
|
923
|
+
1500
|
|
924
|
+
] },
|
|
925
|
+
{ vertex: [
|
|
926
|
+
-800,
|
|
927
|
+
1330,
|
|
928
|
+
1500
|
|
929
|
+
] },
|
|
930
|
+
{ vertex: [
|
|
931
|
+
-800,
|
|
932
|
+
1330,
|
|
933
|
+
-1820
|
|
934
|
+
] },
|
|
935
|
+
{ vertex: [
|
|
936
|
+
1650,
|
|
937
|
+
1330,
|
|
938
|
+
-1820
|
|
939
|
+
] }
|
|
940
|
+
] },
|
|
941
|
+
init_pose: {
|
|
942
|
+
position: [
|
|
943
|
+
0,
|
|
944
|
+
0,
|
|
945
|
+
0
|
|
946
|
+
],
|
|
947
|
+
orientation: [
|
|
948
|
+
0,
|
|
949
|
+
0,
|
|
950
|
+
0,
|
|
951
|
+
1
|
|
952
|
+
]
|
|
953
|
+
},
|
|
954
|
+
id: "box"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
convex_hull: { vertices: [
|
|
958
|
+
{ vertex: [
|
|
959
|
+
1650,
|
|
960
|
+
1330,
|
|
961
|
+
1500
|
|
962
|
+
] },
|
|
963
|
+
{ vertex: [
|
|
964
|
+
1650,
|
|
965
|
+
-1330,
|
|
966
|
+
1500
|
|
967
|
+
] },
|
|
968
|
+
{ vertex: [
|
|
969
|
+
1650,
|
|
970
|
+
-1330,
|
|
971
|
+
-1820
|
|
972
|
+
] },
|
|
973
|
+
{ vertex: [
|
|
974
|
+
1650,
|
|
975
|
+
1330,
|
|
976
|
+
-1820
|
|
977
|
+
] }
|
|
978
|
+
] },
|
|
979
|
+
init_pose: {
|
|
980
|
+
position: [
|
|
981
|
+
0,
|
|
982
|
+
0,
|
|
983
|
+
0
|
|
984
|
+
],
|
|
985
|
+
orientation: [
|
|
986
|
+
0,
|
|
987
|
+
0,
|
|
988
|
+
0,
|
|
989
|
+
1
|
|
990
|
+
]
|
|
991
|
+
},
|
|
992
|
+
id: "box"
|
|
993
|
+
}
|
|
994
|
+
] },
|
|
995
|
+
init_pose: {
|
|
996
|
+
position: [
|
|
997
|
+
0,
|
|
998
|
+
0,
|
|
999
|
+
0
|
|
1000
|
+
],
|
|
1001
|
+
orientation: [
|
|
1002
|
+
0,
|
|
1003
|
+
0,
|
|
1004
|
+
0,
|
|
1005
|
+
1
|
|
1006
|
+
]
|
|
1007
|
+
},
|
|
1008
|
+
id: "Cell workzone"
|
|
1009
|
+
},
|
|
1010
|
+
motion_group_uid: 1
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
id: 2,
|
|
1014
|
+
priority: 0,
|
|
1015
|
+
geometry: {
|
|
1016
|
+
convex_hull: { vertices: [
|
|
1017
|
+
{ vertex: [
|
|
1018
|
+
1650,
|
|
1019
|
+
1330,
|
|
1020
|
+
-1850
|
|
1021
|
+
] },
|
|
1022
|
+
{ vertex: [
|
|
1023
|
+
865,
|
|
1024
|
+
1330,
|
|
1025
|
+
-1850
|
|
1026
|
+
] },
|
|
1027
|
+
{ vertex: [
|
|
1028
|
+
865,
|
|
1029
|
+
-720,
|
|
1030
|
+
-1850
|
|
1031
|
+
] },
|
|
1032
|
+
{ vertex: [
|
|
1033
|
+
1650,
|
|
1034
|
+
-720,
|
|
1035
|
+
-1850
|
|
1036
|
+
] },
|
|
1037
|
+
{ vertex: [
|
|
1038
|
+
1650,
|
|
1039
|
+
1330,
|
|
1040
|
+
-920
|
|
1041
|
+
] },
|
|
1042
|
+
{ vertex: [
|
|
1043
|
+
865,
|
|
1044
|
+
1330,
|
|
1045
|
+
-920
|
|
1046
|
+
] },
|
|
1047
|
+
{ vertex: [
|
|
1048
|
+
865,
|
|
1049
|
+
-720,
|
|
1050
|
+
-920
|
|
1051
|
+
] },
|
|
1052
|
+
{ vertex: [
|
|
1053
|
+
1650,
|
|
1054
|
+
-720,
|
|
1055
|
+
-920
|
|
1056
|
+
] }
|
|
1057
|
+
] },
|
|
1058
|
+
init_pose: {
|
|
1059
|
+
position: [
|
|
1060
|
+
0,
|
|
1061
|
+
0,
|
|
1062
|
+
0
|
|
1063
|
+
],
|
|
1064
|
+
orientation: [
|
|
1065
|
+
0,
|
|
1066
|
+
0,
|
|
1067
|
+
0,
|
|
1068
|
+
1
|
|
1069
|
+
]
|
|
1070
|
+
},
|
|
1071
|
+
id: "Transport"
|
|
1072
|
+
},
|
|
1073
|
+
motion_group_uid: 1
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
id: 3,
|
|
1077
|
+
priority: 0,
|
|
1078
|
+
geometry: {
|
|
1079
|
+
convex_hull: { vertices: [
|
|
1080
|
+
{ vertex: [
|
|
1081
|
+
1650,
|
|
1082
|
+
1330,
|
|
1083
|
+
-600
|
|
1084
|
+
] },
|
|
1085
|
+
{ vertex: [
|
|
1086
|
+
865,
|
|
1087
|
+
1330,
|
|
1088
|
+
-600
|
|
1089
|
+
] },
|
|
1090
|
+
{ vertex: [
|
|
1091
|
+
865,
|
|
1092
|
+
430,
|
|
1093
|
+
-600
|
|
1094
|
+
] },
|
|
1095
|
+
{ vertex: [
|
|
1096
|
+
1650,
|
|
1097
|
+
430,
|
|
1098
|
+
-600
|
|
1099
|
+
] },
|
|
1100
|
+
{ vertex: [
|
|
1101
|
+
1650,
|
|
1102
|
+
1330,
|
|
1103
|
+
-1250
|
|
1104
|
+
] },
|
|
1105
|
+
{ vertex: [
|
|
1106
|
+
865,
|
|
1107
|
+
1330,
|
|
1108
|
+
-1250
|
|
1109
|
+
] },
|
|
1110
|
+
{ vertex: [
|
|
1111
|
+
865,
|
|
1112
|
+
430,
|
|
1113
|
+
-1250
|
|
1114
|
+
] },
|
|
1115
|
+
{ vertex: [
|
|
1116
|
+
1650,
|
|
1117
|
+
430,
|
|
1118
|
+
-1250
|
|
1119
|
+
] }
|
|
1120
|
+
] },
|
|
1121
|
+
init_pose: {
|
|
1122
|
+
position: [
|
|
1123
|
+
0,
|
|
1124
|
+
0,
|
|
1125
|
+
0
|
|
1126
|
+
],
|
|
1127
|
+
orientation: [
|
|
1128
|
+
0,
|
|
1129
|
+
0,
|
|
1130
|
+
0,
|
|
1131
|
+
1
|
|
1132
|
+
]
|
|
1133
|
+
},
|
|
1134
|
+
id: "Tunel"
|
|
1135
|
+
},
|
|
1136
|
+
motion_group_uid: 1
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
id: 4,
|
|
1140
|
+
priority: 0,
|
|
1141
|
+
geometry: {
|
|
1142
|
+
convex_hull: { vertices: [
|
|
1143
|
+
{ vertex: [
|
|
1144
|
+
1650,
|
|
1145
|
+
-760,
|
|
1146
|
+
-440
|
|
1147
|
+
] },
|
|
1148
|
+
{ vertex: [
|
|
1149
|
+
900,
|
|
1150
|
+
-760,
|
|
1151
|
+
-440
|
|
1152
|
+
] },
|
|
1153
|
+
{ vertex: [
|
|
1154
|
+
900,
|
|
1155
|
+
-1330,
|
|
1156
|
+
-440
|
|
1157
|
+
] },
|
|
1158
|
+
{ vertex: [
|
|
1159
|
+
1650,
|
|
1160
|
+
-1330,
|
|
1161
|
+
-440
|
|
1162
|
+
] },
|
|
1163
|
+
{ vertex: [
|
|
1164
|
+
1650,
|
|
1165
|
+
-760,
|
|
1166
|
+
-1800
|
|
1167
|
+
] },
|
|
1168
|
+
{ vertex: [
|
|
1169
|
+
900,
|
|
1170
|
+
-760,
|
|
1171
|
+
-1800
|
|
1172
|
+
] },
|
|
1173
|
+
{ vertex: [
|
|
1174
|
+
900,
|
|
1175
|
+
-1330,
|
|
1176
|
+
-1800
|
|
1177
|
+
] },
|
|
1178
|
+
{ vertex: [
|
|
1179
|
+
1650,
|
|
1180
|
+
-1330,
|
|
1181
|
+
-1800
|
|
1182
|
+
] }
|
|
1183
|
+
] },
|
|
1184
|
+
init_pose: {
|
|
1185
|
+
position: [
|
|
1186
|
+
0,
|
|
1187
|
+
0,
|
|
1188
|
+
0
|
|
1189
|
+
],
|
|
1190
|
+
orientation: [
|
|
1191
|
+
0,
|
|
1192
|
+
0,
|
|
1193
|
+
0,
|
|
1194
|
+
1
|
|
1195
|
+
]
|
|
1196
|
+
},
|
|
1197
|
+
id: "Fanuc controller"
|
|
1198
|
+
},
|
|
1199
|
+
motion_group_uid: 1
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
id: 6,
|
|
1203
|
+
priority: 0,
|
|
1204
|
+
geometry: {
|
|
1205
|
+
convex_hull: { vertices: [
|
|
1206
|
+
{ vertex: [
|
|
1207
|
+
-200,
|
|
1208
|
+
-200,
|
|
1209
|
+
-1900
|
|
1210
|
+
] },
|
|
1211
|
+
{ vertex: [
|
|
1212
|
+
200,
|
|
1213
|
+
-200,
|
|
1214
|
+
-1900
|
|
1215
|
+
] },
|
|
1216
|
+
{ vertex: [
|
|
1217
|
+
200,
|
|
1218
|
+
200,
|
|
1219
|
+
-1900
|
|
1220
|
+
] },
|
|
1221
|
+
{ vertex: [
|
|
1222
|
+
-200,
|
|
1223
|
+
200,
|
|
1224
|
+
-1900
|
|
1225
|
+
] },
|
|
1226
|
+
{ vertex: [
|
|
1227
|
+
-200,
|
|
1228
|
+
-200,
|
|
1229
|
+
-350
|
|
1230
|
+
] },
|
|
1231
|
+
{ vertex: [
|
|
1232
|
+
200,
|
|
1233
|
+
-200,
|
|
1234
|
+
-350
|
|
1235
|
+
] },
|
|
1236
|
+
{ vertex: [
|
|
1237
|
+
200,
|
|
1238
|
+
200,
|
|
1239
|
+
-350
|
|
1240
|
+
] },
|
|
1241
|
+
{ vertex: [
|
|
1242
|
+
-200,
|
|
1243
|
+
200,
|
|
1244
|
+
-350
|
|
1245
|
+
] }
|
|
1246
|
+
] },
|
|
1247
|
+
init_pose: {
|
|
1248
|
+
position: [
|
|
1249
|
+
0,
|
|
1250
|
+
0,
|
|
1251
|
+
0
|
|
1252
|
+
],
|
|
1253
|
+
orientation: [
|
|
1254
|
+
0,
|
|
1255
|
+
0,
|
|
1256
|
+
0,
|
|
1257
|
+
1
|
|
1258
|
+
]
|
|
1259
|
+
},
|
|
1260
|
+
id: "Robot base"
|
|
1261
|
+
},
|
|
1262
|
+
motion_group_uid: 1
|
|
1263
|
+
}
|
|
1264
|
+
],
|
|
1265
|
+
robot_model_geometries: [
|
|
1266
|
+
{
|
|
1267
|
+
link_index: 1,
|
|
1268
|
+
geometry: {
|
|
1269
|
+
sphere: { radius: 270 },
|
|
1270
|
+
init_pose: {
|
|
1271
|
+
position: [
|
|
1272
|
+
-70,
|
|
1273
|
+
-70,
|
|
1274
|
+
-50
|
|
1275
|
+
],
|
|
1276
|
+
orientation: [
|
|
1277
|
+
0,
|
|
1278
|
+
0,
|
|
1279
|
+
0,
|
|
1280
|
+
1
|
|
1281
|
+
]
|
|
1282
|
+
},
|
|
1283
|
+
id: "link1_sphere"
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
link_index: 2,
|
|
1288
|
+
geometry: {
|
|
1289
|
+
capsule: {
|
|
1290
|
+
radius: 160,
|
|
1291
|
+
cylinder_height: 800
|
|
1292
|
+
},
|
|
1293
|
+
init_pose: {
|
|
1294
|
+
position: [
|
|
1295
|
+
-450,
|
|
1296
|
+
40,
|
|
1297
|
+
170
|
|
1298
|
+
],
|
|
1299
|
+
orientation: [
|
|
1300
|
+
0,
|
|
1301
|
+
-Math.SQRT1_2,
|
|
1302
|
+
0,
|
|
1303
|
+
Math.SQRT1_2
|
|
1304
|
+
]
|
|
1305
|
+
},
|
|
1306
|
+
id: "link2_capsule"
|
|
1307
|
+
}
|
|
1308
|
+
},
|
|
1309
|
+
{
|
|
1310
|
+
link_index: 3,
|
|
1311
|
+
geometry: {
|
|
1312
|
+
sphere: { radius: 270 },
|
|
1313
|
+
init_pose: {
|
|
1314
|
+
position: [
|
|
1315
|
+
-110,
|
|
1316
|
+
10,
|
|
1317
|
+
-100
|
|
1318
|
+
],
|
|
1319
|
+
orientation: [
|
|
1320
|
+
0,
|
|
1321
|
+
0,
|
|
1322
|
+
0,
|
|
1323
|
+
1
|
|
1324
|
+
]
|
|
1325
|
+
},
|
|
1326
|
+
id: "link3_sphere"
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
link_index: 4,
|
|
1331
|
+
geometry: {
|
|
1332
|
+
capsule: {
|
|
1333
|
+
radius: 110,
|
|
1334
|
+
cylinder_height: 600
|
|
1335
|
+
},
|
|
1336
|
+
init_pose: {
|
|
1337
|
+
position: [
|
|
1338
|
+
0,
|
|
1339
|
+
300,
|
|
1340
|
+
40
|
|
1341
|
+
],
|
|
1342
|
+
orientation: [
|
|
1343
|
+
-Math.SQRT1_2,
|
|
1344
|
+
0,
|
|
1345
|
+
0,
|
|
1346
|
+
Math.SQRT1_2
|
|
1347
|
+
]
|
|
1348
|
+
},
|
|
1349
|
+
id: "link4_capsule"
|
|
1350
|
+
}
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
link_index: 5,
|
|
1354
|
+
geometry: {
|
|
1355
|
+
sphere: { radius: 75 },
|
|
1356
|
+
init_pose: {
|
|
1357
|
+
position: [
|
|
1358
|
+
0,
|
|
1359
|
+
0,
|
|
1360
|
+
-50
|
|
1361
|
+
],
|
|
1362
|
+
orientation: [
|
|
1363
|
+
0,
|
|
1364
|
+
0,
|
|
1365
|
+
0,
|
|
1366
|
+
1
|
|
1367
|
+
]
|
|
1368
|
+
},
|
|
1369
|
+
id: "link5_sphere"
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
],
|
|
1373
|
+
tool_geometries: []
|
|
1374
|
+
};
|
|
1375
|
+
}
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
method: "GET",
|
|
1379
|
+
path: "/cells/:cellId/motion-groups/:motionGroupId/tcps",
|
|
1380
|
+
handle() {
|
|
1381
|
+
return { tcps: [{
|
|
1382
|
+
id: "Flange",
|
|
1383
|
+
readable_name: "Default-Flange",
|
|
1384
|
+
position: [
|
|
1385
|
+
0,
|
|
1386
|
+
0,
|
|
1387
|
+
0
|
|
1388
|
+
],
|
|
1389
|
+
rotation: {
|
|
1390
|
+
angles: [
|
|
1391
|
+
0,
|
|
1392
|
+
0,
|
|
1393
|
+
0,
|
|
1394
|
+
0
|
|
1395
|
+
],
|
|
1396
|
+
type: "ROTATION_VECTOR"
|
|
1397
|
+
}
|
|
1398
|
+
}, {
|
|
1399
|
+
id: "complex-tcp-position",
|
|
1400
|
+
readable_name: "Complex TCP Position",
|
|
1401
|
+
position: [
|
|
1402
|
+
-200,
|
|
1403
|
+
300,
|
|
1404
|
+
150
|
|
1405
|
+
],
|
|
1406
|
+
rotation: {
|
|
1407
|
+
angles: [
|
|
1408
|
+
-.12139440409113832,
|
|
1409
|
+
-.06356210998212003,
|
|
1410
|
+
-.2023240068185639,
|
|
1411
|
+
0
|
|
1412
|
+
],
|
|
1413
|
+
type: "ROTATION_VECTOR"
|
|
1414
|
+
}
|
|
1415
|
+
}] };
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
];
|
|
1419
|
+
const method = config.method?.toUpperCase() || "GET";
|
|
1420
|
+
const path = `/cells${config.url?.split("/cells")[1]?.split("?")[0]}`;
|
|
1421
|
+
for (const handler of apiHandlers) {
|
|
1422
|
+
const match = path_to_regexp.match(handler.path)(path || "");
|
|
1423
|
+
if (method === handler.method && match) {
|
|
1424
|
+
const json = handler.handle();
|
|
1425
|
+
return {
|
|
1426
|
+
status: 200,
|
|
1427
|
+
statusText: "Success",
|
|
1428
|
+
data: JSON.stringify(json),
|
|
1429
|
+
headers: {},
|
|
1430
|
+
config,
|
|
1431
|
+
request: { responseURL: config.url }
|
|
1432
|
+
};
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
throw new axios.AxiosError(`No mock handler matched this request: ${method} ${path}`, "404", config);
|
|
1436
|
+
}
|
|
1437
|
+
handleWebsocketConnection(socket) {
|
|
1438
|
+
this.connections.push(socket);
|
|
1439
|
+
setTimeout(() => {
|
|
1440
|
+
socket.dispatchEvent(new Event("open"));
|
|
1441
|
+
console.log("Websocket connection opened from", socket.url);
|
|
1442
|
+
if (socket.url.includes("/state-stream")) socket.dispatchEvent(new MessageEvent("message", { data: JSON.stringify(defaultMotionState) }));
|
|
1443
|
+
if (socket.url.includes("/move-joint")) socket.dispatchEvent(new MessageEvent("message", { data: JSON.stringify({ result: {
|
|
1444
|
+
motion_group: "0@ur",
|
|
1445
|
+
state: {
|
|
1446
|
+
controller: "ur",
|
|
1447
|
+
operation_mode: "OPERATION_MODE_AUTO",
|
|
1448
|
+
safety_state: "SAFETY_STATE_NORMAL",
|
|
1449
|
+
timestamp: "2024-09-18T12:48:26.096266444Z",
|
|
1450
|
+
velocity_override: 100,
|
|
1451
|
+
motion_groups: [{
|
|
1452
|
+
motion_group: "0@ur",
|
|
1453
|
+
controller: "ur",
|
|
1454
|
+
joint_position: [
|
|
1455
|
+
1.3492152690887451,
|
|
1456
|
+
-1.5659207105636597,
|
|
1457
|
+
1.6653711795806885,
|
|
1458
|
+
-1.0991662740707397,
|
|
1459
|
+
-1.829018235206604,
|
|
1460
|
+
1.264623761177063
|
|
1461
|
+
],
|
|
1462
|
+
joint_velocity: { joints: [
|
|
1463
|
+
0,
|
|
1464
|
+
0,
|
|
1465
|
+
0,
|
|
1466
|
+
0,
|
|
1467
|
+
0,
|
|
1468
|
+
0
|
|
1469
|
+
] },
|
|
1470
|
+
flange_pose: {
|
|
1471
|
+
position: [
|
|
1472
|
+
6.437331889439328,
|
|
1473
|
+
-628.4123774830913,
|
|
1474
|
+
577.0569957147832
|
|
1475
|
+
],
|
|
1476
|
+
orientation: {
|
|
1477
|
+
x: -1.683333649797158,
|
|
1478
|
+
y: -1.9783363827298732,
|
|
1479
|
+
z: -.4928031860165713
|
|
1480
|
+
},
|
|
1481
|
+
coordinate_system: ""
|
|
1482
|
+
},
|
|
1483
|
+
tcp_pose: {
|
|
1484
|
+
position: [
|
|
1485
|
+
6.437331889439328,
|
|
1486
|
+
-628.4123774830913,
|
|
1487
|
+
577.0569957147832
|
|
1488
|
+
],
|
|
1489
|
+
orientation: {
|
|
1490
|
+
x: -1.683333649797158,
|
|
1491
|
+
y: -1.9783363827298732,
|
|
1492
|
+
z: -.4928031860165713
|
|
1493
|
+
},
|
|
1494
|
+
coordinate_system: "",
|
|
1495
|
+
tcp: "Flange"
|
|
1496
|
+
},
|
|
1497
|
+
velocity: {
|
|
1498
|
+
linear: {
|
|
1499
|
+
x: 0,
|
|
1500
|
+
y: 0,
|
|
1501
|
+
z: 0
|
|
1502
|
+
},
|
|
1503
|
+
angular: {
|
|
1504
|
+
x: -0,
|
|
1505
|
+
y: 0,
|
|
1506
|
+
z: 0
|
|
1507
|
+
},
|
|
1508
|
+
coordinate_system: ""
|
|
1509
|
+
},
|
|
1510
|
+
force: {
|
|
1511
|
+
force: {
|
|
1512
|
+
x: 0,
|
|
1513
|
+
y: 0,
|
|
1514
|
+
z: 0
|
|
1515
|
+
},
|
|
1516
|
+
moment: {
|
|
1517
|
+
x: 0,
|
|
1518
|
+
y: 0,
|
|
1519
|
+
z: 0
|
|
1520
|
+
},
|
|
1521
|
+
coordinate_system: ""
|
|
1522
|
+
},
|
|
1523
|
+
joint_limit_reached: { limit_reached: [
|
|
1524
|
+
false,
|
|
1525
|
+
false,
|
|
1526
|
+
false,
|
|
1527
|
+
false,
|
|
1528
|
+
false,
|
|
1529
|
+
false
|
|
1530
|
+
] },
|
|
1531
|
+
joint_current: { joints: [
|
|
1532
|
+
0,
|
|
1533
|
+
0,
|
|
1534
|
+
0,
|
|
1535
|
+
0,
|
|
1536
|
+
0,
|
|
1537
|
+
0
|
|
1538
|
+
] },
|
|
1539
|
+
sequence_number: "671259"
|
|
1540
|
+
}],
|
|
1541
|
+
sequence_number: "671259"
|
|
1542
|
+
},
|
|
1543
|
+
movement_state: "MOVEMENT_STATE_MOVING"
|
|
1544
|
+
} }) }));
|
|
1545
|
+
if (socket.url.includes("/move-tcp")) socket.dispatchEvent(new MessageEvent("message", { data: JSON.stringify({ result: {
|
|
1546
|
+
motion_group: "0@ur",
|
|
1547
|
+
state: {
|
|
1548
|
+
controller: "ur",
|
|
1549
|
+
operation_mode: "OPERATION_MODE_AUTO",
|
|
1550
|
+
safety_state: "SAFETY_STATE_NORMAL",
|
|
1551
|
+
timestamp: "2024-09-18T12:43:12.188335774Z",
|
|
1552
|
+
velocity_override: 100,
|
|
1553
|
+
motion_groups: [{
|
|
1554
|
+
motion_group: "0@ur",
|
|
1555
|
+
controller: "ur",
|
|
1556
|
+
joint_position: { joints: [
|
|
1557
|
+
1.3352527618408203,
|
|
1558
|
+
-1.5659207105636597,
|
|
1559
|
+
1.6653711795806885,
|
|
1560
|
+
-1.110615611076355,
|
|
1561
|
+
-1.829018235206604,
|
|
1562
|
+
1.264623761177063
|
|
1563
|
+
] },
|
|
1564
|
+
joint_velocity: { joints: [
|
|
1565
|
+
0,
|
|
1566
|
+
0,
|
|
1567
|
+
0,
|
|
1568
|
+
0,
|
|
1569
|
+
0,
|
|
1570
|
+
0
|
|
1571
|
+
] },
|
|
1572
|
+
flange_pose: {
|
|
1573
|
+
position: [
|
|
1574
|
+
-2.763015284002938,
|
|
1575
|
+
-630.2151479701106,
|
|
1576
|
+
577.524509114342
|
|
1577
|
+
],
|
|
1578
|
+
orientation: {
|
|
1579
|
+
x: -1.704794877102097,
|
|
1580
|
+
y: -1.9722372952861567,
|
|
1581
|
+
z: -.4852079204210754
|
|
1582
|
+
},
|
|
1583
|
+
coordinate_system: ""
|
|
1584
|
+
},
|
|
1585
|
+
tcp_pose: {
|
|
1586
|
+
position: [
|
|
1587
|
+
-2.763015284002938,
|
|
1588
|
+
-630.2151479701106,
|
|
1589
|
+
577.524509114342
|
|
1590
|
+
],
|
|
1591
|
+
orientation: {
|
|
1592
|
+
x: -1.704794877102097,
|
|
1593
|
+
y: -1.9722372952861567,
|
|
1594
|
+
z: -.4852079204210754
|
|
1595
|
+
},
|
|
1596
|
+
coordinate_system: "",
|
|
1597
|
+
tcp: "Flange"
|
|
1598
|
+
},
|
|
1599
|
+
velocity: {
|
|
1600
|
+
linear: {
|
|
1601
|
+
x: 0,
|
|
1602
|
+
y: 0,
|
|
1603
|
+
z: 0
|
|
1604
|
+
},
|
|
1605
|
+
angular: {
|
|
1606
|
+
x: -0,
|
|
1607
|
+
y: 0,
|
|
1608
|
+
z: 0
|
|
1609
|
+
},
|
|
1610
|
+
coordinate_system: ""
|
|
1611
|
+
},
|
|
1612
|
+
force: {
|
|
1613
|
+
force: {
|
|
1614
|
+
x: 0,
|
|
1615
|
+
y: 0,
|
|
1616
|
+
z: 0
|
|
1617
|
+
},
|
|
1618
|
+
moment: {
|
|
1619
|
+
x: 0,
|
|
1620
|
+
y: 0,
|
|
1621
|
+
z: 0
|
|
1622
|
+
},
|
|
1623
|
+
coordinate_system: ""
|
|
1624
|
+
},
|
|
1625
|
+
joint_limit_reached: { limit_reached: [
|
|
1626
|
+
false,
|
|
1627
|
+
false,
|
|
1628
|
+
false,
|
|
1629
|
+
false,
|
|
1630
|
+
false,
|
|
1631
|
+
false
|
|
1632
|
+
] },
|
|
1633
|
+
joint_current: { joints: [
|
|
1634
|
+
0,
|
|
1635
|
+
0,
|
|
1636
|
+
0,
|
|
1637
|
+
0,
|
|
1638
|
+
0,
|
|
1639
|
+
0
|
|
1640
|
+
] },
|
|
1641
|
+
sequence_number: "627897"
|
|
1642
|
+
}],
|
|
1643
|
+
sequence_number: "627897"
|
|
1644
|
+
},
|
|
1645
|
+
movement_state: "MOVEMENT_STATE_MOVING"
|
|
1646
|
+
} }) }));
|
|
1647
|
+
}, 10);
|
|
1648
|
+
}
|
|
1649
|
+
handleWebsocketMessage(socket, message) {
|
|
1650
|
+
console.log(`Received message on ${socket.url}`, message);
|
|
1651
|
+
}
|
|
1347
1652
|
};
|
|
1653
|
+
const defaultMotionState = { result: {
|
|
1654
|
+
motion_group: "0@universalrobots-ur5e",
|
|
1655
|
+
controller: "universalrobots-ur5e",
|
|
1656
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1657
|
+
sequence_number: 1,
|
|
1658
|
+
joint_position: [
|
|
1659
|
+
1.1699999570846558,
|
|
1660
|
+
-1.5700000524520874,
|
|
1661
|
+
1.3600000143051147,
|
|
1662
|
+
1.0299999713897705,
|
|
1663
|
+
1.2899999618530273,
|
|
1664
|
+
1.2799999713897705
|
|
1665
|
+
],
|
|
1666
|
+
joint_limit_reached: { limit_reached: [
|
|
1667
|
+
false,
|
|
1668
|
+
false,
|
|
1669
|
+
false,
|
|
1670
|
+
false,
|
|
1671
|
+
false,
|
|
1672
|
+
false
|
|
1673
|
+
] },
|
|
1674
|
+
standstill: false,
|
|
1675
|
+
flange_pose: {
|
|
1676
|
+
position: [
|
|
1677
|
+
1.3300010259703043,
|
|
1678
|
+
-409.2680714682808,
|
|
1679
|
+
531.0203477065281
|
|
1680
|
+
],
|
|
1681
|
+
orientation: [
|
|
1682
|
+
1.7564919306270736,
|
|
1683
|
+
-1.7542521568325058,
|
|
1684
|
+
.7326972590614671
|
|
1685
|
+
]
|
|
1686
|
+
},
|
|
1687
|
+
tcp_pose: {
|
|
1688
|
+
position: [
|
|
1689
|
+
1.3300010259703043,
|
|
1690
|
+
-409.2680714682808,
|
|
1691
|
+
531.0203477065281
|
|
1692
|
+
],
|
|
1693
|
+
orientation: [
|
|
1694
|
+
1.7564919306270736,
|
|
1695
|
+
-1.7542521568325058,
|
|
1696
|
+
.7326972590614671
|
|
1697
|
+
]
|
|
1698
|
+
}
|
|
1699
|
+
} };
|
|
1348
1700
|
|
|
1349
|
-
|
|
1701
|
+
//#endregion
|
|
1702
|
+
//#region src/lib/v2/NovaClient.ts
|
|
1703
|
+
function permissiveInstanceUrlParse(url) {
|
|
1704
|
+
if (!url.startsWith("http")) url = `http://${url}`;
|
|
1705
|
+
return new URL(url).toString();
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
*
|
|
1709
|
+
* Client for connecting to a Nova instance and controlling robots.
|
|
1710
|
+
*/
|
|
1350
1711
|
var NovaClient = class {
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
} else {
|
|
1437
|
-
availableStorage.delete("wbjs.access_token");
|
|
1438
|
-
}
|
|
1439
|
-
} finally {
|
|
1440
|
-
this.authPromise = null;
|
|
1441
|
-
}
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
makeWebsocketURL(path) {
|
|
1445
|
-
const url = new URL(
|
|
1446
|
-
(0, import_url_join.default)(
|
|
1447
|
-
this.config.instanceUrl,
|
|
1448
|
-
`/api/v1/cells/${this.config.cellId}`,
|
|
1449
|
-
path
|
|
1450
|
-
)
|
|
1451
|
-
);
|
|
1452
|
-
url.protocol = url.protocol.replace("http", "ws");
|
|
1453
|
-
url.protocol = url.protocol.replace("https", "wss");
|
|
1454
|
-
if (this.accessToken) {
|
|
1455
|
-
url.searchParams.append("token", this.accessToken);
|
|
1456
|
-
} else if (this.config.username && this.config.password) {
|
|
1457
|
-
url.username = this.config.username;
|
|
1458
|
-
url.password = this.config.password;
|
|
1459
|
-
}
|
|
1460
|
-
return url.toString();
|
|
1461
|
-
}
|
|
1462
|
-
/**
|
|
1463
|
-
* Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.
|
|
1464
|
-
* If you explicitly want to reconnect an existing websocket, call `reconnect`
|
|
1465
|
-
* on the returned object.
|
|
1466
|
-
*/
|
|
1467
|
-
openReconnectingWebsocket(path) {
|
|
1468
|
-
return new AutoReconnectingWebsocket(this.makeWebsocketURL(path), {
|
|
1469
|
-
mock: this.mock
|
|
1470
|
-
});
|
|
1471
|
-
}
|
|
1712
|
+
constructor(config) {
|
|
1713
|
+
this.authPromise = null;
|
|
1714
|
+
this.accessToken = null;
|
|
1715
|
+
const cellId = config.cellId ?? "cell";
|
|
1716
|
+
this.config = {
|
|
1717
|
+
cellId,
|
|
1718
|
+
...config
|
|
1719
|
+
};
|
|
1720
|
+
this.accessToken = config.accessToken || require_LoginWithAuth0.availableStorage.getString("wbjs.access_token") || null;
|
|
1721
|
+
if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
|
|
1722
|
+
else this.config.instanceUrl = permissiveInstanceUrlParse(this.config.instanceUrl);
|
|
1723
|
+
const axiosInstance = axios.default.create({
|
|
1724
|
+
baseURL: (0, url_join.default)(this.config.instanceUrl, "/api/v2"),
|
|
1725
|
+
headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
|
|
1726
|
+
});
|
|
1727
|
+
axiosInstance.interceptors.request.use(async (request) => {
|
|
1728
|
+
if (!request.headers.Authorization) {
|
|
1729
|
+
if (this.accessToken) request.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
1730
|
+
else if (this.config.username && this.config.password) request.headers.Authorization = `Basic ${btoa(`${config.username}:${config.password}`)}`;
|
|
1731
|
+
}
|
|
1732
|
+
return request;
|
|
1733
|
+
});
|
|
1734
|
+
if (typeof window !== "undefined") axiosInstance.interceptors.response.use((r) => r, async (error) => {
|
|
1735
|
+
if ((0, axios.isAxiosError)(error)) {
|
|
1736
|
+
if (error.response?.status === 401) try {
|
|
1737
|
+
await this.renewAuthentication();
|
|
1738
|
+
if (error.config) {
|
|
1739
|
+
if (this.accessToken) error.config.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
1740
|
+
else delete error.config.headers.Authorization;
|
|
1741
|
+
return axiosInstance.request(error.config);
|
|
1742
|
+
}
|
|
1743
|
+
} catch (err) {
|
|
1744
|
+
return Promise.reject(err);
|
|
1745
|
+
}
|
|
1746
|
+
else if (error.response?.status === 503) {
|
|
1747
|
+
if ((await fetch(window.location.href)).status === 503) window.location.reload();
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
return Promise.reject(error);
|
|
1751
|
+
});
|
|
1752
|
+
this.api = new NovaCellAPIClient(cellId, {
|
|
1753
|
+
...config,
|
|
1754
|
+
basePath: (0, url_join.default)(this.config.instanceUrl, "/api/v2"),
|
|
1755
|
+
isJsonMime: (mime) => {
|
|
1756
|
+
return mime === "application/json";
|
|
1757
|
+
},
|
|
1758
|
+
baseOptions: {
|
|
1759
|
+
...this.mock ? { adapter: (config$1) => {
|
|
1760
|
+
return this.mock.handleAPIRequest(config$1);
|
|
1761
|
+
} } : {},
|
|
1762
|
+
...config.baseOptions
|
|
1763
|
+
},
|
|
1764
|
+
axiosInstance
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
async renewAuthentication() {
|
|
1768
|
+
if (this.authPromise) return;
|
|
1769
|
+
this.authPromise = require_LoginWithAuth0.loginWithAuth0(this.config.instanceUrl);
|
|
1770
|
+
try {
|
|
1771
|
+
this.accessToken = await this.authPromise;
|
|
1772
|
+
if (this.accessToken) require_LoginWithAuth0.availableStorage.setString("wbjs.access_token", this.accessToken);
|
|
1773
|
+
else require_LoginWithAuth0.availableStorage.delete("wbjs.access_token");
|
|
1774
|
+
} finally {
|
|
1775
|
+
this.authPromise = null;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
makeWebsocketURL(path) {
|
|
1779
|
+
const url = new URL((0, url_join.default)(this.config.instanceUrl, `/api/v2/cells/${this.config.cellId}`, path));
|
|
1780
|
+
url.protocol = url.protocol.replace("http", "ws");
|
|
1781
|
+
url.protocol = url.protocol.replace("https", "wss");
|
|
1782
|
+
if (this.accessToken) url.searchParams.append("token", this.accessToken);
|
|
1783
|
+
else if (this.config.username && this.config.password) {
|
|
1784
|
+
url.username = this.config.username;
|
|
1785
|
+
url.password = this.config.password;
|
|
1786
|
+
}
|
|
1787
|
+
return url.toString();
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.
|
|
1791
|
+
* If you explicitly want to reconnect an existing websocket, call `reconnect`
|
|
1792
|
+
* on the returned object.
|
|
1793
|
+
*/
|
|
1794
|
+
openReconnectingWebsocket(path) {
|
|
1795
|
+
return new require_LoginWithAuth0.AutoReconnectingWebsocket(this.makeWebsocketURL(path), { mock: this.mock });
|
|
1796
|
+
}
|
|
1472
1797
|
};
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1798
|
+
|
|
1799
|
+
//#endregion
|
|
1800
|
+
//#region src/lib/v2/wandelscriptUtils.ts
|
|
1801
|
+
/**
|
|
1802
|
+
* Convert a Pose object representing a motion group position
|
|
1803
|
+
* into a string which represents that pose in Wandelscript.
|
|
1804
|
+
*/
|
|
1805
|
+
function poseToWandelscriptString(pose) {
|
|
1806
|
+
const position = [
|
|
1807
|
+
pose.position?.[0] ?? 0,
|
|
1808
|
+
pose.position?.[1] ?? 0,
|
|
1809
|
+
pose.position?.[2] ?? 0
|
|
1810
|
+
];
|
|
1811
|
+
const orientation = [
|
|
1812
|
+
pose.orientation?.[0] ?? 0,
|
|
1813
|
+
pose.orientation?.[1] ?? 0,
|
|
1814
|
+
pose.orientation?.[2] ?? 0
|
|
1815
|
+
];
|
|
1816
|
+
const positionValues = position.map((v) => v.toFixed(1));
|
|
1817
|
+
const rotationValues = orientation.map((v) => v.toFixed(4));
|
|
1818
|
+
return `(${positionValues.concat(rotationValues).join(", ")})`;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
//#endregion
|
|
1822
|
+
exports.NovaCellAPIClient = NovaCellAPIClient;
|
|
1823
|
+
exports.NovaClient = NovaClient;
|
|
1824
|
+
exports.poseToWandelscriptString = poseToWandelscriptString;
|
|
1825
|
+
Object.keys(__wandelbots_nova_api_v2).forEach(function (k) {
|
|
1826
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
1827
|
+
enumerable: true,
|
|
1828
|
+
get: function () { return __wandelbots_nova_api_v2[k]; }
|
|
1829
|
+
});
|
|
1478
1830
|
});
|
|
1831
|
+
|
|
1479
1832
|
//# sourceMappingURL=index.cjs.map
|