@wandelbots/wandelbots-js-react-components 3.4.0-pr.feat-yaskawa-gp200s.437.5d50e5b → 3.4.0-pr.feat-add-yaskawa-gp200s.438.0503e4b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -61
- package/dist/auth0-spa-js.production.esm-1QXzndwB.js +950 -0
- package/dist/auth0-spa-js.production.esm-1QXzndwB.js.map +1 -0
- package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs +5 -0
- package/dist/auth0-spa-js.production.esm-BLRAk7Yh.cjs.map +1 -0
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts +1 -1
- package/dist/components/3d-viewport/CoordinateSystemTransform.d.ts.map +1 -1
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts +1 -1
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts.map +1 -1
- package/dist/components/ProgramStateIndicator.d.ts +3 -3
- package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
- package/dist/components/RobotCard.d.ts +3 -4
- package/dist/components/RobotCard.d.ts.map +1 -1
- package/dist/components/jogging/JoggingCartesianTab.d.ts.map +1 -1
- package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts +1 -1
- package/dist/components/jogging/JoggingPanel.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +5 -10
- package/dist/components/jogging/JoggingStore.d.ts.map +1 -1
- package/dist/components/jogging/PoseCartesianValues.d.ts +2 -2
- package/dist/components/jogging/PoseCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/PoseJointValues.d.ts +2 -1
- package/dist/components/jogging/PoseJointValues.d.ts.map +1 -1
- package/dist/components/robots/DHRobot.d.ts.map +1 -1
- package/dist/components/robots/Robot.d.ts +1 -1
- package/dist/components/robots/Robot.d.ts.map +1 -1
- package/dist/components/robots/RobotAnimator.d.ts +2 -2
- package/dist/components/robots/RobotAnimator.d.ts.map +1 -1
- package/dist/components/robots/SupportedRobot.d.ts +3 -3
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/robots/manufacturerHomePositions.d.ts +1 -1
- package/dist/components/robots/manufacturerHomePositions.d.ts.map +1 -1
- package/dist/components/safetyBar/ControllerTypeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/OperationModeIndicator.d.ts +2 -2
- package/dist/components/safetyBar/OperationModeIndicator.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyBar.d.ts +3 -3
- package/dist/components/safetyBar/SafetyBar.d.ts.map +1 -1
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts +2 -2
- package/dist/components/safetyBar/SafetyStateIndicator.d.ts.map +1 -1
- package/dist/components/utils/errorHandling.d.ts.map +1 -1
- package/dist/index.cjs +155 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +39 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34927 -0
- package/dist/index.js.map +1 -0
- package/package.json +21 -49
- package/src/components/3d-viewport/CoordinateSystemTransform.tsx +1 -1
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +2 -1
- package/src/components/3d-viewport/collider/ColliderCollection.tsx +1 -1
- package/src/components/3d-viewport/collider/ColliderElement.tsx +1 -1
- package/src/components/3d-viewport/collider/CollisionSceneRenderer.tsx +1 -1
- package/src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts +1 -1
- package/src/components/AppHeader.md +1 -1
- package/src/components/ProgramStateIndicator.tsx +6 -3
- package/src/components/RobotCard.tsx +7 -4
- package/src/components/jogging/JoggingCartesianTab.tsx +11 -13
- package/src/components/jogging/JoggingJointLimitDetector.tsx +2 -2
- package/src/components/jogging/JoggingJointTab.tsx +4 -4
- package/src/components/jogging/JoggingOptions.tsx +5 -6
- package/src/components/jogging/JoggingPanel.tsx +3 -6
- package/src/components/jogging/JoggingStore.ts +39 -66
- package/src/components/jogging/PoseCartesianValues.tsx +4 -3
- package/src/components/jogging/PoseJointValues.tsx +4 -3
- package/src/components/robots/DHRobot.tsx +3 -2
- package/src/components/robots/Robot.tsx +1 -1
- package/src/components/robots/RobotAnimator.test.tsx +22 -7
- package/src/components/robots/RobotAnimator.tsx +13 -8
- package/src/components/robots/SupportedRobot.tsx +6 -3
- package/src/components/robots/manufacturerHomePositions.ts +1 -1
- package/src/components/safetyBar/ControllerTypeIndicator.tsx +2 -4
- package/src/components/safetyBar/OperationModeIndicator.tsx +5 -7
- package/src/components/safetyBar/SafetyBar.tsx +6 -3
- package/src/components/safetyBar/SafetyStateIndicator.tsx +7 -9
- package/src/components/utils/errorHandling.ts +0 -4
- package/src/i18n/locales/de/translations.json +0 -3
- package/src/i18n/locales/en/translations.json +0 -3
- package/src/index.ts +43 -4
- package/dist/3d.cjs.js +0 -2
- package/dist/3d.cjs.js.map +0 -1
- package/dist/3d.d.ts +0 -11
- package/dist/3d.d.ts.map +0 -1
- package/dist/3d.es.js +0 -16
- package/dist/3d.es.js.map +0 -1
- package/dist/LoadingCover-Dr9hDTku.js +0 -87
- package/dist/LoadingCover-Dr9hDTku.js.map +0 -1
- package/dist/LoadingCover-r2yhJZF9.cjs +0 -2
- package/dist/LoadingCover-r2yhJZF9.cjs.map +0 -1
- package/dist/WandelscriptEditor-Dj7TBCkF.cjs +0 -2
- package/dist/WandelscriptEditor-Dj7TBCkF.cjs.map +0 -1
- package/dist/WandelscriptEditor-DnJvITTA.js +0 -140
- package/dist/WandelscriptEditor-DnJvITTA.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-9WdmjTxR.js +0 -1429
- package/dist/auth0-spa-js.production.esm-9WdmjTxR.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs +0 -5
- package/dist/auth0-spa-js.production.esm-BcLLh1tx.cjs.map +0 -1
- package/dist/components/jogging/JoggingBlocked.d.ts +0 -7
- package/dist/components/jogging/JoggingBlocked.d.ts.map +0 -1
- package/dist/components/utils/errorHandling.test.d.ts +0 -2
- package/dist/components/utils/errorHandling.test.d.ts.map +0 -1
- package/dist/core.cjs.js +0 -2
- package/dist/core.cjs.js.map +0 -1
- package/dist/core.d.ts +0 -33
- package/dist/core.d.ts.map +0 -1
- package/dist/core.es.js +0 -54
- package/dist/core.es.js.map +0 -1
- package/dist/index-CAib4NKw.js +0 -2261
- package/dist/index-CAib4NKw.js.map +0 -1
- package/dist/index-CqMZL0FV.cjs +0 -2
- package/dist/index-CqMZL0FV.cjs.map +0 -1
- package/dist/index-CxasuX80.js +0 -5212
- package/dist/index-CxasuX80.js.map +0 -1
- package/dist/index-DxwppshT.cjs +0 -29
- package/dist/index-DxwppshT.cjs.map +0 -1
- package/dist/index.cjs.js +0 -2
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -69
- package/dist/index.es.js.map +0 -1
- package/dist/lib/ConnectedMotionGroup.d.ts +0 -90
- package/dist/lib/ConnectedMotionGroup.d.ts.map +0 -1
- package/dist/lib/JoggerConnection.d.ts +0 -113
- package/dist/lib/JoggerConnection.d.ts.map +0 -1
- package/dist/lib/JoggerConnection.test.d.ts +0 -2
- package/dist/lib/JoggerConnection.test.d.ts.map +0 -1
- package/dist/lib/MotionStreamConnection.d.ts +0 -24
- package/dist/lib/MotionStreamConnection.d.ts.map +0 -1
- package/dist/lib/MotionStreamConnection.test.d.ts +0 -2
- package/dist/lib/MotionStreamConnection.test.d.ts.map +0 -1
- package/dist/lib/motionStateUpdate.d.ts +0 -7
- package/dist/lib/motionStateUpdate.d.ts.map +0 -1
- package/dist/lib/motionStateUpdate.test.d.ts +0 -2
- package/dist/lib/motionStateUpdate.test.d.ts.map +0 -1
- package/dist/manufacturerHomePositions-Ca80ycLi.cjs +0 -2
- package/dist/manufacturerHomePositions-Ca80ycLi.cjs.map +0 -1
- package/dist/manufacturerHomePositions-CgaG5vaK.js +0 -976
- package/dist/manufacturerHomePositions-CgaG5vaK.js.map +0 -1
- package/dist/theming-BQcKj8Gp.cjs +0 -133
- package/dist/theming-BQcKj8Gp.cjs.map +0 -1
- package/dist/theming-Bafjg0Wg.js +0 -23460
- package/dist/theming-Bafjg0Wg.js.map +0 -1
- package/dist/wandelscript.cjs.js +0 -2
- package/dist/wandelscript.cjs.js.map +0 -1
- package/dist/wandelscript.d.ts +0 -2
- package/dist/wandelscript.d.ts.map +0 -1
- package/dist/wandelscript.es.js +0 -5
- package/dist/wandelscript.es.js.map +0 -1
- package/src/3d.ts +0 -15
- package/src/components/jogging/JoggingBlocked.tsx +0 -37
- package/src/components/utils/errorHandling.test.ts +0 -41
- package/src/core.ts +0 -33
- package/src/lib/ConnectedMotionGroup.ts +0 -444
- package/src/lib/JoggerConnection.test.ts +0 -120
- package/src/lib/JoggerConnection.ts +0 -674
- package/src/lib/MotionStreamConnection.test.ts +0 -23
- package/src/lib/MotionStreamConnection.ts +0 -189
- package/src/lib/motionStateUpdate.test.ts +0 -28
- package/src/lib/motionStateUpdate.ts +0 -117
- package/src/wandelscript.ts +0 -2
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type AutoReconnectingWebsocket,
|
|
3
|
-
tryParseJson,
|
|
4
|
-
} from "@wandelbots/nova-js"
|
|
5
|
-
import type {
|
|
6
|
-
MotionGroupDescription,
|
|
7
|
-
MotionGroupState,
|
|
8
|
-
NovaClient,
|
|
9
|
-
RobotControllerState,
|
|
10
|
-
} from "@wandelbots/nova-js/v2"
|
|
11
|
-
import { makeAutoObservable, runInAction } from "mobx"
|
|
12
|
-
import type { Vector3Simple } from "./JoggerConnection"
|
|
13
|
-
import {
|
|
14
|
-
jointValuesEqual,
|
|
15
|
-
tcpMotionEqual,
|
|
16
|
-
unwrapRotationVector,
|
|
17
|
-
} from "./motionStateUpdate"
|
|
18
|
-
|
|
19
|
-
const MOTION_DELTA_THRESHOLD = 0.0001
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Store representing the current state of a connected motion group.
|
|
23
|
-
*/
|
|
24
|
-
export class MotionStreamConnection {
|
|
25
|
-
static async open(nova: NovaClient, motionGroupId: string) {
|
|
26
|
-
const [_motionGroupIndex, controllerId] = motionGroupId.split("@") as [
|
|
27
|
-
string,
|
|
28
|
-
string,
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
const controller =
|
|
32
|
-
await nova.api.controller.getCurrentRobotControllerState(controllerId)
|
|
33
|
-
const motionGroup = controller?.motion_groups.find(
|
|
34
|
-
(mg) => mg.motion_group === motionGroupId,
|
|
35
|
-
)
|
|
36
|
-
if (!controller || !motionGroup) {
|
|
37
|
-
throw new Error(
|
|
38
|
-
`Controller ${controllerId} or motion group ${motionGroupId} not found`,
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const motionStateSocket = nova.openReconnectingWebsocket(
|
|
43
|
-
`/controllers/${controllerId}/motion-groups/${motionGroupId}/state-stream`,
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
// Wait for the first message to get the initial state
|
|
47
|
-
const firstMessage = await motionStateSocket.firstMessage()
|
|
48
|
-
const initialMotionState = tryParseJson(firstMessage.data)
|
|
49
|
-
?.result as MotionGroupState
|
|
50
|
-
|
|
51
|
-
if (!initialMotionState) {
|
|
52
|
-
throw new Error(
|
|
53
|
-
`Unable to parse initial motion state message ${firstMessage.data}`,
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
console.log(
|
|
58
|
-
`Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\n `,
|
|
59
|
-
initialMotionState,
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
// Get the motion group description for later usage in jogging
|
|
63
|
-
const description = await nova.api.motionGroup.getMotionGroupDescription(
|
|
64
|
-
controllerId,
|
|
65
|
-
motionGroup.motion_group,
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
return new MotionStreamConnection(
|
|
69
|
-
nova,
|
|
70
|
-
controller,
|
|
71
|
-
motionGroup,
|
|
72
|
-
description,
|
|
73
|
-
initialMotionState,
|
|
74
|
-
motionStateSocket,
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Not mobx-observable as this changes very fast; should be observed
|
|
79
|
-
// using animation frames
|
|
80
|
-
rapidlyChangingMotionState: MotionGroupState
|
|
81
|
-
|
|
82
|
-
constructor(
|
|
83
|
-
readonly nova: NovaClient,
|
|
84
|
-
readonly controller: RobotControllerState,
|
|
85
|
-
readonly motionGroup: MotionGroupState,
|
|
86
|
-
readonly description: MotionGroupDescription,
|
|
87
|
-
readonly initialMotionState: MotionGroupState,
|
|
88
|
-
readonly motionStateSocket: AutoReconnectingWebsocket,
|
|
89
|
-
) {
|
|
90
|
-
this.rapidlyChangingMotionState = initialMotionState
|
|
91
|
-
|
|
92
|
-
motionStateSocket.addEventListener("message", (event) => {
|
|
93
|
-
const latestMotionState = tryParseJson(event.data)?.result as
|
|
94
|
-
| MotionGroupState
|
|
95
|
-
| undefined
|
|
96
|
-
|
|
97
|
-
if (!latestMotionState) {
|
|
98
|
-
throw new Error(
|
|
99
|
-
`Failed to get motion state for ${this.motionGroupId}: ${event.data}`,
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// handle joint position changes
|
|
104
|
-
if (
|
|
105
|
-
!jointValuesEqual(
|
|
106
|
-
this.rapidlyChangingMotionState.joint_position,
|
|
107
|
-
latestMotionState.joint_position,
|
|
108
|
-
MOTION_DELTA_THRESHOLD,
|
|
109
|
-
)
|
|
110
|
-
) {
|
|
111
|
-
runInAction(() => {
|
|
112
|
-
this.rapidlyChangingMotionState.joint_position =
|
|
113
|
-
latestMotionState.joint_position
|
|
114
|
-
})
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// handle tcp pose changes
|
|
118
|
-
if (
|
|
119
|
-
!tcpMotionEqual(
|
|
120
|
-
this.rapidlyChangingMotionState,
|
|
121
|
-
latestMotionState,
|
|
122
|
-
MOTION_DELTA_THRESHOLD,
|
|
123
|
-
)
|
|
124
|
-
) {
|
|
125
|
-
runInAction(() => {
|
|
126
|
-
if (this.rapidlyChangingMotionState.tcp_pose == null) {
|
|
127
|
-
this.rapidlyChangingMotionState.tcp_pose =
|
|
128
|
-
latestMotionState.tcp_pose
|
|
129
|
-
} else if (
|
|
130
|
-
latestMotionState.tcp_pose?.orientation &&
|
|
131
|
-
latestMotionState.tcp_pose?.position &&
|
|
132
|
-
this.rapidlyChangingMotionState.tcp_pose?.orientation
|
|
133
|
-
) {
|
|
134
|
-
this.rapidlyChangingMotionState.tcp_pose = {
|
|
135
|
-
position: latestMotionState.tcp_pose.position,
|
|
136
|
-
orientation: unwrapRotationVector(
|
|
137
|
-
latestMotionState.tcp_pose.orientation as Vector3Simple,
|
|
138
|
-
this.rapidlyChangingMotionState.tcp_pose
|
|
139
|
-
.orientation as Vector3Simple,
|
|
140
|
-
),
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
console.warn(
|
|
144
|
-
"Received incomplete tcp_pose, ignoring",
|
|
145
|
-
latestMotionState.tcp_pose,
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// handle standstill changes
|
|
152
|
-
if (
|
|
153
|
-
this.rapidlyChangingMotionState.standstill !==
|
|
154
|
-
latestMotionState.standstill
|
|
155
|
-
) {
|
|
156
|
-
runInAction(() => {
|
|
157
|
-
this.rapidlyChangingMotionState.standstill =
|
|
158
|
-
latestMotionState.standstill
|
|
159
|
-
})
|
|
160
|
-
}
|
|
161
|
-
})
|
|
162
|
-
makeAutoObservable(this)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
get motionGroupId() {
|
|
166
|
-
return this.motionGroup.motion_group
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
get controllerId() {
|
|
170
|
-
return this.controller.controller
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
get wandelscriptIdentifier() {
|
|
174
|
-
const num = this.motionGroupId.split("@")[0]
|
|
175
|
-
return `${this.controllerId.replace(/-/g, "_")}_${num}`
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
get joints() {
|
|
179
|
-
return this.initialMotionState.joint_position.map((_, i) => {
|
|
180
|
-
return {
|
|
181
|
-
index: i,
|
|
182
|
-
}
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
dispose() {
|
|
187
|
-
this.motionStateSocket.close()
|
|
188
|
-
}
|
|
189
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest"
|
|
2
|
-
import { poseEqual } from "./motionStateUpdate"
|
|
3
|
-
|
|
4
|
-
describe("poseEqual", async () => {
|
|
5
|
-
test("returns true for identical poses", () => {
|
|
6
|
-
const pose1 = {
|
|
7
|
-
position: [0, 0, 0],
|
|
8
|
-
orientation: [0, 0, 0],
|
|
9
|
-
}
|
|
10
|
-
const pose2 = {
|
|
11
|
-
position: [0, 0, 0],
|
|
12
|
-
orientation: [0, 0, 0],
|
|
13
|
-
}
|
|
14
|
-
expect(poseEqual(pose1, pose2, 0.001)).toBe(true)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
test("returns false for different poses", () => {
|
|
18
|
-
const pose1 = {
|
|
19
|
-
position: [0, 0, 0],
|
|
20
|
-
orientation: [0, 0, 0],
|
|
21
|
-
}
|
|
22
|
-
const pose2 = {
|
|
23
|
-
position: [1, 1, 1],
|
|
24
|
-
orientation: [1, 1, 1],
|
|
25
|
-
}
|
|
26
|
-
expect(poseEqual(pose1, pose2, 0.001)).toBe(false)
|
|
27
|
-
})
|
|
28
|
-
})
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import type { MotionGroupState, Pose } from "@wandelbots/nova-js/v2"
|
|
2
|
-
import type { Vector3Simple } from "./JoggerConnection"
|
|
3
|
-
import { Vector3 } from "three"
|
|
4
|
-
|
|
5
|
-
export function jointValuesEqual(
|
|
6
|
-
oldJointValues: number[],
|
|
7
|
-
newJointValues: number[],
|
|
8
|
-
changeDeltaThreshold: number,
|
|
9
|
-
): boolean {
|
|
10
|
-
if (newJointValues.length !== oldJointValues.length) {
|
|
11
|
-
return true
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
for (let jointIndex = 0; jointIndex < newJointValues.length; jointIndex++) {
|
|
15
|
-
if (
|
|
16
|
-
// biome-ignore lint/style/noNonNullAssertion: legacy code
|
|
17
|
-
Math.abs(newJointValues[jointIndex]! - oldJointValues[jointIndex]!) >
|
|
18
|
-
changeDeltaThreshold
|
|
19
|
-
) {
|
|
20
|
-
return false
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return true
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function poseEqual(
|
|
28
|
-
oldTcp: Pose | undefined,
|
|
29
|
-
newTcp: Pose | undefined,
|
|
30
|
-
changeDeltaThreshold: number,
|
|
31
|
-
): boolean {
|
|
32
|
-
// undefined -> defined (+reverse) transition
|
|
33
|
-
if ((oldTcp === undefined && newTcp) || (oldTcp && newTcp === undefined)) {
|
|
34
|
-
return false
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Poses might be incomplete (missing orientation or position)
|
|
38
|
-
if (
|
|
39
|
-
oldTcp?.orientation === undefined ||
|
|
40
|
-
newTcp?.orientation === undefined ||
|
|
41
|
-
oldTcp?.position === undefined ||
|
|
42
|
-
newTcp?.position === undefined
|
|
43
|
-
) {
|
|
44
|
-
return false
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// the typechecker cannot resolve states to "!= undefined" if "&&" is used
|
|
48
|
-
if (oldTcp === undefined || newTcp === undefined) {
|
|
49
|
-
return true
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let changedDelta = 0
|
|
53
|
-
changedDelta += Math.abs(oldTcp.orientation[0] - newTcp.orientation[0])
|
|
54
|
-
changedDelta += Math.abs(oldTcp.orientation[1] - newTcp.orientation[1])
|
|
55
|
-
changedDelta += Math.abs(oldTcp.orientation[2] - newTcp.orientation[2])
|
|
56
|
-
changedDelta += Math.abs(oldTcp.position[0] - newTcp.position[0])
|
|
57
|
-
changedDelta += Math.abs(oldTcp.position[1] - newTcp.position[1])
|
|
58
|
-
changedDelta += Math.abs(oldTcp.position[2] - newTcp.position[2])
|
|
59
|
-
|
|
60
|
-
return changedDelta <= changeDeltaThreshold
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Runs poseEqual check + coordinate system/tcp name equality
|
|
64
|
-
export function tcpMotionEqual(
|
|
65
|
-
oldMotionState: MotionGroupState,
|
|
66
|
-
newMotionState: MotionGroupState,
|
|
67
|
-
changeDeltaThreshold: number,
|
|
68
|
-
): boolean {
|
|
69
|
-
return (
|
|
70
|
-
oldMotionState.coordinate_system === newMotionState.coordinate_system &&
|
|
71
|
-
oldMotionState.tcp === newMotionState.tcp &&
|
|
72
|
-
poseEqual(
|
|
73
|
-
oldMotionState.tcp_pose,
|
|
74
|
-
newMotionState.tcp_pose,
|
|
75
|
-
changeDeltaThreshold,
|
|
76
|
-
)
|
|
77
|
-
)
|
|
78
|
-
}
|
|
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
|
-
}
|
package/src/wandelscript.ts
DELETED