@wandelbots/nova-js 3.6.1-pr.270.f77f20a → 3.7.0-pr.267.1acb341
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/package.json +11 -9
- package/dist/AutoReconnectingWebsocket-9Of5_BJe.d.cts +0 -68
- package/dist/AutoReconnectingWebsocket-9Of5_BJe.d.cts.map +0 -1
- package/dist/LoginWithAuth0-oZFpwe7m.cjs +0 -409
- package/dist/LoginWithAuth0-oZFpwe7m.cjs.map +0 -1
- package/dist/NovaClient-4PG1cMau.d.cts +0 -346
- package/dist/NovaClient-4PG1cMau.d.cts.map +0 -1
- package/dist/NovaClient-B-QdK0HR.cjs +0 -2035
- package/dist/NovaClient-B-QdK0HR.cjs.map +0 -1
- package/dist/index.cjs +0 -54
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -104
- package/dist/index.d.cts.map +0 -1
- package/dist/lib/v1/index.cjs +0 -196
- package/dist/lib/v1/index.cjs.map +0 -1
- package/dist/lib/v1/index.d.cts +0 -62
- package/dist/lib/v1/index.d.cts.map +0 -1
- package/dist/lib/v2/index.cjs +0 -820
- package/dist/lib/v2/index.cjs.map +0 -1
- package/dist/lib/v2/index.d.cts +0 -119
- package/dist/lib/v2/index.d.cts.map +0 -1
package/dist/lib/v2/index.cjs
DELETED
|
@@ -1,820 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_LoginWithAuth0 = require("../../LoginWithAuth0-oZFpwe7m.cjs");
|
|
3
|
-
let axios = require("axios");
|
|
4
|
-
axios = require_LoginWithAuth0.__toESM(axios, 1);
|
|
5
|
-
let url_join = require("url-join");
|
|
6
|
-
url_join = require_LoginWithAuth0.__toESM(url_join, 1);
|
|
7
|
-
let path_to_regexp = require("path-to-regexp");
|
|
8
|
-
path_to_regexp = require_LoginWithAuth0.__toESM(path_to_regexp, 1);
|
|
9
|
-
let _wandelbots_nova_api_v2 = require("@wandelbots/nova-api/v2");
|
|
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
|
-
*/
|
|
15
|
-
var NovaCellAPIClient = class {
|
|
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.withUnwrappedResponsesOnly(_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
|
-
}
|
|
78
|
-
};
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/lib/v2/mock/getCurrentRobotControllerState.ts
|
|
81
|
-
const getCurrentRobotControllerState = {
|
|
82
|
-
method: "GET",
|
|
83
|
-
path: "/cells/:cellId/controllers/:controllerId/state",
|
|
84
|
-
handle() {
|
|
85
|
-
return {
|
|
86
|
-
mode: "MODE_CONTROL",
|
|
87
|
-
last_error: [],
|
|
88
|
-
timestamp: "2025-10-16T09:19:26.634534092Z",
|
|
89
|
-
sequence_number: 1054764,
|
|
90
|
-
controller: "mock-ur5e",
|
|
91
|
-
operation_mode: "OPERATION_MODE_AUTO",
|
|
92
|
-
safety_state: "SAFETY_STATE_NORMAL",
|
|
93
|
-
velocity_override: 100,
|
|
94
|
-
motion_groups: [{
|
|
95
|
-
timestamp: "2025-10-16T09:19:26.634534092Z",
|
|
96
|
-
sequence_number: 1054764,
|
|
97
|
-
motion_group: "0@mock-ur5e",
|
|
98
|
-
controller: "mock-ur5e",
|
|
99
|
-
joint_position: [
|
|
100
|
-
1.487959623336792,
|
|
101
|
-
-1.8501918315887451,
|
|
102
|
-
1.8003005981445312,
|
|
103
|
-
6.034560203552246,
|
|
104
|
-
1.4921919107437134,
|
|
105
|
-
1.593459963798523
|
|
106
|
-
],
|
|
107
|
-
joint_limit_reached: { limit_reached: [
|
|
108
|
-
false,
|
|
109
|
-
false,
|
|
110
|
-
false,
|
|
111
|
-
false,
|
|
112
|
-
false,
|
|
113
|
-
false
|
|
114
|
-
] },
|
|
115
|
-
joint_torque: [],
|
|
116
|
-
joint_current: [
|
|
117
|
-
0,
|
|
118
|
-
0,
|
|
119
|
-
0,
|
|
120
|
-
0,
|
|
121
|
-
0,
|
|
122
|
-
0
|
|
123
|
-
],
|
|
124
|
-
flange_pose: {
|
|
125
|
-
position: [
|
|
126
|
-
107.6452433732927,
|
|
127
|
-
-409.0402987746852,
|
|
128
|
-
524.2402132330305
|
|
129
|
-
],
|
|
130
|
-
orientation: [
|
|
131
|
-
.9874434028353319,
|
|
132
|
-
-.986571714997442,
|
|
133
|
-
1.3336589451098142
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
tcp: "Flange",
|
|
137
|
-
tcp_pose: {
|
|
138
|
-
position: [
|
|
139
|
-
107.6452433732927,
|
|
140
|
-
-409.0402987746852,
|
|
141
|
-
524.2402132330305
|
|
142
|
-
],
|
|
143
|
-
orientation: [
|
|
144
|
-
.9874434028353319,
|
|
145
|
-
-.986571714997442,
|
|
146
|
-
1.3336589451098142
|
|
147
|
-
]
|
|
148
|
-
},
|
|
149
|
-
payload: "",
|
|
150
|
-
coordinate_system: "",
|
|
151
|
-
standstill: true
|
|
152
|
-
}]
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
//#endregion
|
|
157
|
-
//#region src/lib/v2/mock/getMotionGroupDescription.ts
|
|
158
|
-
const getMotionGroupDescription = {
|
|
159
|
-
method: "GET",
|
|
160
|
-
path: "/cells/:cellId/controllers/:controllerId/motion-groups/:motionGroupId/description",
|
|
161
|
-
handle() {
|
|
162
|
-
return {
|
|
163
|
-
motion_group_model: "UniversalRobots_UR5e",
|
|
164
|
-
mounting: {
|
|
165
|
-
position: [
|
|
166
|
-
0,
|
|
167
|
-
0,
|
|
168
|
-
0
|
|
169
|
-
],
|
|
170
|
-
orientation: [
|
|
171
|
-
0,
|
|
172
|
-
0,
|
|
173
|
-
0
|
|
174
|
-
]
|
|
175
|
-
},
|
|
176
|
-
tcps: { Flange: {
|
|
177
|
-
name: "Default-Flange",
|
|
178
|
-
pose: {
|
|
179
|
-
position: [
|
|
180
|
-
0,
|
|
181
|
-
0,
|
|
182
|
-
0
|
|
183
|
-
],
|
|
184
|
-
orientation: [
|
|
185
|
-
0,
|
|
186
|
-
0,
|
|
187
|
-
0
|
|
188
|
-
]
|
|
189
|
-
}
|
|
190
|
-
} },
|
|
191
|
-
payloads: { "FPay-0": {
|
|
192
|
-
name: "FPay-0",
|
|
193
|
-
payload: 0,
|
|
194
|
-
center_of_mass: [
|
|
195
|
-
0,
|
|
196
|
-
0,
|
|
197
|
-
0
|
|
198
|
-
],
|
|
199
|
-
moment_of_inertia: [
|
|
200
|
-
0,
|
|
201
|
-
0,
|
|
202
|
-
0
|
|
203
|
-
]
|
|
204
|
-
} },
|
|
205
|
-
cycle_time: 8,
|
|
206
|
-
dh_parameters: [
|
|
207
|
-
{
|
|
208
|
-
alpha: 1.5707963267948966,
|
|
209
|
-
d: 162.25
|
|
210
|
-
},
|
|
211
|
-
{ a: -425 },
|
|
212
|
-
{ a: -392.2 },
|
|
213
|
-
{
|
|
214
|
-
alpha: 1.5707963267948966,
|
|
215
|
-
d: 133.3
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
alpha: -1.5707963267948966,
|
|
219
|
-
d: 99.7
|
|
220
|
-
},
|
|
221
|
-
{ d: 99.6 }
|
|
222
|
-
],
|
|
223
|
-
operation_limits: {
|
|
224
|
-
auto_limits: {
|
|
225
|
-
joints: [
|
|
226
|
-
{
|
|
227
|
-
position: {
|
|
228
|
-
lower_limit: -6.283185307179586,
|
|
229
|
-
upper_limit: 6.283185307179586
|
|
230
|
-
},
|
|
231
|
-
velocity: 3.34159255027771,
|
|
232
|
-
acceleration: 40,
|
|
233
|
-
torque: 150
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
position: {
|
|
237
|
-
lower_limit: -6.283185307179586,
|
|
238
|
-
upper_limit: 6.283185307179586
|
|
239
|
-
},
|
|
240
|
-
velocity: 3.34159255027771,
|
|
241
|
-
acceleration: 40,
|
|
242
|
-
torque: 150
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
position: {
|
|
246
|
-
lower_limit: -6.283185307179586,
|
|
247
|
-
upper_limit: 6.283185307179586
|
|
248
|
-
},
|
|
249
|
-
velocity: 3.34159255027771,
|
|
250
|
-
acceleration: 40,
|
|
251
|
-
torque: 150
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
position: {
|
|
255
|
-
lower_limit: -6.283185307179586,
|
|
256
|
-
upper_limit: 6.283185307179586
|
|
257
|
-
},
|
|
258
|
-
velocity: 3.34159255027771,
|
|
259
|
-
acceleration: 40,
|
|
260
|
-
torque: 28
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
position: {
|
|
264
|
-
lower_limit: -6.283185307179586,
|
|
265
|
-
upper_limit: 6.283185307179586
|
|
266
|
-
},
|
|
267
|
-
velocity: 3.34159255027771,
|
|
268
|
-
acceleration: 40,
|
|
269
|
-
torque: 28
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
position: {
|
|
273
|
-
lower_limit: -6.283185307179586,
|
|
274
|
-
upper_limit: 6.283185307179586
|
|
275
|
-
},
|
|
276
|
-
velocity: 3.34159255027771,
|
|
277
|
-
acceleration: 40,
|
|
278
|
-
torque: 28
|
|
279
|
-
}
|
|
280
|
-
],
|
|
281
|
-
tcp: { velocity: 5e3 },
|
|
282
|
-
elbow: { velocity: 5e3 },
|
|
283
|
-
flange: { velocity: 5e3 }
|
|
284
|
-
},
|
|
285
|
-
manual_limits: {
|
|
286
|
-
joints: [
|
|
287
|
-
{
|
|
288
|
-
position: {
|
|
289
|
-
lower_limit: -6.283185307179586,
|
|
290
|
-
upper_limit: 6.283185307179586
|
|
291
|
-
},
|
|
292
|
-
velocity: 3.34159255027771,
|
|
293
|
-
acceleration: 40,
|
|
294
|
-
torque: 150
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
position: {
|
|
298
|
-
lower_limit: -6.283185307179586,
|
|
299
|
-
upper_limit: 6.283185307179586
|
|
300
|
-
},
|
|
301
|
-
velocity: 3.34159255027771,
|
|
302
|
-
acceleration: 40,
|
|
303
|
-
torque: 150
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
position: {
|
|
307
|
-
lower_limit: -6.283185307179586,
|
|
308
|
-
upper_limit: 6.283185307179586
|
|
309
|
-
},
|
|
310
|
-
velocity: 3.34159255027771,
|
|
311
|
-
acceleration: 40,
|
|
312
|
-
torque: 150
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
position: {
|
|
316
|
-
lower_limit: -6.283185307179586,
|
|
317
|
-
upper_limit: 6.283185307179586
|
|
318
|
-
},
|
|
319
|
-
velocity: 3.34159255027771,
|
|
320
|
-
acceleration: 40,
|
|
321
|
-
torque: 28
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
position: {
|
|
325
|
-
lower_limit: -6.283185307179586,
|
|
326
|
-
upper_limit: 6.283185307179586
|
|
327
|
-
},
|
|
328
|
-
velocity: 3.34159255027771,
|
|
329
|
-
acceleration: 40,
|
|
330
|
-
torque: 28
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
position: {
|
|
334
|
-
lower_limit: -6.283185307179586,
|
|
335
|
-
upper_limit: 6.283185307179586
|
|
336
|
-
},
|
|
337
|
-
velocity: 3.34159255027771,
|
|
338
|
-
acceleration: 40,
|
|
339
|
-
torque: 28
|
|
340
|
-
}
|
|
341
|
-
],
|
|
342
|
-
tcp: { velocity: 5e3 }
|
|
343
|
-
},
|
|
344
|
-
manual_t1_limits: {
|
|
345
|
-
joints: [
|
|
346
|
-
{
|
|
347
|
-
position: {
|
|
348
|
-
lower_limit: -6.283185307179586,
|
|
349
|
-
upper_limit: 6.283185307179586
|
|
350
|
-
},
|
|
351
|
-
velocity: 3.34159255027771,
|
|
352
|
-
acceleration: 40,
|
|
353
|
-
torque: 150
|
|
354
|
-
},
|
|
355
|
-
{
|
|
356
|
-
position: {
|
|
357
|
-
lower_limit: -6.283185307179586,
|
|
358
|
-
upper_limit: 6.283185307179586
|
|
359
|
-
},
|
|
360
|
-
velocity: 3.34159255027771,
|
|
361
|
-
acceleration: 40,
|
|
362
|
-
torque: 150
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
position: {
|
|
366
|
-
lower_limit: -6.283185307179586,
|
|
367
|
-
upper_limit: 6.283185307179586
|
|
368
|
-
},
|
|
369
|
-
velocity: 3.34159255027771,
|
|
370
|
-
acceleration: 40,
|
|
371
|
-
torque: 150
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
position: {
|
|
375
|
-
lower_limit: -6.283185307179586,
|
|
376
|
-
upper_limit: 6.283185307179586
|
|
377
|
-
},
|
|
378
|
-
velocity: 3.34159255027771,
|
|
379
|
-
acceleration: 40,
|
|
380
|
-
torque: 28
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
position: {
|
|
384
|
-
lower_limit: -6.283185307179586,
|
|
385
|
-
upper_limit: 6.283185307179586
|
|
386
|
-
},
|
|
387
|
-
velocity: 3.34159255027771,
|
|
388
|
-
acceleration: 40,
|
|
389
|
-
torque: 28
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
position: {
|
|
393
|
-
lower_limit: -6.283185307179586,
|
|
394
|
-
upper_limit: 6.283185307179586
|
|
395
|
-
},
|
|
396
|
-
velocity: 3.34159255027771,
|
|
397
|
-
acceleration: 40,
|
|
398
|
-
torque: 28
|
|
399
|
-
}
|
|
400
|
-
],
|
|
401
|
-
tcp: { velocity: 5e3 }
|
|
402
|
-
},
|
|
403
|
-
manual_t2_limits: {
|
|
404
|
-
joints: [
|
|
405
|
-
{
|
|
406
|
-
position: {
|
|
407
|
-
lower_limit: -6.283185307179586,
|
|
408
|
-
upper_limit: 6.283185307179586
|
|
409
|
-
},
|
|
410
|
-
velocity: 3.34159255027771,
|
|
411
|
-
acceleration: 40,
|
|
412
|
-
torque: 150
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
position: {
|
|
416
|
-
lower_limit: -6.283185307179586,
|
|
417
|
-
upper_limit: 6.283185307179586
|
|
418
|
-
},
|
|
419
|
-
velocity: 3.34159255027771,
|
|
420
|
-
acceleration: 40,
|
|
421
|
-
torque: 150
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
position: {
|
|
425
|
-
lower_limit: -6.283185307179586,
|
|
426
|
-
upper_limit: 6.283185307179586
|
|
427
|
-
},
|
|
428
|
-
velocity: 3.34159255027771,
|
|
429
|
-
acceleration: 40,
|
|
430
|
-
torque: 150
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
position: {
|
|
434
|
-
lower_limit: -6.283185307179586,
|
|
435
|
-
upper_limit: 6.283185307179586
|
|
436
|
-
},
|
|
437
|
-
velocity: 3.34159255027771,
|
|
438
|
-
acceleration: 40,
|
|
439
|
-
torque: 28
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
position: {
|
|
443
|
-
lower_limit: -6.283185307179586,
|
|
444
|
-
upper_limit: 6.283185307179586
|
|
445
|
-
},
|
|
446
|
-
velocity: 3.34159255027771,
|
|
447
|
-
acceleration: 40,
|
|
448
|
-
torque: 28
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
position: {
|
|
452
|
-
lower_limit: -6.283185307179586,
|
|
453
|
-
upper_limit: 6.283185307179586
|
|
454
|
-
},
|
|
455
|
-
velocity: 3.34159255027771,
|
|
456
|
-
acceleration: 40,
|
|
457
|
-
torque: 28
|
|
458
|
-
}
|
|
459
|
-
],
|
|
460
|
-
tcp: { velocity: 5e3 }
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
serial_number: "WBVirtualRobot"
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
//#endregion
|
|
468
|
-
//#region src/lib/v2/mock/getMotionGroupKinematicModel.ts
|
|
469
|
-
const getMotionGroupKinematicModel = {
|
|
470
|
-
method: "GET",
|
|
471
|
-
path: "/motion-group-models/:motionGroupModel/kinematic",
|
|
472
|
-
handle() {
|
|
473
|
-
return {
|
|
474
|
-
dh_parameters: [
|
|
475
|
-
{
|
|
476
|
-
alpha: 1.5707963267948966,
|
|
477
|
-
theta: 0,
|
|
478
|
-
a: 0,
|
|
479
|
-
d: 162.25,
|
|
480
|
-
reverse_rotation_direction: false
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
alpha: 0,
|
|
484
|
-
theta: 0,
|
|
485
|
-
a: -425,
|
|
486
|
-
d: 0,
|
|
487
|
-
reverse_rotation_direction: false
|
|
488
|
-
},
|
|
489
|
-
{
|
|
490
|
-
alpha: 0,
|
|
491
|
-
theta: 0,
|
|
492
|
-
a: -392.2,
|
|
493
|
-
d: 0,
|
|
494
|
-
reverse_rotation_direction: false
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
alpha: 1.5707963267948966,
|
|
498
|
-
theta: 0,
|
|
499
|
-
a: 0,
|
|
500
|
-
d: 133.3,
|
|
501
|
-
reverse_rotation_direction: false
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
alpha: -1.5707963267948966,
|
|
505
|
-
theta: 0,
|
|
506
|
-
a: 0,
|
|
507
|
-
d: 99.7,
|
|
508
|
-
reverse_rotation_direction: false
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
alpha: 0,
|
|
512
|
-
theta: 0,
|
|
513
|
-
a: 0,
|
|
514
|
-
d: 99.6,
|
|
515
|
-
reverse_rotation_direction: false
|
|
516
|
-
}
|
|
517
|
-
],
|
|
518
|
-
inverse_solver: "Universalrobots"
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
};
|
|
522
|
-
//#endregion
|
|
523
|
-
//#region src/lib/v2/mock/getRobotController.ts
|
|
524
|
-
const getRobotController = {
|
|
525
|
-
method: "GET",
|
|
526
|
-
path: "/cells/:cellId/controllers/:controllerId",
|
|
527
|
-
handle() {
|
|
528
|
-
return {
|
|
529
|
-
configuration: {
|
|
530
|
-
initial_joint_position: "[0,-1.571,-1.571,-1.571,1.571,-1.571,0]",
|
|
531
|
-
kind: "VirtualController",
|
|
532
|
-
manufacturer: "universalrobots",
|
|
533
|
-
type: "universalrobots-ur5e"
|
|
534
|
-
},
|
|
535
|
-
name: "mock-ur5"
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
//#endregion
|
|
540
|
-
//#region src/lib/v2/mock/listCoordinateSystems.ts
|
|
541
|
-
const listCoordinateSystems = {
|
|
542
|
-
method: "GET",
|
|
543
|
-
path: "/cells/:cellId/controllers/:controllerId/coordinate-systems",
|
|
544
|
-
handle() {
|
|
545
|
-
return [{
|
|
546
|
-
coordinate_system: "",
|
|
547
|
-
name: "world",
|
|
548
|
-
reference_coordinate_system: "",
|
|
549
|
-
position: [
|
|
550
|
-
0,
|
|
551
|
-
0,
|
|
552
|
-
0
|
|
553
|
-
],
|
|
554
|
-
orientation: [
|
|
555
|
-
0,
|
|
556
|
-
0,
|
|
557
|
-
0
|
|
558
|
-
],
|
|
559
|
-
orientation_type: "ROTATION_VECTOR"
|
|
560
|
-
}, {
|
|
561
|
-
coordinate_system: "CS-0",
|
|
562
|
-
name: "Default-CS",
|
|
563
|
-
reference_coordinate_system: "",
|
|
564
|
-
position: [
|
|
565
|
-
0,
|
|
566
|
-
0,
|
|
567
|
-
0
|
|
568
|
-
],
|
|
569
|
-
orientation: [
|
|
570
|
-
0,
|
|
571
|
-
0,
|
|
572
|
-
0
|
|
573
|
-
],
|
|
574
|
-
orientation_type: "ROTATION_VECTOR"
|
|
575
|
-
}];
|
|
576
|
-
}
|
|
577
|
-
};
|
|
578
|
-
//#endregion
|
|
579
|
-
//#region src/lib/v2/mock/listRobotControllers.ts
|
|
580
|
-
const listRobotControllers = {
|
|
581
|
-
method: "GET",
|
|
582
|
-
path: "/cells/:cellId/controllers",
|
|
583
|
-
handle() {
|
|
584
|
-
return ["mock-ur5e"];
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
//#endregion
|
|
588
|
-
//#region src/lib/v2/mock/MockNovaInstance.ts
|
|
589
|
-
/**
|
|
590
|
-
* Ultra-simplified mock Nova server for testing stuff
|
|
591
|
-
*/
|
|
592
|
-
var MockNovaInstance = class {
|
|
593
|
-
constructor() {
|
|
594
|
-
this.connections = [];
|
|
595
|
-
}
|
|
596
|
-
async handleAPIRequest(config) {
|
|
597
|
-
const apiHandlers = [
|
|
598
|
-
listRobotControllers,
|
|
599
|
-
getRobotController,
|
|
600
|
-
getMotionGroupDescription,
|
|
601
|
-
getCurrentRobotControllerState,
|
|
602
|
-
listCoordinateSystems,
|
|
603
|
-
getMotionGroupKinematicModel
|
|
604
|
-
];
|
|
605
|
-
const method = config.method?.toUpperCase() || "GET";
|
|
606
|
-
if (!config.url) throw new Error("No url sent with request");
|
|
607
|
-
const path = config.url.split("?")[0];
|
|
608
|
-
for (const handler of apiHandlers) {
|
|
609
|
-
const match = path_to_regexp.match(handler.path)(path);
|
|
610
|
-
if (method === handler.method && match) {
|
|
611
|
-
const json = handler.handle();
|
|
612
|
-
return {
|
|
613
|
-
status: 200,
|
|
614
|
-
statusText: "Success",
|
|
615
|
-
data: JSON.stringify(json),
|
|
616
|
-
headers: {},
|
|
617
|
-
config,
|
|
618
|
-
request: { responseURL: config.url }
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
throw new axios.AxiosError(`No mock handler matched this request: ${method} ${path}`, "404", config);
|
|
623
|
-
}
|
|
624
|
-
handleWebsocketConnection(socket) {
|
|
625
|
-
this.connections.push(socket);
|
|
626
|
-
setTimeout(() => {
|
|
627
|
-
socket.dispatchEvent(new Event("open"));
|
|
628
|
-
console.log("Websocket connection opened from", socket.url);
|
|
629
|
-
if (socket.url.includes("/state-stream")) socket.dispatchEvent(new MessageEvent("message", { data: JSON.stringify(defaultMotionState) }));
|
|
630
|
-
if (socket.url.includes("/execution/jogging")) socket.dispatchEvent(new MessageEvent("message", { data: JSON.stringify({ result: {
|
|
631
|
-
message: "string",
|
|
632
|
-
kind: "INITIALIZE_RECEIVED"
|
|
633
|
-
} }) }));
|
|
634
|
-
}, 10);
|
|
635
|
-
}
|
|
636
|
-
handleWebsocketMessage(socket, message) {
|
|
637
|
-
console.log(`Received message on ${socket.url}`, message);
|
|
638
|
-
}
|
|
639
|
-
};
|
|
640
|
-
const defaultMotionState = { result: {
|
|
641
|
-
motion_group: "0@universalrobots-ur5e",
|
|
642
|
-
controller: "universalrobots-ur5e",
|
|
643
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
644
|
-
sequence_number: 1,
|
|
645
|
-
joint_position: [
|
|
646
|
-
1.1699999570846558,
|
|
647
|
-
-1.5700000524520874,
|
|
648
|
-
1.3600000143051147,
|
|
649
|
-
1.0299999713897705,
|
|
650
|
-
1.2899999618530273,
|
|
651
|
-
1.2799999713897705
|
|
652
|
-
],
|
|
653
|
-
joint_limit_reached: { limit_reached: [
|
|
654
|
-
false,
|
|
655
|
-
false,
|
|
656
|
-
false,
|
|
657
|
-
false,
|
|
658
|
-
false,
|
|
659
|
-
false
|
|
660
|
-
] },
|
|
661
|
-
standstill: false,
|
|
662
|
-
flange_pose: {
|
|
663
|
-
position: [
|
|
664
|
-
1.3300010259703043,
|
|
665
|
-
-409.2680714682808,
|
|
666
|
-
531.0203477065281
|
|
667
|
-
],
|
|
668
|
-
orientation: [
|
|
669
|
-
1.7564919306270736,
|
|
670
|
-
-1.7542521568325058,
|
|
671
|
-
.7326972590614671
|
|
672
|
-
]
|
|
673
|
-
},
|
|
674
|
-
tcp_pose: {
|
|
675
|
-
position: [
|
|
676
|
-
1.3300010259703043,
|
|
677
|
-
-409.2680714682808,
|
|
678
|
-
531.0203477065281
|
|
679
|
-
],
|
|
680
|
-
orientation: [
|
|
681
|
-
1.7564919306270736,
|
|
682
|
-
-1.7542521568325058,
|
|
683
|
-
.7326972590614671
|
|
684
|
-
]
|
|
685
|
-
},
|
|
686
|
-
description_revision: 0
|
|
687
|
-
} };
|
|
688
|
-
//#endregion
|
|
689
|
-
//#region src/lib/v2/NovaClient.ts
|
|
690
|
-
/**
|
|
691
|
-
*
|
|
692
|
-
* Client for connecting to a Nova instance and controlling robots.
|
|
693
|
-
*/
|
|
694
|
-
var NovaClient = class {
|
|
695
|
-
constructor(config) {
|
|
696
|
-
this.authPromise = null;
|
|
697
|
-
this.accessToken = null;
|
|
698
|
-
const cellId = config.cellId ?? "cell";
|
|
699
|
-
this.config = {
|
|
700
|
-
cellId,
|
|
701
|
-
...config
|
|
702
|
-
};
|
|
703
|
-
this.accessToken = config.accessToken || require_LoginWithAuth0.availableStorage.getString("wbjs.access_token") || null;
|
|
704
|
-
if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
|
|
705
|
-
this.instanceUrl = require_LoginWithAuth0.parseNovaInstanceUrl(this.config.instanceUrl);
|
|
706
|
-
const axiosInstance = axios.default.create({
|
|
707
|
-
baseURL: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
|
|
708
|
-
headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
|
|
709
|
-
});
|
|
710
|
-
axiosInstance.interceptors.request.use(async (request) => {
|
|
711
|
-
if (!request.headers.Authorization) {
|
|
712
|
-
if (this.accessToken) request.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
713
|
-
else if (this.config.username && this.config.password) request.headers.Authorization = `Basic ${btoa(`${config.username}:${config.password}`)}`;
|
|
714
|
-
}
|
|
715
|
-
return request;
|
|
716
|
-
});
|
|
717
|
-
if (typeof window !== "undefined") axiosInstance.interceptors.response.use((r) => r, async (error) => {
|
|
718
|
-
if ((0, axios.isAxiosError)(error)) {
|
|
719
|
-
if (error.response?.status === 401) try {
|
|
720
|
-
await this.renewAuthentication();
|
|
721
|
-
if (error.config) {
|
|
722
|
-
if (this.accessToken) error.config.headers.Authorization = `Bearer ${this.accessToken}`;
|
|
723
|
-
else delete error.config.headers.Authorization;
|
|
724
|
-
return axiosInstance.request(error.config);
|
|
725
|
-
}
|
|
726
|
-
} catch (err) {
|
|
727
|
-
return Promise.reject(err);
|
|
728
|
-
}
|
|
729
|
-
else if (error.response?.status === 503) {
|
|
730
|
-
if ((await fetch(window.location.href)).status === 503) window.location.reload();
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
return Promise.reject(error);
|
|
734
|
-
});
|
|
735
|
-
this.api = new NovaCellAPIClient(cellId, {
|
|
736
|
-
...config,
|
|
737
|
-
basePath: (0, url_join.default)(this.instanceUrl.href, "/api/v2"),
|
|
738
|
-
isJsonMime: (mime) => {
|
|
739
|
-
return mime === "application/json";
|
|
740
|
-
},
|
|
741
|
-
baseOptions: {
|
|
742
|
-
...this.mock ? { adapter: (config) => {
|
|
743
|
-
return this.mock.handleAPIRequest(config);
|
|
744
|
-
} } : {},
|
|
745
|
-
...config.baseOptions
|
|
746
|
-
},
|
|
747
|
-
axiosInstance
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
async renewAuthentication() {
|
|
751
|
-
if (this.authPromise) return;
|
|
752
|
-
const storedToken = require_LoginWithAuth0.availableStorage.getString("wbjs.access_token");
|
|
753
|
-
if (storedToken && this.accessToken !== storedToken) {
|
|
754
|
-
this.accessToken = storedToken;
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
this.authPromise = require_LoginWithAuth0.loginWithAuth0(this.instanceUrl);
|
|
758
|
-
try {
|
|
759
|
-
this.accessToken = await this.authPromise;
|
|
760
|
-
if (this.accessToken) require_LoginWithAuth0.availableStorage.setString("wbjs.access_token", this.accessToken);
|
|
761
|
-
else require_LoginWithAuth0.availableStorage.delete("wbjs.access_token");
|
|
762
|
-
} finally {
|
|
763
|
-
this.authPromise = null;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
makeWebsocketURL(path) {
|
|
767
|
-
const url = new URL((0, url_join.default)(this.instanceUrl.href, `/api/v2/cells/${this.config.cellId}`, path));
|
|
768
|
-
url.protocol = url.protocol.replace("http", "ws");
|
|
769
|
-
url.protocol = url.protocol.replace("https", "wss");
|
|
770
|
-
if (this.accessToken) url.searchParams.append("token", this.accessToken);
|
|
771
|
-
else if (this.config.username && this.config.password) {
|
|
772
|
-
url.username = this.config.username;
|
|
773
|
-
url.password = this.config.password;
|
|
774
|
-
}
|
|
775
|
-
return url.toString();
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.
|
|
779
|
-
* If you explicitly want to reconnect an existing websocket, call `reconnect`
|
|
780
|
-
* on the returned object.
|
|
781
|
-
*/
|
|
782
|
-
openReconnectingWebsocket(path) {
|
|
783
|
-
return new require_LoginWithAuth0.AutoReconnectingWebsocket(this.makeWebsocketURL(path), { mock: this.mock });
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
//#endregion
|
|
787
|
-
//#region src/lib/v2/wandelscriptUtils.ts
|
|
788
|
-
/**
|
|
789
|
-
* Convert a Pose object representing a motion group position
|
|
790
|
-
* into a string which represents that pose in Wandelscript.
|
|
791
|
-
*/
|
|
792
|
-
function poseToWandelscriptString(pose) {
|
|
793
|
-
const position = [
|
|
794
|
-
pose.position?.[0] ?? 0,
|
|
795
|
-
pose.position?.[1] ?? 0,
|
|
796
|
-
pose.position?.[2] ?? 0
|
|
797
|
-
];
|
|
798
|
-
const orientation = [
|
|
799
|
-
pose.orientation?.[0] ?? 0,
|
|
800
|
-
pose.orientation?.[1] ?? 0,
|
|
801
|
-
pose.orientation?.[2] ?? 0
|
|
802
|
-
];
|
|
803
|
-
const positionValues = position.map((v) => v.toFixed(1));
|
|
804
|
-
const rotationValues = orientation.map((v) => v.toFixed(4));
|
|
805
|
-
return `(${positionValues.concat(rotationValues).join(", ")})`;
|
|
806
|
-
}
|
|
807
|
-
//#endregion
|
|
808
|
-
exports.NovaCellAPIClient = NovaCellAPIClient;
|
|
809
|
-
exports.NovaClient = NovaClient;
|
|
810
|
-
exports.poseToWandelscriptString = poseToWandelscriptString;
|
|
811
|
-
Object.keys(_wandelbots_nova_api_v2).forEach(function(k) {
|
|
812
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
813
|
-
enumerable: true,
|
|
814
|
-
get: function() {
|
|
815
|
-
return _wandelbots_nova_api_v2[k];
|
|
816
|
-
}
|
|
817
|
-
});
|
|
818
|
-
});
|
|
819
|
-
|
|
820
|
-
//# sourceMappingURL=index.cjs.map
|