@wandelbots/nova-js 1.17.1-pr.feat-added-v2-client.64.9ac2247

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.
Files changed (95) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +202 -0
  3. package/dist/LoginWithAuth0.d.ts +7 -0
  4. package/dist/LoginWithAuth0.d.ts.map +1 -0
  5. package/dist/chunk-V3NJLR6P.js +336 -0
  6. package/dist/chunk-V3NJLR6P.js.map +1 -0
  7. package/dist/index.cjs +390 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.ts +6 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +54 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/lib/AutoReconnectingWebsocket.d.ts +43 -0
  14. package/dist/lib/AutoReconnectingWebsocket.d.ts.map +1 -0
  15. package/dist/lib/availableStorage.d.ts +15 -0
  16. package/dist/lib/availableStorage.d.ts.map +1 -0
  17. package/dist/lib/converters.d.ts +26 -0
  18. package/dist/lib/converters.d.ts.map +1 -0
  19. package/dist/lib/errorHandling.d.ts +4 -0
  20. package/dist/lib/errorHandling.d.ts.map +1 -0
  21. package/dist/lib/v1/ConnectedMotionGroup.d.ts +77 -0
  22. package/dist/lib/v1/ConnectedMotionGroup.d.ts.map +1 -0
  23. package/dist/lib/v1/JoggerConnection.d.ts +94 -0
  24. package/dist/lib/v1/JoggerConnection.d.ts.map +1 -0
  25. package/dist/lib/v1/MotionStreamConnection.d.ts +25 -0
  26. package/dist/lib/v1/MotionStreamConnection.d.ts.map +1 -0
  27. package/dist/lib/v1/NovaCellAPIClient.d.ts +66 -0
  28. package/dist/lib/v1/NovaCellAPIClient.d.ts.map +1 -0
  29. package/dist/lib/v1/NovaClient.d.ts +67 -0
  30. package/dist/lib/v1/NovaClient.d.ts.map +1 -0
  31. package/dist/lib/v1/ProgramStateConnection.d.ts +53 -0
  32. package/dist/lib/v1/ProgramStateConnection.d.ts.map +1 -0
  33. package/dist/lib/v1/getLatestTrajectories.d.ts +4 -0
  34. package/dist/lib/v1/getLatestTrajectories.d.ts.map +1 -0
  35. package/dist/lib/v1/index.cjs +3957 -0
  36. package/dist/lib/v1/index.cjs.map +1 -0
  37. package/dist/lib/v1/index.d.ts +9 -0
  38. package/dist/lib/v1/index.d.ts.map +1 -0
  39. package/dist/lib/v1/index.js +3662 -0
  40. package/dist/lib/v1/index.js.map +1 -0
  41. package/dist/lib/v1/mock/MockNovaInstance.d.ts +13 -0
  42. package/dist/lib/v1/mock/MockNovaInstance.d.ts.map +1 -0
  43. package/dist/lib/v1/motionStateUpdate.d.ts +4 -0
  44. package/dist/lib/v1/motionStateUpdate.d.ts.map +1 -0
  45. package/dist/lib/v2/ConnectedMotionGroup.d.ts +41 -0
  46. package/dist/lib/v2/ConnectedMotionGroup.d.ts.map +1 -0
  47. package/dist/lib/v2/JoggerConnection.d.ts +53 -0
  48. package/dist/lib/v2/JoggerConnection.d.ts.map +1 -0
  49. package/dist/lib/v2/MotionStreamConnection.d.ts +25 -0
  50. package/dist/lib/v2/MotionStreamConnection.d.ts.map +1 -0
  51. package/dist/lib/v2/NovaCellAPIClient.d.ts +64 -0
  52. package/dist/lib/v2/NovaCellAPIClient.d.ts.map +1 -0
  53. package/dist/lib/v2/NovaClient.d.ts +67 -0
  54. package/dist/lib/v2/NovaClient.d.ts.map +1 -0
  55. package/dist/lib/v2/ProgramStateConnection.d.ts +53 -0
  56. package/dist/lib/v2/ProgramStateConnection.d.ts.map +1 -0
  57. package/dist/lib/v2/index.cjs +2239 -0
  58. package/dist/lib/v2/index.cjs.map +1 -0
  59. package/dist/lib/v2/index.d.ts +8 -0
  60. package/dist/lib/v2/index.d.ts.map +1 -0
  61. package/dist/lib/v2/index.js +1947 -0
  62. package/dist/lib/v2/index.js.map +1 -0
  63. package/dist/lib/v2/mock/MockNovaInstance.d.ts +13 -0
  64. package/dist/lib/v2/mock/MockNovaInstance.d.ts.map +1 -0
  65. package/dist/lib/v2/motionStateUpdate.d.ts +4 -0
  66. package/dist/lib/v2/motionStateUpdate.d.ts.map +1 -0
  67. package/dist/lib/v2/vectorUtils.d.ts +7 -0
  68. package/dist/lib/v2/vectorUtils.d.ts.map +1 -0
  69. package/package.json +67 -0
  70. package/src/LoginWithAuth0.ts +90 -0
  71. package/src/index.ts +5 -0
  72. package/src/lib/AutoReconnectingWebsocket.ts +163 -0
  73. package/src/lib/availableStorage.ts +46 -0
  74. package/src/lib/converters.ts +74 -0
  75. package/src/lib/errorHandling.ts +26 -0
  76. package/src/lib/v1/ConnectedMotionGroup.ts +419 -0
  77. package/src/lib/v1/JoggerConnection.ts +480 -0
  78. package/src/lib/v1/MotionStreamConnection.ts +202 -0
  79. package/src/lib/v1/NovaCellAPIClient.ts +180 -0
  80. package/src/lib/v1/NovaClient.ts +232 -0
  81. package/src/lib/v1/ProgramStateConnection.ts +267 -0
  82. package/src/lib/v1/getLatestTrajectories.ts +36 -0
  83. package/src/lib/v1/index.ts +8 -0
  84. package/src/lib/v1/mock/MockNovaInstance.ts +1302 -0
  85. package/src/lib/v1/motionStateUpdate.ts +55 -0
  86. package/src/lib/v2/ConnectedMotionGroup.ts +216 -0
  87. package/src/lib/v2/JoggerConnection.ts +207 -0
  88. package/src/lib/v2/MotionStreamConnection.ts +201 -0
  89. package/src/lib/v2/NovaCellAPIClient.ts +174 -0
  90. package/src/lib/v2/NovaClient.ts +230 -0
  91. package/src/lib/v2/ProgramStateConnection.ts +255 -0
  92. package/src/lib/v2/index.ts +7 -0
  93. package/src/lib/v2/mock/MockNovaInstance.ts +982 -0
  94. package/src/lib/v2/motionStateUpdate.ts +55 -0
  95. package/src/lib/v2/vectorUtils.ts +36 -0
