@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
package/dist/wandelscript.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wandelscript.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/wandelscript.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wandelscript.d.ts","sourceRoot":"","sources":["../src/wandelscript.ts"],"names":[],"mappings":"AACA,cAAc,qDAAqD,CAAA"}
|
package/dist/wandelscript.es.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wandelscript.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/src/3d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// 3D viewport and Three.js-based components
|
|
2
|
-
export { default as CollisionSceneRenderer } from "./components/3d-viewport/collider/CollisionSceneRenderer"
|
|
3
|
-
export * from "./components/3d-viewport/PresetEnvironment"
|
|
4
|
-
export * from "./components/3d-viewport/SafetyZonesRenderer"
|
|
5
|
-
export * from "./components/3d-viewport/TrajectoryRenderer"
|
|
6
|
-
export * from "./components/RobotCard"
|
|
7
|
-
export * from "./components/robots/AxisConfig"
|
|
8
|
-
export {
|
|
9
|
-
MANUFACTURER_HOME_CONFIGS,
|
|
10
|
-
extractManufacturer,
|
|
11
|
-
getDefaultHomeConfig,
|
|
12
|
-
} from "./components/robots/manufacturerHomePositions"
|
|
13
|
-
export * from "./components/robots/Robot"
|
|
14
|
-
export { defaultGetModel } from "./components/robots/robotModelLogic"
|
|
15
|
-
export * from "./components/robots/SupportedRobot"
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Alert, AlertTitle, Backdrop, Button, Stack } from "@mui/material"
|
|
2
|
-
import { observer } from "mobx-react-lite"
|
|
3
|
-
import { useTranslation } from "react-i18next"
|
|
4
|
-
import { type JoggingStore } from "./JoggingStore"
|
|
5
|
-
|
|
6
|
-
export const JoggingBlocked = observer(({ store }: { store: JoggingStore }) => {
|
|
7
|
-
const { t } = useTranslation()
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<Backdrop
|
|
11
|
-
open={true}
|
|
12
|
-
sx={{
|
|
13
|
-
position: "absolute",
|
|
14
|
-
zIndex: (theme) => theme.zIndex.drawer + 1,
|
|
15
|
-
color: "#fff",
|
|
16
|
-
background: "rgba(15, 15, 15, 0.88)",
|
|
17
|
-
justifyContent: "flex-start",
|
|
18
|
-
alignItems: "flex-start",
|
|
19
|
-
}}
|
|
20
|
-
>
|
|
21
|
-
<Stack sx={{ m: 2, width: "100%" }}>
|
|
22
|
-
<Alert severity="error" sx={{ mb: 2 }}>
|
|
23
|
-
<AlertTitle>{t("Jogging.Blocked.ti")}</AlertTitle>
|
|
24
|
-
{t("Jogging.Blocked.lb")}
|
|
25
|
-
</Alert>
|
|
26
|
-
|
|
27
|
-
<Button
|
|
28
|
-
variant="contained"
|
|
29
|
-
color="secondary"
|
|
30
|
-
onClick={() => store.unblock()}
|
|
31
|
-
>
|
|
32
|
-
{t("Jogging.Blocked.Reenable.bt")}
|
|
33
|
-
</Button>
|
|
34
|
-
</Stack>
|
|
35
|
-
</Backdrop>
|
|
36
|
-
)
|
|
37
|
-
})
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosError, AxiosHeaders } from "axios"
|
|
2
|
-
import { expect, test } from "vitest"
|
|
3
|
-
import { makeErrorMessage } from "./errorHandling"
|
|
4
|
-
|
|
5
|
-
test("making useful error messages", async () => {
|
|
6
|
-
// Error objects take the message
|
|
7
|
-
const someCustomError = new Error("some custom error")
|
|
8
|
-
expect(makeErrorMessage(someCustomError)).toEqual("some custom error")
|
|
9
|
-
|
|
10
|
-
// Strings go through prefixed
|
|
11
|
-
expect(makeErrorMessage("some string")).toEqual(
|
|
12
|
-
'Unexpected error: "some string"',
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
// Random objects get serialized
|
|
16
|
-
expect(makeErrorMessage({ some: "object" })).toEqual(
|
|
17
|
-
'Unexpected error: {"some":"object"}',
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
// Axios errors with a response should include the response code
|
|
21
|
-
// and url - but not for 404, we use a friendly message for that
|
|
22
|
-
try {
|
|
23
|
-
await axios.get("http://example.com/doesnt-exist")
|
|
24
|
-
expect(true).toBe(false)
|
|
25
|
-
} catch (err) {
|
|
26
|
-
expect(makeErrorMessage(err)).toMatch(
|
|
27
|
-
"Failed to connect to the server. Please check your internet connection.",
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Not sure how to reproduce CORS errors naturally in vitest environment
|
|
32
|
-
// so let's create it manually
|
|
33
|
-
const networkError = new AxiosError("Network Error", "ERR_NETWORK", {
|
|
34
|
-
url: "http://example.com/some-cors-thing",
|
|
35
|
-
method: "post",
|
|
36
|
-
headers: new AxiosHeaders(),
|
|
37
|
-
})
|
|
38
|
-
expect(makeErrorMessage(networkError)).toEqual(
|
|
39
|
-
"Failed to connect to the server. Please check your internet connection.",
|
|
40
|
-
)
|
|
41
|
-
})
|
package/src/core.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Core components without heavy dependencies (Three.js, Monaco, MUI X)
|
|
2
|
-
export * from "./components/AppHeader"
|
|
3
|
-
export * from "./components/CycleTimer"
|
|
4
|
-
export * from "./components/DataGrid"
|
|
5
|
-
export * from "./components/jogging/JoggingCartesianAxisControl"
|
|
6
|
-
export * from "./components/jogging/JoggingJointRotationControl"
|
|
7
|
-
export * from "./components/jogging/JoggingPanel"
|
|
8
|
-
export { JoggingStore } from "./components/jogging/JoggingStore"
|
|
9
|
-
export * from "./components/jogging/PoseCartesianValues"
|
|
10
|
-
export * from "./components/jogging/PoseJointValues"
|
|
11
|
-
export * from "./components/LoadingCover"
|
|
12
|
-
export * from "./components/LogPanel"
|
|
13
|
-
export { LogStore } from "./components/LogStore"
|
|
14
|
-
export * from "./components/LogViewer"
|
|
15
|
-
export * from "./components/modal/NoMotionGroupModal"
|
|
16
|
-
export * from "./components/ProgramControl"
|
|
17
|
-
export * from "./components/ProgramStateIndicator"
|
|
18
|
-
export * from "./components/RobotListItem"
|
|
19
|
-
export * from "./components/RobotSetupReadinessIndicator"
|
|
20
|
-
export * from "./components/safetyBar/SafetyBar"
|
|
21
|
-
export * from "./components/SelectableFab"
|
|
22
|
-
export * from "./components/TabBar"
|
|
23
|
-
export * from "./components/Timer"
|
|
24
|
-
export * from "./components/utils/hooks"
|
|
25
|
-
export * from "./components/utils/interpolation"
|
|
26
|
-
export * from "./components/VelocitySlider"
|
|
27
|
-
export * from "./i18n/config"
|
|
28
|
-
export * from "./lib/ConnectedMotionGroup"
|
|
29
|
-
export * from "./lib/JoggerConnection"
|
|
30
|
-
export * from "./lib/motionStateUpdate"
|
|
31
|
-
export * from "./lib/MotionStreamConnection"
|
|
32
|
-
export * from "./themes/themeTypes"
|
|
33
|
-
export { createNovaMuiTheme } from "./themes/theming"
|
|
@@ -1,444 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
tryParseJson,
|
|
3
|
-
type AutoReconnectingWebsocket,
|
|
4
|
-
} from "@wandelbots/nova-js"
|
|
5
|
-
import type {
|
|
6
|
-
DHParameter,
|
|
7
|
-
MotionGroupDescription,
|
|
8
|
-
MotionGroupState,
|
|
9
|
-
NovaClient,
|
|
10
|
-
OperationMode,
|
|
11
|
-
RobotControllerState,
|
|
12
|
-
SafetyStateType,
|
|
13
|
-
} from "@wandelbots/nova-js/v2"
|
|
14
|
-
import { makeAutoObservable, runInAction } from "mobx"
|
|
15
|
-
import * as THREE from "three"
|
|
16
|
-
import type { Vector3Simple } from "./JoggerConnection"
|
|
17
|
-
import { jointValuesEqual, tcpMotionEqual } from "./motionStateUpdate"
|
|
18
|
-
|
|
19
|
-
const MOTION_DELTA_THRESHOLD = 0.0001
|
|
20
|
-
|
|
21
|
-
export type RobotTcpLike = {
|
|
22
|
-
id: string
|
|
23
|
-
readable_name: string
|
|
24
|
-
position: Vector3Simple
|
|
25
|
-
orientation: Vector3Simple
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export type MotionGroupOption = {
|
|
29
|
-
selectionId: string
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const EMPTY_DH_PARAMETER: DHParameter = {
|
|
33
|
-
a: 0,
|
|
34
|
-
d: 0,
|
|
35
|
-
alpha: 0,
|
|
36
|
-
theta: 0,
|
|
37
|
-
reverse_rotation_direction: false,
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Store representing the current state of a connected motion group.
|
|
42
|
-
* API v2 version, not used yet in the components.
|
|
43
|
-
*/
|
|
44
|
-
export class ConnectedMotionGroup {
|
|
45
|
-
static async connectMultiple(nova: NovaClient, motionGroupIds: string[]) {
|
|
46
|
-
return Promise.all(
|
|
47
|
-
motionGroupIds.map((motionGroupId) =>
|
|
48
|
-
ConnectedMotionGroup.connect(nova, motionGroupId),
|
|
49
|
-
),
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static async connect(nova: NovaClient, motionGroupId: string) {
|
|
54
|
-
const [_motionGroupIndex, controllerId] = motionGroupId.split("@") as [
|
|
55
|
-
string,
|
|
56
|
-
string,
|
|
57
|
-
]
|
|
58
|
-
|
|
59
|
-
const controller =
|
|
60
|
-
await nova.api.controller.getCurrentRobotControllerState(controllerId)
|
|
61
|
-
const motionGroup = controller?.motion_groups.find(
|
|
62
|
-
(mg) => mg.motion_group === motionGroupId,
|
|
63
|
-
)
|
|
64
|
-
if (!controller || !motionGroup) {
|
|
65
|
-
throw new Error(
|
|
66
|
-
`Controller ${controllerId} or motion group ${motionGroupId} not found`,
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const motionStateSocket = nova.openReconnectingWebsocket(
|
|
71
|
-
`/controllers/${controllerId}/motion-groups/${motionGroupId}/state-stream`,
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
// Wait for the first message to get the initial state
|
|
75
|
-
const firstMessage = await motionStateSocket.firstMessage()
|
|
76
|
-
const initialMotionState = tryParseJson(firstMessage.data)
|
|
77
|
-
?.result as MotionGroupState
|
|
78
|
-
|
|
79
|
-
if (!initialMotionState) {
|
|
80
|
-
throw new Error(
|
|
81
|
-
`Unable to parse initial motion state message ${firstMessage.data}`,
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
console.log(
|
|
86
|
-
`Connected motion state websocket to motion group ${motionGroup.motion_group}. Initial state:\n `,
|
|
87
|
-
initialMotionState,
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
// Check if robot is virtual or physical
|
|
91
|
-
const config = await nova.api.controller.getRobotController(
|
|
92
|
-
controller.controller,
|
|
93
|
-
)
|
|
94
|
-
const isVirtual = config.configuration.kind === "VirtualController"
|
|
95
|
-
|
|
96
|
-
// If there's a configured mounting, we need it to show the right
|
|
97
|
-
// position of the robot model
|
|
98
|
-
const description = await nova.api.motionGroup.getMotionGroupDescription(
|
|
99
|
-
controllerId,
|
|
100
|
-
motionGroup.motion_group,
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
// Find out what TCPs this motion group has (we need it for jogging)
|
|
104
|
-
// There are converted into a RobotTcpLike for easier use in the UI
|
|
105
|
-
const tcps: RobotTcpLike[] = Object.entries(description.tcps || {}).map(
|
|
106
|
-
([id, tcp]) => ({
|
|
107
|
-
id,
|
|
108
|
-
readable_name: tcp.name,
|
|
109
|
-
position: tcp.pose.position as Vector3Simple,
|
|
110
|
-
orientation: tcp.pose.orientation as Vector3Simple,
|
|
111
|
-
}),
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
// Open the websocket to monitor controller state for e.g. e-stop
|
|
115
|
-
const controllerStateSocket = nova.openReconnectingWebsocket(
|
|
116
|
-
`/controllers/${controller.controller}/state-stream?response_rate=1000`,
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
// Wait for the first message to get the initial state
|
|
120
|
-
const firstControllerMessage = await controllerStateSocket.firstMessage()
|
|
121
|
-
const initialControllerState = tryParseJson(firstControllerMessage.data)
|
|
122
|
-
?.result as RobotControllerState
|
|
123
|
-
|
|
124
|
-
if (!initialControllerState) {
|
|
125
|
-
throw new Error(
|
|
126
|
-
`Unable to parse initial controller state message ${firstControllerMessage.data}`,
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
console.log(
|
|
131
|
-
`Connected controller state websocket to controller ${controller.controller}. Initial state:\n `,
|
|
132
|
-
initialControllerState,
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
return new ConnectedMotionGroup(
|
|
136
|
-
nova,
|
|
137
|
-
controller,
|
|
138
|
-
motionGroup,
|
|
139
|
-
initialMotionState,
|
|
140
|
-
motionStateSocket,
|
|
141
|
-
isVirtual,
|
|
142
|
-
tcps,
|
|
143
|
-
description,
|
|
144
|
-
initialControllerState,
|
|
145
|
-
controllerStateSocket,
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
connectedJoggingSocket: WebSocket | null = null
|
|
150
|
-
// biome-ignore lint/suspicious/noExplicitAny: legacy code
|
|
151
|
-
planData: any | null // tmp
|
|
152
|
-
joggingVelocity: number = 10
|
|
153
|
-
|
|
154
|
-
// Not mobx-observable as this changes very fast; should be observed
|
|
155
|
-
// using animation frames
|
|
156
|
-
rapidlyChangingMotionState: MotionGroupState
|
|
157
|
-
|
|
158
|
-
// Response rate on the websocket should be a bit slower on this one since
|
|
159
|
-
// we don't use the motion data
|
|
160
|
-
controllerState: RobotControllerState
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Reflects activation state of the motion group / robot servos. The
|
|
164
|
-
* movement controls in the UI should only be enabled in the "active" state
|
|
165
|
-
*/
|
|
166
|
-
activationState: "inactive" | "activating" | "deactivating" | "active" =
|
|
167
|
-
"inactive"
|
|
168
|
-
|
|
169
|
-
constructor(
|
|
170
|
-
readonly nova: NovaClient,
|
|
171
|
-
readonly controller: RobotControllerState,
|
|
172
|
-
readonly motionGroup: MotionGroupState,
|
|
173
|
-
readonly initialMotionState: MotionGroupState,
|
|
174
|
-
readonly motionStateSocket: AutoReconnectingWebsocket,
|
|
175
|
-
readonly isVirtual: boolean,
|
|
176
|
-
readonly tcps: RobotTcpLike[],
|
|
177
|
-
readonly description: MotionGroupDescription,
|
|
178
|
-
readonly initialControllerState: RobotControllerState,
|
|
179
|
-
readonly controllerStateSocket: AutoReconnectingWebsocket,
|
|
180
|
-
) {
|
|
181
|
-
this.rapidlyChangingMotionState = initialMotionState
|
|
182
|
-
this.controllerState = initialControllerState
|
|
183
|
-
|
|
184
|
-
// Track controller state updates (e.g. safety state and operation mode)
|
|
185
|
-
controllerStateSocket.addEventListener("message", (event) => {
|
|
186
|
-
const data = tryParseJson(event.data)?.result
|
|
187
|
-
|
|
188
|
-
if (!data) {
|
|
189
|
-
return
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
runInAction(() => {
|
|
193
|
-
this.controllerState = data
|
|
194
|
-
})
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
motionStateSocket.addEventListener("message", (event) => {
|
|
198
|
-
const latestMotionState = tryParseJson(event.data)?.result as
|
|
199
|
-
| MotionGroupState
|
|
200
|
-
| undefined
|
|
201
|
-
|
|
202
|
-
if (!latestMotionState) {
|
|
203
|
-
throw new Error(
|
|
204
|
-
`Failed to get motion state for ${this.motionGroupId}: ${event.data}`,
|
|
205
|
-
)
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// handle joint position changes
|
|
209
|
-
if (
|
|
210
|
-
!jointValuesEqual(
|
|
211
|
-
this.rapidlyChangingMotionState.joint_position,
|
|
212
|
-
latestMotionState.joint_position,
|
|
213
|
-
MOTION_DELTA_THRESHOLD,
|
|
214
|
-
)
|
|
215
|
-
) {
|
|
216
|
-
runInAction(() => {
|
|
217
|
-
this.rapidlyChangingMotionState.joint_position =
|
|
218
|
-
latestMotionState.joint_position
|
|
219
|
-
})
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// handle tcp pose changes
|
|
223
|
-
if (
|
|
224
|
-
!tcpMotionEqual(
|
|
225
|
-
this.rapidlyChangingMotionState,
|
|
226
|
-
latestMotionState,
|
|
227
|
-
MOTION_DELTA_THRESHOLD,
|
|
228
|
-
)
|
|
229
|
-
) {
|
|
230
|
-
runInAction(() => {
|
|
231
|
-
this.rapidlyChangingMotionState.tcp_pose = latestMotionState.tcp_pose
|
|
232
|
-
})
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// handle standstill changes
|
|
236
|
-
if (
|
|
237
|
-
this.rapidlyChangingMotionState.standstill !==
|
|
238
|
-
latestMotionState.standstill
|
|
239
|
-
) {
|
|
240
|
-
runInAction(() => {
|
|
241
|
-
this.rapidlyChangingMotionState.standstill =
|
|
242
|
-
latestMotionState.standstill
|
|
243
|
-
})
|
|
244
|
-
}
|
|
245
|
-
})
|
|
246
|
-
makeAutoObservable(this)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
get motionGroupId() {
|
|
250
|
-
return this.motionGroup.motion_group
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
get controllerId() {
|
|
254
|
-
return this.controller.controller
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
get modelFromController() {
|
|
258
|
-
return this.description.motion_group_model
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
get wandelscriptIdentifier() {
|
|
262
|
-
const num = this.motionGroupId.split("@")[0]
|
|
263
|
-
return `${this.controllerId.replace(/-/g, "_")}_${num}`
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/** Jogging velocity in radians for rotation and joint movement */
|
|
267
|
-
get joggingVelocityRads() {
|
|
268
|
-
return (this.joggingVelocity * Math.PI) / 180
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
get joints() {
|
|
272
|
-
return this.initialMotionState.joint_position.map((_, i) => {
|
|
273
|
-
return {
|
|
274
|
-
index: i,
|
|
275
|
-
}
|
|
276
|
-
})
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Please note that API v2 omits 0 values
|
|
280
|
-
get dhParameters() {
|
|
281
|
-
if (this.description.dh_parameters === undefined) {
|
|
282
|
-
return undefined
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return this.description.dh_parameters.map((dh_param) => ({
|
|
286
|
-
...EMPTY_DH_PARAMETER,
|
|
287
|
-
...dh_param,
|
|
288
|
-
}))
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
get safetyZones() {
|
|
292
|
-
return this.description.safety_zones
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/** Gets the robot mounting position offset in 3D viz coordinates */
|
|
296
|
-
get mountingPosition(): [number, number, number] {
|
|
297
|
-
if (!this.description.mounting) {
|
|
298
|
-
return [0, 0, 0]
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
return [
|
|
302
|
-
(this.description.mounting.position?.[0] || 0) / 1000,
|
|
303
|
-
(this.description.mounting.position?.[1] || 0) / 1000,
|
|
304
|
-
(this.description.mounting.position?.[2] || 0) / 1000,
|
|
305
|
-
]
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/** Gets the robot mounting position rotation in 3D viz coordinates */
|
|
309
|
-
get mountingQuaternion() {
|
|
310
|
-
const rotationVector = new THREE.Vector3(
|
|
311
|
-
this.description.mounting?.orientation?.[0] || 0,
|
|
312
|
-
this.description.mounting?.orientation?.[1] || 0,
|
|
313
|
-
this.description.mounting?.orientation?.[2] || 0,
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
const magnitude = rotationVector.length()
|
|
317
|
-
const axis = rotationVector.normalize()
|
|
318
|
-
|
|
319
|
-
return new THREE.Quaternion().setFromAxisAngle(axis, magnitude)
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Whether the controller is currently in a safety state
|
|
324
|
-
* corresponding to an emergency stop
|
|
325
|
-
*/
|
|
326
|
-
get isEstopActive() {
|
|
327
|
-
const estopStates: SafetyStateType[] = [
|
|
328
|
-
"SAFETY_STATE_ROBOT_EMERGENCY_STOP",
|
|
329
|
-
"SAFETY_STATE_DEVICE_EMERGENCY_STOP",
|
|
330
|
-
]
|
|
331
|
-
|
|
332
|
-
return estopStates.includes(this.controllerState.safety_state)
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Whether the controller is in a safety state
|
|
337
|
-
* that may be non-functional for robot pad purposes
|
|
338
|
-
*/
|
|
339
|
-
get isMoveableSafetyState() {
|
|
340
|
-
const goodSafetyStates: SafetyStateType[] = [
|
|
341
|
-
"SAFETY_STATE_NORMAL",
|
|
342
|
-
"SAFETY_STATE_REDUCED",
|
|
343
|
-
]
|
|
344
|
-
|
|
345
|
-
return goodSafetyStates.includes(this.controllerState.safety_state)
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Whether the controller is in an operation mode that allows movement
|
|
350
|
-
*/
|
|
351
|
-
get isMoveableOperationMode() {
|
|
352
|
-
const goodOperationModes: OperationMode[] = [
|
|
353
|
-
"OPERATION_MODE_AUTO",
|
|
354
|
-
"OPERATION_MODE_MANUAL",
|
|
355
|
-
"OPERATION_MODE_MANUAL_T1",
|
|
356
|
-
"OPERATION_MODE_MANUAL_T2",
|
|
357
|
-
]
|
|
358
|
-
|
|
359
|
-
return goodOperationModes.includes(this.controllerState.operation_mode)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Whether the robot is currently active and can be moved, based on the
|
|
364
|
-
* safety state, operation mode and servo toggle activation state.
|
|
365
|
-
*/
|
|
366
|
-
get canBeMoved() {
|
|
367
|
-
return (
|
|
368
|
-
this.isMoveableSafetyState &&
|
|
369
|
-
this.isMoveableOperationMode &&
|
|
370
|
-
this.activationState === "active"
|
|
371
|
-
)
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
async deactivate() {
|
|
375
|
-
if (this.activationState !== "active") {
|
|
376
|
-
console.error("Tried to deactivate while already deactivating")
|
|
377
|
-
return
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
runInAction(() => {
|
|
381
|
-
this.activationState = "deactivating"
|
|
382
|
-
})
|
|
383
|
-
|
|
384
|
-
try {
|
|
385
|
-
await this.nova.api.controller.setDefaultMode(
|
|
386
|
-
this.controllerId,
|
|
387
|
-
"ROBOT_SYSTEM_MODE_MONITOR",
|
|
388
|
-
)
|
|
389
|
-
|
|
390
|
-
runInAction(() => {
|
|
391
|
-
this.activationState = "inactive"
|
|
392
|
-
})
|
|
393
|
-
} catch (err) {
|
|
394
|
-
runInAction(() => {
|
|
395
|
-
this.activationState = "active"
|
|
396
|
-
})
|
|
397
|
-
throw err
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
async activate() {
|
|
402
|
-
if (this.activationState !== "inactive") {
|
|
403
|
-
console.error("Tried to activate while already activating")
|
|
404
|
-
return
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
runInAction(() => {
|
|
408
|
-
this.activationState = "activating"
|
|
409
|
-
})
|
|
410
|
-
|
|
411
|
-
try {
|
|
412
|
-
await this.nova.api.controller.setDefaultMode(
|
|
413
|
-
this.controllerId,
|
|
414
|
-
"ROBOT_SYSTEM_MODE_CONTROL",
|
|
415
|
-
)
|
|
416
|
-
|
|
417
|
-
runInAction(() => {
|
|
418
|
-
this.activationState = "active"
|
|
419
|
-
})
|
|
420
|
-
} catch (err) {
|
|
421
|
-
runInAction(() => {
|
|
422
|
-
this.activationState = "inactive"
|
|
423
|
-
})
|
|
424
|
-
throw err
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
toggleActivation() {
|
|
429
|
-
if (this.activationState === "inactive") {
|
|
430
|
-
this.activate()
|
|
431
|
-
} else if (this.activationState === "active") {
|
|
432
|
-
this.deactivate()
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
dispose() {
|
|
437
|
-
this.motionStateSocket.close()
|
|
438
|
-
if (this.connectedJoggingSocket) this.connectedJoggingSocket.close()
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
setJoggingVelocity(velocity: number) {
|
|
442
|
-
this.joggingVelocity = velocity
|
|
443
|
-
}
|
|
444
|
-
}
|