Skip to content

Commit

Permalink
feat: add-fanuc-crx10ial (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoBellmannWandelbots authored Oct 1, 2024
1 parent abcb097 commit 402d45d
Show file tree
Hide file tree
Showing 4 changed files with 325 additions and 0 deletions.
Binary file added public/models/FANUC_CRX10iAL.glb
Binary file not shown.
248 changes: 248 additions & 0 deletions src/components/robots/FANUC_CRX10iAL.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
import { animated } from "@react-spring/three"
import { useGLTF } from "@react-three/drei"
import type { RobotModelProps } from "./types"

FANUC_CRX10iAL.config = {
rotationOffsets: [0, Math.PI / 2, 0, 0, 0, 0],
}

export function FANUC_CRX10iAL({ modelURL, ...props }: RobotModelProps) {
const gltf = useGLTF(modelURL) as any
const nodes = gltf.nodes
const materials = gltf.materials

return (
<group {...props} dispose={null}>
<group name="Scene">
<group name="link_0">
<mesh
name="visuals_0"
castShadow
receiveShadow
geometry={nodes.visuals_0.geometry}
material={materials.fanuc_metal_black}
/>
<mesh
name="visuals_0_1"
castShadow
receiveShadow
geometry={nodes.visuals_0_1.geometry}
material={materials.fanuc_stainless_steel}
/>
<mesh
name="visuals_0_2"
castShadow
receiveShadow
geometry={nodes.visuals_0_2.geometry}
material={materials.fanuc_metal_black}
/>
<mesh
name="visuals_0_3"
castShadow
receiveShadow
geometry={nodes.visuals_0_3.geometry}
material={materials.fanuc_stainless_steel}
/>
<mesh
name="visuals_0_4"
castShadow
receiveShadow
geometry={nodes.visuals_0_4.geometry}
material={materials.fanuc_aluminium_black}
/>
<mesh
name="visuals_0_5"
castShadow
receiveShadow
geometry={nodes.visuals_0_5.geometry}
material={materials.fanuc_aluminium_black}
/>
<mesh
name="visuals_0_6"
castShadow
receiveShadow
geometry={nodes.visuals_0_6.geometry}
material={materials.fanuc_rubber}
/>
</group>
<animated.group name="FANUC_CRX10IAL_J00">
<animated.group
name="FANUC_CRX10IAL_J01"
rotation={[Math.PI / 2, Math.PI / 2, 0]}
>
<animated.group name="FANUC_CRX10IAL_J02" position={[0.71, 0, 0]}>
<animated.group
name="FANUC_CRX10IAL_J03"
rotation={[-Math.PI / 2, 0, 0]}
>
<animated.group
name="FANUC_CRX10IAL_J04"
position={[0, -0.54, 0]}
rotation={[Math.PI / 2, 0, 0]}
>
<animated.group
name="FANUC_CRX10IAL_J05"
position={[0, 0.15, 0]}
rotation={[-Math.PI / 2, 0, 0]}
>
<group
name="FANUC_CRX10IAL_FLG"
position={[0, -0.16, 0]}
rotation={[-Math.PI, 0, 0]}
/>
<group
name="link_6"
position={[-0.71, 0.54, -0.15]}
rotation={[0, 0, -Math.PI / 2]}
>
<mesh
name="visuals_6"
castShadow
receiveShadow
geometry={nodes.visuals_6.geometry}
material={materials.fanuc_metal_black}
/>
<mesh
name="visuals_6_1"
castShadow
receiveShadow
geometry={nodes.visuals_6_1.geometry}
material={materials.fanuc_stainless_steel}
/>
<mesh
name="visuals_6_2"
castShadow
receiveShadow
geometry={nodes.visuals_6_2.geometry}
material={materials.fanuc_aluminium_black}
/>
<mesh
name="visuals_6_3"
castShadow
receiveShadow
geometry={nodes.visuals_6_3.geometry}
material={materials.fanuc_aluminium_black}
/>
</group>
</animated.group>
<group
name="link_5"
position={[-0.71, 0, -0.54]}
rotation={[-Math.PI / 2, 0, -Math.PI / 2]}
>
<mesh
name="visuals_5"
castShadow
receiveShadow
geometry={nodes.visuals_5.geometry}
material={materials.fanuc_white}
/>
<mesh
name="visuals_5_1"
castShadow
receiveShadow
geometry={nodes.visuals_5_1.geometry}
material={materials.fanuc_green}
/>
<mesh
name="visuals_5_2"
castShadow
receiveShadow
geometry={nodes.visuals_5_2.geometry}
material={materials.fanuc_stainless_steel}
/>
</group>
</animated.group>
<group
name="link_4"
position={[-0.71, 0, 0]}
rotation={[0, 0, -Math.PI / 2]}
>
<mesh
name="visuals_4"
castShadow
receiveShadow
geometry={nodes.visuals_4.geometry}
material={materials.fanuc_white}
/>
<mesh
name="visuals_4_1"
castShadow
receiveShadow
geometry={nodes.visuals_4_1.geometry}
material={materials.fanuc_white}
/>
<mesh
name="visuals_4_2"
castShadow
receiveShadow
geometry={nodes.visuals_4_2.geometry}
material={materials.fanuc_metal_black}
/>
<mesh
name="visuals_4_3"
castShadow
receiveShadow
geometry={nodes.visuals_4_3.geometry}
material={materials.fanuc_red}
/>
</group>
</animated.group>
<group
name="link_3"
position={[-0.71, 0, 0]}
rotation={[-Math.PI / 2, 0, -Math.PI / 2]}
>
<mesh
name="visuals_3"
castShadow
receiveShadow
geometry={nodes.visuals_3.geometry}
material={materials.fanuc_white}
/>
<mesh
name="visuals_3_1"
castShadow
receiveShadow
geometry={nodes.visuals_3_1.geometry}
material={materials.fanuc_green}
/>
</group>
</animated.group>
<mesh
name="link_2"
castShadow
receiveShadow
geometry={nodes.link_2.geometry}
material={materials.fanuc_white}
rotation={[-Math.PI / 2, 0, -Math.PI / 2]}
/>
</animated.group>
<group name="link_1">
<mesh
name="visuals_1"
castShadow
receiveShadow
geometry={nodes.visuals_1.geometry}
material={materials.fanuc_green}
/>
<mesh
name="visuals_1_1"
castShadow
receiveShadow
geometry={nodes.visuals_1_1.geometry}
material={materials.fanuc_white}
/>
<mesh
name="visuals_1_2"
castShadow
receiveShadow
geometry={nodes.visuals_1_2.geometry}
material={materials.fanuc_green}
/>
</group>
</animated.group>
</group>
</group>
)
}
4 changes: 4 additions & 0 deletions src/components/robots/SupportedRobot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { ErrorBoundary } from "react-error-boundary"
import * as THREE from "three"
import { externalizeComponent } from "../../externalizeComponent"
import ConsoleFilter from "../ConsoleFilter"
import { FANUC_CRX10iAL } from "./FANUC_CRX10iAL"
import RobotAnimator from "./RobotAnimator"
import type { RobotModelComponent } from "./types"

Expand Down Expand Up @@ -200,6 +201,9 @@ export const SupportedRobot = externalizeComponent(
case "FANUC_CRX10iA":
Robot = FANUC_CRX10iA
break
case "FANUC_CRX10iAL":
Robot = FANUC_CRX10iAL
break
case "FANUC_CRX20iAL":
Robot = FANUC_CRX20iAL
break
Expand Down
73 changes: 73 additions & 0 deletions stories/robots/FANUC_CRX10iAL.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type { StoryObj } from "@storybook/react"
import { SupportedRobot } from "../../src"
import { rapidlyChangingMotionState } from "./motionState"
import { sharedStoryConfig } from "./robotStoryConfig"

export default {
...sharedStoryConfig,
tags: ["!autodocs"],
title: "3D View/Robot/Supported Models/FANUC_CRX10iAL",
}

function SupportedRobotScene(
props: React.ComponentProps<typeof SupportedRobot>,
) {
return (
<SupportedRobot
{...props}
rapidlyChangingMotionState={rapidlyChangingMotionState}
dhParameters={[
{
a: 0,
d: 0,
alpha: 1.5707963267948966,
theta: 0,
reverse_rotation_direction: false,
},
{
a: 710,
d: 0,
alpha: 0,
theta: 1.5707963267948966,
reverse_rotation_direction: false,
},
{
a: 0,
d: 0,
alpha: -1.5707963267948966,
theta: 0,
reverse_rotation_direction: false,
},
{
a: 0,
d: -540,
alpha: 1.5707963267948966,
theta: 0,
reverse_rotation_direction: false,
},
{
a: 0,
d: 150,
alpha: -1.5707963267948966,
theta: 0,
reverse_rotation_direction: false,
},
{
a: 0,
d: -160,
alpha: 3.1415926535897931,
theta: 0,
reverse_rotation_direction: false,
},
]}
/>
)
}

export const RobotStory: StoryObj<typeof SupportedRobotScene> = {
args: {
modelFromController: "FANUC_CRX10iAL",
},
render: (args) => <SupportedRobotScene {...args} />,
name: "FANUC_CRX10iAL",
}

0 comments on commit 402d45d

Please sign in to comment.