@wandelbots/nova-js 2.0.0 → 2.0.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/v1/index.ts","../../../src/lib/v1/ConnectedMotionGroup.ts","../../../src/lib/v1/motionStateUpdate.ts","../../../src/lib/v1/getLatestTrajectories.ts","../../../node_modules/lodash-es/_listCacheClear.js","../../../node_modules/lodash-es/eq.js","../../../node_modules/lodash-es/_assocIndexOf.js","../../../node_modules/lodash-es/_listCacheDelete.js","../../../node_modules/lodash-es/_listCacheGet.js","../../../node_modules/lodash-es/_listCacheHas.js","../../../node_modules/lodash-es/_listCacheSet.js","../../../node_modules/lodash-es/_ListCache.js","../../../node_modules/lodash-es/_stackClear.js","../../../node_modules/lodash-es/_stackDelete.js","../../../node_modules/lodash-es/_stackGet.js","../../../node_modules/lodash-es/_stackHas.js","../../../node_modules/lodash-es/_freeGlobal.js","../../../node_modules/lodash-es/_root.js","../../../node_modules/lodash-es/_Symbol.js","../../../node_modules/lodash-es/_getRawTag.js","../../../node_modules/lodash-es/_objectToString.js","../../../node_modules/lodash-es/_baseGetTag.js","../../../node_modules/lodash-es/isObject.js","../../../node_modules/lodash-es/isFunction.js","../../../node_modules/lodash-es/_coreJsData.js","../../../node_modules/lodash-es/_isMasked.js","../../../node_modules/lodash-es/_toSource.js","../../../node_modules/lodash-es/_baseIsNative.js","../../../node_modules/lodash-es/_getValue.js","../../../node_modules/lodash-es/_getNative.js","../../../node_modules/lodash-es/_Map.js","../../../node_modules/lodash-es/_nativeCreate.js","../../../node_modules/lodash-es/_hashClear.js","../../../node_modules/lodash-es/_hashDelete.js","../../../node_modules/lodash-es/_hashGet.js","../../../node_modules/lodash-es/_hashHas.js","../../../node_modules/lodash-es/_hashSet.js","../../../node_modules/lodash-es/_Hash.js","../../../node_modules/lodash-es/_mapCacheClear.js","../../../node_modules/lodash-es/_isKeyable.js","../../../node_modules/lodash-es/_getMapData.js","../../../node_modules/lodash-es/_mapCacheDelete.js","../../../node_modules/lodash-es/_mapCacheGet.js","../../../node_modules/lodash-es/_mapCacheHas.js","../../../node_modules/lodash-es/_mapCacheSet.js","../../../node_modules/lodash-es/_MapCache.js","../../../node_modules/lodash-es/_stackSet.js","../../../node_modules/lodash-es/_Stack.js","../../../node_modules/lodash-es/_setCacheAdd.js","../../../node_modules/lodash-es/_setCacheHas.js","../../../node_modules/lodash-es/_SetCache.js","../../../node_modules/lodash-es/_arraySome.js","../../../node_modules/lodash-es/_cacheHas.js","../../../node_modules/lodash-es/_equalArrays.js","../../../node_modules/lodash-es/_Uint8Array.js","../../../node_modules/lodash-es/_mapToArray.js","../../../node_modules/lodash-es/_setToArray.js","../../../node_modules/lodash-es/_equalByTag.js","../../../node_modules/lodash-es/_arrayPush.js","../../../node_modules/lodash-es/isArray.js","../../../node_modules/lodash-es/_baseGetAllKeys.js","../../../node_modules/lodash-es/_arrayFilter.js","../../../node_modules/lodash-es/stubArray.js","../../../node_modules/lodash-es/_getSymbols.js","../../../node_modules/lodash-es/_baseTimes.js","../../../node_modules/lodash-es/isObjectLike.js","../../../node_modules/lodash-es/_baseIsArguments.js","../../../node_modules/lodash-es/isArguments.js","../../../node_modules/lodash-es/stubFalse.js","../../../node_modules/lodash-es/isBuffer.js","../../../node_modules/lodash-es/_isIndex.js","../../../node_modules/lodash-es/isLength.js","../../../node_modules/lodash-es/_baseIsTypedArray.js","../../../node_modules/lodash-es/_baseUnary.js","../../../node_modules/lodash-es/_nodeUtil.js","../../../node_modules/lodash-es/isTypedArray.js","../../../node_modules/lodash-es/_arrayLikeKeys.js","../../../node_modules/lodash-es/_isPrototype.js","../../../node_modules/lodash-es/_overArg.js","../../../node_modules/lodash-es/_nativeKeys.js","../../../node_modules/lodash-es/_baseKeys.js","../../../node_modules/lodash-es/isArrayLike.js","../../../node_modules/lodash-es/keys.js","../../../node_modules/lodash-es/_getAllKeys.js","../../../node_modules/lodash-es/_equalObjects.js","../../../node_modules/lodash-es/_DataView.js","../../../node_modules/lodash-es/_Promise.js","../../../node_modules/lodash-es/_Set.js","../../../node_modules/lodash-es/_WeakMap.js","../../../node_modules/lodash-es/_getTag.js","../../../node_modules/lodash-es/_baseIsEqualDeep.js","../../../node_modules/lodash-es/_baseIsEqual.js","../../../node_modules/lodash-es/isEqual.js","../../../src/lib/v1/JoggerConnection.ts","../../../src/lib/v1/MotionStreamConnection.ts","../../../src/lib/v1/NovaCellAPIClient.ts","../../../src/lib/v1/NovaClient.ts","../../../src/lib/v1/mock/MockNovaInstance.ts","../../../src/lib/v1/ProgramStateConnection.ts"],"sourcesContent":["export * from \"@wandelbots/nova-api/v1\"\nexport * from \"./ConnectedMotionGroup\"\nexport * from \"./getLatestTrajectories\"\nexport * from \"./JoggerConnection\"\nexport * from \"./MotionStreamConnection\"\nexport * from \"./NovaCellAPIClient\"\nexport * from \"./NovaClient\"\nexport * from \"./ProgramStateConnection\"\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 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 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 { 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 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 { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nexport default listCacheClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nexport default eq;\n","import eq from './eq.js';\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nexport default assocIndexOf;\n","import assocIndexOf from './_assocIndexOf.js';\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nexport default listCacheDelete;\n","import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nexport default listCacheGet;\n","import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nexport default listCacheHas;\n","import assocIndexOf from './_assocIndexOf.js';\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nexport default listCacheSet;\n","import listCacheClear from './_listCacheClear.js';\nimport listCacheDelete from './_listCacheDelete.js';\nimport listCacheGet from './_listCacheGet.js';\nimport listCacheHas from './_listCacheHas.js';\nimport listCacheSet from './_listCacheSet.js';\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nexport default ListCache;\n","import ListCache from './_ListCache.js';\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nexport default stackClear;\n","/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nexport default stackDelete;\n","/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nexport default stackGet;\n","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nexport default stackHas;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nexport default isObject;\n","import baseGetTag from './_baseGetTag.js';\nimport isObject from './isObject.js';\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nexport default isFunction;\n","import root from './_root.js';\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nexport default coreJsData;\n","import coreJsData from './_coreJsData.js';\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nexport default isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nexport default toSource;\n","import isFunction from './isFunction.js';\nimport isMasked from './_isMasked.js';\nimport isObject from './isObject.js';\nimport toSource from './_toSource.js';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nexport default baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nexport default getValue;\n","import baseIsNative from './_baseIsNative.js';\nimport getValue from './_getValue.js';\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nexport default getNative;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nexport default Map;\n","import getNative from './_getNative.js';\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nexport default nativeCreate;\n","import nativeCreate from './_nativeCreate.js';\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nexport default hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default hashDelete;\n","import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nexport default hashGet;\n","import nativeCreate from './_nativeCreate.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nexport default hashHas;\n","import nativeCreate from './_nativeCreate.js';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nexport default hashSet;\n","import hashClear from './_hashClear.js';\nimport hashDelete from './_hashDelete.js';\nimport hashGet from './_hashGet.js';\nimport hashHas from './_hashHas.js';\nimport hashSet from './_hashSet.js';\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nexport default Hash;\n","import Hash from './_Hash.js';\nimport ListCache from './_ListCache.js';\nimport Map from './_Map.js';\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nexport default mapCacheClear;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nexport default isKeyable;\n","import isKeyable from './_isKeyable.js';\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nexport default getMapData;\n","import getMapData from './_getMapData.js';\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nexport default mapCacheDelete;\n","import getMapData from './_getMapData.js';\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nexport default mapCacheGet;\n","import getMapData from './_getMapData.js';\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nexport default mapCacheHas;\n","import getMapData from './_getMapData.js';\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nexport default mapCacheSet;\n","import mapCacheClear from './_mapCacheClear.js';\nimport mapCacheDelete from './_mapCacheDelete.js';\nimport mapCacheGet from './_mapCacheGet.js';\nimport mapCacheHas from './_mapCacheHas.js';\nimport mapCacheSet from './_mapCacheSet.js';\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nexport default MapCache;\n","import ListCache from './_ListCache.js';\nimport Map from './_Map.js';\nimport MapCache from './_MapCache.js';\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nexport default stackSet;\n","import ListCache from './_ListCache.js';\nimport stackClear from './_stackClear.js';\nimport stackDelete from './_stackDelete.js';\nimport stackGet from './_stackGet.js';\nimport stackHas from './_stackHas.js';\nimport stackSet from './_stackSet.js';\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nexport default Stack;\n","/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Adds `value` to the array cache.\n *\n * @private\n * @name add\n * @memberOf SetCache\n * @alias push\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache instance.\n */\nfunction setCacheAdd(value) {\n this.__data__.set(value, HASH_UNDEFINED);\n return this;\n}\n\nexport default setCacheAdd;\n","/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nexport default setCacheHas;\n","import MapCache from './_MapCache.js';\nimport setCacheAdd from './_setCacheAdd.js';\nimport setCacheHas from './_setCacheHas.js';\n\n/**\n *\n * Creates an array cache object to store unique values.\n *\n * @private\n * @constructor\n * @param {Array} [values] The values to cache.\n */\nfunction SetCache(values) {\n var index = -1,\n length = values == null ? 0 : values.length;\n\n this.__data__ = new MapCache;\n while (++index < length) {\n this.add(values[index]);\n }\n}\n\n// Add methods to `SetCache`.\nSetCache.prototype.add = SetCache.prototype.push = setCacheAdd;\nSetCache.prototype.has = setCacheHas;\n\nexport default SetCache;\n","/**\n * A specialized version of `_.some` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\nfunction arraySome(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n}\n\nexport default arraySome;\n","/**\n * Checks if a `cache` value for `key` exists.\n *\n * @private\n * @param {Object} cache The cache to query.\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction cacheHas(cache, key) {\n return cache.has(key);\n}\n\nexport default cacheHas;\n","import SetCache from './_SetCache.js';\nimport arraySome from './_arraySome.js';\nimport cacheHas from './_cacheHas.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `array` and `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\nfunction equalArrays(array, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isPartial && othLength > arrLength)) {\n return false;\n }\n // Check that cyclic values are equal.\n var arrStacked = stack.get(array);\n var othStacked = stack.get(other);\n if (arrStacked && othStacked) {\n return arrStacked == other && othStacked == array;\n }\n var index = -1,\n result = true,\n seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;\n\n stack.set(array, other);\n stack.set(other, array);\n\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, arrValue, index, other, array, stack)\n : customizer(arrValue, othValue, index, array, other, stack);\n }\n if (compared !== undefined) {\n if (compared) {\n continue;\n }\n result = false;\n break;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (seen) {\n if (!arraySome(other, function(othValue, othIndex) {\n if (!cacheHas(seen, othIndex) &&\n (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {\n return seen.push(othIndex);\n }\n })) {\n result = false;\n break;\n }\n } else if (!(\n arrValue === othValue ||\n equalFunc(arrValue, othValue, bitmask, customizer, stack)\n )) {\n result = false;\n break;\n }\n }\n stack['delete'](array);\n stack['delete'](other);\n return result;\n}\n\nexport default equalArrays;\n","import root from './_root.js';\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nexport default Uint8Array;\n","/**\n * Converts `map` to its key-value pairs.\n *\n * @private\n * @param {Object} map The map to convert.\n * @returns {Array} Returns the key-value pairs.\n */\nfunction mapToArray(map) {\n var index = -1,\n result = Array(map.size);\n\n map.forEach(function(value, key) {\n result[++index] = [key, value];\n });\n return result;\n}\n\nexport default mapToArray;\n","/**\n * Converts `set` to an array of its values.\n *\n * @private\n * @param {Object} set The set to convert.\n * @returns {Array} Returns the values.\n */\nfunction setToArray(set) {\n var index = -1,\n result = Array(set.size);\n\n set.forEach(function(value) {\n result[++index] = value;\n });\n return result;\n}\n\nexport default setToArray;\n","import Symbol from './_Symbol.js';\nimport Uint8Array from './_Uint8Array.js';\nimport eq from './eq.js';\nimport equalArrays from './_equalArrays.js';\nimport mapToArray from './_mapToArray.js';\nimport setToArray from './_setToArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1,\n COMPARE_UNORDERED_FLAG = 2;\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]';\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {\n switch (tag) {\n case dataViewTag:\n if ((object.byteLength != other.byteLength) ||\n (object.byteOffset != other.byteOffset)) {\n return false;\n }\n object = object.buffer;\n other = other.buffer;\n\n case arrayBufferTag:\n if ((object.byteLength != other.byteLength) ||\n !equalFunc(new Uint8Array(object), new Uint8Array(other))) {\n return false;\n }\n return true;\n\n case boolTag:\n case dateTag:\n case numberTag:\n // Coerce booleans to `1` or `0` and dates to milliseconds.\n // Invalid dates are coerced to `NaN`.\n return eq(+object, +other);\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings, primitives and objects,\n // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring\n // for more details.\n return object == (other + '');\n\n case mapTag:\n var convert = mapToArray;\n\n case setTag:\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG;\n convert || (convert = setToArray);\n\n if (object.size != other.size && !isPartial) {\n return false;\n }\n // Assume cyclic values are equal.\n var stacked = stack.get(object);\n if (stacked) {\n return stacked == other;\n }\n bitmask |= COMPARE_UNORDERED_FLAG;\n\n // Recursively compare objects (susceptible to call stack limits).\n stack.set(object, other);\n var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);\n stack['delete'](object);\n return result;\n\n case symbolTag:\n if (symbolValueOf) {\n return symbolValueOf.call(object) == symbolValueOf.call(other);\n }\n }\n return false;\n}\n\nexport default equalByTag;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nexport default arrayPush;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nexport default isArray;\n","import arrayPush from './_arrayPush.js';\nimport isArray from './isArray.js';\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nexport default baseGetAllKeys;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nexport default arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nexport default stubArray;\n","import arrayFilter from './_arrayFilter.js';\nimport stubArray from './stubArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nexport default getSymbols;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nexport default baseTimes;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n","import baseGetTag from './_baseGetTag.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nexport default baseIsArguments;\n","import baseIsArguments from './_baseIsArguments.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nexport default isArguments;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nexport default stubFalse;\n","import root from './_root.js';\nimport stubFalse from './stubFalse.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nexport default isBuffer;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nexport default isIndex;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nexport default isLength;\n","import baseGetTag from './_baseGetTag.js';\nimport isLength from './isLength.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nexport default baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nexport default baseUnary;\n","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nexport default nodeUtil;\n","import baseIsTypedArray from './_baseIsTypedArray.js';\nimport baseUnary from './_baseUnary.js';\nimport nodeUtil from './_nodeUtil.js';\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nexport default isTypedArray;\n","import baseTimes from './_baseTimes.js';\nimport isArguments from './isArguments.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isIndex from './_isIndex.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default arrayLikeKeys;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nexport default isPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n","import overArg from './_overArg.js';\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nexport default nativeKeys;\n","import isPrototype from './_isPrototype.js';\nimport nativeKeys from './_nativeKeys.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nexport default baseKeys;\n","import isFunction from './isFunction.js';\nimport isLength from './isLength.js';\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nexport default isArrayLike;\n","import arrayLikeKeys from './_arrayLikeKeys.js';\nimport baseKeys from './_baseKeys.js';\nimport isArrayLike from './isArrayLike.js';\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nexport default keys;\n","import baseGetAllKeys from './_baseGetAllKeys.js';\nimport getSymbols from './_getSymbols.js';\nimport keys from './keys.js';\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nexport default getAllKeys;\n","import getAllKeys from './_getAllKeys.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} stack Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction equalObjects(object, other, bitmask, customizer, equalFunc, stack) {\n var isPartial = bitmask & COMPARE_PARTIAL_FLAG,\n objProps = getAllKeys(object),\n objLength = objProps.length,\n othProps = getAllKeys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isPartial) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n // Check that cyclic values are equal.\n var objStacked = stack.get(object);\n var othStacked = stack.get(other);\n if (objStacked && othStacked) {\n return objStacked == other && othStacked == object;\n }\n var result = true;\n stack.set(object, other);\n stack.set(other, object);\n\n var skipCtor = isPartial;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key];\n\n if (customizer) {\n var compared = isPartial\n ? customizer(othValue, objValue, key, other, object, stack)\n : customizer(objValue, othValue, key, object, other, stack);\n }\n // Recursively compare objects (susceptible to call stack limits).\n if (!(compared === undefined\n ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))\n : compared\n )) {\n result = false;\n break;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (result && !skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n result = false;\n }\n }\n stack['delete'](object);\n stack['delete'](other);\n return result;\n}\n\nexport default equalObjects;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nexport default DataView;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nexport default Promise;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nexport default Set;\n","import getNative from './_getNative.js';\nimport root from './_root.js';\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nexport default WeakMap;\n","import DataView from './_DataView.js';\nimport Map from './_Map.js';\nimport Promise from './_Promise.js';\nimport Set from './_Set.js';\nimport WeakMap from './_WeakMap.js';\nimport baseGetTag from './_baseGetTag.js';\nimport toSource from './_toSource.js';\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nexport default getTag;\n","import Stack from './_Stack.js';\nimport equalArrays from './_equalArrays.js';\nimport equalByTag from './_equalByTag.js';\nimport equalObjects from './_equalObjects.js';\nimport getTag from './_getTag.js';\nimport isArray from './isArray.js';\nimport isBuffer from './isBuffer.js';\nimport isTypedArray from './isTypedArray.js';\n\n/** Used to compose bitmasks for value comparisons. */\nvar COMPARE_PARTIAL_FLAG = 1;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.\n * @param {Function} customizer The function to customize comparisons.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Object} [stack] Tracks traversed `object` and `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\nfunction baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = objIsArr ? arrayTag : getTag(object),\n othTag = othIsArr ? arrayTag : getTag(other);\n\n objTag = objTag == argsTag ? objectTag : objTag;\n othTag = othTag == argsTag ? objectTag : othTag;\n\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && isBuffer(object)) {\n if (!isBuffer(other)) {\n return false;\n }\n objIsArr = true;\n objIsObj = false;\n }\n if (isSameTag && !objIsObj) {\n stack || (stack = new Stack);\n return (objIsArr || isTypedArray(object))\n ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)\n : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);\n }\n if (!(bitmask & COMPARE_PARTIAL_FLAG)) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n var objUnwrapped = objIsWrapped ? object.value() : object,\n othUnwrapped = othIsWrapped ? other.value() : other;\n\n stack || (stack = new Stack);\n return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);\n }\n }\n if (!isSameTag) {\n return false;\n }\n stack || (stack = new Stack);\n return equalObjects(object, other, bitmask, customizer, equalFunc, stack);\n}\n\nexport default baseIsEqualDeep;\n","import baseIsEqualDeep from './_baseIsEqualDeep.js';\nimport isObjectLike from './isObjectLike.js';\n\n/**\n * The base implementation of `_.isEqual` which supports partial comparisons\n * and tracks traversed objects.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Unordered comparison\n * 2 - Partial comparison\n * @param {Function} [customizer] The function to customize comparisons.\n * @param {Object} [stack] Tracks traversed `value` and `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\nfunction baseIsEqual(value, other, bitmask, customizer, stack) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);\n}\n\nexport default baseIsEqual;\n","import baseIsEqual from './_baseIsEqual.js';\n\n/**\n * Performs a deep comparison between two values to determine if they are\n * equivalent.\n *\n * **Note:** This method supports comparing arrays, array buffers, booleans,\n * date objects, error objects, maps, numbers, `Object` objects, regexes,\n * sets, strings, symbols, and typed arrays. `Object` objects are compared\n * by their own, not inherited, enumerable properties. Functions and DOM\n * nodes are compared by strict equality, i.e. `===`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.isEqual(object, other);\n * // => true\n *\n * object === other;\n * // => false\n */\nfunction isEqual(value, other) {\n return baseIsEqual(value, other);\n}\n\nexport default isEqual;\n","import type { Command, Joints, TcpPose } from \"@wandelbots/nova-api/v1\"\nimport isEqual from \"lodash-es/isEqual\"\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 (!isEqual(this.cartesianJoggingOpts, cartesianJoggingOpts)) {\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 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","import 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 console.log(\"got first message\", 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 == undefined) {\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","import type { Configuration as BaseConfiguration } 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 { BaseAPI } from \"@wandelbots/nova-api/v1/base\"\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 { 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 { 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 */\nexport class NovaClient {\n readonly api: NovaCellAPIClient\n readonly config: NovaClientConfigWithDefaults\n readonly mock?: MockNovaInstance\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\n // Set up Axios instance with interceptor for token fetching\n const axiosInstance = axios.create({\n baseURL: urlJoin(this.config.instanceUrl, \"/api/v1\"),\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.config.instanceUrl, \"/api/v1\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\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 this.authPromise = loginWithAuth0(this.config.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.config.instanceUrl,\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 return motionGroups[0]!\n }\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 * EXPERIMENTAL\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: -0.7071067811865475,\n z: 0,\n w: 0.7071067811865476,\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: -0.7071067811865475,\n y: 0,\n z: 0,\n w: 0.7071067811865476,\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 },\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","import { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = (runnerState as any).stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = (runnerState as any).stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = (runnerState as any).stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: Object,\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n default_robot: activeRobot?.wandelscriptIdentifier,\n } as any,\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,cAAc;;;ACYd,SAAS,oBAAoB,mBAAmB;AAChD,YAAY,WAAW;;;ACXhB,SAAS,iBACd,gBACA,gBACA,sBACS;AACT,MAAI,eAAe,WAAW,eAAe,QAAQ;AACnD,WAAO;AAAA,EACT;AAEA,WAAS,aAAa,GAAG,aAAa,eAAe,QAAQ,cAAc;AACzE,QACE,KAAK,IAAI,eAAe,UAAU,IAAK,eAAe,UAAU,CAA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AAAA,MACpB;AAAA,MACA,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":["mounting","objectProto","nativeObjectToString","symToStringTag","funcProto","objectProto","funcToString","hasOwnProperty","objectProto","hasOwnProperty","objectProto","hasOwnProperty","HASH_UNDEFINED","HASH_UNDEFINED","othValue","COMPARE_PARTIAL_FLAG","COMPARE_UNORDERED_FLAG","objectProto","objectProto","hasOwnProperty","propertyIsEnumerable","MAX_SAFE_INTEGER","argsTag","boolTag","dateTag","errorTag","funcTag","mapTag","numberTag","regexpTag","setTag","stringTag","arrayBufferTag","dataViewTag","freeExports","freeModule","moduleExports","objectProto","hasOwnProperty","objectProto","objectProto","hasOwnProperty","COMPARE_PARTIAL_FLAG","objectProto","hasOwnProperty","Promise","Set","mapTag","objectTag","setTag","weakMapTag","dataViewTag","COMPARE_PARTIAL_FLAG","argsTag","arrayTag","objectTag","objectProto","hasOwnProperty","Vector3","Vector3","makeAutoObservable","runInAction","Vector3","MOTION_DELTA_THRESHOLD","Vector3","runInAction","makeAutoObservable","axios","match","axios","_a","config","AxiosError","makeAutoObservable","runInAction","ProgramState","makeAutoObservable","runInAction","AxiosError"]}
1
+ {"version":3,"sources":["../../../src/lib/v1/index.ts","../../../src/lib/v1/ConnectedMotionGroup.ts","../../../src/lib/v1/motionStateUpdate.ts","../../../src/lib/v1/getLatestTrajectories.ts","../../../src/lib/v1/JoggerConnection.ts","../../../src/lib/v1/MotionStreamConnection.ts","../../../src/lib/v1/NovaCellAPIClient.ts","../../../src/lib/v1/NovaClient.ts","../../../src/lib/v1/mock/MockNovaInstance.ts","../../../src/lib/v1/ProgramStateConnection.ts"],"sourcesContent":["export * from \"@wandelbots/nova-api/v1\"\nexport * from \"./ConnectedMotionGroup\"\nexport * from \"./getLatestTrajectories\"\nexport * from \"./JoggerConnection\"\nexport * from \"./MotionStreamConnection\"\nexport * from \"./NovaCellAPIClient\"\nexport * from \"./NovaClient\"\nexport * from \"./ProgramStateConnection\"\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 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 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 { 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 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 { GetTrajectoryResponse } from \"@wandelbots/nova-api/v1\"\nimport type { NovaCellAPIClient } from \"./NovaCellAPIClient\"\n\nlet lastMotionIds: Set<string> = new Set()\n\nexport async function getLatestTrajectories(\n apiClient: NovaCellAPIClient,\n sampleTime: number = 50,\n responsesCoordinateSystem?: string,\n): Promise<GetTrajectoryResponse[]> {\n const newTrajectories: GetTrajectoryResponse[] = []\n\n try {\n const motions = await apiClient.motion.listMotions()\n const currentMotionIds = new Set(motions.motions)\n\n const newMotionIds = Array.from(currentMotionIds).filter(\n (id) => !lastMotionIds.has(id),\n )\n\n for (const motionId of newMotionIds) {\n const trajectory = await apiClient.motion.getMotionTrajectory(\n motionId,\n sampleTime,\n responsesCoordinateSystem,\n )\n newTrajectories.push(trajectory)\n }\n\n lastMotionIds = currentMotionIds\n } catch (error) {\n console.error(\"Failed to get latest trajectories:\", error)\n }\n\n return newTrajectories\n}\n","import type { Command, Joints, TcpPose } from \"@wandelbots/nova-api/v1\"\nimport isEqual from \"lodash-es/isEqual\"\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 (!isEqual(this.cartesianJoggingOpts, cartesianJoggingOpts)) {\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 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","import 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 console.log(\"got first message\", 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 == undefined) {\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","import type { Configuration as BaseConfiguration } 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 { BaseAPI } from \"@wandelbots/nova-api/v1/base\"\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 { 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 { 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 */\nexport class NovaClient {\n readonly api: NovaCellAPIClient\n readonly config: NovaClientConfigWithDefaults\n readonly mock?: MockNovaInstance\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\n // Set up Axios instance with interceptor for token fetching\n const axiosInstance = axios.create({\n baseURL: urlJoin(this.config.instanceUrl, \"/api/v1\"),\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.config.instanceUrl, \"/api/v1\"),\n isJsonMime: (mime: string) => {\n return mime === \"application/json\"\n },\n baseOptions: {\n ...(this.mock\n ? ({\n adapter: (config) => {\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 this.authPromise = loginWithAuth0(this.config.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.config.instanceUrl,\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 return motionGroups[0]!\n }\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 * EXPERIMENTAL\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: -0.7071067811865475,\n z: 0,\n w: 0.7071067811865476,\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: -0.7071067811865475,\n y: 0,\n z: 0,\n w: 0.7071067811865476,\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 },\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","import { AxiosError } from \"axios\"\nimport { makeAutoObservable, runInAction } from \"mobx\"\nimport { AutoReconnectingWebsocket } from \"../AutoReconnectingWebsocket\"\nimport { tryParseJson } from \"../converters\"\nimport type { MotionStreamConnection } from \"./MotionStreamConnection\"\nimport type { NovaClient } from \"./NovaClient\"\n\nexport type ProgramRunnerLogEntry = {\n timestamp: number\n message: string\n level?: \"warn\" | \"error\"\n}\n\nexport enum ProgramState {\n NotStarted = \"not started\",\n Running = \"running\",\n Stopped = \"stopped\",\n Failed = \"failed\",\n Completed = \"completed\",\n}\n\nexport type CurrentProgram = {\n id?: string\n wandelscript?: string\n state?: ProgramState\n}\n\ntype ProgramStateMessage = {\n type: string\n runner: {\n id: string\n state: ProgramState\n start_time?: number | null\n execution_time?: number | null\n }\n}\n\n/**\n * Interface for running Wandelscript programs on the Nova instance and\n * tracking their progress and output\n */\nexport class ProgramStateConnection {\n currentProgram: CurrentProgram = {}\n logs: ProgramRunnerLogEntry[] = []\n\n executionState = \"idle\" as \"idle\" | \"starting\" | \"executing\" | \"stopping\"\n currentlyExecutingProgramRunnerId = null as string | null\n\n programStateSocket: AutoReconnectingWebsocket\n\n constructor(readonly nova: NovaClient) {\n makeAutoObservable(this, {}, { autoBind: true })\n\n this.programStateSocket = nova.openReconnectingWebsocket(`/programs/state`)\n\n this.programStateSocket.addEventListener(\"message\", (ev) => {\n const msg = tryParseJson(ev.data)\n\n if (!msg) {\n console.error(\"Failed to parse program state message\", ev.data)\n return\n }\n if (msg.type === \"update\") {\n this.handleProgramStateMessage(msg)\n }\n })\n }\n\n /** Handle a program state update from the backend */\n async handleProgramStateMessage(msg: ProgramStateMessage) {\n const { runner } = msg\n\n // Ignoring other programs for now\n // TODO - show if execution state is busy from another source\n if (runner.id !== this.currentlyExecutingProgramRunnerId) return\n\n if (runner.state === ProgramState.Failed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n // TODO - wandelengine should send print statements in real time over\n // websocket as well, rather than at the end\n const stdout = (runnerState as any).stdout\n if (stdout) {\n this.log(stdout)\n }\n this.logError(\n `Program runner ${runner.id} failed with error: ${runnerState.error}\\n${runnerState.traceback}`,\n )\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.currentProgram.state = ProgramState.Failed\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Stopped) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = (runnerState as any).stdout\n if (stdout) {\n this.log(stdout)\n }\n\n this.currentProgram.state = ProgramState.Stopped\n this.log(`Program runner ${runner.id} stopped`)\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Completed) {\n try {\n const runnerState = await this.nova.api.program.getProgramRunner(\n runner.id,\n )\n\n const stdout = (runnerState as any).stdout\n if (stdout) {\n this.log(stdout)\n }\n this.log(\n `Program runner ${runner.id} finished successfully in ${runner.execution_time?.toFixed(2)} seconds`,\n )\n\n this.currentProgram.state = ProgramState.Completed\n } catch (err) {\n this.logError(\n `Failed to retrieve results for program ${runner.id}: ${err}`,\n )\n }\n\n this.gotoIdleState()\n } else if (runner.state === ProgramState.Running) {\n this.currentProgram.state = ProgramState.Running\n this.log(`Program runner ${runner.id} now running`)\n } else if (runner.state !== ProgramState.NotStarted) {\n console.error(runner)\n this.logError(\n `Program runner ${runner.id} entered unexpected state: ${runner.state}`,\n )\n this.currentProgram.state = ProgramState.NotStarted\n this.gotoIdleState()\n }\n }\n\n /** Call when a program is no longer executing */\n gotoIdleState() {\n runInAction(() => {\n this.executionState = \"idle\"\n })\n this.currentlyExecutingProgramRunnerId = null\n }\n\n async executeProgram(\n wandelscript: string,\n initial_state?: Object,\n activeRobot?: MotionStreamConnection,\n ) {\n this.currentProgram = {\n wandelscript: wandelscript,\n state: ProgramState.NotStarted,\n }\n\n const { currentProgram: openProgram } = this\n if (!openProgram) return\n runInAction(() => {\n this.executionState = \"starting\"\n })\n\n // Jogging can cause program execution to fail for some time after\n // So we need to explicitly stop jogging before running a program\n if (activeRobot) {\n try {\n await this.nova.api.motionGroupJogging.stopJogging(\n activeRobot.motionGroupId,\n )\n } catch (err) {\n console.error(err)\n }\n }\n\n // WOS-1539: Wandelengine parser currently breaks if there are empty lines with indentation\n const trimmedCode = openProgram.wandelscript!.replaceAll(/^\\s*$/gm, \"\")\n\n try {\n const programRunnerRef = await this.nova.api.program.createProgramRunner(\n {\n code: trimmedCode,\n initial_state: initial_state,\n default_robot: activeRobot?.wandelscriptIdentifier,\n } as any,\n {\n headers: {\n \"Content-Type\": \"application/json\",\n },\n },\n )\n\n this.log(`Created program runner ${programRunnerRef.id}\"`)\n runInAction(() => {\n this.executionState = \"executing\"\n })\n this.currentlyExecutingProgramRunnerId = programRunnerRef.id\n } catch (error) {\n if (error instanceof AxiosError && error.response && error.request) {\n this.logError(\n `${error.response.status} ${error.response.statusText} from ${error.response.config.url} ${JSON.stringify(error.response.data)}`,\n )\n } else {\n this.logError(JSON.stringify(error))\n }\n runInAction(() => {\n this.executionState = \"idle\"\n })\n }\n }\n\n async stopProgram() {\n if (!this.currentlyExecutingProgramRunnerId) return\n runInAction(() => {\n this.executionState = \"stopping\"\n })\n\n try {\n await this.nova.api.program.stopProgramRunner(\n this.currentlyExecutingProgramRunnerId,\n )\n } catch (err) {\n // Reactivate the stop button so user can try again\n runInAction(() => {\n this.executionState = \"executing\"\n })\n throw err\n }\n }\n\n reset() {\n this.currentProgram = {}\n }\n\n log(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n })\n }\n\n logError(message: string) {\n console.log(message)\n this.logs.push({\n timestamp: Date.now(),\n message,\n level: \"error\",\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,cAAc;;;ACYd,SAAS,oBAAoB,mBAAmB;AAChD,YAAY,WAAW;;;ACXhB,SAAS,iBACd,gBACA,gBACA,sBACS;AACT,MAAI,eAAe,WAAW,eAAe,QAAQ;AACnD,WAAO;AAAA,EACT;AAEA,WAAS,aAAa,GAAG,aAAa,eAAe,QAAQ,cAAc;AACzE,QACE,KAAK,IAAI,eAAe,UAAU,IAAK,eAAe,UAAU,CAAE,IAClE,sBACA;AACA,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,aACd,QACA,QACA,sBACS;AAET,MAAK,WAAW,UAAa,UAAY,UAAU,WAAW,QAAY;AACxE,WAAO;AAAA,EACT;AAGA,MAAI,WAAW,UAAa,WAAW,QAAW;AAChD,WAAO;AAAA,EACT;AAEA,MAAI,eAAe;AACnB,kBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,CAAC;AACpE,kBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,CAAC;AACpE,kBAAgB,KAAK,IAAI,OAAO,YAAY,IAAI,OAAO,YAAY,CAAC;AACpE,kBAAgB,KAAK,IAAI,OAAO,SAAS,IAAI,OAAO,SAAS,CAAC;AAC9D,kBAAgB,KAAK,IAAI,OAAO,SAAS,IAAI,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,aAAY,MAAM;AAChB,eAAK,iBAAiB;AAAA,QACxB,CAAC;AAAA,MACH;AAAA,IACF;AAAA;AAAA,EAEM,cAAc;AAAA;AAClB,UAAI,CAAC,KAAK,kCAAmC;AAC7C,MAAAA,aAAY,MAAM;AAChB,aAAK,iBAAiB;AAAA,MACxB,CAAC;AAED,UAAI;AACF,cAAM,KAAK,KAAK,IAAI,QAAQ;AAAA,UAC1B,KAAK;AAAA,QACP;AAAA,MACF,SAAS,KAAK;AAEZ,QAAAA,aAAY,MAAM;AAChB,eAAK,iBAAiB;AAAA,QACxB,CAAC;AACD,cAAM;AAAA,MACR;AAAA,IACF;AAAA;AAAA,EAEA,QAAQ;AACN,SAAK,iBAAiB,CAAC;AAAA,EACzB;AAAA,EAEA,IAAI,SAAiB;AACnB,YAAQ,IAAI,OAAO;AACnB,SAAK,KAAK,KAAK;AAAA,MACb,WAAW,KAAK,IAAI;AAAA,MACpB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,SAAS,SAAiB;AACxB,YAAQ,IAAI,OAAO;AACnB,SAAK,KAAK,KAAK;AAAA,MACb,WAAW,KAAK,IAAI;AAAA,MACpB;AAAA,MACA,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":["mounting","Vector3","Vector3","makeAutoObservable","runInAction","Vector3","MOTION_DELTA_THRESHOLD","Vector3","runInAction","makeAutoObservable","axios","match","axios","_a","config","AxiosError","makeAutoObservable","runInAction","ProgramState","makeAutoObservable","runInAction","AxiosError"]}