@wandelbots/wandelbots-js-react-components 4.7.2-pr.v4.554.f8a153d → 5.0.0
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 +11 -32
- package/dist/3d.cjs.js +1 -1
- package/dist/3d.es.js +1 -1
- package/dist/MotionGroupVisualizer-C6MgXjCN.cjs +2 -0
- package/dist/MotionGroupVisualizer-C6MgXjCN.cjs.map +1 -0
- package/dist/MotionGroupVisualizer-Cm-XYEZe.js +1328 -0
- package/dist/{MotionGroupVisualizer-DP4K1dVw.cjs.map → MotionGroupVisualizer-Cm-XYEZe.js.map} +1 -1
- package/dist/auth0-spa-js.production.esm-CVEdrQ4-.cjs +5 -0
- package/dist/auth0-spa-js.production.esm-CVEdrQ4-.cjs.map +1 -0
- package/dist/auth0-spa-js.production.esm-Cr9w0sUa.js +4217 -0
- package/dist/auth0-spa-js.production.esm-Cr9w0sUa.js.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 +1 -2
- package/dist/components/3d-viewport/SafetyZonesRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/TrajectoryRenderer.d.ts +2 -2
- package/dist/components/3d-viewport/TrajectoryRenderer.d.ts.map +1 -1
- package/dist/components/3d-viewport/collider/ColliderCollection.d.ts +1 -1
- package/dist/components/3d-viewport/collider/ColliderElement.d.ts +1 -1
- package/dist/components/3d-viewport/collider/CollisionSceneRenderer.d.ts +2 -2
- package/dist/components/3d-viewport/collider/colliderShapeToBufferGeometry.d.ts +1 -1
- package/dist/core.cjs.js +1 -1
- package/dist/core.es.js +37 -39
- package/dist/core.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +51 -55
- package/dist/index.es.js.map +1 -1
- package/dist/interpolation-GwZidExa.cjs +42 -0
- package/dist/interpolation-GwZidExa.cjs.map +1 -0
- package/dist/{interpolation-B8AcxfdD.js → interpolation-JdOMWH6y.js} +3635 -3115
- package/dist/interpolation-JdOMWH6y.js.map +1 -0
- package/dist/lib/ConnectedMotionGroup.d.ts +2 -3
- package/dist/lib/ConnectedMotionGroup.d.ts.map +1 -1
- package/dist/lib/MotionStreamConnection.d.ts +0 -1
- package/dist/lib/MotionStreamConnection.d.ts.map +1 -1
- package/dist/themes/createDarkTheme.d.ts.map +1 -1
- package/dist/themes/themeTypes.d.ts +0 -4
- package/dist/themes/themeTypes.d.ts.map +1 -1
- package/dist/{theming-BKpqgTRM.js → theming-B1iO9Lkl.js} +3104 -3062
- package/dist/theming-B1iO9Lkl.js.map +1 -0
- package/dist/theming-BKsKrdpU.cjs +115 -0
- package/dist/theming-BKsKrdpU.cjs.map +1 -0
- package/package.json +15 -29
- package/src/components/3d-viewport/CoordinateSystemTransform.tsx +29 -18
- package/src/components/3d-viewport/SafetyZonesRenderer.tsx +24 -151
- package/src/components/3d-viewport/TrajectoryRenderer.tsx +9 -10
- 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 +2 -2
- package/src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts +1 -1
- package/src/index.ts +0 -1
- package/src/lib/ConnectedMotionGroup.ts +0 -5
- package/src/lib/MotionStreamConnection.ts +0 -5
- package/src/themes/createDarkTheme.ts +1 -22
- package/src/themes/themeTypes.ts +0 -5
- package/dist/LoadingCover-B3UN1lnU.js +0 -81
- package/dist/LoadingCover-B3UN1lnU.js.map +0 -1
- package/dist/LoadingCover-DXcsXWDy.cjs +0 -2
- package/dist/LoadingCover-DXcsXWDy.cjs.map +0 -1
- package/dist/MotionGroupVisualizer-CPEIGXUC.js +0 -1407
- package/dist/MotionGroupVisualizer-CPEIGXUC.js.map +0 -1
- package/dist/MotionGroupVisualizer-DP4K1dVw.cjs +0 -2
- package/dist/WandelscriptEditor-6sAoniLC.cjs +0 -2
- package/dist/WandelscriptEditor-6sAoniLC.cjs.map +0 -1
- package/dist/WandelscriptEditor-kWC2VyG_.js +0 -140
- package/dist/WandelscriptEditor-kWC2VyG_.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-DNao6_S5.js +0 -4064
- package/dist/auth0-spa-js.production.esm-DNao6_S5.js.map +0 -1
- package/dist/auth0-spa-js.production.esm-DaBMfOV8.cjs +0 -5
- package/dist/auth0-spa-js.production.esm-DaBMfOV8.cjs.map +0 -1
- package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts +0 -16
- package/dist/components/wandelscript-editor/WandelscriptEditor.d.ts.map +0 -1
- package/dist/components/wandelscript-editor/wandelscript.tmLanguage.d.ts +0 -45
- package/dist/components/wandelscript-editor/wandelscript.tmLanguage.d.ts.map +0 -1
- package/dist/externalizeComponent-B98tgTPP.cjs +0 -24
- package/dist/externalizeComponent-B98tgTPP.cjs.map +0 -1
- package/dist/externalizeComponent-BOqKMZMc.js +0 -526
- package/dist/externalizeComponent-BOqKMZMc.js.map +0 -1
- package/dist/interpolation-B8AcxfdD.js.map +0 -1
- package/dist/interpolation-SWzo5zr4.cjs +0 -20
- package/dist/interpolation-SWzo5zr4.cjs.map +0 -1
- package/dist/theming-BKpqgTRM.js.map +0 -1
- package/dist/theming-CatQaIl_.cjs +0 -115
- package/dist/theming-CatQaIl_.cjs.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/components/wandelscript-editor/WandelscriptEditor.tsx +0 -142
- package/src/components/wandelscript-editor/wandelscript.tmLanguage.ts +0 -62
- package/src/wandelscript.ts +0 -2
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
+
"packageManager": "pnpm@10.33.0",
|
|
7
8
|
"files": [
|
|
8
9
|
"dist",
|
|
9
10
|
"src",
|
|
@@ -26,19 +27,14 @@
|
|
|
26
27
|
"types": "./dist/3d.d.ts",
|
|
27
28
|
"import": "./dist/3d.es.js",
|
|
28
29
|
"require": "./dist/3d.cjs.js"
|
|
29
|
-
},
|
|
30
|
-
"./wandelscript": {
|
|
31
|
-
"types": "./dist/wandelscript.d.ts",
|
|
32
|
-
"import": "./dist/wandelscript.es.js",
|
|
33
|
-
"require": "./dist/wandelscript.cjs.js"
|
|
34
30
|
}
|
|
35
31
|
},
|
|
36
32
|
"types": "./dist/index.d.ts",
|
|
37
33
|
"scripts": {
|
|
38
34
|
"dev": "storybook dev -p 6006 --no-open",
|
|
39
|
-
"dev:pack": "nodemon -V -w src -e '*' -x \"
|
|
35
|
+
"dev:pack": "nodemon -V -w src -e '*' -x \"pnpm run build && pnpm pack\"",
|
|
40
36
|
"dev:build": "nodemon -V -w src -e '*' -x \"vite build && tsc --declaration --emitDeclarationOnly\"",
|
|
41
|
-
"dev:wbjs": "nodemon --watch $WBJS_PATH -e tgz --exec '
|
|
37
|
+
"dev:wbjs": "nodemon --watch $WBJS_PATH -e tgz --exec 'pnpm install file:$WBJS_PATH && storybook dev -p 6006 --no-open'",
|
|
42
38
|
"tsc": "tsc --pretty --noEmit -p stories/tsconfig.json",
|
|
43
39
|
"test": "test-storybook --url http://127.0.0.1:6006 --index-json --browsers chromium",
|
|
44
40
|
"test:unit": "vitest --workspace vitest.workspace.ts --project unit",
|
|
@@ -65,13 +61,11 @@
|
|
|
65
61
|
"author": "Wandelbots",
|
|
66
62
|
"license": "Apache-2.0",
|
|
67
63
|
"engines": {
|
|
68
|
-
"node": ">=18.14.0"
|
|
69
|
-
"npm": ">=8.0.0"
|
|
64
|
+
"node": ">=18.14.0"
|
|
70
65
|
},
|
|
71
66
|
"devDependencies": {
|
|
72
67
|
"@emotion/react": "^11.14.0",
|
|
73
68
|
"@emotion/styled": "^11.14.0",
|
|
74
|
-
"@monaco-editor/react": "^4.7.0",
|
|
75
69
|
"@mui/icons-material": "^7.3.7",
|
|
76
70
|
"@mui/material": "^7.3.7",
|
|
77
71
|
"@react-three/drei": "^10.2.0",
|
|
@@ -81,14 +75,15 @@
|
|
|
81
75
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
82
76
|
"@rollup/plugin-terser": "^0.4.4",
|
|
83
77
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
84
|
-
"@shikijs/monaco": "^3.1.0",
|
|
85
78
|
"@storybook/addon-docs": "^10.2.3",
|
|
79
|
+
"@storybook/react": "^10.3.5",
|
|
86
80
|
"@storybook/react-vite": "^10.2.3",
|
|
87
81
|
"@storybook/test-runner": "^0.24.1",
|
|
88
82
|
"@svgr/rollup": "^8.1.0",
|
|
89
83
|
"@testing-library/jest-dom": "^6.6.3",
|
|
90
84
|
"@testing-library/react": "^16.3.2",
|
|
91
85
|
"@testing-library/user-event": "^14.6.1",
|
|
86
|
+
"@types/lodash": "^4.17.24",
|
|
92
87
|
"@types/lodash-es": "^4.17.12",
|
|
93
88
|
"@types/react": "^19.1.8",
|
|
94
89
|
"@types/three": "^0.182.0",
|
|
@@ -102,9 +97,9 @@
|
|
|
102
97
|
"jest-simple-dot-reporter": "^1.0.5",
|
|
103
98
|
"jest-summary-reporter": "^0.0.2",
|
|
104
99
|
"jsdom": "^27.4.0",
|
|
105
|
-
"monaco-editor": "^0.55.1",
|
|
106
100
|
"nodemon": "^3.1.9",
|
|
107
101
|
"npm-run-all": "^4.1.5",
|
|
102
|
+
"playwright": "^1.59.1",
|
|
108
103
|
"postcss": "^8.5.3",
|
|
109
104
|
"prettier-eslint": "^16.3.0",
|
|
110
105
|
"prop-types": "^15.8.1",
|
|
@@ -117,7 +112,6 @@
|
|
|
117
112
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
118
113
|
"rollup-plugin-postcss": "^4.0.2",
|
|
119
114
|
"semantic-release": "^25.0.2",
|
|
120
|
-
"shiki": "^3.1.0",
|
|
121
115
|
"storybook": "^10.2.3",
|
|
122
116
|
"storybook-preset-inline-svg": "^2.0.0",
|
|
123
117
|
"three": "^0.182.0",
|
|
@@ -134,15 +128,12 @@
|
|
|
134
128
|
"peerDependencies": {
|
|
135
129
|
"@emotion/react": "^11.11.1",
|
|
136
130
|
"@emotion/styled": "^11.11.0",
|
|
137
|
-
"@monaco-editor/react": "^4.7.0",
|
|
138
131
|
"@mui/icons-material": "^6 || ^7",
|
|
139
132
|
"@mui/material": "^6 || ^7",
|
|
140
133
|
"@react-three/drei": "^9.122.0 || ^10",
|
|
141
134
|
"@react-three/fiber": "^8 || ^9",
|
|
142
|
-
"@shikijs/monaco": "^3.1.0",
|
|
143
135
|
"react": "^18.0.0 || ^19.0.0",
|
|
144
136
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
145
|
-
"shiki": "^3.1.0",
|
|
146
137
|
"three": ">=0.182",
|
|
147
138
|
"three-stdlib": ">=2"
|
|
148
139
|
},
|
|
@@ -150,15 +141,6 @@
|
|
|
150
141
|
"react-dom": {
|
|
151
142
|
"optional": true
|
|
152
143
|
},
|
|
153
|
-
"@monaco-editor/react": {
|
|
154
|
-
"optional": true
|
|
155
|
-
},
|
|
156
|
-
"@shikijs/monaco": {
|
|
157
|
-
"optional": true
|
|
158
|
-
},
|
|
159
|
-
"shiki": {
|
|
160
|
-
"optional": true
|
|
161
|
-
},
|
|
162
144
|
"@react-three/drei": {
|
|
163
145
|
"optional": true
|
|
164
146
|
},
|
|
@@ -176,7 +158,7 @@
|
|
|
176
158
|
"@mui/x-charts": "^8.27.0",
|
|
177
159
|
"@mui/x-data-grid": "^8.27.0",
|
|
178
160
|
"@wandelbots/nova-js": "^3.5.4",
|
|
179
|
-
"axios": "^1.
|
|
161
|
+
"axios": "^1.15.0",
|
|
180
162
|
"dotenv": "^17.2.3",
|
|
181
163
|
"i18next-browser-languagedetector": "^8.2.0",
|
|
182
164
|
"lodash-es": "^4.17.21",
|
|
@@ -186,7 +168,11 @@
|
|
|
186
168
|
"react-i18next": "^16.5.2",
|
|
187
169
|
"username": "^7.0.0"
|
|
188
170
|
},
|
|
189
|
-
"
|
|
190
|
-
"
|
|
171
|
+
"pnpm": {
|
|
172
|
+
"overrides": {
|
|
173
|
+
"storybook": "$storybook",
|
|
174
|
+
"handlebars": "^4.7.9",
|
|
175
|
+
"minimatch@<3.1.3": "^3.1.3"
|
|
176
|
+
}
|
|
191
177
|
}
|
|
192
178
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CoordinateSystem } from "@wandelbots/nova-js/
|
|
1
|
+
import type { CoordinateSystem } from "@wandelbots/nova-js/v2"
|
|
2
2
|
import type { ReactNode } from "react"
|
|
3
3
|
import { Quaternion, Vector3 } from "three"
|
|
4
4
|
|
|
@@ -14,28 +14,39 @@ export const CoordinateSystemTransform = ({
|
|
|
14
14
|
children: ReactNode
|
|
15
15
|
}) => {
|
|
16
16
|
const position = new Vector3(
|
|
17
|
-
(coordinateSystem?.position?.
|
|
18
|
-
(coordinateSystem?.position?.
|
|
19
|
-
(coordinateSystem?.position?.
|
|
17
|
+
(coordinateSystem?.position?.[0] ?? 0) / 1000,
|
|
18
|
+
(coordinateSystem?.position?.[1] ?? 0) / 1000,
|
|
19
|
+
(coordinateSystem?.position?.[2] ?? 0) / 1000,
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const orientationType = coordinateSystem?.orientation_type
|
|
23
|
+
|
|
24
|
+
let quaternion: Quaternion
|
|
25
|
+
|
|
26
|
+
if (orientationType === "QUATERNION") {
|
|
27
|
+
quaternion = new Quaternion(
|
|
28
|
+
coordinateSystem?.orientation?.[0] ?? 0,
|
|
29
|
+
coordinateSystem?.orientation?.[1] ?? 0,
|
|
30
|
+
coordinateSystem?.orientation?.[2] ?? 0,
|
|
31
|
+
coordinateSystem?.orientation?.[3] ?? 1,
|
|
27
32
|
)
|
|
28
|
-
|
|
33
|
+
} else {
|
|
34
|
+
if (orientationType && orientationType !== "ROTATION_VECTOR") {
|
|
35
|
+
console.warn(
|
|
36
|
+
`Unsupported orientation type ${orientationType}. Only ROTATION_VECTOR and QUATERNION are supported.`,
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
// Default to ROTATION_VECTOR
|
|
40
|
+
const rotationVector = new Vector3(
|
|
41
|
+
coordinateSystem?.orientation?.[0] ?? 0,
|
|
42
|
+
coordinateSystem?.orientation?.[1] ?? 0,
|
|
43
|
+
coordinateSystem?.orientation?.[2] ?? 0,
|
|
44
|
+
)
|
|
45
|
+
const magnitude = rotationVector.length()
|
|
46
|
+
const axis = rotationVector.normalize()
|
|
47
|
+
quaternion = new Quaternion().setFromAxisAngle(axis, magnitude)
|
|
29
48
|
}
|
|
30
49
|
|
|
31
|
-
const rotationVector = new Vector3(
|
|
32
|
-
rotation?.angles[0] ?? 0,
|
|
33
|
-
rotation?.angles[1] ?? 0,
|
|
34
|
-
rotation?.angles[2] ?? 0,
|
|
35
|
-
)
|
|
36
|
-
const magnitude = rotationVector.length()
|
|
37
|
-
const axis = rotationVector.normalize()
|
|
38
|
-
const quaternion = new Quaternion().setFromAxisAngle(axis, magnitude)
|
|
39
50
|
return (
|
|
40
51
|
<group position={position} quaternion={quaternion}>
|
|
41
52
|
{children}
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
+
import { useMemo } from "react"
|
|
1
2
|
import { type ThreeElements } from "@react-three/fiber"
|
|
2
|
-
import { useEffect, useMemo } from "react"
|
|
3
3
|
import * as THREE from "three"
|
|
4
4
|
import { ConvexGeometry, RoundedBoxGeometry } from "three-stdlib"
|
|
5
5
|
|
|
6
|
-
import type { Geometry, SafetySetupSafetyZone } from "@wandelbots/nova-js/v1"
|
|
7
6
|
import type {
|
|
8
|
-
Capsule,
|
|
9
7
|
Collider,
|
|
10
8
|
ConvexHull,
|
|
11
9
|
DHParameter,
|
|
12
10
|
MotionGroupDescription,
|
|
13
|
-
RectangularCapsule,
|
|
14
11
|
Sphere,
|
|
12
|
+
Capsule,
|
|
13
|
+
RectangularCapsule,
|
|
15
14
|
} from "@wandelbots/nova-js/v2"
|
|
16
15
|
|
|
17
|
-
import {
|
|
18
|
-
dhParametersToPlaneSize,
|
|
19
|
-
orientationToQuaternion,
|
|
20
|
-
verticesToCoplanarity,
|
|
21
|
-
} from "../utils/converters"
|
|
16
|
+
import { dhParametersToPlaneSize, orientationToQuaternion, verticesToCoplanarity } from "../utils/converters"
|
|
22
17
|
|
|
23
18
|
export type SafetyZonesRendererProps = {
|
|
24
|
-
safetyZones:
|
|
19
|
+
safetyZones: MotionGroupDescription["safety_zones"]
|
|
25
20
|
dhParameters?: DHParameter[]
|
|
26
21
|
} & ThreeElements["group"]
|
|
27
22
|
|
|
@@ -49,16 +44,6 @@ export function SafetyZonesRenderer({
|
|
|
49
44
|
*/
|
|
50
45
|
const planeSize = dhParametersToPlaneSize(dhParameters ?? [])
|
|
51
46
|
|
|
52
|
-
/**
|
|
53
|
-
* Warning during runtime stating the deprecation of the V1 safety zones
|
|
54
|
-
*/
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
Array.isArray(safetyZones) &&
|
|
57
|
-
console.warn(
|
|
58
|
-
"SafetyZonesRenderer: The support of V1 safety zones is deprecated. Please migrate to V2 safety zones.",
|
|
59
|
-
)
|
|
60
|
-
}, [safetyZones])
|
|
61
|
-
|
|
62
47
|
/**
|
|
63
48
|
* Helper function to render plane, sphere, and capsule meshes
|
|
64
49
|
* @param id number
|
|
@@ -69,23 +54,14 @@ export function SafetyZonesRenderer({
|
|
|
69
54
|
return null
|
|
70
55
|
}
|
|
71
56
|
|
|
72
|
-
const position = new THREE.Vector3(
|
|
73
|
-
|
|
74
|
-
zone.pose.position[1] / 1000,
|
|
75
|
-
zone.pose.position[2] / 1000,
|
|
76
|
-
)
|
|
77
|
-
const orientation = new THREE.Vector3(
|
|
78
|
-
zone.pose.orientation[0],
|
|
79
|
-
zone.pose.orientation[1],
|
|
80
|
-
zone.pose.orientation[2],
|
|
81
|
-
)
|
|
57
|
+
const position = new THREE.Vector3(zone.pose.position[0] / 1000, zone.pose.position[1] / 1000, zone.pose.position[2] / 1000)
|
|
58
|
+
const orientation = new THREE.Vector3(zone.pose.orientation[0], zone.pose.orientation[1], zone.pose.orientation[2])
|
|
82
59
|
|
|
83
60
|
let geometry: React.ReactElement | null
|
|
84
61
|
|
|
85
|
-
const materialProps =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
: { ...safetyZoneMaterialProps, side: THREE.FrontSide }
|
|
62
|
+
const materialProps = zone.shape.shape_type === "plane"
|
|
63
|
+
? { ...safetyZoneMaterialProps, side: THREE.DoubleSide }
|
|
64
|
+
: { ...safetyZoneMaterialProps, side: THREE.FrontSide }
|
|
89
65
|
|
|
90
66
|
switch (zone.shape.shape_type) {
|
|
91
67
|
/**
|
|
@@ -133,12 +109,7 @@ export function SafetyZonesRenderer({
|
|
|
133
109
|
vertices.push(newVertex)
|
|
134
110
|
}
|
|
135
111
|
try {
|
|
136
|
-
geometry = (
|
|
137
|
-
<primitive
|
|
138
|
-
object={new ConvexGeometry(vertices)}
|
|
139
|
-
attach="geometry"
|
|
140
|
-
/>
|
|
141
|
-
)
|
|
112
|
+
geometry = <primitive object={new ConvexGeometry(vertices)} attach="geometry" />
|
|
142
113
|
} catch (error) {
|
|
143
114
|
console.log("Error creating ConvexGeometry:", error)
|
|
144
115
|
return null
|
|
@@ -170,10 +141,7 @@ export function SafetyZonesRenderer({
|
|
|
170
141
|
}
|
|
171
142
|
|
|
172
143
|
default: {
|
|
173
|
-
console.warn(
|
|
174
|
-
"Unsupported safety zone shape type:",
|
|
175
|
-
zone.shape.shape_type,
|
|
176
|
-
)
|
|
144
|
+
console.warn("Unsupported safety zone shape type:", zone.shape.shape_type)
|
|
177
145
|
geometry = null
|
|
178
146
|
}
|
|
179
147
|
}
|
|
@@ -192,112 +160,17 @@ export function SafetyZonesRenderer({
|
|
|
192
160
|
}
|
|
193
161
|
|
|
194
162
|
/**
|
|
195
|
-
* Helper
|
|
196
|
-
*/
|
|
197
|
-
const renderV2SafetyZones = () => {
|
|
198
|
-
return Object.values(safetyZones ?? {}).map(
|
|
199
|
-
(zone: Collider, index: number) => {
|
|
200
|
-
return renderMesh(index, zone)
|
|
201
|
-
},
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Helper function to V1 safety zones
|
|
207
|
-
* @deprecated this render function is to be seen as a temporary measure, as the support
|
|
208
|
-
* for the V1 safety zones is to be removed in the future
|
|
209
|
-
*/
|
|
210
|
-
const renderV1SafetyZones = () => {
|
|
211
|
-
if (Array.isArray(safetyZones)) {
|
|
212
|
-
return (safetyZones as SafetySetupSafetyZone[]).map(
|
|
213
|
-
(zone: SafetySetupSafetyZone, index) => {
|
|
214
|
-
let geometries: Geometry[] = []
|
|
215
|
-
if (zone.geometry) {
|
|
216
|
-
if (zone.geometry.compound) {
|
|
217
|
-
geometries = zone.geometry.compound.child_geometries
|
|
218
|
-
} else if (zone.geometry.convex_hull) {
|
|
219
|
-
geometries = [zone.geometry]
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return geometries.map((geometry, i) => {
|
|
224
|
-
if (!geometry.convex_hull) return null
|
|
225
|
-
|
|
226
|
-
const vertices = geometry.convex_hull.vertices.map(
|
|
227
|
-
(v) => new THREE.Vector3(v.x / 1000, v.y / 1000, v.z / 1000),
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
// Check if the vertices are on the same plane and only define a plane
|
|
231
|
-
// Algorithm has troubles with vertices that are on the same plane so we
|
|
232
|
-
// add a new vertex slightly moved along the normal direction
|
|
233
|
-
const coplanarityResult = verticesToCoplanarity(vertices)
|
|
234
|
-
|
|
235
|
-
if (coplanarityResult.isCoplanar && coplanarityResult.normal) {
|
|
236
|
-
// Add a new vertex slightly moved along the normal direction
|
|
237
|
-
const offset = 0.0001
|
|
238
|
-
const newVertex = new THREE.Vector3().addVectors(
|
|
239
|
-
vertices[0],
|
|
240
|
-
coplanarityResult.normal.multiplyScalar(offset),
|
|
241
|
-
)
|
|
242
|
-
vertices.push(newVertex)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
let convexGeometry
|
|
246
|
-
try {
|
|
247
|
-
convexGeometry = new ConvexGeometry(vertices)
|
|
248
|
-
} catch (error) {
|
|
249
|
-
console.log("Error creating ConvexGeometry:", error)
|
|
250
|
-
return null
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return (
|
|
254
|
-
<mesh
|
|
255
|
-
key={`${index}-${i}`}
|
|
256
|
-
position={
|
|
257
|
-
new THREE.Vector3(
|
|
258
|
-
geometry.init_pose.position!.x!,
|
|
259
|
-
geometry.init_pose.position!.y!,
|
|
260
|
-
geometry.init_pose.position!.z!,
|
|
261
|
-
)
|
|
262
|
-
}
|
|
263
|
-
quaternion={
|
|
264
|
-
new THREE.Quaternion(
|
|
265
|
-
geometry.init_pose.orientation!.x!,
|
|
266
|
-
geometry.init_pose.orientation!.y!,
|
|
267
|
-
geometry.init_pose.orientation!.z!,
|
|
268
|
-
geometry.init_pose.orientation!.w!,
|
|
269
|
-
)
|
|
270
|
-
}
|
|
271
|
-
geometry={convexGeometry}
|
|
272
|
-
>
|
|
273
|
-
<meshStandardMaterial
|
|
274
|
-
key={index}
|
|
275
|
-
attach="material"
|
|
276
|
-
color="#009f4d"
|
|
277
|
-
opacity={0.2}
|
|
278
|
-
depthTest={false}
|
|
279
|
-
depthWrite={false}
|
|
280
|
-
transparent
|
|
281
|
-
polygonOffset
|
|
282
|
-
polygonOffsetFactor={-i}
|
|
283
|
-
/>
|
|
284
|
-
</mesh>
|
|
285
|
-
)
|
|
286
|
-
})
|
|
287
|
-
},
|
|
288
|
-
)
|
|
289
|
-
}
|
|
290
|
-
return null
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Helper variable to render both api versions of safety zones
|
|
163
|
+
* Helper variable render safety zones
|
|
295
164
|
*/
|
|
296
165
|
const renderedSafetyZones = useMemo(() => {
|
|
297
|
-
return
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, [safetyZones,
|
|
301
|
-
|
|
302
|
-
return
|
|
303
|
-
}
|
|
166
|
+
return Object.values(safetyZones ?? {}).map((zone: Collider, index: number) => {
|
|
167
|
+
return renderMesh(index, zone)
|
|
168
|
+
})
|
|
169
|
+
}, [safetyZones, planeSize])
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<group {...props}>
|
|
173
|
+
{renderedSafetyZones}
|
|
174
|
+
</group>
|
|
175
|
+
)
|
|
176
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Line } from "@react-three/drei"
|
|
2
|
-
import type {
|
|
2
|
+
import type { Pose } from "@wandelbots/nova-js/v2"
|
|
3
3
|
import * as THREE from "three"
|
|
4
4
|
|
|
5
5
|
export type TrajectoryRendererProps = {
|
|
6
|
-
trajectory:
|
|
6
|
+
trajectory: Pose[]
|
|
7
7
|
} & React.JSX.IntrinsicElements["group"]
|
|
8
8
|
|
|
9
9
|
export function TrajectoryRenderer({
|
|
@@ -11,14 +11,13 @@ export function TrajectoryRenderer({
|
|
|
11
11
|
...props
|
|
12
12
|
}: TrajectoryRendererProps) {
|
|
13
13
|
const points =
|
|
14
|
-
trajectory
|
|
15
|
-
?.map((
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
14
|
+
trajectory
|
|
15
|
+
?.map((pose: Pose) => {
|
|
16
|
+
if (pose.position && pose.position.length >= 3) {
|
|
17
|
+
const [x, y, z] = pose.position
|
|
18
|
+
if (isFinite(x) && isFinite(y) && isFinite(z)) {
|
|
19
|
+
return new THREE.Vector3(x / 1000, z / 1000, -y / 1000)
|
|
20
|
+
}
|
|
22
21
|
}
|
|
23
22
|
return null
|
|
24
23
|
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollisionSetup } from "@wandelbots/nova-js/v2"
|
|
2
2
|
import ColliderCollection, {
|
|
3
3
|
type MeshChildrenProvider,
|
|
4
4
|
} from "./ColliderCollection"
|
|
5
5
|
|
|
6
6
|
type CollisionSceneRendererProps = {
|
|
7
|
-
scene:
|
|
7
|
+
scene: CollisionSetup
|
|
8
8
|
meshChildrenProvider: MeshChildrenProvider
|
|
9
9
|
}
|
|
10
10
|
|
package/src/index.ts
CHANGED
|
@@ -258,11 +258,6 @@ export class ConnectedMotionGroup {
|
|
|
258
258
|
return this.description.motion_group_model
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
get wandelscriptIdentifier() {
|
|
262
|
-
const num = this.motionGroupId.split("@")[0]
|
|
263
|
-
return `${this.controllerId.replace(/-/g, "_")}_${num}`
|
|
264
|
-
}
|
|
265
|
-
|
|
266
261
|
/** Jogging velocity in radians for rotation and joint movement */
|
|
267
262
|
get joggingVelocityRads() {
|
|
268
263
|
return (this.joggingVelocity * Math.PI) / 180
|
|
@@ -170,11 +170,6 @@ export class MotionStreamConnection {
|
|
|
170
170
|
return this.controller.controller
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
get wandelscriptIdentifier() {
|
|
174
|
-
const num = this.motionGroupId.split("@")[0]
|
|
175
|
-
return `${this.controllerId.replace(/-/g, "_")}_${num}`
|
|
176
|
-
}
|
|
177
|
-
|
|
178
173
|
get joints() {
|
|
179
174
|
return this.initialMotionState.joint_position.map((_, i) => {
|
|
180
175
|
return {
|
|
@@ -338,28 +338,7 @@ export function createDarkTheme(): Theme {
|
|
|
338
338
|
VelocitySlider: {
|
|
339
339
|
sliderLegendColor: baseTheme.palette.text.primary,
|
|
340
340
|
},
|
|
341
|
-
}
|
|
342
|
-
WandelscriptEditor: {
|
|
343
|
-
monacoTheme: {
|
|
344
|
-
base: "vs-dark",
|
|
345
|
-
inherit: true,
|
|
346
|
-
rules: [
|
|
347
|
-
{
|
|
348
|
-
token: "keyword",
|
|
349
|
-
foreground: "#b349a9ff",
|
|
350
|
-
},
|
|
351
|
-
],
|
|
352
|
-
colors: {
|
|
353
|
-
"editor.background": rgbToHex(
|
|
354
|
-
baseTheme.palette.backgroundPaperElevation?.[5] ?? "",
|
|
355
|
-
),
|
|
356
|
-
"editor.foreground": "#d4d4d4",
|
|
357
|
-
"editorLineNumber.foreground": "#797979",
|
|
358
|
-
"editorLineNumber.activeForeground": "#e9e9e9",
|
|
359
|
-
"editor.lineHighlightBorder": "#e9e9e911",
|
|
360
|
-
},
|
|
361
|
-
},
|
|
362
|
-
},
|
|
341
|
+
}
|
|
363
342
|
},
|
|
364
343
|
} as Theme
|
|
365
344
|
}
|
package/src/themes/themeTypes.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { editor } from "monaco-editor"
|
|
2
|
-
|
|
3
1
|
type NovaColorPaletteExtension = {
|
|
4
2
|
paletteExt?: {
|
|
5
3
|
primary?: {
|
|
@@ -48,9 +46,6 @@ interface NovaComponentsExtension {
|
|
|
48
46
|
sliderLegendColor?: string
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
|
-
WandelscriptEditor?: {
|
|
52
|
-
monacoTheme: editor.IStandaloneThemeData
|
|
53
|
-
}
|
|
54
49
|
}
|
|
55
50
|
}
|
|
56
51
|
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { t as l, j as t } from "./externalizeComponent-BOqKMZMc.js";
|
|
2
|
-
import { useTheme as c, Stack as i, CircularProgress as g, capitalize as d } from "@mui/material";
|
|
3
|
-
import { lowerFirst as u } from "lodash-es";
|
|
4
|
-
import { useState as f, useEffect as x } from "react";
|
|
5
|
-
import { AxiosError as a } from "axios";
|
|
6
|
-
function T(e, r) {
|
|
7
|
-
throw new Error(r + ` ${JSON.stringify(e)}`);
|
|
8
|
-
}
|
|
9
|
-
function h(e) {
|
|
10
|
-
var r, s, o, n;
|
|
11
|
-
return e instanceof a && e.code === "ERR_NETWORK" ? "Failed to connect to the server. Please check your internet connection." : e instanceof a && e.response ? `${(r = e.response) == null ? void 0 : r.status} ${(s = e.response) == null ? void 0 : s.statusText} from ${(o = e.response) == null ? void 0 : o.config.url}: ${JSON.stringify((n = e.response) == null ? void 0 : n.data)}` : e instanceof Error ? e.message : `Unexpected error: ${l(e) || e}`;
|
|
12
|
-
}
|
|
13
|
-
const k = (e) => {
|
|
14
|
-
const r = e.softTimeout || 3e3, [s, o] = f(!1), n = c();
|
|
15
|
-
return x(() => {
|
|
16
|
-
const m = setTimeout(() => {
|
|
17
|
-
o(!0);
|
|
18
|
-
}, r);
|
|
19
|
-
return () => clearTimeout(m);
|
|
20
|
-
}), /* @__PURE__ */ t.jsx(
|
|
21
|
-
i,
|
|
22
|
-
{
|
|
23
|
-
width: "100%",
|
|
24
|
-
height: "100%",
|
|
25
|
-
alignItems: "center",
|
|
26
|
-
justifyContent: "center",
|
|
27
|
-
sx: { color: n.palette.text.primary },
|
|
28
|
-
children: e.error ? /* @__PURE__ */ t.jsx(
|
|
29
|
-
w,
|
|
30
|
-
{
|
|
31
|
-
loadingMessage: e.message,
|
|
32
|
-
error: e.error
|
|
33
|
-
}
|
|
34
|
-
) : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
35
|
-
/* @__PURE__ */ t.jsx(g, { sx: { marginBottom: "24px" } }),
|
|
36
|
-
!!e.message && /* @__PURE__ */ t.jsx("div", { children: e.message }),
|
|
37
|
-
/* @__PURE__ */ t.jsx(
|
|
38
|
-
i,
|
|
39
|
-
{
|
|
40
|
-
sx: {
|
|
41
|
-
visibility: s ? "visible" : "hidden",
|
|
42
|
-
marginTop: "1rem",
|
|
43
|
-
color: n.palette.text.secondary
|
|
44
|
-
},
|
|
45
|
-
children: "This is taking longer than expected..."
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
] })
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}, w = (e) => {
|
|
52
|
-
const r = h(e.error), s = e.error instanceof Error ? e.error.stack : null, o = c();
|
|
53
|
-
return /* @__PURE__ */ t.jsxs(
|
|
54
|
-
i,
|
|
55
|
-
{
|
|
56
|
-
sx: {
|
|
57
|
-
maxHeight: "100%",
|
|
58
|
-
maxWidth: "min(100%, 800px)",
|
|
59
|
-
padding: 2,
|
|
60
|
-
overflow: "auto",
|
|
61
|
-
color: o.palette.error.main,
|
|
62
|
-
"& pre": {
|
|
63
|
-
whiteSpace: "pre-wrap",
|
|
64
|
-
wordBreak: "break-word",
|
|
65
|
-
paddingBottom: "3rem"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
children: [
|
|
69
|
-
(e.loadingMessage ? `Error while ${u(d(e.loadingMessage))} - ` : "") + r,
|
|
70
|
-
/* @__PURE__ */ t.jsx("br", {}),
|
|
71
|
-
s && /* @__PURE__ */ t.jsx("pre", { children: s })
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
k as L,
|
|
78
|
-
w as a,
|
|
79
|
-
T as b
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=LoadingCover-B3UN1lnU.js.map
|