@wandelbots/wandelbots-js-react-components 2.54.5-pr.feat-upgrade-robot-motions-to-v2.407.98ff8a7 → 2.54.5-pr.feat-jogging-blocked.406.76c87b3

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 (55) hide show
  1. package/dist/components/ProgramStateIndicator.d.ts +3 -3
  2. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  3. package/dist/components/RobotCard.d.ts +3 -4
  4. package/dist/components/RobotCard.d.ts.map +1 -1
  5. package/dist/components/jogging/JoggingBlocked.d.ts +7 -0
  6. package/dist/components/jogging/JoggingBlocked.d.ts.map +1 -0
  7. package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
  8. package/dist/components/jogging/JoggingStore.d.ts +4 -0
  9. package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
  10. package/dist/components/robots/DHRobot.d.ts.map +1 -1
  11. package/dist/components/robots/Robot.d.ts +1 -1
  12. package/dist/components/robots/Robot.d.ts.map +1 -1
  13. package/dist/components/robots/RobotAnimator.d.ts +2 -2
  14. package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
  15. package/dist/components/robots/SupportedRobot.d.ts +3 -3
  16. package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
  17. package/dist/components/robots/manufacturerHomePositions.d.ts +1 -1
  18. package/dist/components/safetyBar/OperationModeIndicator.d.ts +2 -2
  19. package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
  20. package/dist/components/safetyBar/SafetyBar.d.ts +3 -3
  21. package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
  22. package/dist/components/safetyBar/SafetyStateIndicator.d.ts +2 -2
  23. package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
  24. package/dist/index.cjs +44 -44
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.js +3324 -3269
  27. package/dist/index.js.map +1 -1
  28. package/dist/lib/ConnectedMotionGroup.d.ts +1 -7
  29. package/dist/lib/ConnectedMotionGroup.d.ts.map +1 -1
  30. package/dist/lib/JoggerConnection.d.ts +2 -1
  31. package/dist/lib/JoggerConnection.d.ts.map +1 -1
  32. package/dist/lib/MotionStreamConnection.d.ts.map +1 -1
  33. package/dist/lib/motionStateUpdate.d.ts +0 -2
  34. package/dist/lib/motionStateUpdate.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/ProgramStateIndicator.tsx +6 -3
  37. package/src/components/RobotCard.tsx +7 -4
  38. package/src/components/jogging/JoggingBlocked.tsx +37 -0
  39. package/src/components/jogging/JoggingPanel.tsx +3 -1
  40. package/src/components/jogging/JoggingStore.ts +22 -0
  41. package/src/components/robots/DHRobot.tsx +3 -2
  42. package/src/components/robots/Robot.tsx +1 -1
  43. package/src/components/robots/RobotAnimator.test.tsx +22 -7
  44. package/src/components/robots/RobotAnimator.tsx +13 -8
  45. package/src/components/robots/SupportedRobot.tsx +6 -3
  46. package/src/components/robots/manufacturerHomePositions.ts +1 -1
  47. package/src/components/safetyBar/OperationModeIndicator.tsx +2 -2
  48. package/src/components/safetyBar/SafetyBar.tsx +6 -3
  49. package/src/components/safetyBar/SafetyStateIndicator.tsx +2 -2
  50. package/src/i18n/locales/de/translations.json +3 -0
  51. package/src/i18n/locales/en/translations.json +3 -0
  52. package/src/lib/ConnectedMotionGroup.ts +4 -22
  53. package/src/lib/JoggerConnection.ts +21 -6
  54. package/src/lib/MotionStreamConnection.ts +42 -7
  55. package/src/lib/motionStateUpdate.ts +0 -41
@@ -6,15 +6,51 @@ import type {
6
6
  RobotControllerState,
7
7
  } from "@wandelbots/nova-js/v2"
8
8
  import { makeAutoObservable, runInAction } from "mobx"
9
+ import { Vector3 } from "three"
9
10
  import type { Vector3Simple } from "./JoggerConnection"
10
- import {
11
- jointValuesEqual,
12
- tcpMotionEqual,
13
- unwrapRotationVector,
14
- } from "./motionStateUpdate"
11
+ import { jointValuesEqual, tcpMotionEqual } from "./motionStateUpdate"
15
12
 
