@wandelbots/wandelbots-js-react-components 1.9.0 → 1.9.2
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 +2 -1
- package/dist/Setup.d.ts +12 -0
- package/dist/Setup.d.ts.map +1 -0
- package/dist/components/ConsoleFilter.d.ts +2 -0
- package/dist/components/ConsoleFilter.d.ts.map +1 -0
- package/dist/components/LoadingButton.d.ts +1 -1
- package/dist/components/jogging/JoggingCartesianValues.d.ts.map +1 -1
- package/dist/components/jogging/JoggingOptions.d.ts.map +1 -1
- package/dist/components/jogging/JoggingStore.d.ts +1 -1
- package/dist/components/jogging/JoggingVelocitySlider.d.ts.map +1 -1
- package/dist/components/robots/SupportedRobot.d.ts.map +1 -1
- package/dist/components/robots/SupportedRobot.stories.d.ts +156 -0
- package/dist/components/robots/SupportedRobot.stories.d.ts.map +1 -0
- package/dist/index.cjs +23 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +750 -759
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Setup.tsx +37 -0
- package/src/components/ConsoleFilter.tsx +24 -0
- package/src/components/VelocitySlider.tsx +1 -1
- package/src/components/jogging/JoggingCartesianTab.tsx +1 -1
- package/src/components/jogging/JoggingCartesianValues.tsx +2 -1
- package/src/components/jogging/JoggingOptions.tsx +2 -4
- package/src/components/jogging/JoggingVelocitySlider.tsx +0 -14
- package/src/components/robots/SupportedRobot.stories.tsx +130 -0
- package/src/components/robots/SupportedRobot.tsx +2 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
package/src/Setup.tsx
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { Vector3 } from "three"
|
|
3
|
+
import { Canvas, type Props as CanvasProps } from "@react-three/fiber"
|
|
4
|
+
import { OrbitControls } from "@react-three/drei"
|
|
5
|
+
import { PresetEnvironment } from "./components/3d-viewport/PresetEnvironment"
|
|
6
|
+
|
|
7
|
+
type Props = React.PropsWithChildren<
|
|
8
|
+
CanvasProps & {
|
|
9
|
+
cameraFov?: number
|
|
10
|
+
cameraPosition?: Vector3
|
|
11
|
+
controls?: boolean
|
|
12
|
+
lights?: boolean
|
|
13
|
+
}
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
export const Setup = ({
|
|
17
|
+
children,
|
|
18
|
+
cameraFov = 25,
|
|
19
|
+
cameraPosition = new Vector3(-2, 1, 1),
|
|
20
|
+
controls = true,
|
|
21
|
+
lights = true,
|
|
22
|
+
...restProps
|
|
23
|
+
}: Props) => (
|
|
24
|
+
<Canvas
|
|
25
|
+
shadows
|
|
26
|
+
camera={{ position: cameraPosition, fov: cameraFov }}
|
|
27
|
+
{...restProps}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
{lights && (
|
|
31
|
+
<>
|
|
32
|
+
<PresetEnvironment />
|
|
33
|
+
</>
|
|
34
|
+
)}
|
|
35
|
+
{controls && <OrbitControls makeDefault />}
|
|
36
|
+
</Canvas>
|
|
37
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import { useEffect } from "react"
|
|
3
|
+
|
|
4
|
+
const defaultWarn = console.warn
|
|
5
|
+
|
|
6
|
+
export default function ConsoleFilter() {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
console.warn = (data) => {
|
|
9
|
+
// This message is caused by a bug from useSpring in combination with Canvas "demand" frameloop.
|
|
10
|
+
// For now we can only suppress this warning there are no sideeffects yet
|
|
11
|
+
// See https://github.com/pmndrs/react-spring/issues/1586#issuecomment-915051856
|
|
12
|
+
if (
|
|
13
|
+
data ===
|
|
14
|
+
"Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"
|
|
15
|
+
) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
defaultWarn(data)
|
|
20
|
+
}
|
|
21
|
+
}, [])
|
|
22
|
+
|
|
23
|
+
return <></>
|
|
24
|
+
}
|
|
@@ -150,7 +150,7 @@ export const JoggingCartesianTab = observer(
|
|
|
150
150
|
{/* Jogging options */}
|
|
151
151
|
<JoggingOptions store={store} />
|
|
152
152
|
|
|
153
|
-
<Stack width="80%" maxWidth="296px" margin="auto" marginTop="
|
|
153
|
+
<Stack width="80%" maxWidth="296px" margin="auto" marginTop="16px">
|
|
154
154
|
{/* Translate or rotate toggle */}
|
|
155
155
|
<ToggleButtonGroup
|
|
156
156
|
value={store.selectedCartesianMotionType}
|
|
@@ -30,8 +30,7 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
|
|
|
30
30
|
alignItems={"center"}
|
|
31
31
|
spacing={2}
|
|
32
32
|
sx={{
|
|
33
|
-
padding: "16px",
|
|
34
|
-
paddingTop: "8px",
|
|
33
|
+
padding: "8px 16px",
|
|
35
34
|
"& label": {
|
|
36
35
|
opacity: 0.7,
|
|
37
36
|
fontSize: "12px",
|
|
@@ -84,8 +83,7 @@ export const JoggingOptions = observer(({ store }: { store: JoggingStore }) => {
|
|
|
84
83
|
alignItems={"center"}
|
|
85
84
|
spacing={2}
|
|
86
85
|
sx={{
|
|
87
|
-
padding: "16px",
|
|
88
|
-
paddingTop: "8px",
|
|
86
|
+
padding: "8px 16px",
|
|
89
87
|
"& label": {
|
|
90
88
|
opacity: 0.7,
|
|
91
89
|
fontSize: "12px",
|
|
@@ -29,20 +29,6 @@ export const JoggingVelocitySlider = observer(
|
|
|
29
29
|
}}
|
|
30
30
|
>
|
|
31
31
|
<Stack sx={{ width: "380px", maxWidth: "90%", margin: "auto" }}>
|
|
32
|
-
<Stack
|
|
33
|
-
sx={{
|
|
34
|
-
justifyContent: "center",
|
|
35
|
-
}}
|
|
36
|
-
>
|
|
37
|
-
<Typography
|
|
38
|
-
sx={{
|
|
39
|
-
fontSize: "12px",
|
|
40
|
-
opacity: 0.6,
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
{t("Jogging.Velocity.lb")}
|
|
44
|
-
</Typography>
|
|
45
|
-
</Stack>
|
|
46
32
|
<VelocitySlider
|
|
47
33
|
velocity={store.velocityInCurrentUnits}
|
|
48
34
|
min={store.minVelocityInCurrentUnits}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { useState } from "react"
|
|
3
|
+
import { Canvas } from "@react-three/fiber"
|
|
4
|
+
import { Euler, Vector3, WebGLRenderer } from "three"
|
|
5
|
+
import { OrbitControls, Grid } from "@react-three/drei"
|
|
6
|
+
import { SupportedRobot } from "./SupportedRobot"
|
|
7
|
+
import type {
|
|
8
|
+
Joints,
|
|
9
|
+
MotionGroupStateJointLimitReached,
|
|
10
|
+
MotionGroupStateResponse,
|
|
11
|
+
MotionVector,
|
|
12
|
+
TcpPose,
|
|
13
|
+
} from "@wandelbots/wandelbots-js"
|
|
14
|
+
import { Setup } from "../../Setup"
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
title: "Components/SupportedRobot",
|
|
18
|
+
component: SupportedRobot,
|
|
19
|
+
decorators: [
|
|
20
|
+
(Story) => (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
width: "100%",
|
|
24
|
+
height: "100vh",
|
|
25
|
+
display: "flex",
|
|
26
|
+
justifyContent: "center",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<Setup cameraPosition={new Vector3(0, 0, 3)}>
|
|
31
|
+
<group position={[0, -0.25, 0]}>
|
|
32
|
+
<Story />
|
|
33
|
+
</group>
|
|
34
|
+
</Setup>
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
],
|
|
38
|
+
} satisfies Meta<typeof SupportedRobot>
|
|
39
|
+
|
|
40
|
+
type Story = StoryObj<typeof SupportedRobot>
|
|
41
|
+
|
|
42
|
+
function SupportedRobotScene(
|
|
43
|
+
props: React.ComponentProps<typeof SupportedRobot>,
|
|
44
|
+
) {
|
|
45
|
+
const rapidlyChangingMotionState: MotionGroupStateResponse = {
|
|
46
|
+
state: {
|
|
47
|
+
motion_group: "",
|
|
48
|
+
controller: "",
|
|
49
|
+
joint_position: {
|
|
50
|
+
joints: [0, 0, 0, 0, 0, 0],
|
|
51
|
+
} as Joints,
|
|
52
|
+
joint_velocity: {
|
|
53
|
+
joints: [0, 0, 0, 0, 0, 0],
|
|
54
|
+
} as Joints,
|
|
55
|
+
tcp_pose: {
|
|
56
|
+
position: { x: 0, y: 0, z: 0 },
|
|
57
|
+
orientation: { x: 0, y: 0, z: 0 },
|
|
58
|
+
coordinate_system: "world",
|
|
59
|
+
tcp: "flange",
|
|
60
|
+
} as TcpPose,
|
|
61
|
+
velocity: {
|
|
62
|
+
linear: { x: 0, y: 0, z: 0 },
|
|
63
|
+
angular: { x: 0, y: 0, z: 0 },
|
|
64
|
+
coordinate_system: "world",
|
|
65
|
+
} as MotionVector,
|
|
66
|
+
joint_limit_reached: {
|
|
67
|
+
limit_reached: [false, false, false, false, false, false],
|
|
68
|
+
} as MotionGroupStateJointLimitReached,
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<SupportedRobot
|
|
74
|
+
{...props}
|
|
75
|
+
rapidlyChangingMotionState={rapidlyChangingMotionState}
|
|
76
|
+
dhParameters={[
|
|
77
|
+
{
|
|
78
|
+
a: 0,
|
|
79
|
+
d: 0,
|
|
80
|
+
alpha: 1.5707963267948966,
|
|
81
|
+
theta: 0,
|
|
82
|
+
reverse_rotation_direction: false,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
a: 710,
|
|
86
|
+
d: 0,
|
|
87
|
+
alpha: 0,
|
|
88
|
+
theta: 1.5707963267948966,
|
|
89
|
+
reverse_rotation_direction: false,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
a: 0,
|
|
93
|
+
d: 0,
|
|
94
|
+
alpha: -1.5707963267948966,
|
|
95
|
+
theta: 0,
|
|
96
|
+
reverse_rotation_direction: false,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
a: 0,
|
|
100
|
+
d: -540,
|
|
101
|
+
alpha: 1.5707963267948966,
|
|
102
|
+
theta: 0,
|
|
103
|
+
reverse_rotation_direction: false,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
a: 0,
|
|
107
|
+
d: 150,
|
|
108
|
+
alpha: -1.5707963267948966,
|
|
109
|
+
theta: 0,
|
|
110
|
+
reverse_rotation_direction: false,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
a: 0,
|
|
114
|
+
d: -160,
|
|
115
|
+
alpha: 3.141592653589793,
|
|
116
|
+
theta: 0,
|
|
117
|
+
reverse_rotation_direction: false,
|
|
118
|
+
},
|
|
119
|
+
]}
|
|
120
|
+
/>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const SupportedRobotSceneSt = {
|
|
125
|
+
args: {
|
|
126
|
+
modelFromController: "FANUC_CRX25iAL",
|
|
127
|
+
},
|
|
128
|
+
render: (args) => <SupportedRobotScene {...args} />,
|
|
129
|
+
name: "Default",
|
|
130
|
+
} satisfies Story
|
|
@@ -30,6 +30,7 @@ import { DHRobot } from "./DHRobot"
|
|
|
30
30
|
|
|
31
31
|
import * as THREE from "three"
|
|
32
32
|
import { ErrorBoundary } from "react-error-boundary"
|
|
33
|
+
import ConsoleFilter from "../ConsoleFilter"
|
|
33
34
|
|
|
34
35
|
export type DHRobotProps = {
|
|
35
36
|
rapidlyChangingMotionState: MotionGroupStateResponse
|
|
@@ -265,6 +266,7 @@ export function SupportedRobot({
|
|
|
265
266
|
/>
|
|
266
267
|
</group>
|
|
267
268
|
</Suspense>
|
|
269
|
+
<ConsoleFilter />
|
|
268
270
|
</ErrorBoundary>
|
|
269
271
|
)
|
|
270
272
|
}
|
package/src/index.ts
CHANGED