@wandelbots/wandelbots-js-react-components 2.34.1-pr.feature-robot-precondition-list.372.f06f958 → 2.34.1-pr.feature-robot-precondition-list.372.224a5cd
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/dist/components/RobotCard.d.ts.map +1 -1
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6164 -6139
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/RobotCard.tsx +34 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.34.1-pr.feature-robot-precondition-list.372.
|
|
3
|
+
"version": "2.34.1-pr.feature-robot-precondition-list.372.224a5cd",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Box, Button, Card, Divider, Typography, useTheme } from "@mui/material"
|
|
2
|
-
import { Bounds } from "@react-three/drei"
|
|
2
|
+
import { Bounds, useBounds } from "@react-three/drei"
|
|
3
3
|
import { Canvas } from "@react-three/fiber"
|
|
4
4
|
import type {
|
|
5
5
|
ConnectedMotionGroup,
|
|
@@ -13,6 +13,33 @@ import type { Group } from "three"
|
|
|
13
13
|
import { externalizeComponent } from "../externalizeComponent"
|
|
14
14
|
import { PresetEnvironment } from "./3d-viewport/PresetEnvironment"
|
|
15
15
|
import { CycleTimer } from "./CycleTimer"
|
|
16
|
+
import { useAutorun } from "./utils/hooks"
|
|
17
|
+
|
|
18
|
+
// Component that handles bounds refreshing when motion state changes
|
|
19
|
+
function BoundsRefresher({
|
|
20
|
+
connectedMotionGroup,
|
|
21
|
+
}: {
|
|
22
|
+
connectedMotionGroup: ConnectedMotionGroup
|
|
23
|
+
}) {
|
|
24
|
+
const bounds = useBounds()
|
|
25
|
+
|
|
26
|
+
useAutorun(() => {
|
|
27
|
+
// Ensure rapidlyChangingMotionState exists before accessing its properties
|
|
28
|
+
if (!connectedMotionGroup.rapidlyChangingMotionState?.state) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Access the rapidly changing motion state to make the autorun reactive to changes
|
|
33
|
+
connectedMotionGroup.rapidlyChangingMotionState.state.joint_position
|
|
34
|
+
connectedMotionGroup.rapidlyChangingMotionState.tcp_pose
|
|
35
|
+
|
|
36
|
+
// Refresh bounds when robot pose/position changes
|
|
37
|
+
bounds.refresh().clip().fit()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
|
|
16
43
|
import type { ProgramState } from "./ProgramControl"
|
|
17
44
|
import { ProgramStateIndicator } from "./ProgramStateIndicator"
|
|
18
45
|
import { Robot } from "./robots/Robot"
|
|
@@ -300,6 +327,9 @@ export const RobotCard = externalizeComponent(
|
|
|
300
327
|
>
|
|
301
328
|
<PresetEnvironment />
|
|
302
329
|
<Bounds fit observe margin={1} maxDuration={1}>
|
|
330
|
+
<BoundsRefresher
|
|
331
|
+
connectedMotionGroup={connectedMotionGroup}
|
|
332
|
+
/>
|
|
303
333
|
<RobotComponent
|
|
304
334
|
connectedMotionGroup={connectedMotionGroup}
|
|
305
335
|
postModelRender={handleModelRender}
|
|
@@ -479,6 +509,9 @@ export const RobotCard = externalizeComponent(
|
|
|
479
509
|
>
|
|
480
510
|
<PresetEnvironment />
|
|
481
511
|
<Bounds fit clip observe margin={1} maxDuration={1}>
|
|
512
|
+
<BoundsRefresher
|
|
513
|
+
connectedMotionGroup={connectedMotionGroup}
|
|
514
|
+
/>
|
|
482
515
|
<RobotComponent
|
|
483
516
|
connectedMotionGroup={connectedMotionGroup}
|
|
484
517
|
postModelRender={handleModelRender}
|