16
13
  const MOTION_DELTA_THRESHOLD = 0.0001
17
14
 
15
+ function unwrapRotationVector(
16
+ newRotationVectorApi: Vector3Simple,
17
+ currentRotationVectorApi: Vector3Simple,
18
+ ): Vector3Simple {
19
+ const currentRotationVector = new Vector3(
20
+ currentRotationVectorApi[0],
21
+ currentRotationVectorApi[1],
22
+ currentRotationVectorApi[2],
23
+ )
24
+
25
+ const newRotationVector = new Vector3(
26
+ newRotationVectorApi[0],
27
+ newRotationVectorApi[1],
28
+ newRotationVectorApi[2],
29
+ )
30
+
31
+ const currentAngle = currentRotationVector.length()
32
+ const currentAxis = currentRotationVector.normalize()
33
+
34
+ let newAngle = newRotationVector.length()
35
+ let newAxis = newRotationVector.normalize()
36
+
37
+ // Align rotation axes
38
+ if (newAxis.dot(currentAxis) < 0) {
39
+ newAngle = -newAngle
40
+ newAxis = newAxis.multiplyScalar(-1.0)
41
+ }
42
+
43
+ // Shift rotation angle close to previous one to extend domain of rotation angles beyond [0, pi]
44
+ // - this simplifies interpolation and prevents abruptly changing signs of the rotation angles
45
+ let angleDifference = newAngle - currentAngle
46
+ angleDifference -=
47
+ 2.0 * Math.PI * Math.floor((angleDifference + Math.PI) / (2.0 * Math.PI))
48
+
49
+ newAngle = currentAngle + angleDifference
50
+
51
+ return [...newAxis.multiplyScalar(newAngle)] as Vector3Simple
52
+ }
53
+
18
54
  /**
19
55
  * Store representing the current state of a connected motion group.
20
56
  */
@@ -106,8 +142,7 @@ export class MotionStreamConnection {
106
142
  )
107
143
  ) {
108
144
  runInAction(() => {
109
- this.rapidlyChangingMotionState.joint_position =
110
- latestMotionState.joint_position
145
+ this.rapidlyChangingMotionState = latestMotionState
111
146
  })
112
147
  }
113
148
 
@@ -1,6 +1,4 @@
1
1
  import type { MotionGroupState, Pose } from "@wandelbots/nova-js/v2"
2
- import type { Vector3Simple } from "./JoggerConnection"
3
- import { Vector3 } from "three"
4
2
 
5
3
  export function jointValuesEqual(
6
4
  oldJointValues: number[],
@@ -76,42 +74,3 @@ export function tcpMotionEqual(
76
74
  )
77
75
  )
78
76
  }
79
-
80
- export function unwrapRotationVector(
81
- newRotationVectorApi: Vector3Simple,
82
- currentRotationVectorApi: Vector3Simple,
83
- ): Vector3Simple {
84
- const currentRotationVector = new Vector3(
85
- currentRotationVectorApi[0],
86
- currentRotationVectorApi[1],
87
- currentRotationVectorApi[2],
88
- )
89
-
90
- const newRotationVector = new Vector3(
91
- newRotationVectorApi[0],
92
- newRotationVectorApi[1],
93
- newRotationVectorApi[2],
94
- )
95
-
96
- const currentAngle = currentRotationVector.length()
97
- const currentAxis = currentRotationVector.normalize()
98
-
99
- let newAngle = newRotationVector.length()
100
- let newAxis = newRotationVector.normalize()
101
-
102
- // Align rotation axes
103
- if (newAxis.dot(currentAxis) < 0) {
104
- newAngle = -newAngle
105
- newAxis = newAxis.multiplyScalar(-1.0)
106
- }
107
-
108
- // Shift rotation angle close to previous one to extend domain of rotation angles beyond [0, pi]
109
- // - this simplifies interpolation and prevents abruptly changing signs of the rotation angles
110
- let angleDifference = newAngle - currentAngle
111
- angleDifference -=
112
- 2.0 * Math.PI * Math.floor((angleDifference + Math.PI) / (2.0 * Math.PI))
113
-
114
- newAngle = currentAngle + angleDifference
115
-
116
- return [...newAxis.multiplyScalar(newAngle)] as Vector3Simple
117
- }