@wandelbots/nova-js 3.13.0-pr.307.07b1ea2 → 3.13.0-pr.307.2abdb29
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/dist/Nova--8gozkLR.d.mts +85 -0
- package/dist/Nova--8gozkLR.d.mts.map +1 -0
- package/dist/Nova-B1o5iTQ6.d.cts +85 -0
- package/dist/Nova-B1o5iTQ6.d.cts.map +1 -0
- package/dist/{context-Cu5mXcFZ.cjs → context-BZELA2eh.cjs} +3 -146
- package/dist/context-BZELA2eh.cjs.map +1 -0
- package/dist/{context-CmXqEEwW.mjs → context-ffr5Q2dc.mjs} +3 -86
- package/dist/context-ffr5Q2dc.mjs.map +1 -0
- package/dist/converters-DnG1fX23.mjs +87 -0
- package/dist/converters-DnG1fX23.mjs.map +1 -0
- package/dist/converters-EYS27XJE.cjs +146 -0
- package/dist/converters-EYS27XJE.cjs.map +1 -0
- package/dist/experimental/nats/index.cjs +37 -4
- package/dist/experimental/nats/index.cjs.map +1 -1
- package/dist/experimental/nats/index.d.cts +30 -7
- package/dist/experimental/nats/index.d.cts.map +1 -1
- package/dist/experimental/nats/index.d.mts +30 -7
- package/dist/experimental/nats/index.d.mts.map +1 -1
- package/dist/experimental/nats/index.mjs +37 -5
- package/dist/experimental/nats/index.mjs.map +1 -1
- package/dist/index.cjs +13 -12
- package/dist/index.mjs +3 -2
- package/dist/v1/index.cjs +3 -3
- package/dist/v1/index.cjs.map +1 -1
- package/dist/v1/index.mjs +2 -2
- package/dist/v2/index.cjs +4 -3
- package/dist/v2/index.cjs.map +1 -1
- package/dist/v2/index.d.cts +5 -83
- package/dist/v2/index.d.cts.map +1 -1
- package/dist/v2/index.d.mts +4 -82
- package/dist/v2/index.d.mts.map +1 -1
- package/dist/v2/index.mjs +2 -1
- package/dist/v2/index.mjs.map +1 -1
- package/dist/{wandelscriptUtils-CKhiZJsB.mjs → wandelscriptUtils-CpUXdLVc.mjs} +3 -2
- package/dist/{wandelscriptUtils-CKhiZJsB.mjs.map → wandelscriptUtils-CpUXdLVc.mjs.map} +1 -1
- package/dist/{wandelscriptUtils-BdqeVDCY.cjs → wandelscriptUtils-DcY1aLWu.cjs} +13 -12
- package/dist/{wandelscriptUtils-BdqeVDCY.cjs.map → wandelscriptUtils-DcY1aLWu.cjs.map} +1 -1
- package/package.json +1 -1
- package/src/experimental/nats/index.ts +1 -0
- package/src/lib/experimental/nats/NovaNatsClient.ts +41 -4
- package/src/lib/experimental/nats/buildNatsServerUrl.ts +15 -0
- package/src/lib/experimental/nats/buildSubject.ts +2 -1
- package/src/lib/experimental/nats/generated/operations.ts +4 -4
- package/dist/context-CmXqEEwW.mjs.map +0 -1
- package/dist/context-Cu5mXcFZ.cjs.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const require_context = require("./context-
|
|
1
|
+
const require_context = require("./context-BZELA2eh.cjs");
|
|
2
|
+
const require_converters = require("./converters-EYS27XJE.cjs");
|
|
2
3
|
let axios = require("axios");
|
|
3
4
|
axios = require_context.__toESM(axios, 1);
|
|
4
5
|
let mobx = require("mobx");
|
|
@@ -44,7 +45,7 @@ var ConnectedMotionGroup = class ConnectedMotionGroup {
|
|
|
44
45
|
if (!controller || !motionGroup) throw new Error(`Controller ${controllerId} or motion group ${motionGroupId} not found`);
|
|
45
46
|
const motionStateSocket = nova.openReconnectingWebsocket(`/motion-groups/${motionGroupId}/state-stream`);
|
|
46
47
|
const firstMessage = await motionStateSocket.firstMessage();
|
|
47
|
-
const initialMotionState =
|
|
48
|
+
const initialMotionState = require_converters.tryParseJson(firstMessage.data)?.result;
|
|
48
49
|
if (!initialMotionState) throw new Error(`Unable to parse initial motion state message ${firstMessage.data}`);
|
|
49
50
|
console.log(`Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\n `, initialMotionState);
|
|
50
51
|
const isVirtual = (await nova.api.controller.getRobotController(controller.controller)).configuration.kind === "VirtualController";
|
|
@@ -58,7 +59,7 @@ var ConnectedMotionGroup = class ConnectedMotionGroup {
|
|
|
58
59
|
})();
|
|
59
60
|
const controllerStateSocket = nova.openReconnectingWebsocket(`/controllers/${controller.controller}/state-stream?response_rate=1000`);
|
|
60
61
|
const firstControllerMessage = await controllerStateSocket.firstMessage();
|
|
61
|
-
const initialControllerState =
|
|
62
|
+
const initialControllerState = require_converters.tryParseJson(firstControllerMessage.data)?.result;
|
|
62
63
|
if (!initialControllerState) throw new Error(`Unable to parse initial controller state message ${firstControllerMessage.data}`);
|
|
63
64
|
console.log(`Connected controller state websocket to controller ${controller.controller}. Initial state:\n `, initialControllerState);
|
|
64
65
|
const { tcps } = await nova.api.motionGroupInfos.listTcps(motionGroupId);
|
|
@@ -103,14 +104,14 @@ var ConnectedMotionGroup = class ConnectedMotionGroup {
|
|
|
103
104
|
this.rapidlyChangingMotionState = initialMotionState;
|
|
104
105
|
this.controllerState = initialControllerState;
|
|
105
106
|
controllerStateSocket.addEventListener("message", (event) => {
|
|
106
|
-
const data =
|
|
107
|
+
const data = require_converters.tryParseJson(event.data)?.result;
|
|
107
108
|
if (!data) return;
|
|
108
109
|
(0, mobx.runInAction)(() => {
|
|
109
110
|
this.controllerState = data;
|
|
110
111
|
});
|
|
111
112
|
});
|
|
112
113
|
motionStateSocket.addEventListener("message", (event) => {
|
|
113
|
-
const motionStateResponse =
|
|
114
|
+
const motionStateResponse = require_converters.tryParseJson(event.data)?.result;
|
|
114
115
|
if (!motionStateResponse) throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${event.data}`);
|
|
115
116
|
if (!jointValuesEqual(this.rapidlyChangingMotionState.state.joint_position.joints, motionStateResponse.state.joint_position.joints, MOTION_DELTA_THRESHOLD$1)) (0, mobx.runInAction)(() => {
|
|
116
117
|
this.rapidlyChangingMotionState.state = motionStateResponse.state;
|
|
@@ -336,7 +337,7 @@ var JoggerConnection = class JoggerConnection {
|
|
|
336
337
|
if (mode === "cartesian" && !this.cartesianWebsocket) {
|
|
337
338
|
this.cartesianWebsocket = this.nova.openReconnectingWebsocket(`/motion-groups/move-tcp`);
|
|
338
339
|
this.cartesianWebsocket.addEventListener("message", (ev) => {
|
|
339
|
-
const data =
|
|
340
|
+
const data = require_converters.tryParseJson(ev.data);
|
|
340
341
|
if (data && "error" in data) if (this.opts.onError) this.opts.onError(ev.data);
|
|
341
342
|
else throw new Error(ev.data);
|
|
342
343
|
});
|
|
@@ -344,7 +345,7 @@ var JoggerConnection = class JoggerConnection {
|
|
|
344
345
|
if (mode === "joint" && !this.jointWebsocket) {
|
|
345
346
|
this.jointWebsocket = this.nova.openReconnectingWebsocket(`/motion-groups/move-joint`);
|
|
346
347
|
this.jointWebsocket.addEventListener("message", (ev) => {
|
|
347
|
-
const data =
|
|
348
|
+
const data = require_converters.tryParseJson(ev.data);
|
|
348
349
|
if (data && "error" in data) if (this.opts.onError) this.opts.onError(ev.data);
|
|
349
350
|
else throw new Error(ev.data);
|
|
350
351
|
});
|
|
@@ -413,7 +414,7 @@ var JoggerConnection = class JoggerConnection {
|
|
|
413
414
|
*/
|
|
414
415
|
async runIncrementalCartesianMotion({ currentTcpPose, currentJoints, coordSystemId, velocityInRelevantUnits, axis, direction, motion }) {
|
|
415
416
|
const commands = [];
|
|
416
|
-
if (!
|
|
417
|
+
if (!require_converters.isSameCoordinateSystem(currentTcpPose.coordinate_system, coordSystemId)) throw new Error(`Current TCP pose coordinate system ${currentTcpPose.coordinate_system} does not match target coordinate system ${coordSystemId}`);
|
|
417
418
|
if (motion.type === "translate") {
|
|
418
419
|
const targetTcpPosition = Object.assign({}, currentTcpPose.position);
|
|
419
420
|
targetTcpPosition[axis] += motion.distanceMm * (direction === "-" ? -1 : 1);
|
|
@@ -516,7 +517,7 @@ var MotionStreamConnection = class MotionStreamConnection {
|
|
|
516
517
|
if (!controller || !motionGroup) throw new Error(`Controller ${controllerId} or motion group ${motionGroupId} not found`);
|
|
517
518
|
const motionStateSocket = nova.openReconnectingWebsocket(`/motion-groups/${motionGroupId}/state-stream`);
|
|
518
519
|
const firstMessage = await motionStateSocket.firstMessage();
|
|
519
|
-
const initialMotionState =
|
|
520
|
+
const initialMotionState = require_converters.tryParseJson(firstMessage.data)?.result;
|
|
520
521
|
if (!initialMotionState) throw new Error(`Unable to parse initial motion state message ${firstMessage.data}`);
|
|
521
522
|
console.log(`Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\n `, initialMotionState);
|
|
522
523
|
return new MotionStreamConnection(nova, controller, motionGroup, initialMotionState, motionStateSocket);
|
|
@@ -535,7 +536,7 @@ var MotionStreamConnection = class MotionStreamConnection {
|
|
|
535
536
|
this.motionStateSocket = motionStateSocket;
|
|
536
537
|
this.rapidlyChangingMotionState = initialMotionState;
|
|
537
538
|
motionStateSocket.addEventListener("message", (event) => {
|
|
538
|
-
const motionStateResponse =
|
|
539
|
+
const motionStateResponse = require_converters.tryParseJson(event.data)?.result;
|
|
539
540
|
if (!motionStateResponse) throw new Error(`Failed to get motion state for ${this.motionGroupId}: ${event.data}`);
|
|
540
541
|
if (!jointValuesEqual(this.rapidlyChangingMotionState.state.joint_position.joints, motionStateResponse.state.joint_position.joints, MOTION_DELTA_THRESHOLD)) (0, mobx.runInAction)(() => {
|
|
541
542
|
this.rapidlyChangingMotionState.state = motionStateResponse.state;
|
|
@@ -1935,7 +1936,7 @@ var NovaClient = class {
|
|
|
1935
1936
|
};
|
|
1936
1937
|
this.accessToken = config.accessToken || require_context.availableStorage.getString("wbjs.access_token") || null;
|
|
1937
1938
|
if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
|
|
1938
|
-
this.instanceUrl =
|
|
1939
|
+
this.instanceUrl = require_converters.parseNovaInstanceUrl(this.config.instanceUrl);
|
|
1939
1940
|
const axiosInstance = axios.default.create({
|
|
1940
1941
|
baseURL: new URL("/api/v1", this.config.instanceUrl).href,
|
|
1941
1942
|
headers: require_context.isLocalhostDev ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
|
|
@@ -2095,4 +2096,4 @@ Object.defineProperty(exports, "poseToWandelscriptString", {
|
|
|
2095
2096
|
}
|
|
2096
2097
|
});
|
|
2097
2098
|
|
|
2098
|
-
//# sourceMappingURL=wandelscriptUtils-
|
|
2099
|
+
//# sourceMappingURL=wandelscriptUtils-DcY1aLWu.cjs.map
|