@@ -0,0 +1,55 @@
1
+ import type { TcpPose } from "@wandelbots/nova-api/v2"
2
+
3
+ export function jointValuesEqual(
4
+ oldJointValues: number[],
5
+ newJointValues: number[],
6
+ changeDeltaThreshold: number,
7
+ ): boolean {
8
+ if (newJointValues.length !== oldJointValues.length) {
9
+ return true
10
+ }
11
+
12
+ for (let jointIndex = 0; jointIndex < newJointValues.length; jointIndex++) {
13
+ if (
14
+ Math.abs(newJointValues[jointIndex]! - oldJointValues[jointIndex]!) >
15
+ changeDeltaThreshold
16
+ ) {
17
+ return false
18
+ }
19
+ }
20
+
21
+ return true
22
+ }
23
+
24
+ export function tcpPoseEqual(
25
+ oldTcp: TcpPose | undefined,
26
+ newTcp: TcpPose | undefined,
27
+ changeDeltaThreshold: number,
28
+ ): boolean {
29
+ // undefined -> defined (+reverse) transition
30
+ if ((oldTcp === undefined && newTcp) || (oldTcp && newTcp === undefined)) {
31
+ return false
32
+ }
33
+
34
+ // the typechecker cannot resolve states to "!= undefined" if "&&" is used
35
+ if (oldTcp === undefined || newTcp === undefined) {
36
+ return true
37
+ }
38
+
39
+ let changedDelta = 0
40
+ changedDelta += Math.abs(oldTcp.orientation[0] - newTcp.orientation[0])
41
+ changedDelta += Math.abs(oldTcp.orientation[1] - newTcp.orientation[1])
42
+ changedDelta += Math.abs(oldTcp.orientation[2] - newTcp.orientation[2])
43
+ changedDelta += Math.abs(oldTcp.position[0] - newTcp.position[0])
44
+ changedDelta += Math.abs(oldTcp.position[1] - newTcp.position[1])
45
+ changedDelta += Math.abs(oldTcp.position[2] - newTcp.position[2])
46
+
47
+ if (changedDelta > changeDeltaThreshold) {
48
+ return false
49
+ }
50
+
51
+ return (
52
+ oldTcp.coordinate_system === newTcp.coordinate_system &&
53
+ oldTcp.tcp === newTcp.tcp
54
+ )
55
+ }
@@ -0,0 +1,36 @@
1
+ import * as THREE from "three"
2
+
3
+ // Vector used by api endpoints
4
+ export type Vector3d = [number, number, number]
5
+
6
+ export function axisToIndex(axis: "x" | "y" | "z"): number {
7
+ switch (axis) {
8
+ case "x":
9
+ return 0
10
+ case "y":
11
+ return 1
12
+ case "z":
13
+ return 2
14
+ }
15
+ }
16
+
17
+ export function indexToAxis(index: number): "x" | "y" | "z" | null {
18
+ switch (index) {
19
+ case 0:
20
+ return "x"
21
+ case 1:
22
+ return "y"
23
+ case 2:
24
+ return "z"
25
+ default:
26
+ return null
27
+ }
28
+ }
29
+
30
+ export function vector3FromArray(vector: Vector3d): THREE.Vector3 {
31
+ return new THREE.Vector3(vector[0], vector[1], vector[2])
32
+ }
33
+
34
+ export function vector3ToArray(vector: THREE.Vector3): Vector3d {
35
+ return [vector.x, vector.y, vector.z]
36
+ }