@wandelbots/nova-js 3.9.0-pr.280.641b7e2 → 3.9.0-pr.280.7a81d6a
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 +10 -10
- package/dist/{AutoReconnectingWebsocket-DNOF9mpz.d.cts → AutoReconnectingWebsocket-DEs8wlLZ.d.cts} +1 -2
- package/dist/AutoReconnectingWebsocket-DEs8wlLZ.d.cts.map +1 -0
- package/dist/{AutoReconnectingWebsocket-DNOF9mpz.d.mts → AutoReconnectingWebsocket-DEs8wlLZ.d.mts} +1 -2
- package/dist/AutoReconnectingWebsocket-DEs8wlLZ.d.mts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/lib/deprecated/v1/index.cjs +1 -4
- package/dist/lib/deprecated/v1/index.cjs.map +1 -1
- package/dist/lib/deprecated/v1/index.d.cts +2 -7
- package/dist/lib/deprecated/v1/index.d.cts.map +1 -1
- package/dist/lib/deprecated/v1/index.d.mts +2 -7
- package/dist/lib/deprecated/v1/index.d.mts.map +1 -1
- package/dist/lib/deprecated/v1/index.mjs +1 -4
- package/dist/lib/deprecated/v1/index.mjs.map +1 -1
- package/dist/lib/v2/index.cjs +25 -38
- package/dist/lib/v2/index.cjs.map +1 -1
- package/dist/lib/v2/index.d.cts +35 -44
- package/dist/lib/v2/index.d.cts.map +1 -1
- package/dist/lib/v2/index.d.mts +35 -44
- package/dist/lib/v2/index.d.mts.map +1 -1
- package/dist/lib/v2/index.mjs +24 -38
- package/dist/lib/v2/index.mjs.map +1 -1
- package/dist/{wandelscriptUtils-P0WYSZww.cjs → wandelscriptUtils-BvZ8hcul.cjs} +6 -12
- package/dist/wandelscriptUtils-BvZ8hcul.cjs.map +1 -0
- package/dist/{wandelscriptUtils-C7hQePlo.mjs → wandelscriptUtils-CsQAUu_9.mjs} +5 -12
- package/dist/wandelscriptUtils-CsQAUu_9.mjs.map +1 -0
- package/dist/{wandelscriptUtils-1A9uFPV_.d.cts → wandelscriptUtils-Cz-yQ2eJ.d.mts} +3 -13
- package/dist/wandelscriptUtils-Cz-yQ2eJ.d.mts.map +1 -0
- package/dist/{wandelscriptUtils-pySXnBlX.d.mts → wandelscriptUtils-_Si3ueEd.d.cts} +3 -13
- package/dist/wandelscriptUtils-_Si3ueEd.d.cts.map +1 -0
- package/package.json +3 -2
- package/src/lib/deprecated/v1/ConnectedMotionGroup.ts +0 -2
- package/src/lib/deprecated/v1/JoggerConnection.ts +0 -2
- package/src/lib/deprecated/v1/MotionStreamConnection.ts +0 -1
- package/src/lib/deprecated/v1/NovaCellAPIClient.ts +0 -3
- package/src/lib/deprecated/v1/NovaClient.ts +8 -8
- package/src/lib/deprecated/v1/ProgramStateConnection.ts +0 -4
- package/src/lib/deprecated/v1/getLatestTrajectories.ts +0 -1
- package/src/lib/deprecated/v1/mock/MockNovaInstance.ts +0 -1
- package/src/lib/deprecated/v1/motionStateUpdate.ts +0 -2
- package/src/lib/deprecated/v1/wandelscriptUtils.ts +0 -1
- package/src/lib/deprecated/v2/NovaCellAPIClient.ts +0 -3
- package/src/lib/deprecated/v2/NovaClient.ts +9 -9
- package/src/lib/deprecated/v2/wandelscriptUtils.ts +0 -1
- package/src/lib/v2/Nova.ts +9 -10
- package/src/lib/v2/NovaAPIClient.ts +93 -81
- package/src/lib/v2/index.ts +1 -1
- package/dist/AutoReconnectingWebsocket-DNOF9mpz.d.cts.map +0 -1
- package/dist/AutoReconnectingWebsocket-DNOF9mpz.d.mts.map +0 -1
- package/dist/wandelscriptUtils-1A9uFPV_.d.cts.map +0 -1
- package/dist/wandelscriptUtils-C7hQePlo.mjs.map +0 -1
- package/dist/wandelscriptUtils-P0WYSZww.cjs.map +0 -1
- package/dist/wandelscriptUtils-pySXnBlX.d.mts.map +0 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const require_LoginWithAuth0 = require("./LoginWithAuth0-oZFpwe7m.cjs");
|
|
2
2
|
let axios = require("axios");
|
|
3
3
|
axios = require_LoginWithAuth0.__toESM(axios, 1);
|
|
4
|
+
let url_join = require("url-join");
|
|
5
|
+
url_join = require_LoginWithAuth0.__toESM(url_join, 1);
|
|
4
6
|
let mobx = require("mobx");
|
|
5
7
|
let three = require("three");
|
|
6
8
|
three = require_LoginWithAuth0.__toESM(three, 1);
|
|
@@ -9,13 +11,11 @@ let _wandelbots_nova_api_v1 = require("@wandelbots/nova-api/v1");
|
|
|
9
11
|
let path_to_regexp = require("path-to-regexp");
|
|
10
12
|
path_to_regexp = require_LoginWithAuth0.__toESM(path_to_regexp, 1);
|
|
11
13
|
//#region src/lib/deprecated/v1/motionStateUpdate.ts
|
|
12
|
-
/** @deprecated */
|
|
13
14
|
function jointValuesEqual(oldJointValues, newJointValues, changeDeltaThreshold) {
|
|
14
15
|
if (newJointValues.length !== oldJointValues.length) return true;
|
|
15
16
|
for (let jointIndex = 0; jointIndex < newJointValues.length; jointIndex++) if (Math.abs(newJointValues[jointIndex] - oldJointValues[jointIndex]) > changeDeltaThreshold) return false;
|
|
16
17
|
return true;
|
|
17
18
|
}
|
|
18
|
-
/** @deprecated */
|
|
19
19
|
function tcpPoseEqual(oldTcp, newTcp, changeDeltaThreshold) {
|
|
20
20
|
if (oldTcp === void 0 && newTcp || oldTcp && newTcp === void 0) return false;
|
|
21
21
|
if (oldTcp === void 0 || newTcp === void 0) return true;
|
|
@@ -34,7 +34,6 @@ function tcpPoseEqual(oldTcp, newTcp, changeDeltaThreshold) {
|
|
|
34
34
|
const MOTION_DELTA_THRESHOLD$1 = 1e-4;
|
|
35
35
|
/**
|
|
36
36
|
* Store representing the current state of a connected motion group.
|
|
37
|
-
* @deprecated
|
|
38
37
|
*/
|
|
39
38
|
var ConnectedMotionGroup = class ConnectedMotionGroup {
|
|
40
39
|
static async connect(nova, motionGroupId, controllers) {
|
|
@@ -237,7 +236,6 @@ var ConnectedMotionGroup = class ConnectedMotionGroup {
|
|
|
237
236
|
};
|
|
238
237
|
//#endregion
|
|
239
238
|
//#region src/lib/deprecated/v1/JoggerConnection.ts
|
|
240
|
-
/** @deprecated */
|
|
241
239
|
var JoggerConnection = class JoggerConnection {
|
|
242
240
|
static async open(nova, motionGroupId, opts = {}) {
|
|
243
241
|
return new JoggerConnection(await nova.connectMotionStream(motionGroupId), opts);
|
|
@@ -484,7 +482,6 @@ function unwrapRotationVector(newRotationVectorApi, currentRotationVectorApi) {
|
|
|
484
482
|
}
|
|
485
483
|
/**
|
|
486
484
|
* Store representing the current state of a connected motion group.
|
|
487
|
-
* @deprecated
|
|
488
485
|
*/
|
|
489
486
|
var MotionStreamConnection = class MotionStreamConnection {
|
|
490
487
|
static async open(nova, motionGroupId) {
|
|
@@ -552,7 +549,6 @@ var MotionStreamConnection = class MotionStreamConnection {
|
|
|
552
549
|
/**
|
|
553
550
|
* API client providing type-safe access to all the Nova API REST endpoints
|
|
554
551
|
* associated with a specific cell id.
|
|
555
|
-
* @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
|
|
556
552
|
*/
|
|
557
553
|
var NovaCellAPIClient = class {
|
|
558
554
|
constructor(cellId, opts) {
|
|
@@ -628,7 +624,6 @@ var NovaCellAPIClient = class {
|
|
|
628
624
|
//#region src/lib/deprecated/v1/mock/MockNovaInstance.ts
|
|
629
625
|
/**
|
|
630
626
|
* Ultra-simplified mock Nova server for testing stuff
|
|
631
|
-
* @deprecated
|
|
632
627
|
*/
|
|
633
628
|
var MockNovaInstance = class {
|
|
634
629
|
constructor() {
|
|
@@ -1880,7 +1875,7 @@ var NovaClient = class {
|
|
|
1880
1875
|
if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
|
|
1881
1876
|
this.instanceUrl = require_LoginWithAuth0.parseNovaInstanceUrl(this.config.instanceUrl);
|
|
1882
1877
|
const axiosInstance = axios.default.create({
|
|
1883
|
-
baseURL:
|
|
1878
|
+
baseURL: (0, url_join.default)(this.config.instanceUrl, "/api/v1"),
|
|
1884
1879
|
headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
|
|
1885
1880
|
});
|
|
1886
1881
|
axiosInstance.interceptors.request.use(async (request) => {
|
|
@@ -1910,7 +1905,7 @@ var NovaClient = class {
|
|
|
1910
1905
|
});
|
|
1911
1906
|
this.api = new NovaCellAPIClient(cellId, {
|
|
1912
1907
|
...config,
|
|
1913
|
-
basePath:
|
|
1908
|
+
basePath: (0, url_join.default)(this.instanceUrl.href, "/api/v1"),
|
|
1914
1909
|
isJsonMime: (mime) => {
|
|
1915
1910
|
return mime === "application/json";
|
|
1916
1911
|
},
|
|
@@ -1940,7 +1935,7 @@ var NovaClient = class {
|
|
|
1940
1935
|
}
|
|
1941
1936
|
}
|
|
1942
1937
|
makeWebsocketURL(path) {
|
|
1943
|
-
const url = new URL(
|
|
1938
|
+
const url = new URL((0, url_join.default)(this.instanceUrl.href, `/api/v1/cells/${this.config.cellId}`, path));
|
|
1944
1939
|
url.protocol = url.protocol.replace("http", "ws");
|
|
1945
1940
|
url.protocol = url.protocol.replace("https", "wss");
|
|
1946
1941
|
if (this.accessToken) url.searchParams.append("token", this.accessToken);
|
|
@@ -1983,7 +1978,6 @@ var NovaClient = class {
|
|
|
1983
1978
|
/**
|
|
1984
1979
|
* Convert a Pose object representing a motion group position
|
|
1985
1980
|
* into a string which represents that pose in Wandelscript.
|
|
1986
|
-
* @deprecated
|
|
1987
1981
|
*/
|
|
1988
1982
|
function poseToWandelscriptString(pose) {
|
|
1989
1983
|
const position = [
|
|
@@ -2038,4 +2032,4 @@ Object.defineProperty(exports, "poseToWandelscriptString", {
|
|
|
2038
2032
|
}
|
|
2039
2033
|
});
|
|
2040
2034
|
|
|
2041
|
-
//# sourceMappingURL=wandelscriptUtils-
|
|
2035
|
+
//# sourceMappingURL=wandelscriptUtils-BvZ8hcul.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wandelscriptUtils-BvZ8hcul.cjs","names":["MOTION_DELTA_THRESHOLD","tryParseJson","THREE","tryParseJson","isSameCoordinateSystem","Vector3","Vector3","tryParseJson","SystemApi","CellApi","DeviceConfigurationApi","MotionGroupApi","MotionGroupInfosApi","ControllerApi","ProgramApi","ProgramValuesApi","ControllerIOsApi","MotionGroupKinematicApi","MotionApi","CoordinateSystemsApi","ApplicationApi","MotionGroupJoggingApi","VirtualRobotApi","VirtualRobotSetupApi","VirtualRobotModeApi","VirtualRobotBehaviorApi","LibraryProgramMetadataApi","LibraryProgramApi","LibraryRecipeMetadataApi","LibraryRecipeApi","StoreObjectApi","StoreCollisionComponentsApi","StoreCollisionScenesApi","pathToRegexp","AxiosError","availableStorage","parseNovaInstanceUrl","loginWithAuth0","AutoReconnectingWebsocket"],"sources":["../src/lib/deprecated/v1/motionStateUpdate.ts","../src/lib/deprecated/v1/ConnectedMotionGroup.ts","../src/lib/deprecated/v1/JoggerConnection.ts","../src/lib/deprecated/v1/MotionStreamConnection.ts","../src/lib/deprecated/v1/NovaCellAPIClient.ts","../src/lib/deprecated/v1/mock/MockNovaInstance.ts","../src/lib/deprecated/v1/NovaClient.ts","../src/lib/deprecated/v1/wandelscriptUtils.ts"],"sourcesContent":["import type { TcpPose } from \"@wandelbots/nova-api/v1\"\n\nexport function jointValuesEqual(\n oldJointValues: number[],\n newJointValues: number[],\n changeDeltaThreshold: number,\n): boolean {\n if (newJointValues.length !== oldJointValues.length) {\n return true\n }\n\n for (let jointIndex = 0; jointIndex < newJointValues.length; jointIndex++) {\n if (\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n Math.abs(newJointValues[jointIndex]! - oldJointValues[jointIndex]!) >\n changeDeltaThreshold\n ) {\n return false\n }\n }\n\n return true\n}\n\nexport function tcpPoseEqual(\n oldTcp: TcpPose | undefined,\n newTcp: TcpPose | undefined,\n changeDeltaThreshold: number,\n): boolean {\n // undefined -> defined (+reverse) transition\n if ((oldTcp === undefined && newTcp) || (oldTcp && newTcp === undefined)) {\n return false\n }\n\n // the typechecker cannot resolve states to \"!= undefined\" if \"&&\" is used\n if (oldTcp === undefined || newTcp === undefined) {\n return true\n }\n\n let changedDelta = 0\n changedDelta += Math.abs(oldTcp.orientation.x - newTcp.orientation.x)\n changedDelta += Math.abs(oldTcp.orientation.y - newTcp.orientation.y)\n changedDelta += Math.abs(oldTcp.orientation.z - newTcp.orientation.z)\n changedDelta += Math.abs(oldTcp.position.x - newTcp.position.x)\n changedDelta += Math.abs(oldTcp.position.y - newTcp.position.y)\n changedDelta += Math.abs(oldTcp.position.z - newTcp.position.z)\n\n if (changedDelta > changeDeltaThreshold) {\n return false\n }\n\n return (\n oldTcp.coordinate_system === newTcp.coordinate_system &&\n oldTcp.tcp === newTcp.tcp\n )\n}\n","import type {\n ControllerInstance,\n MotionGroupPhysical,\n MotionGroupSpecification,\n MotionGroupStateResponse,\n Mounting,\n RobotControllerState,\n RobotControllerStateOperationModeEnum,\n RobotControllerStateSafetyStateEnum,\n RobotTcp,\n SafetySetup,\n} from \"@wandelbots/nova-api/v1\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport * as THREE from \"three\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../../converters\"\nimport { jointValuesEqual, tcpPoseEqual } from \"./motionStateUpdate\"\nimport type { NovaClient } from \"./NovaClient\"\n\nconst MOTION_DELTA_THRESHOLD = 0.0001\n\nexport type MotionGroupOption = {\n selectionId: string\n} & MotionGroupPhysical\n\n/**\n * Store representing the current state of a connected motion group.\n */\nexport class ConnectedMotionGroup {\n static async connect(\n nova: NovaClient,\n motionGroupId: string,\n controllers: ControllerInstance[],\n ) {\n const [_motionGroupIndex, controllerId] = motionGroupId.split(\"@\") as [\n string,\n string,\n ]\n const controller = controllers.find((c) => c.controller === controllerId)\n const motionGroup = controller?.physical_motion_groups.find(\n (mg) => mg.motion_group === motionGroupId,\n )\n if (!controller || !motionGroup) {\n throw new Error(\n `Controller ${controllerId} or motion group ${motionGroupId} not found`,\n )\n }\n\n const motionStateSocket = nova.openReconnectingWebsocket(\n `/motion-groups/${motionGroupId}/state-stream`,\n )\n\n // Wait for the first message to get the initial state\n const firstMessage = await motionStateSocket.firstMessage()\n const initialMotionState = tryParseJson(firstMessage.data)\n ?.result as MotionGroupStateResponse\n\n if (!initialMotionState) {\n throw new Error(\n `Unable to parse initial motion state message ${firstMessage.data}`,\n )\n }\n\n console.log(\n `Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\\n `,\n initialMotionState,\n )\n\n // Check if robot is virtual or physical\n const config = await nova.api.controller.getRobotController(\n controller.controller,\n )\n const isVirtual = config.configuration.kind === \"VirtualController\"\n\n // If there's a configured mounting, we need it to show the right\n // position of the robot model\n const mounting = await (async () => {\n try {\n const mounting = await nova.api.motionGroupInfos.getMounting(\n motionGroup.motion_group,\n )\n return mounting\n } catch (err) {\n console.error(\n `Error fetching mounting for ${motionGroup.motion_group}`,\n err,\n )\n return null\n }\n })()\n\n // Open the websocket to monitor controller state for e.g. e-stop\n const controllerStateSocket = nova.openReconnectingWebsocket(\n `/controllers/${controller.controller}/state-stream?response_rate=1000`,\n )\n\n // Wait for the first message to get the initial state\n const firstControllerMessage = await controllerStateSocket.firstMessage()\n const initialControllerState = tryParseJson(firstControllerMessage.data)\n ?.result as RobotControllerState\n\n if (!initialControllerState) {\n throw new Error(\n `Unable to parse initial controller state message ${firstControllerMessage.data}`,\n )\n }\n\n console.log(\n `Connected controller state websocket to controller ${controller.controller}. Initial state:\\n `,\n initialControllerState,\n )\n\n // Find out what TCPs this motion group has (we need it for jogging)\n const { tcps } = await nova.api.motionGroupInfos.listTcps(motionGroupId)\n\n const motionGroupSpecification =\n await nova.api.motionGroupInfos.getMotionGroupSpecification(motionGroupId)\n\n const safetySetup =\n await nova.api.motionGroupInfos.getSafetySetup(motionGroupId)\n\n return new ConnectedMotionGroup(\n nova,\n controller,\n motionGroup,\n initialMotionState,\n motionStateSocket,\n isVirtual,\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n tcps!,\n motionGroupSpecification,\n safetySetup,\n mounting,\n initialControllerState,\n controllerStateSocket,\n )\n }\n\n connectedJoggingCartesianSocket: WebSocket | null = null\n connectedJoggingJointsSocket: WebSocket | null = null\n // biome-ignore lint/suspicious/noExplicitAny: legacy code\n planData: any | null // tmp\n joggingVelocity: number = 10\n\n // Not mobx-observable as this changes very fast; should be observed\n // using animation frames\n rapidlyChangingMotionState: MotionGroupStateResponse\n\n // Response rate on the websocket should be a bit slower on this one since\n // we don't use the motion data\n controllerState: RobotControllerState\n\n /**\n * Reflects activation state of the motion group / robot servos. The\n * movement controls in the UI should only be enabled in the \"active\" state\n */\n activationState: \"inactive\" | \"activating\" | \"deactivating\" | \"active\" =\n \"inactive\"\n\n constructor(\n readonly nova: NovaClient,\n readonly controller: ControllerInstance,\n readonly motionGroup: MotionGroupPhysical,\n readonly initialMotionState: MotionGroupStateResponse,\n readonly motionStateSocket: AutoReconnectingWebsocket,\n readonly isVirtual: boolean,\n readonly tcps: RobotTcp[],\n readonly motionGroupSpecification: MotionGroupSpecification,\n readonly safetySetup: SafetySetup,\n readonly mounting: Mounting | null,\n readonly initialControllerState: RobotControllerState,\n readonly controllerStateSocket: AutoReconnectingWebsocket,\n ) {\n this.rapidlyChangingMotionState = initialMotionState\n this.controllerState = initialControllerState\n\n // Track controller state updates (e.g. safety state and operation mode)\n controllerStateSocket.addEventListener(\"message\", (event) => {\n const data = tryParseJson(event.data)?.result\n\n if (!data) {\n return\n }\n\n runInAction(() => {\n this.controllerState = data\n })\n })\n\n motionStateSocket.addEventListener(\"message\", (event) => {\n const motionStateResponse = tryParseJson(event.data)?.result as\n | MotionGroupStateResponse\n | undefined\n\n if (!motionStateResponse) {\n throw new Error(\n `Failed to get motion state for ${this.motionGroupId}: ${event.data}`,\n )\n }\n\n // handle motionState message\n if (\n !jointValuesEqual(\n this.rapidlyChangingMotionState.state.joint_position.joints,\n motionStateResponse.state.joint_position.joints,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n this.rapidlyChangingMotionState.state = motionStateResponse.state\n })\n }\n\n // handle tcpPose message\n if (\n !tcpPoseEqual(\n this.rapidlyChangingMotionState.tcp_pose,\n motionStateResponse.tcp_pose,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n this.rapidlyChangingMotionState.tcp_pose =\n motionStateResponse.tcp_pose\n })\n }\n })\n makeAutoObservable(this)\n }\n\n get motionGroupId() {\n return this.motionGroup.motion_group\n }\n\n get controllerId() {\n return this.controller.controller\n }\n\n get modelFromController() {\n return this.motionGroup.model_from_controller\n }\n\n get wandelscriptIdentifier() {\n const num = this.motionGroupId.split(\"@\")[0]\n return `${this.controllerId.replaceAll(\"-\", \"_\")}_${num}`\n }\n\n /** Jogging velocity in radians for rotation and joint movement */\n get joggingVelocityRads() {\n return (this.joggingVelocity * Math.PI) / 180\n }\n\n get joints() {\n return this.initialMotionState.state.joint_position.joints.map((_, i) => {\n return {\n index: i,\n }\n })\n }\n\n get dhParameters() {\n return this.motionGroupSpecification.dh_parameters\n }\n\n get safetyZones() {\n return this.safetySetup.safety_zones\n }\n\n /** Gets the robot mounting position offset in 3D viz coordinates */\n get mountingPosition(): [number, number, number] {\n if (!this.mounting) {\n return [0, 0, 0]\n }\n\n return [\n this.mounting.pose.position.x / 1000,\n this.mounting.pose.position.y / 1000,\n this.mounting.pose.position.z / 1000,\n ]\n }\n\n /** Gets the robot mounting position rotation in 3D viz coordinates */\n get mountingQuaternion() {\n const rotationVector = new THREE.Vector3(\n this.mounting?.pose.orientation?.x || 0,\n this.mounting?.pose.orientation?.y || 0,\n this.mounting?.pose.orientation?.z || 0,\n )\n\n const magnitude = rotationVector.length()\n const axis = rotationVector.normalize()\n\n return new THREE.Quaternion().setFromAxisAngle(axis, magnitude)\n }\n\n /**\n * Whether the controller is currently in a safety state\n * corresponding to an emergency stop\n */\n get isEstopActive() {\n const estopStates: RobotControllerStateSafetyStateEnum[] = [\n \"SAFETY_STATE_ROBOT_EMERGENCY_STOP\",\n \"SAFETY_STATE_DEVICE_EMERGENCY_STOP\",\n ]\n\n return estopStates.includes(this.controllerState.safety_state)\n }\n\n /**\n * Whether the controller is in a safety state\n * that may be non-functional for robot pad purposes\n */\n get isMoveableSafetyState() {\n const goodSafetyStates: RobotControllerStateSafetyStateEnum[] = [\n \"SAFETY_STATE_NORMAL\",\n \"SAFETY_STATE_REDUCED\",\n ]\n\n return goodSafetyStates.includes(this.controllerState.safety_state)\n }\n\n /**\n * Whether the controller is in an operation mode that allows movement\n */\n get isMoveableOperationMode() {\n const goodOperationModes: RobotControllerStateOperationModeEnum[] = [\n \"OPERATION_MODE_AUTO\",\n \"OPERATION_MODE_MANUAL\",\n \"OPERATION_MODE_MANUAL_T1\",\n \"OPERATION_MODE_MANUAL_T2\",\n ]\n\n return goodOperationModes.includes(this.controllerState.operation_mode)\n }\n\n /**\n * Whether the robot is currently active and can be moved, based on the\n * safety state, operation mode and servo toggle activation state.\n */\n get canBeMoved() {\n return (\n this.isMoveableSafetyState &&\n this.isMoveableOperationMode &&\n this.activationState === \"active\"\n )\n }\n\n async deactivate() {\n if (this.activationState !== \"active\") {\n console.error(\"Tried to deactivate while already deactivating\")\n return\n }\n\n runInAction(() => {\n this.activationState = \"deactivating\"\n })\n\n try {\n await this.nova.api.controller.setDefaultMode(\n this.controllerId,\n \"MODE_MONITOR\",\n )\n\n runInAction(() => {\n this.activationState = \"inactive\"\n })\n } catch (err) {\n runInAction(() => {\n this.activationState = \"active\"\n })\n throw err\n }\n }\n\n async activate() {\n if (this.activationState !== \"inactive\") {\n console.error(\"Tried to activate while already activating\")\n return\n }\n\n runInAction(() => {\n this.activationState = \"activating\"\n })\n\n try {\n await this.nova.api.controller.setDefaultMode(\n this.controllerId,\n \"MODE_CONTROL\",\n )\n\n runInAction(() => {\n this.activationState = \"active\"\n })\n } catch (err) {\n runInAction(() => {\n this.activationState = \"inactive\"\n })\n throw err\n }\n }\n\n toggleActivation() {\n if (this.activationState === \"inactive\") {\n this.activate()\n } else if (this.activationState === \"active\") {\n this.deactivate()\n }\n }\n\n dispose() {\n this.motionStateSocket.close()\n if (this.connectedJoggingCartesianSocket)\n this.connectedJoggingCartesianSocket.close()\n if (this.connectedJoggingJointsSocket)\n this.connectedJoggingJointsSocket.close()\n }\n\n setJoggingVelocity(velocity: number) {\n this.joggingVelocity = velocity\n }\n}\n","import type { Command, Joints, TcpPose } from \"@wandelbots/nova-api/v1\"\nimport { Vector3 } from \"three/src/math/Vector3.js\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { isSameCoordinateSystem, tryParseJson } from \"../../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type JoggerConnectionOpts = {\n /**\n * When an error message is received from the jogging websocket, it\n * will be passed here. If this handler is not provided, the error will\n * instead be thrown as an unhandled error.\n */\n onError?: (err: unknown) => void\n}\n\nexport class JoggerConnection {\n // Currently a separate websocket is needed for each mode, pester API people\n // to merge these for simplicity\n cartesianWebsocket: AutoReconnectingWebsocket | null = null\n jointWebsocket: AutoReconnectingWebsocket | null = null\n cartesianJoggingOpts: {\n tcpId?: string\n coordSystemId?: string\n } = {}\n\n static async open(\n nova: NovaClient,\n motionGroupId: string,\n opts: JoggerConnectionOpts = {},\n ) {\n const motionStream = await nova.connectMotionStream(motionGroupId)\n\n return new JoggerConnection(motionStream, opts)\n }\n\n constructor(\n readonly motionStream: MotionStreamConnection,\n readonly opts: JoggerConnectionOpts = {},\n ) {}\n\n get motionGroupId() {\n return this.motionStream.motionGroupId\n }\n\n get nova() {\n return this.motionStream.nova\n }\n\n get numJoints() {\n return this.motionStream.joints.length\n }\n\n get activeJoggingMode() {\n if (this.cartesianWebsocket) return \"cartesian\"\n if (this.jointWebsocket) return \"joint\"\n return \"increment\"\n }\n\n get activeWebsocket() {\n return this.cartesianWebsocket || this.jointWebsocket\n }\n\n async stop() {\n // Why not call the stopJogging API endpoint?\n // Because this results in the websocket closing and we\n // would like to keep it open for now.\n\n if (this.cartesianWebsocket) {\n this.cartesianWebsocket.sendJson({\n motion_group: this.motionGroupId,\n position_direction: { x: 0, y: 0, z: 0 },\n rotation_direction: { x: 0, y: 0, z: 0 },\n position_velocity: 0,\n rotation_velocity: 0,\n tcp: this.cartesianJoggingOpts.tcpId,\n coordinate_system: this.cartesianJoggingOpts.coordSystemId,\n })\n }\n\n if (this.jointWebsocket) {\n this.jointWebsocket.sendJson({\n motion_group: this.motionGroupId,\n joint_velocities: new Array(this.numJoints).fill(0),\n })\n }\n }\n\n dispose() {\n if (this.cartesianWebsocket) {\n this.cartesianWebsocket.dispose()\n }\n\n if (this.jointWebsocket) {\n this.jointWebsocket.dispose()\n }\n }\n\n setJoggingMode(\n mode: \"cartesian\" | \"joint\" | \"increment\",\n cartesianJoggingOpts?: {\n tcpId?: string\n coordSystemId?: string\n },\n ) {\n console.log(\"Setting jogging mode to\", mode)\n if (cartesianJoggingOpts) {\n // Websocket needs to be reopened to change options\n if (\n JSON.stringify(this.cartesianJoggingOpts) !==\n JSON.stringify(cartesianJoggingOpts)\n ) {\n if (this.cartesianWebsocket) {\n this.cartesianWebsocket.dispose()\n this.cartesianWebsocket = null\n }\n }\n\n this.cartesianJoggingOpts = cartesianJoggingOpts\n }\n\n if (mode !== \"cartesian\" && this.cartesianWebsocket) {\n this.cartesianWebsocket.dispose()\n this.cartesianWebsocket = null\n }\n\n if (mode !== \"joint\" && this.jointWebsocket) {\n this.jointWebsocket.dispose()\n this.jointWebsocket = null\n }\n\n if (mode === \"cartesian\" && !this.cartesianWebsocket) {\n this.cartesianWebsocket = this.nova.openReconnectingWebsocket(\n `/motion-groups/move-tcp`,\n )\n\n this.cartesianWebsocket.addEventListener(\n \"message\",\n (ev: MessageEvent) => {\n const data = tryParseJson(ev.data)\n if (data && \"error\" in data) {\n if (this.opts.onError) {\n this.opts.onError(ev.data)\n } else {\n throw new Error(ev.data)\n }\n }\n },\n )\n }\n\n if (mode === \"joint\" && !this.jointWebsocket) {\n this.jointWebsocket = this.nova.openReconnectingWebsocket(\n `/motion-groups/move-joint`,\n )\n\n this.jointWebsocket.addEventListener(\"message\", (ev: MessageEvent) => {\n const data = tryParseJson(ev.data)\n if (data && \"error\" in data) {\n if (this.opts.onError) {\n this.opts.onError(ev.data)\n } else {\n throw new Error(ev.data)\n }\n }\n })\n }\n }\n\n /**\n * Start rotation of a single robot joint at the specified velocity\n */\n async startJointRotation({\n joint,\n direction,\n velocityRadsPerSec,\n }: {\n /** Index of the joint to rotate */\n joint: number\n /** Direction of rotation (\"+\" or \"-\") */\n direction: \"+\" | \"-\"\n /** Speed of the rotation in radians per second */\n velocityRadsPerSec: number\n }) {\n if (!this.jointWebsocket) {\n throw new Error(\n \"Joint jogging websocket not connected; call setJoggingMode first\",\n )\n }\n\n const jointVelocities = new Array(this.numJoints).fill(0)\n\n jointVelocities[joint] =\n direction === \"-\" ? -velocityRadsPerSec : velocityRadsPerSec\n\n this.jointWebsocket.sendJson({\n motion_group: this.motionGroupId,\n joint_velocities: jointVelocities,\n })\n }\n\n /**\n * Start the TCP moving along a specified axis at a given velocity\n */\n async startTCPTranslation({\n axis,\n direction,\n velocityMmPerSec,\n }: {\n axis: \"x\" | \"y\" | \"z\"\n direction: \"-\" | \"+\"\n velocityMmPerSec: number\n }) {\n if (!this.cartesianWebsocket) {\n throw new Error(\n \"Cartesian jogging websocket not connected; call setJoggingMode first\",\n )\n }\n\n const zeroVector = { x: 0, y: 0, z: 0 }\n const joggingVector = Object.assign({}, zeroVector)\n joggingVector[axis] = direction === \"-\" ? -1 : 1\n\n this.cartesianWebsocket.sendJson({\n motion_group: this.motionGroupId,\n position_direction: joggingVector,\n rotation_direction: zeroVector,\n position_velocity: velocityMmPerSec,\n rotation_velocity: 0,\n tcp: this.cartesianJoggingOpts.tcpId,\n coordinate_system: this.cartesianJoggingOpts.coordSystemId,\n })\n }\n\n /**\n * Start the TCP rotating around a specified axis at a given velocity\n */\n async startTCPRotation({\n axis,\n direction,\n velocityRadsPerSec,\n }: {\n axis: \"x\" | \"y\" | \"z\"\n direction: \"-\" | \"+\"\n velocityRadsPerSec: number\n }) {\n if (!this.cartesianWebsocket) {\n throw new Error(\n \"Cartesian jogging websocket not connected; call setJoggingMode first\",\n )\n }\n\n const zeroVector = { x: 0, y: 0, z: 0 }\n const joggingVector = Object.assign({}, zeroVector)\n joggingVector[axis] = direction === \"-\" ? -1 : 1\n\n this.cartesianWebsocket.sendJson({\n motion_group: this.motionGroupId,\n position_direction: zeroVector,\n rotation_direction: joggingVector,\n position_velocity: 0,\n rotation_velocity: velocityRadsPerSec,\n tcp: this.cartesianJoggingOpts.tcpId,\n coordinate_system: this.cartesianJoggingOpts.coordSystemId,\n })\n }\n\n /**\n * Move the robot by a fixed distance in a single cartesian\n * axis, either rotating or translating relative to the TCP.\n * Promise resolves only after the motion has completed.\n */\n async runIncrementalCartesianMotion({\n currentTcpPose,\n currentJoints,\n coordSystemId,\n velocityInRelevantUnits,\n axis,\n direction,\n motion,\n }: {\n currentTcpPose: TcpPose\n currentJoints: Joints\n coordSystemId: string\n velocityInRelevantUnits: number\n axis: \"x\" | \"y\" | \"z\"\n direction: \"-\" | \"+\"\n motion:\n | {\n type: \"rotate\"\n distanceRads: number\n }\n | {\n type: \"translate\"\n distanceMm: number\n }\n }) {\n const commands: Command[] = []\n\n if (\n !isSameCoordinateSystem(currentTcpPose.coordinate_system, coordSystemId)\n ) {\n throw new Error(\n `Current TCP pose coordinate system ${currentTcpPose.coordinate_system} does not match target coordinate system ${coordSystemId}`,\n )\n }\n\n if (motion.type === \"translate\") {\n const targetTcpPosition = Object.assign({}, currentTcpPose.position)\n targetTcpPosition[axis] +=\n motion.distanceMm * (direction === \"-\" ? -1 : 1)\n\n commands.push({\n settings: {\n limits_override: {\n tcp_velocity_limit: velocityInRelevantUnits,\n },\n },\n line: {\n position: targetTcpPosition,\n orientation: currentTcpPose.orientation,\n coordinate_system: coordSystemId,\n },\n })\n } else if (motion.type === \"rotate\") {\n // Concatenate rotations expressed by rotation vectors\n // Equations taken from https://physics.stackexchange.com/a/287819\n\n // Compute axis and angle of current rotation vector\n const currentRotationVector = new Vector3(\n currentTcpPose.orientation.x,\n currentTcpPose.orientation.y,\n currentTcpPose.orientation.z,\n )\n\n const currentRotationRad = currentRotationVector.length()\n const currentRotationDirection = currentRotationVector.clone().normalize()\n\n // Compute axis and angle of difference rotation vector\n const differenceRotationRad =\n motion.distanceRads * (direction === \"-\" ? -1 : 1)\n\n const differenceRotationDirection = new Vector3(0.0, 0.0, 0.0)\n differenceRotationDirection[axis] = 1.0\n\n // Some abbreviations to make the following equations more readable\n const f1 =\n Math.cos(0.5 * differenceRotationRad) *\n Math.cos(0.5 * currentRotationRad)\n const f2 =\n Math.sin(0.5 * differenceRotationRad) *\n Math.sin(0.5 * currentRotationRad)\n const f3 =\n Math.sin(0.5 * differenceRotationRad) *\n Math.cos(0.5 * currentRotationRad)\n const f4 =\n Math.cos(0.5 * differenceRotationRad) *\n Math.sin(0.5 * currentRotationRad)\n\n const dotProduct = differenceRotationDirection.dot(\n currentRotationDirection,\n )\n\n const crossProduct = differenceRotationDirection\n .clone()\n .cross(currentRotationDirection)\n\n // Compute angle of concatenated rotation\n const newRotationRad = 2.0 * Math.acos(f1 - f2 * dotProduct)\n\n // Compute rotation vector of concatenated rotation\n const f5 = newRotationRad / Math.sin(0.5 * newRotationRad)\n\n const targetTcpOrientation = new Vector3()\n .addScaledVector(crossProduct, f2)\n .addScaledVector(differenceRotationDirection, f3)\n .addScaledVector(currentRotationDirection, f4)\n .multiplyScalar(f5)\n\n commands.push({\n settings: {\n limits_override: {\n tcp_orientation_velocity_limit: velocityInRelevantUnits,\n },\n },\n line: {\n position: currentTcpPose.position,\n orientation: targetTcpOrientation,\n coordinate_system: coordSystemId,\n },\n })\n }\n\n const motionPlanRes = await this.nova.api.motion.planMotion({\n motion_group: this.motionGroupId,\n start_joint_position: currentJoints,\n tcp: this.cartesianJoggingOpts.tcpId,\n commands,\n })\n\n const plannedMotion = motionPlanRes.plan_successful_response?.motion\n if (!plannedMotion) {\n throw new Error(\n `Failed to plan jogging increment motion ${JSON.stringify(motionPlanRes)}`,\n )\n }\n\n await this.nova.api.motion.streamMoveForward(\n plannedMotion,\n 100,\n undefined,\n undefined,\n undefined,\n {\n // Might take a while at low velocity\n timeout: 1000 * 60,\n },\n )\n }\n\n /**\n * Rotate a single robot joint by a fixed number of radians\n * Promise resolves only after the motion has completed.\n */\n async runIncrementalJointRotation({\n joint,\n currentJoints,\n velocityRadsPerSec,\n direction,\n distanceRads,\n }: {\n joint: number\n currentJoints: Joints\n velocityRadsPerSec: number\n direction: \"-\" | \"+\"\n distanceRads: number\n }) {\n const targetJoints = [...currentJoints.joints]\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n targetJoints[joint]! += distanceRads * (direction === \"-\" ? -1 : 1)\n\n const jointVelocityLimits: number[] = new Array(\n currentJoints.joints.length,\n ).fill(velocityRadsPerSec)\n\n const motionPlanRes = await this.nova.api.motion.planMotion({\n motion_group: this.motionGroupId,\n start_joint_position: currentJoints,\n commands: [\n {\n settings: {\n limits_override: {\n joint_velocity_limits: {\n joints: jointVelocityLimits,\n },\n },\n },\n joint_ptp: {\n joints: targetJoints,\n },\n },\n ],\n })\n\n const plannedMotion = motionPlanRes.plan_successful_response?.motion\n if (!plannedMotion) {\n console.error(\"Failed to plan jogging increment motion\", motionPlanRes)\n return\n }\n\n await this.nova.api.motion.streamMoveForward(\n plannedMotion,\n 100,\n undefined,\n undefined,\n undefined,\n {\n // Might take a while at low velocity\n timeout: 1000 * 60,\n },\n )\n }\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\nimport type {\n ControllerInstance,\n MotionGroupPhysical,\n MotionGroupStateResponse,\n Vector3d,\n} from \"@wandelbots/nova-api/v1\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport { Vector3 } from \"three\"\nimport type { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../../converters\"\nimport { jointValuesEqual, tcpPoseEqual } from \"./motionStateUpdate\"\nimport type { NovaClient } from \"./NovaClient\"\n\nconst MOTION_DELTA_THRESHOLD = 0.0001\n\nfunction unwrapRotationVector(\n newRotationVectorApi: Vector3d,\n currentRotationVectorApi: Vector3d,\n): Vector3d {\n const currentRotationVector = new Vector3(\n currentRotationVectorApi.x,\n currentRotationVectorApi.y,\n currentRotationVectorApi.z,\n )\n\n const newRotationVector = new Vector3(\n newRotationVectorApi.x,\n newRotationVectorApi.y,\n newRotationVectorApi.z,\n )\n\n const currentAngle = currentRotationVector.length()\n const currentAxis = currentRotationVector.normalize()\n\n let newAngle = newRotationVector.length()\n let newAxis = newRotationVector.normalize()\n\n // Align rotation axes\n if (newAxis.dot(currentAxis) < 0) {\n newAngle = -newAngle\n newAxis = newAxis.multiplyScalar(-1.0)\n }\n\n // Shift rotation angle close to previous one to extend domain of rotation angles beyond [0, pi]\n // - this simplifies interpolation and prevents abruptly changing signs of the rotation angles\n let angleDifference = newAngle - currentAngle\n angleDifference -=\n 2.0 * Math.PI * Math.floor((angleDifference + Math.PI) / (2.0 * Math.PI))\n\n newAngle = currentAngle + angleDifference\n\n return newAxis.multiplyScalar(newAngle)\n}\n\n/**\n * Store representing the current state of a connected motion group.\n */\nexport class MotionStreamConnection {\n static async open(nova: NovaClient, motionGroupId: string) {\n const { instances: controllers } =\n await nova.api.controller.listControllers()\n\n const [_motionGroupIndex, controllerId] = motionGroupId.split(\"@\") as [\n string,\n string,\n ]\n const controller = controllers.find((c) => c.controller === controllerId)\n const motionGroup = controller?.physical_motion_groups.find(\n (mg) => mg.motion_group === motionGroupId,\n )\n if (!controller || !motionGroup) {\n throw new Error(\n `Controller ${controllerId} or motion group ${motionGroupId} not found`,\n )\n }\n\n const motionStateSocket = nova.openReconnectingWebsocket(\n `/motion-groups/${motionGroupId}/state-stream`,\n )\n\n // Wait for the first message to get the initial state\n const firstMessage = await motionStateSocket.firstMessage()\n const initialMotionState = tryParseJson(firstMessage.data)\n ?.result as MotionGroupStateResponse\n\n if (!initialMotionState) {\n throw new Error(\n `Unable to parse initial motion state message ${firstMessage.data}`,\n )\n }\n\n console.log(\n `Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\\n `,\n initialMotionState,\n )\n\n return new MotionStreamConnection(\n nova,\n controller,\n motionGroup,\n initialMotionState,\n motionStateSocket,\n )\n }\n\n // Not mobx-observable as this changes very fast; should be observed\n // using animation frames\n rapidlyChangingMotionState: MotionGroupStateResponse\n\n constructor(\n readonly nova: NovaClient,\n readonly controller: ControllerInstance,\n readonly motionGroup: MotionGroupPhysical,\n readonly initialMotionState: MotionGroupStateResponse,\n readonly motionStateSocket: AutoReconnectingWebsocket,\n ) {\n this.rapidlyChangingMotionState = initialMotionState\n\n motionStateSocket.addEventListener(\"message\", (event) => {\n const motionStateResponse = tryParseJson(event.data)?.result as\n | MotionGroupStateResponse\n | undefined\n\n if (!motionStateResponse) {\n throw new Error(\n `Failed to get motion state for ${this.motionGroupId}: ${event.data}`,\n )\n }\n\n // handle motionState message\n if (\n !jointValuesEqual(\n this.rapidlyChangingMotionState.state.joint_position.joints,\n motionStateResponse.state.joint_position.joints,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n this.rapidlyChangingMotionState.state = motionStateResponse.state\n })\n }\n\n // handle tcpPose message\n if (\n !tcpPoseEqual(\n this.rapidlyChangingMotionState.tcp_pose,\n motionStateResponse.tcp_pose,\n MOTION_DELTA_THRESHOLD,\n )\n ) {\n runInAction(() => {\n if (this.rapidlyChangingMotionState.tcp_pose == null) {\n this.rapidlyChangingMotionState.tcp_pose =\n motionStateResponse.tcp_pose\n } else {\n this.rapidlyChangingMotionState.tcp_pose = {\n position: motionStateResponse.tcp_pose!.position,\n orientation: unwrapRotationVector(\n motionStateResponse.tcp_pose!.orientation,\n this.rapidlyChangingMotionState.tcp_pose!.orientation,\n ),\n tcp: motionStateResponse.tcp_pose!.tcp,\n coordinate_system:\n motionStateResponse.tcp_pose!.coordinate_system,\n }\n }\n })\n }\n })\n makeAutoObservable(this)\n }\n\n get motionGroupId() {\n return this.motionGroup.motion_group\n }\n\n get controllerId() {\n return this.controller.controller\n }\n\n get modelFromController() {\n return this.motionGroup.model_from_controller\n }\n\n get wandelscriptIdentifier() {\n const num = this.motionGroupId.split(\"@\")[0]\n return `${this.controllerId.replaceAll(\"-\", \"_\")}_${num}`\n }\n\n get joints() {\n return this.initialMotionState.state.joint_position.joints.map((_, i) => {\n return {\n index: i,\n }\n })\n }\n\n dispose() {\n this.motionStateSocket.close()\n }\n}\n","/** biome-ignore-all lint/style/noNonNullAssertion: legacy code */\n/** biome-ignore-all lint/suspicious/noExplicitAny: legacy code */\nimport type {\n BaseAPI,\n Configuration as BaseConfiguration,\n} from \"@wandelbots/nova-api/v1\"\nimport {\n ApplicationApi,\n CellApi,\n ControllerApi,\n ControllerIOsApi,\n CoordinateSystemsApi,\n DeviceConfigurationApi,\n LibraryProgramApi,\n LibraryProgramMetadataApi,\n LibraryRecipeApi,\n LibraryRecipeMetadataApi,\n MotionApi,\n MotionGroupApi,\n MotionGroupInfosApi,\n MotionGroupJoggingApi,\n MotionGroupKinematicApi,\n ProgramApi,\n ProgramValuesApi,\n StoreCollisionComponentsApi,\n StoreCollisionScenesApi,\n StoreObjectApi,\n SystemApi,\n VirtualRobotApi,\n VirtualRobotBehaviorApi,\n VirtualRobotModeApi,\n VirtualRobotSetupApi,\n} from \"@wandelbots/nova-api/v1\"\nimport type { AxiosInstance } from \"axios\"\nimport axios from \"axios\"\n\ntype OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R\n ? (...args: P) => R\n : never\n\ntype UnwrapAxiosResponseReturn<T> = T extends (...a: any) => any\n ? (\n ...a: Parameters<T>\n ) => Promise<Awaited<ReturnType<T>> extends { data: infer D } ? D : never>\n : never\n\nexport type WithCellId<T> = {\n [P in keyof T]: UnwrapAxiosResponseReturn<OmitFirstArg<T[P]>>\n}\n\nexport type WithUnwrappedAxiosResponse<T> = {\n [P in keyof T]: UnwrapAxiosResponseReturn<T[P]>\n}\n\n/**\n * API client providing type-safe access to all the Nova API REST endpoints\n * associated with a specific cell id.\n */\nexport class NovaCellAPIClient {\n constructor(\n readonly cellId: string,\n readonly opts: BaseConfiguration & {\n axiosInstance?: AxiosInstance\n mock?: boolean\n },\n ) {}\n\n /**\n * Some TypeScript sorcery which alters the API class methods so you don't\n * have to pass the cell id to every single one, and de-encapsulates the\n * response data\n */\n private withCellId<T extends BaseAPI>(\n ApiConstructor: new (\n config: BaseConfiguration,\n basePath: string,\n axios: AxiosInstance,\n ) => T,\n ) {\n const apiClient = new ApiConstructor(\n {\n ...this.opts,\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n },\n this.opts.basePath ?? \"\",\n this.opts.axiosInstance ?? axios.create(),\n ) as {\n [key: string | symbol]: any\n }\n\n for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient)!)) {\n if (key !== \"constructor\" && typeof apiClient[key] === \"function\") {\n const originalFunction = apiClient[key]\n apiClient[key] = (...args: any[]) => {\n return originalFunction\n .apply(apiClient, [this.cellId, ...args])\n .then((res: any) => res.data)\n }\n }\n }\n\n return apiClient as WithCellId<T>\n }\n\n /**\n * As withCellId, but only does the response unwrapping\n */\n private withUnwrappedResponsesOnly<T extends BaseAPI>(\n ApiConstructor: new (\n config: BaseConfiguration,\n basePath: string,\n axios: AxiosInstance,\n ) => T,\n ) {\n const apiClient = new ApiConstructor(\n {\n ...this.opts,\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n },\n this.opts.basePath ?? \"\",\n this.opts.axiosInstance ?? axios.create(),\n ) as {\n [key: string | symbol]: any\n }\n\n for (const key of Reflect.ownKeys(Reflect.getPrototypeOf(apiClient)!)) {\n if (key !== \"constructor\" && typeof apiClient[key] === \"function\") {\n const originalFunction = apiClient[key]\n apiClient[key] = (...args: any[]) => {\n return originalFunction\n .apply(apiClient, args)\n .then((res: any) => res.data)\n }\n }\n }\n\n return apiClient as WithUnwrappedAxiosResponse<T>\n }\n\n readonly system = this.withUnwrappedResponsesOnly(SystemApi)\n readonly cell = this.withUnwrappedResponsesOnly(CellApi)\n\n readonly deviceConfig = this.withCellId(DeviceConfigurationApi)\n\n readonly motionGroup = this.withCellId(MotionGroupApi)\n readonly motionGroupInfos = this.withCellId(MotionGroupInfosApi)\n\n readonly controller = this.withCellId(ControllerApi)\n\n readonly program = this.withCellId(ProgramApi)\n readonly programValues = this.withCellId(ProgramValuesApi)\n\n readonly controllerIOs = this.withCellId(ControllerIOsApi)\n\n readonly motionGroupKinematic = this.withCellId(MotionGroupKinematicApi)\n readonly motion = this.withCellId(MotionApi)\n\n readonly coordinateSystems = this.withCellId(CoordinateSystemsApi)\n\n readonly application = this.withCellId(ApplicationApi)\n readonly applicationGlobal = this.withUnwrappedResponsesOnly(ApplicationApi)\n\n readonly motionGroupJogging = this.withCellId(MotionGroupJoggingApi)\n\n readonly virtualRobot = this.withCellId(VirtualRobotApi)\n readonly virtualRobotSetup = this.withCellId(VirtualRobotSetupApi)\n readonly virtualRobotMode = this.withCellId(VirtualRobotModeApi)\n readonly virtualRobotBehavior = this.withCellId(VirtualRobotBehaviorApi)\n\n readonly libraryProgramMetadata = this.withCellId(LibraryProgramMetadataApi)\n readonly libraryProgram = this.withCellId(LibraryProgramApi)\n readonly libraryRecipeMetadata = this.withCellId(LibraryRecipeMetadataApi)\n readonly libraryRecipe = this.withCellId(LibraryRecipeApi)\n\n readonly storeObject = this.withCellId(StoreObjectApi)\n readonly storeCollisionComponents = this.withCellId(\n StoreCollisionComponentsApi,\n )\n readonly storeCollisionScenes = this.withCellId(StoreCollisionScenesApi)\n}\n","import type {\n ControllerInstanceList,\n MotionGroupSpecification,\n MotionGroupStateResponse,\n RobotController,\n SafetySetup,\n} from \"@wandelbots/nova-api/v1\"\nimport type { AxiosResponse, InternalAxiosRequestConfig } from \"axios\"\nimport { AxiosError } from \"axios\"\nimport * as pathToRegexp from \"path-to-regexp\"\nimport type { AutoReconnectingWebsocket } from \"../../../AutoReconnectingWebsocket\"\n\n/**\n * Ultra-simplified mock Nova server for testing stuff\n */\nexport class MockNovaInstance {\n readonly connections: AutoReconnectingWebsocket[] = []\n\n async handleAPIRequest(\n config: InternalAxiosRequestConfig,\n ): Promise<AxiosResponse> {\n const apiHandlers = [\n {\n method: \"GET\",\n path: \"/cells/:cellId/controllers\",\n handle() {\n return {\n instances: [\n {\n controller: \"mock-ur5e\",\n model_name: \"UniversalRobots::Controller\",\n host: \"mock-ur5e\",\n allow_software_install_on_controller: true,\n physical_motion_groups: [\n {\n motion_group: \"0@mock-ur5e\",\n name_from_controller: \"UR5e\",\n active: false,\n model_from_controller: \"UniversalRobots_UR5e\",\n },\n ],\n has_error: false,\n error_details: \"\",\n },\n ],\n } satisfies ControllerInstanceList\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/controllers/:controllerId\",\n handle() {\n return {\n configuration: {\n kind: \"VirtualController\",\n manufacturer: \"universalrobots\",\n position: \"[0,-1.571,-1.571,-1.571,1.571,-1.571,0]\",\n type: \"universalrobots-ur5e\",\n },\n name: \"mock-ur5\",\n } satisfies RobotController\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/motion-groups/:motionGroupId/specification\",\n handle() {\n return {\n dh_parameters: [\n {\n alpha: 1.5707963267948966,\n theta: 0,\n a: 0,\n d: 162.25,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0,\n theta: 0,\n a: -425,\n d: 0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0,\n theta: 0,\n a: -392.2,\n d: 0,\n reverse_rotation_direction: false,\n },\n {\n alpha: 1.5707963267948966,\n theta: 0,\n a: 0,\n d: 133.3,\n reverse_rotation_direction: false,\n },\n {\n alpha: -1.5707963267948966,\n theta: 0,\n a: 0,\n d: 99.7,\n reverse_rotation_direction: false,\n },\n {\n alpha: 0,\n theta: 0,\n a: 0,\n d: 99.6,\n reverse_rotation_direction: false,\n },\n ],\n mechanical_joint_limits: [\n {\n joint: \"JOINTNAME_AXIS_1\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_2\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_3\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_4\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_5\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_6\",\n lower_limit: -6.335545063018799,\n upper_limit: 6.335545063018799,\n unlimited: false,\n },\n ],\n } satisfies MotionGroupSpecification\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/motion-groups/:motionGroupId/safety-setup\",\n handle() {\n return {\n safety_settings: [\n {\n safety_state: \"SAFETY_NORMAL\",\n settings: {\n joint_position_limits: [\n {\n joint: \"JOINTNAME_AXIS_1\",\n lower_limit: -2.96705961227417,\n upper_limit: 2.96705961227417,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_2\",\n lower_limit: -1.7453292608261108,\n upper_limit: 2.7925267219543457,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_3\",\n lower_limit: -3.3161256313323975,\n upper_limit: 0.40142571926116943,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_4\",\n lower_limit: -3.4906585216522217,\n upper_limit: 3.4906585216522217,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_5\",\n lower_limit: -2.4434609413146973,\n upper_limit: 2.4434609413146973,\n unlimited: false,\n },\n {\n joint: \"JOINTNAME_AXIS_6\",\n lower_limit: -4.71238899230957,\n upper_limit: 4.71238899230957,\n unlimited: false,\n },\n ],\n joint_velocity_limits: [\n {\n joint: \"JOINTNAME_AXIS_1\",\n limit: 3.1415927410125732,\n },\n {\n joint: \"JOINTNAME_AXIS_2\",\n limit: 3.1415927410125732,\n },\n {\n joint: \"JOINTNAME_AXIS_3\",\n limit: 3.4906585216522217,\n },\n {\n joint: \"JOINTNAME_AXIS_4\",\n limit: 6.108652591705322,\n },\n {\n joint: \"JOINTNAME_AXIS_5\",\n limit: 6.108652591705322,\n },\n {\n joint: \"JOINTNAME_AXIS_6\",\n limit: 6.981317043304443,\n },\n ],\n joint_acceleration_limits: [],\n joint_torque_limits: [],\n tcp_velocity_limit: 1800,\n },\n },\n ],\n safety_zones: [\n {\n id: 1,\n priority: 0,\n geometry: {\n compound: {\n child_geometries: [\n {\n convex_hull: {\n vertices: [\n {\n x: -800,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: 1330,\n z: -1820,\n },\n {\n x: -800,\n y: 1330,\n z: -1820,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: -800,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: -1330,\n z: 1500,\n },\n {\n x: -800,\n y: -1330,\n z: 1500,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: -800,\n y: -1330,\n z: -1820,\n },\n {\n x: -800,\n y: 1330,\n z: -1820,\n },\n {\n x: -800,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: -1330,\n z: 1500,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: -1330,\n z: 1500,\n },\n {\n x: 1650,\n y: -1330,\n z: 1500,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: 1330,\n z: 1500,\n },\n {\n x: -800,\n y: 1330,\n z: -1820,\n },\n {\n x: 1650,\n y: 1330,\n z: -1820,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: 1500,\n },\n {\n x: 1650,\n y: -1330,\n z: 1500,\n },\n {\n x: 1650,\n y: -1330,\n z: -1820,\n },\n {\n x: 1650,\n y: 1330,\n z: -1820,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"box\",\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Cell workzone\",\n },\n motion_group_uid: 1,\n },\n {\n id: 2,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: -1850,\n },\n {\n x: 865,\n y: 1330,\n z: -1850,\n },\n {\n x: 865,\n y: -720,\n z: -1850,\n },\n {\n x: 1650,\n y: -720,\n z: -1850,\n },\n {\n x: 1650,\n y: 1330,\n z: -920,\n },\n {\n x: 865,\n y: 1330,\n z: -920,\n },\n {\n x: 865,\n y: -720,\n z: -920,\n },\n {\n x: 1650,\n y: -720,\n z: -920,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Transport\",\n },\n motion_group_uid: 1,\n },\n {\n id: 3,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: 1330,\n z: -600,\n },\n {\n x: 865,\n y: 1330,\n z: -600,\n },\n {\n x: 865,\n y: 430,\n z: -600,\n },\n {\n x: 1650,\n y: 430,\n z: -600,\n },\n {\n x: 1650,\n y: 1330,\n z: -1250,\n },\n {\n x: 865,\n y: 1330,\n z: -1250,\n },\n {\n x: 865,\n y: 430,\n z: -1250,\n },\n {\n x: 1650,\n y: 430,\n z: -1250,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Tunel\",\n },\n motion_group_uid: 1,\n },\n {\n id: 4,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: 1650,\n y: -760,\n z: -440,\n },\n {\n x: 900,\n y: -760,\n z: -440,\n },\n {\n x: 900,\n y: -1330,\n z: -440,\n },\n {\n x: 1650,\n y: -1330,\n z: -440,\n },\n {\n x: 1650,\n y: -760,\n z: -1800,\n },\n {\n x: 900,\n y: -760,\n z: -1800,\n },\n {\n x: 900,\n y: -1330,\n z: -1800,\n },\n {\n x: 1650,\n y: -1330,\n z: -1800,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Fanuc controller\",\n },\n motion_group_uid: 1,\n },\n {\n id: 6,\n priority: 0,\n geometry: {\n convex_hull: {\n vertices: [\n {\n x: -200,\n y: -200,\n z: -1900,\n },\n {\n x: 200,\n y: -200,\n z: -1900,\n },\n {\n x: 200,\n y: 200,\n z: -1900,\n },\n {\n x: -200,\n y: 200,\n z: -1900,\n },\n {\n x: -200,\n y: -200,\n z: -350,\n },\n {\n x: 200,\n y: -200,\n z: -350,\n },\n {\n x: 200,\n y: 200,\n z: -350,\n },\n {\n x: -200,\n y: 200,\n z: -350,\n },\n ],\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"Robot base\",\n },\n motion_group_uid: 1,\n },\n ],\n robot_model_geometries: [\n {\n link_index: 1,\n geometry: {\n sphere: {\n radius: 270,\n },\n init_pose: {\n position: {\n x: -70,\n y: -70,\n z: -50,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"link1_sphere\",\n },\n },\n {\n link_index: 2,\n geometry: {\n capsule: {\n radius: 160,\n cylinder_height: 800,\n },\n init_pose: {\n position: {\n x: -450,\n y: 40,\n z: 170,\n },\n orientation: {\n x: 0,\n y: -Math.SQRT1_2,\n z: 0,\n w: Math.SQRT1_2,\n },\n },\n id: \"link2_capsule\",\n },\n },\n {\n link_index: 3,\n geometry: {\n sphere: {\n radius: 270,\n },\n init_pose: {\n position: {\n x: -110,\n y: 10,\n z: -100,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"link3_sphere\",\n },\n },\n {\n link_index: 4,\n geometry: {\n capsule: {\n radius: 110,\n cylinder_height: 600,\n },\n init_pose: {\n position: {\n x: 0,\n y: 300,\n z: 40,\n },\n orientation: {\n x: -Math.SQRT1_2,\n y: 0,\n z: 0,\n w: Math.SQRT1_2,\n },\n },\n id: \"link4_capsule\",\n },\n },\n {\n link_index: 5,\n geometry: {\n sphere: {\n radius: 75,\n },\n init_pose: {\n position: {\n x: 0,\n y: 0,\n z: -50,\n },\n orientation: {\n x: 0,\n y: 0,\n z: 0,\n w: 1,\n },\n },\n id: \"link5_sphere\",\n },\n },\n ],\n tool_geometries: [],\n } satisfies SafetySetup\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/coordinate-systems\",\n handle() {\n return {\n coordinatesystems: [\n {\n coordinate_system: \"\",\n name: \"world\",\n reference_uid: \"\",\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n rotation: {\n angles: [0, 0, 0],\n type: \"ROTATION_VECTOR\",\n },\n },\n ],\n } //satisfies CoordinateSystems\n },\n },\n {\n method: \"GET\",\n path: \"/cells/:cellId/motion-groups/:motionGroupId/tcps\",\n handle() {\n return {\n tcps: [\n {\n id: \"Flange\",\n readable_name: \"Default-Flange\",\n position: {\n x: 0,\n y: 0,\n z: 0,\n },\n rotation: {\n angles: [0, 0, 0, 0],\n type: \"ROTATION_VECTOR\",\n },\n },\n {\n id: \"complex-tcp-position\",\n readable_name: \"Complex TCP Position\",\n position: {\n x: -200,\n y: 300,\n z: 150,\n },\n rotation: {\n angles: [\n -0.12139440409113832, -0.06356210998212003,\n -0.2023240068185639, 0,\n ],\n type: \"ROTATION_VECTOR\",\n },\n },\n ],\n }\n },\n },\n ]\n\n const method = config.method?.toUpperCase() || \"GET\"\n const path = `/cells${config.url?.split(\"/cells\")[1]?.split(\"?\")[0]}`\n\n for (const handler of apiHandlers) {\n const match = pathToRegexp.match(handler.path)(path || \"\")\n if (method === handler.method && match) {\n const json = handler.handle()\n return {\n status: 200,\n statusText: \"Success\",\n data: JSON.stringify(json),\n headers: {},\n config,\n request: {\n responseURL: config.url,\n },\n }\n }\n }\n\n throw new AxiosError(\n `No mock handler matched this request: ${method} ${path}`,\n \"404\",\n config,\n )\n\n // return {\n // status: 404,\n // statusText: \"Not Found\",\n // data: \"\",\n // headers: {},\n // config,\n // request: {\n // responseURL: config.url,\n // },\n // }\n }\n\n handleWebsocketConnection(socket: AutoReconnectingWebsocket) {\n this.connections.push(socket)\n\n setTimeout(() => {\n socket.dispatchEvent(new Event(\"open\"))\n\n console.log(\"Websocket connection opened from\", socket.url)\n\n if (socket.url.includes(\"/state-stream\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify(defaultMotionState),\n }),\n )\n }\n\n if (socket.url.includes(\"/move-joint\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n motion_group: \"0@ur\",\n state: {\n controller: \"ur\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n timestamp: \"2024-09-18T12:48:26.096266444Z\",\n velocity_override: 100,\n motion_groups: [\n {\n motion_group: \"0@ur\",\n controller: \"ur\",\n joint_position: {\n joints: [\n 1.3492152690887451, -1.5659207105636597,\n 1.6653711795806885, -1.0991662740707397,\n -1.829018235206604, 1.264623761177063,\n ],\n },\n joint_velocity: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n flange_pose: {\n position: {\n x: 6.437331889439328,\n y: -628.4123774830913,\n z: 577.0569957147832,\n },\n orientation: {\n x: -1.683333649797158,\n y: -1.9783363827298732,\n z: -0.4928031860165713,\n },\n coordinate_system: \"\",\n },\n tcp_pose: {\n position: {\n x: 6.437331889439328,\n y: -628.4123774830913,\n z: 577.0569957147832,\n },\n orientation: {\n x: -1.683333649797158,\n y: -1.9783363827298732,\n z: -0.4928031860165713,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n velocity: {\n linear: {\n x: 0,\n y: 0,\n z: 0,\n },\n angular: {\n x: -0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n force: {\n force: {\n x: 0,\n y: 0,\n z: 0,\n },\n moment: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n joint_limit_reached: {\n limit_reached: [\n false,\n false,\n false,\n false,\n false,\n false,\n ],\n },\n joint_current: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n sequence_number: \"671259\",\n },\n ],\n sequence_number: \"671259\",\n },\n movement_state: \"MOVEMENT_STATE_MOVING\",\n },\n }),\n }),\n )\n }\n\n if (socket.url.includes(\"/move-tcp\")) {\n socket.dispatchEvent(\n new MessageEvent(\"message\", {\n data: JSON.stringify({\n result: {\n motion_group: \"0@ur\",\n state: {\n controller: \"ur\",\n operation_mode: \"OPERATION_MODE_AUTO\",\n safety_state: \"SAFETY_STATE_NORMAL\",\n timestamp: \"2024-09-18T12:43:12.188335774Z\",\n velocity_override: 100,\n motion_groups: [\n {\n motion_group: \"0@ur\",\n controller: \"ur\",\n joint_position: {\n joints: [\n 1.3352527618408203, -1.5659207105636597,\n 1.6653711795806885, -1.110615611076355,\n -1.829018235206604, 1.264623761177063,\n ],\n },\n joint_velocity: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n flange_pose: {\n position: {\n x: -2.763015284002938,\n y: -630.2151479701106,\n z: 577.524509114342,\n },\n orientation: {\n x: -1.704794877102097,\n y: -1.9722372952861567,\n z: -0.4852079204210754,\n },\n coordinate_system: \"\",\n },\n tcp_pose: {\n position: {\n x: -2.763015284002938,\n y: -630.2151479701106,\n z: 577.524509114342,\n },\n orientation: {\n x: -1.704794877102097,\n y: -1.9722372952861567,\n z: -0.4852079204210754,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n velocity: {\n linear: {\n x: 0,\n y: 0,\n z: 0,\n },\n angular: {\n x: -0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n force: {\n force: {\n x: 0,\n y: 0,\n z: 0,\n },\n moment: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n joint_limit_reached: {\n limit_reached: [\n false,\n false,\n false,\n false,\n false,\n false,\n ],\n },\n joint_current: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n sequence_number: \"627897\",\n },\n ],\n sequence_number: \"627897\",\n },\n movement_state: \"MOVEMENT_STATE_MOVING\",\n },\n }),\n }),\n )\n }\n }, 10)\n }\n\n handleWebsocketMessage(socket: AutoReconnectingWebsocket, message: string) {\n console.log(`Received message on ${socket.url}`, message)\n }\n}\n\nconst defaultMotionState = {\n result: {\n state: {\n motion_group: \"0@universalrobots-ur5e\",\n controller: \"universalrobots-ur5e\",\n joint_position: {\n joints: [\n 1.1699999570846558, -1.5700000524520874, 1.3600000143051147,\n 1.0299999713897705, 1.2899999618530273, 1.2799999713897705,\n ],\n },\n joint_velocity: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n flange_pose: {\n position: {\n x: 1.3300010259703043,\n y: -409.2680714682808,\n z: 531.0203477065281,\n },\n orientation: {\n x: 1.7564919306270736,\n y: -1.7542521568325058,\n z: 0.7326972590614671,\n },\n coordinate_system: \"\",\n },\n tcp_pose: {\n position: {\n x: 1.3300010259703043,\n y: -409.2680714682808,\n z: 531.0203477065281,\n },\n orientation: {\n x: 1.7564919306270736,\n y: -1.7542521568325058,\n z: 0.7326972590614671,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n velocity: {\n linear: {\n x: 0,\n y: 0,\n z: 0,\n },\n angular: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n force: {\n force: {\n x: 0,\n y: 0,\n z: 0,\n },\n moment: {\n x: 0,\n y: 0,\n z: 0,\n },\n coordinate_system: \"\",\n },\n joint_limit_reached: {\n limit_reached: [false, false, false, false, false, false],\n },\n joint_current: {\n joints: [0, 0, 0, 0, 0, 0],\n },\n sequence_number: \"1\",\n },\n tcp_pose: {\n position: {\n x: 302.90748476115556,\n y: -152.87065869452337,\n z: 424.0454619321661,\n },\n orientation: {\n x: 2.3403056115045353,\n y: -1.1706836379431356,\n z: 0.9772511964246311,\n },\n coordinate_system: \"\",\n tcp: \"Flange\",\n },\n } satisfies MotionGroupStateResponse,\n}\n","/**\n * @fileoverview\n * @deprecated The nova v1 client is deprecated. Please use the v2 client from `@wandelbots/nova-js/v2` instead.\n */\n\nimport type { Configuration as BaseConfiguration } from \"@wandelbots/nova-api/v1\"\nimport type { AxiosRequestConfig } from \"axios\"\nimport axios, { isAxiosError } from \"axios\"\nimport urlJoin from \"url-join\"\nimport { loginWithAuth0 } from \"../../../LoginWithAuth0.js\"\nimport { AutoReconnectingWebsocket } from \"../../AutoReconnectingWebsocket.js\"\nimport { availableStorage } from \"../../availableStorage.js\"\nimport { parseNovaInstanceUrl } from \"../../converters.js\"\nimport { ConnectedMotionGroup } from \"./ConnectedMotionGroup.js\"\nimport { JoggerConnection } from \"./JoggerConnection.js\"\nimport { MotionStreamConnection } from \"./MotionStreamConnection.js\"\nimport { NovaCellAPIClient } from \"./NovaCellAPIClient.js\"\nimport { MockNovaInstance } from \"./mock/MockNovaInstance.js\"\n\nexport type NovaClientConfig = {\n /**\n * Url of the deployed Nova instance to connect to\n * e.g. https://saeattii.instance.wandelbots.io\n */\n instanceUrl: string | \"https://mock.example.com\"\n\n /**\n * Identifier of the cell on the Nova instance to connect this client to.\n * If omitted, the default identifier \"cell\" is used.\n **/\n cellId?: string\n\n /**\n * Username for basic auth to the Nova instance.\n * @deprecated use accessToken instead\n */\n username?: string\n\n /**\n * Password for basic auth to the Nova instance.\n * @deprecated use accessToken instead\n */\n password?: string\n\n /**\n * Access token for Bearer authentication.\n */\n accessToken?: string\n} & Omit<BaseConfiguration, \"isJsonMime\" | \"basePath\">\n\ntype NovaClientConfigWithDefaults = NovaClientConfig & { cellId: string }\n\n/**\n * Client for connecting to a Nova instance and controlling robots.\n * @deprecated The nova v1 client is deprecated. Please use the v2 client from `@wandelbots/nova-js/v2` instead.\n */\nexport class NovaClient {\n readonly api: NovaCellAPIClient\n readonly config: NovaClientConfigWithDefaults\n readonly mock?: MockNovaInstance\n readonly instanceUrl: URL\n authPromise: Promise<string | null> | null = null\n accessToken: string | null = null\n\n constructor(config: NovaClientConfig) {\n const cellId = config.cellId ?? \"cell\"\n this.config = {\n cellId,\n ...config,\n }\n this.accessToken =\n config.accessToken ||\n availableStorage.getString(\"wbjs.access_token\") ||\n null\n\n if (this.config.instanceUrl === \"https://mock.example.com\") {\n this.mock = new MockNovaInstance()\n }\n this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl)\n\n // Set up Axios instance with interceptor for token fetching\n const axiosInstance = axios.create({\n baseURL: urlJoin(this.config.instanceUrl, \"/api/v1\"),\n // TODO - backend needs to set proper CORS headers for this\n headers:\n typeof window !== \"undefined\" &&\n window.location.origin.includes(\"localhost\")\n ? {}\n : {\n // Identify the client to the backend for logging purposes\n \"X-Wandelbots-Client\": \"Wandelbots-Nova-JS-SDK\",\n },\n })\n\n axiosInstance.interceptors.request.use(async (request) => {\n if (!request.headers.Authorization) {\n if (this.accessToken) {\n request.headers.Authorization = `Bearer ${this.accessToken}`\n } else if (this.config.username && this.config.password) {\n request.headers.Authorization = `Basic ${btoa(`${config.username}:${config.password}`)}`\n }\n }\n return request\n })\n\n if (typeof window !== \"undefined\") {\n axiosInstance.interceptors.response.use(\n (r) => r,\n async (error) => {\n if (isAxiosError(error)) {\n if (error.response?.status === 401) {\n // If we hit a 401, attempt to login the user and retry with\n // a new access token\n try {\n await this.renewAuthentication()\n\n if (error.config) {\n if (this.accessToken) {\n error.config.headers.Authorization = `Bearer ${this.accessToken}`\n } else {\n delete error.config.headers.Authorization\n }\n return axiosInstance.request(error.config)\n }\n } catch (err) {\n return Promise.reject(err)\n }\n } else if (error.response?.status === 503) {\n // Check if the server as a whole is down\n const res = await fetch(window.location.href)\n if (res.status === 503) {\n // Go to 503 page\n window.location.reload()\n }\n }\n }\n\n return Promise.reject(error)\n },\n )\n }\n\n this.api = new NovaCellAPIClient(cellId, {\n ...config,\n basePath: urlJoin(this.instanceUrl.href, \"/api/v1\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n return this.mock!.handleAPIRequest(config)\n },\n } satisfies AxiosRequestConfig)\n : {}),\n ...config.baseOptions,\n },\n axiosInstance,\n })\n }\n\n async renewAuthentication(): Promise<void> {\n if (this.authPromise) {\n // Don't double up\n return\n }\n\n const storedToken = availableStorage.getString(\"wbjs.access_token\")\n if (storedToken && this.accessToken !== storedToken) {\n // Might be newer than the one we have\n this.accessToken = storedToken\n return\n }\n\n // Otherwise, perform login flow\n this.authPromise = loginWithAuth0(this.instanceUrl)\n try {\n this.accessToken = await this.authPromise\n if (this.accessToken) {\n // Cache access token so we don't need to log in every refresh\n availableStorage.setString(\"wbjs.access_token\", this.accessToken)\n } else {\n availableStorage.delete(\"wbjs.access_token\")\n }\n } finally {\n this.authPromise = null\n }\n }\n\n makeWebsocketURL(path: string): string {\n const url = new URL(\n urlJoin(\n this.instanceUrl.href,\n `/api/v1/cells/${this.config.cellId}`,\n path,\n ),\n )\n url.protocol = url.protocol.replace(\"http\", \"ws\")\n url.protocol = url.protocol.replace(\"https\", \"wss\")\n\n // If provided, add basic auth credentials to the URL\n // NOTE - basic auth is deprecated on websockets and doesn't work in Safari\n // use tokens instead\n if (this.accessToken) {\n url.searchParams.append(\"token\", this.accessToken)\n } else if (this.config.username && this.config.password) {\n url.username = this.config.username\n url.password = this.config.password\n }\n\n return url.toString()\n }\n\n /**\n * Retrieve an AutoReconnectingWebsocket to the given path on the Nova instance.\n * If you explicitly want to reconnect an existing websocket, call `reconnect`\n * on the returned object.\n */\n openReconnectingWebsocket(path: string) {\n return new AutoReconnectingWebsocket(this.makeWebsocketURL(path), {\n mock: this.mock,\n })\n }\n\n /**\n * Connect to the motion state websocket(s) for a given motion group\n */\n async connectMotionStream(motionGroupId: string) {\n return await MotionStreamConnection.open(this, motionGroupId)\n }\n\n /**\n * Connect to the jogging websocket(s) for a given motion group\n */\n async connectJogger(motionGroupId: string) {\n return await JoggerConnection.open(this, motionGroupId)\n }\n\n async connectMotionGroups(\n motionGroupIds: string[],\n ): Promise<ConnectedMotionGroup[]> {\n const { instances } = await this.api.controller.listControllers()\n\n return Promise.all(\n motionGroupIds.map((motionGroupId) =>\n ConnectedMotionGroup.connect(this, motionGroupId, instances),\n ),\n )\n }\n\n async connectMotionGroup(\n motionGroupId: string,\n ): Promise<ConnectedMotionGroup> {\n const motionGroups = await this.connectMotionGroups([motionGroupId])\n // biome-ignore lint/style/noNonNullAssertion: legacy code\n return motionGroups[0]!\n }\n}\n","import type { Pose } from \"@wandelbots/nova-api/v1\"\n\n/**\n * Convert a Pose object representing a motion group position\n * into a string which represents that pose in Wandelscript.\n */\nexport function poseToWandelscriptString(\n pose: Pick<Pose, \"position\" | \"orientation\">,\n) {\n const position = [pose.position.x, pose.position.y, pose.position.z]\n const orientation = [\n pose.orientation?.x ?? 0,\n pose.orientation?.y ?? 0,\n pose.orientation?.z ?? 0,\n ]\n\n const positionValues = position.map((v) => v.toFixed(1))\n // Rotation needs more precision since it's in radians\n const rotationValues = orientation.map((v) => v.toFixed(4))\n\n return `(${positionValues.concat(rotationValues).join(\", \")})`\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,SAAgB,iBACd,gBACA,gBACA,sBACS;CACT,IAAI,eAAe,WAAW,eAAe,QAC3C,OAAO;CAGT,KAAK,IAAI,aAAa,GAAG,aAAa,eAAe,QAAQ,cAC3D,IAEE,KAAK,IAAI,eAAe,cAAe,eAAe,WAAY,IAClE,sBAEA,OAAO;CAIX,OAAO;AACT;AAEA,SAAgB,aACd,QACA,QACA,sBACS;CAET,IAAK,WAAW,KAAA,KAAa,UAAY,UAAU,WAAW,KAAA,GAC5D,OAAO;CAIT,IAAI,WAAW,KAAA,KAAa,WAAW,KAAA,GACrC,OAAO;CAGT,IAAI,eAAe;CACnB,gBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,CAAC;CACpE,gBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,CAAC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nC,OAAO,iBACJ,MAAM,WAAW,IAAI,EACrB,MAAM,QAAa,IAAI,IAAI;GAChC;EACF;EAGF,OAAO;CACT;AA0CF;;;;;;ACxKA,IAAa,mBAAb,MAA8B;;qBACwB,CAAC;;CAErD,MAAM,iBACJ,QACwB;EACxB,MAAM,cAAc;GAClB;IACE,QAAQ;IACR,MAAM;IACN,SAAS;KACP,OAAO,EACL,WAAW,CACT;MACE,YAAY;MACZ,YAAY;MACZ,MAAM;MACN,sCAAsC;MACtC,wBAAwB,CACtB;OACE,cAAc;OACd,sBAAsB;OACtB,QAAQ;OACR,uBAAuB;MACzB,CACF;MACA,WAAW;MACX,eAAe;KACjB,CACF,EACF;IACF;GACF;GACA;IACE,QAAQ;IACR,MAAM;IACN,SAAS;KACP,OAAO;MACL,eAAe;OACb,MAAM;OACN,cAAc;OACd,UAAU;OACV,MAAM;MACR;MACA,MAAM;KACR;IACF;GACF;GACA;IACE,QAAQ;IACR,MAAM;IACN,SAAS;KACP,OAAO;MACL,eAAe;OACb;QACE,OAAO;QACP,OAAO;QACP,GAAG;QACH,GAAG;QACH,4BAA4B;OAC9B;OACA;QACE,OAAO;QACP,OAAO;QACP,GAAG;QACH,GAAG;QACH,4BAA4B;OAC9B;OACA;QACE,OAAO;QACP,OAAO;QACP,GAAG;QACH,GAAG;QACH,4BAA4B;OAC9B;OACA;QACE,OAAO;QACP,OAAO;QACP,GAAG;QACH,GAAG;QACH,4BAA4B;OAC9B;OACA;QACE,OAAO;QACP,OAAO;QACP,GAAG;QACH,GAAG;QACH,4BAA4B;OAC9B;OACA;QACE,OAAO;QACP,OAAO;QACP,GAAG;QACH,GAAG;QACH,4BAA4B;OAC9B;MACF;MACA,yBAAyB;OACvB;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;OACb;OACA;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;OACb;OACA;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;OACb;OACA;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;OACb;OACA;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;OACb;OACA;QACE,OAAO;QACP,aAAa;QACb,aAAa;QACb,WAAW;OACb;MACF;KACF;IACF;GACF;GACA;IACE,QAAQ;IACR,MAAM;IACN,SAAS;KACP,OAAO;MACL,iBAAiB,CACf;OACE,cAAc;OACd,UAAU;QACR,uBAAuB;SACrB;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;SACb;SACA;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;SACb;SACA;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;SACb;SACA;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;SACb;SACA;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;SACb;SACA;UACE,OAAO;UACP,aAAa;UACb,aAAa;UACb,WAAW;SACb;QACF;QACA,uBAAuB;SACrB;UACE,OAAO;UACP,OAAO;SACT;SACA;UACE,OAAO;UACP,OAAO;SACT;SACA;UACE,OAAO;UACP,OAAO;SACT;SACA;UACE,OAAO;UACP,OAAO;SACT;SACA;UACE,OAAO;UACP,OAAO;SACT;SACA;UACE,OAAO;UACP,OAAO;SACT;QACF;QACA,2BAA2B,CAAC;QAC5B,qBAAqB,CAAC;QACtB,oBAAoB;OACtB;MACF,CACF;MACA,cAAc;OACZ;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,UAAU,EACR,kBAAkB;UAChB;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF,EACF;WACA,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF;WACA,IAAI;UACN;UACA;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF,EACF;WACA,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF;WACA,IAAI;UACN;UACA;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF,EACF;WACA,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF;WACA,IAAI;UACN;UACA;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF,EACF;WACA,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF;WACA,IAAI;UACN;UACA;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF,EACF;WACA,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF;WACA,IAAI;UACN;UACA;WACE,aAAa,EACX,UAAU;YACR;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA;aACE,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF,EACF;WACA,WAAW;YACT,UAAU;aACR,GAAG;aACH,GAAG;aACH,GAAG;YACL;YACA,aAAa;aACX,GAAG;aACH,GAAG;aACH,GAAG;aACH,GAAG;YACL;WACF;WACA,IAAI;UACN;SACF,EACF;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF;SACA,IAAI;QACN;QACA,kBAAkB;OACpB;OACA;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF,EACF;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF;SACA,IAAI;QACN;QACA,kBAAkB;OACpB;OACA;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF,EACF;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF;SACA,IAAI;QACN;QACA,kBAAkB;OACpB;OACA;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF,EACF;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF;SACA,IAAI;QACN;QACA,kBAAkB;OACpB;OACA;QACE,IAAI;QACJ,UAAU;QACV,UAAU;SACR,aAAa,EACX,UAAU;UACR;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA;WACE,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF,EACF;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF;SACA,IAAI;QACN;QACA,kBAAkB;OACpB;MACF;MACA,wBAAwB;OACtB;QACE,YAAY;QACZ,UAAU;SACR,QAAQ,EACN,QAAQ,IACV;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF;SACA,IAAI;QACN;OACF;OACA;QACE,YAAY;QACZ,UAAU;SACR,SAAS;UACP,QAAQ;UACR,iBAAiB;SACnB;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG,CAAC,KAAK;WACT,GAAG;WACH,GAAG,KAAK;UACV;SACF;SACA,IAAI;QACN;OACF;OACA;QACE,YAAY;QACZ,UAAU;SACR,QAAQ,EACN,QAAQ,IACV;SACA,WAAW;UACT,UAAU;WACR,GAAG;WACH,GAAG;WACH,GAAG;UACL;UACA,aAAa;WACX,GAAG;WACH,GAAG;WACH,GAAG;WACH,GAAG;UACL;SACF;SACA,IAAI;QACN;OACF;OACA;QACE,YAAY;QACZ,UAAU;SACR,SAAS;UACP,QAAQ;UACR,iBAAiB;SACnB;SACA,WAAW;UACT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,cAAc,EAAE,KAAK,IAAI,EAAE;AAC9D"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a as isSameCoordinateSystem, m as AutoReconnectingWebsocket, n as loginWithAuth0, p as availableStorage, s as parseNovaInstanceUrl, u as tryParseJson } from "./LoginWithAuth0-DeirP_w9.mjs";
|
|
2
2
|
import axios, { AxiosError, isAxiosError } from "axios";
|
|
3
|
+
import urlJoin from "url-join";
|
|
3
4
|
import { makeAutoObservable, runInAction } from "mobx";
|
|
4
5
|
import * as THREE from "three";
|
|
5
6
|
import { Vector3 } from "three";
|
|
@@ -7,13 +8,11 @@ import { Vector3 as Vector3$1 } from "three/src/math/Vector3.js";
|
|
|
7
8
|
import { ApplicationApi, CellApi, ControllerApi, ControllerIOsApi, CoordinateSystemsApi, DeviceConfigurationApi, LibraryProgramApi, LibraryProgramMetadataApi, LibraryRecipeApi, LibraryRecipeMetadataApi, MotionApi, MotionGroupApi, MotionGroupInfosApi, MotionGroupJoggingApi, MotionGroupKinematicApi, ProgramApi, ProgramValuesApi, StoreCollisionComponentsApi, StoreCollisionScenesApi, StoreObjectApi, SystemApi, VirtualRobotApi, VirtualRobotBehaviorApi, VirtualRobotModeApi, VirtualRobotSetupApi } from "@wandelbots/nova-api/v1";
|
|
8
9
|
import * as pathToRegexp from "path-to-regexp";
|
|
9
10
|
//#region src/lib/deprecated/v1/motionStateUpdate.ts
|
|
10
|
-
/** @deprecated */
|
|
11
11
|
function jointValuesEqual(oldJointValues, newJointValues, changeDeltaThreshold) {
|
|
12
12
|
if (newJointValues.length !== oldJointValues.length) return true;
|
|
13
13
|
for (let jointIndex = 0; jointIndex < newJointValues.length; jointIndex++) if (Math.abs(newJointValues[jointIndex] - oldJointValues[jointIndex]) > changeDeltaThreshold) return false;
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
/** @deprecated */
|
|
17
16
|
function tcpPoseEqual(oldTcp, newTcp, changeDeltaThreshold) {
|
|
18
17
|
if (oldTcp === void 0 && newTcp || oldTcp && newTcp === void 0) return false;
|
|
19
18
|
if (oldTcp === void 0 || newTcp === void 0) return true;
|
|
@@ -32,7 +31,6 @@ function tcpPoseEqual(oldTcp, newTcp, changeDeltaThreshold) {
|
|
|
32
31
|
const MOTION_DELTA_THRESHOLD$1 = 1e-4;
|
|
33
32
|
/**
|
|
34
33
|
* Store representing the current state of a connected motion group.
|
|
35
|
-
* @deprecated
|
|
36
34
|
*/
|
|
37
35
|
var ConnectedMotionGroup = class ConnectedMotionGroup {
|
|
38
36
|
static async connect(nova, motionGroupId, controllers) {
|
|
@@ -235,7 +233,6 @@ var ConnectedMotionGroup = class ConnectedMotionGroup {
|
|
|
235
233
|
};
|
|
236
234
|
//#endregion
|
|
237
235
|
//#region src/lib/deprecated/v1/JoggerConnection.ts
|
|
238
|
-
/** @deprecated */
|
|
239
236
|
var JoggerConnection = class JoggerConnection {
|
|
240
237
|
static async open(nova, motionGroupId, opts = {}) {
|
|
241
238
|
return new JoggerConnection(await nova.connectMotionStream(motionGroupId), opts);
|
|
@@ -482,7 +479,6 @@ function unwrapRotationVector(newRotationVectorApi, currentRotationVectorApi) {
|
|
|
482
479
|
}
|
|
483
480
|
/**
|
|
484
481
|
* Store representing the current state of a connected motion group.
|
|
485
|
-
* @deprecated
|
|
486
482
|
*/
|
|
487
483
|
var MotionStreamConnection = class MotionStreamConnection {
|
|
488
484
|
static async open(nova, motionGroupId) {
|
|
@@ -550,7 +546,6 @@ var MotionStreamConnection = class MotionStreamConnection {
|
|
|
550
546
|
/**
|
|
551
547
|
* API client providing type-safe access to all the Nova API REST endpoints
|
|
552
548
|
* associated with a specific cell id.
|
|
553
|
-
* @deprecated Use `NovaAPIClient` from `@wandelbots/nova-js/v2` instead.
|
|
554
549
|
*/
|
|
555
550
|
var NovaCellAPIClient = class {
|
|
556
551
|
constructor(cellId, opts) {
|
|
@@ -626,7 +621,6 @@ var NovaCellAPIClient = class {
|
|
|
626
621
|
//#region src/lib/deprecated/v1/mock/MockNovaInstance.ts
|
|
627
622
|
/**
|
|
628
623
|
* Ultra-simplified mock Nova server for testing stuff
|
|
629
|
-
* @deprecated
|
|
630
624
|
*/
|
|
631
625
|
var MockNovaInstance = class {
|
|
632
626
|
constructor() {
|
|
@@ -1878,7 +1872,7 @@ var NovaClient = class {
|
|
|
1878
1872
|
if (this.config.instanceUrl === "https://mock.example.com") this.mock = new MockNovaInstance();
|
|
1879
1873
|
this.instanceUrl = parseNovaInstanceUrl(this.config.instanceUrl);
|
|
1880
1874
|
const axiosInstance = axios.create({
|
|
1881
|
-
baseURL:
|
|
1875
|
+
baseURL: urlJoin(this.config.instanceUrl, "/api/v1"),
|
|
1882
1876
|
headers: typeof window !== "undefined" && window.location.origin.includes("localhost") ? {} : { "X-Wandelbots-Client": "Wandelbots-Nova-JS-SDK" }
|
|
1883
1877
|
});
|
|
1884
1878
|
axiosInstance.interceptors.request.use(async (request) => {
|
|
@@ -1908,7 +1902,7 @@ var NovaClient = class {
|
|
|
1908
1902
|
});
|
|
1909
1903
|
this.api = new NovaCellAPIClient(cellId, {
|
|
1910
1904
|
...config,
|
|
1911
|
-
basePath:
|
|
1905
|
+
basePath: urlJoin(this.instanceUrl.href, "/api/v1"),
|
|
1912
1906
|
isJsonMime: (mime) => {
|
|
1913
1907
|
return mime === "application/json";
|
|
1914
1908
|
},
|
|
@@ -1938,7 +1932,7 @@ var NovaClient = class {
|
|
|
1938
1932
|
}
|
|
1939
1933
|
}
|
|
1940
1934
|
makeWebsocketURL(path) {
|
|
1941
|
-
const url = new URL(
|
|
1935
|
+
const url = new URL(urlJoin(this.instanceUrl.href, `/api/v1/cells/${this.config.cellId}`, path));
|
|
1942
1936
|
url.protocol = url.protocol.replace("http", "ws");
|
|
1943
1937
|
url.protocol = url.protocol.replace("https", "wss");
|
|
1944
1938
|
if (this.accessToken) url.searchParams.append("token", this.accessToken);
|
|
@@ -1981,7 +1975,6 @@ var NovaClient = class {
|
|
|
1981
1975
|
/**
|
|
1982
1976
|
* Convert a Pose object representing a motion group position
|
|
1983
1977
|
* into a string which represents that pose in Wandelscript.
|
|
1984
|
-
* @deprecated
|
|
1985
1978
|
*/
|
|
1986
1979
|
function poseToWandelscriptString(pose) {
|
|
1987
1980
|
const position = [
|
|
@@ -2001,4 +1994,4 @@ function poseToWandelscriptString(pose) {
|
|
|
2001
1994
|
//#endregion
|
|
2002
1995
|
export { JoggerConnection as a, MotionStreamConnection as i, NovaClient as n, ConnectedMotionGroup as o, NovaCellAPIClient as r, poseToWandelscriptString as t };
|
|
2003
1996
|
|
|
2004
|
-
//# sourceMappingURL=wandelscriptUtils-
|
|
1997
|
+
//# sourceMappingURL=wandelscriptUtils-CsQAUu_9.mjs.map
|