@wandelbots/wandelbots-js-react-components 4.7.1 → 4.7.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.
@@ -1,20 +1,24 @@
1
- import { useEffect, useMemo } from "react"
2
1
  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"
6
7
  import type {
8
+ Capsule,
7
9
  Collider,
8
10
  ConvexHull,
9
11
  DHParameter,
10
12
  MotionGroupDescription,
11
- Sphere,
12
- Capsule,
13
13
  RectangularCapsule,
14
+ Sphere,
14
15
  } from "@wandelbots/nova-js/v2"
15
- import type { Geometry, SafetySetupSafetyZone } from "@wandelbots/nova-js/v1"
16
16
 
17
- import { dhParametersToPlaneSize, orientationToQuaternion, verticesToCoplanarity } from "../utils/converters"
17
+ import {
18
+ dhParametersToPlaneSize,
19
+ orientationToQuaternion,
20
+ verticesToCoplanarity,
21
+ } from "../utils/converters"
18
22
 
19
23
  export type SafetyZonesRendererProps = {
20
24
  safetyZones: SafetySetupSafetyZone[] | MotionGroupDescription["safety_zones"]
@@ -50,7 +54,9 @@ export function SafetyZonesRenderer({
50
54
  */
51
55
  useEffect(() => {
52
56
  Array.isArray(safetyZones) &&
53
- console.warn("SafetyZonesRenderer: The support of V1 safety zones is deprecated. Please migrate to V2 safety zones.")
57
+ console.warn(
58
+ "SafetyZonesRenderer: The support of V1 safety zones is deprecated. Please migrate to V2 safety zones.",
59
+ )
54
60
  }, [safetyZones])
55
61
 
56
62
  /**
@@ -63,14 +69,23 @@ export function SafetyZonesRenderer({
63
69
  return null
64
70
  }
65
71
 
66
- const position = new THREE.Vector3(zone.pose.position[0] / 1000, zone.pose.position[1] / 1000, zone.pose.position[2] / 1000)
67
- const orientation = new THREE.Vector3(zone.pose.orientation[0], zone.pose.orientation[1], zone.pose.orientation[2])
72
+ const position = new THREE.Vector3(
73
+ zone.pose.position[0] / 1000,
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
+ )
68
82
 
69
83
  let geometry: React.ReactElement | null
70
84
 
71
- const materialProps = zone.shape.shape_type === "plane"
72
- ? { ...safetyZoneMaterialProps, side: THREE.DoubleSide }
73
- : { ...safetyZoneMaterialProps, side: THREE.FrontSide }
85
+ const materialProps =
86
+ zone.shape.shape_type === "plane"
87
+ ? { ...safetyZoneMaterialProps, side: THREE.DoubleSide }
88
+ : { ...safetyZoneMaterialProps, side: THREE.FrontSide }
74
89
 
75
90
  switch (zone.shape.shape_type) {
76
91
  /**
@@ -118,7 +133,12 @@ export function SafetyZonesRenderer({
118
133
  vertices.push(newVertex)
119
134
  }
120
135
  try {
121
- geometry = <primitive object={new ConvexGeometry(vertices)} attach="geometry" />
136
+ geometry = (
137
+ <primitive
138
+ object={new ConvexGeometry(vertices)}
139
+ attach="geometry"
140
+ />
141
+ )
122
142
  } catch (error) {
123
143
  console.log("Error creating ConvexGeometry:", error)
124
144
  return null
@@ -134,18 +154,26 @@ export function SafetyZonesRenderer({
134
154
  * Basically a rounded box with a rectangular cross-section.
135
155
  */
136
156
  case "rectangular_capsule": {
137
- const shape = (zone.shape as RectangularCapsule)
157
+ const shape = zone.shape as RectangularCapsule
138
158
  const rcRadius = shape.radius / 1000
139
159
  const width = shape.sphere_center_distance_x / 1000
140
160
  const height = shape.sphere_center_distance_y / 1000
141
161
  const depth = rcRadius * 2
142
162
 
143
- geometry = <primitive object={new RoundedBoxGeometry(width, height, depth, 2, rcRadius)} attach="geometry" />
163
+ geometry = (
164
+ <primitive
165
+ object={new RoundedBoxGeometry(width, height, depth, 2, rcRadius)}
166
+ attach="geometry"
167
+ />
168
+ )
144
169
  break
145
170
  }
146
171
 
147
172
  default: {
148
- console.warn("Unsupported safety zone shape type:", zone.shape.shape_type)
173
+ console.warn(
174
+ "Unsupported safety zone shape type:",
175
+ zone.shape.shape_type,
176
+ )
149
177
  geometry = null
150
178
  }
151
179
  }
@@ -158,10 +186,7 @@ export function SafetyZonesRenderer({
158
186
  quaternion={orientationToQuaternion(orientation)}
159
187
  >
160
188
  {geometry}
161
- <meshStandardMaterial
162
- {...materialProps}
163
- polygonOffsetFactor={-id}
164
- />
189
+ <meshStandardMaterial {...materialProps} polygonOffsetFactor={-id} />
165
190
  </mesh>
166
191
  )
167
192
  }
@@ -170,9 +195,11 @@ export function SafetyZonesRenderer({
170
195
  * Helper function to render V2 safety zones
171
196
  */
172
197
  const renderV2SafetyZones = () => {
173
- return Object.values(safetyZones ?? {}).map((zone: Collider, index: number) => {
174
- return renderMesh(index, zone)
175
- })
198
+ return Object.values(safetyZones ?? {}).map(
199
+ (zone: Collider, index: number) => {
200
+ return renderMesh(index, zone)
201
+ },
202
+ )
176
203
  }
177
204
 
178
205
  /**
@@ -182,62 +209,83 @@ export function SafetyZonesRenderer({
182
209
  */
183
210
  const renderV1SafetyZones = () => {
184
211
  if (Array.isArray(safetyZones)) {
185
- return (safetyZones as SafetySetupSafetyZone[]).map((zone: SafetySetupSafetyZone, index) => {
186
- let geometries: Geometry[] = []
187
- if (zone.geometry) {
188
- if (zone.geometry.compound) {
189
- geometries = zone.geometry.compound.child_geometries
190
- } else if (zone.geometry.convex_hull) {
191
- geometries = [zone.geometry]
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
+ }
192
221
  }
193
- }
194
222
 
195
- return geometries.map((geometry, i) => {
196
- if (!geometry.convex_hull) return null
223
+ return geometries.map((geometry, i) => {
224
+ if (!geometry.convex_hull) return null
197
225
 
198
- const vertices = geometry.convex_hull.vertices.map(
199
- (v) => new THREE.Vector3(v.x / 1000, v.y / 1000, v.z / 1000),
200
- )
226
+ const vertices = geometry.convex_hull.vertices.map(
227
+ (v) => new THREE.Vector3(v.x / 1000, v.y / 1000, v.z / 1000),
228
+ )
201
229
 
202
- // Check if the vertices are on the same plane and only define a plane
203
- // Algorithm has troubles with vertices that are on the same plane so we
204
- // add a new vertex slightly moved along the normal direction
205
- const coplanarityResult = verticesToCoplanarity(vertices)
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)
206
234
 
207
- if (coplanarityResult.isCoplanar && coplanarityResult.normal) {
208
- // Add a new vertex slightly moved along the normal direction
209
- const offset = 0.0001
210
- const newVertex = new THREE.Vector3().addVectors(
211
- vertices[0],
212
- coplanarityResult.normal.multiplyScalar(offset),
213
- )
214
- vertices.push(newVertex)
215
- }
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
+ }
216
244
 
217
- let convexGeometry
218
- try {
219
- convexGeometry = new ConvexGeometry(vertices)
220
- } catch (error) {
221
- console.log("Error creating ConvexGeometry:", error)
222
- return null
223
- }
224
- return (
225
- <mesh key={`${index}-${i}`} geometry={convexGeometry}>
226
- <meshStandardMaterial
227
- key={index}
228
- attach="material"
229
- color="#009f4d"
230
- opacity={0.2}
231
- depthTest={false}
232
- depthWrite={false}
233
- transparent
234
- polygonOffset
235
- polygonOffsetFactor={-i}
236
- />
237
- </mesh>
238
- )
239
- })
240
- })
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
+ )
241
289
  }
242
290
  return null
243
291
  }
@@ -251,9 +299,5 @@ export function SafetyZonesRenderer({
251
299
  : renderV2SafetyZones()
252
300
  }, [safetyZones, renderV1SafetyZones, renderV2SafetyZones])
253
301
 
254
- return (
255
- <group {...props}>
256
- {renderedSafetyZones}
257
- </group>
258
- )
259
- }
302
+ return <group {...props}>{renderedSafetyZones}</group>
303
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"MotionGroupVisualizer-7Mw9PINy.js","sources":["../src/components/3d-viewport/collider/colliderShapeToBufferGeometry.ts","../src/components/3d-viewport/collider/ColliderElement.tsx","../src/components/3d-viewport/collider/ColliderCollection.tsx","../src/components/3d-viewport/collider/CollisionSceneRenderer.tsx","../src/components/3d-viewport/PresetEnvironment.tsx","../src/components/3d-viewport/SafetyZonesRenderer.tsx","../src/components/3d-viewport/TrajectoryRenderer.tsx","../src/components/robots/robotModelLogic.ts","../src/components/robots/RobotAnimator.tsx","../src/components/robots/DHRobot.tsx","../src/components/ConsoleFilter.tsx","../src/components/robots/GenericRobot.tsx","../src/components/robots/ghostStyle.ts","../src/components/robots/SupportedRobot.tsx","../src/components/robots/Robot.tsx","../src/components/RobotCard.tsx","../src/components/robots/AxisConfig.ts","../src/components/robots/LinearAxisAnimator.tsx","../src/components/robots/DHLinearAxis.tsx","../src/components/robots/SupportedLinearAxis.tsx","../src/components/robots/LinearAxis.tsx","../src/components/robots/manufacturerHomePositions.ts","../src/components/robots/MotionGroupVisualizer.tsx"],"sourcesContent":["import type { ColliderShape } from \"@wandelbots/nova-js/v1\"\nimport * as THREE from \"three\"\nimport { ConvexGeometry } from \"three-stdlib\"\n\nexport function colliderShapeToBufferGeometry(\n shape: ColliderShape,\n): THREE.BufferGeometry {\n const shapeType = shape.shape_type\n switch (shapeType) {\n case \"convex_hull\":\n return new ConvexGeometry(\n shape.vertices.map(\n (vertex) =>\n new THREE.Vector3(\n vertex[0] / 1000,\n vertex[1] / 1000,\n vertex[2] / 1000,\n ),\n ),\n )\n case \"box\":\n return new THREE.BoxGeometry(\n shape.size_x / 1000,\n shape.size_y / 1000,\n shape.size_z / 1000,\n )\n case \"sphere\":\n return new THREE.SphereGeometry(shape.radius / 1000)\n case \"capsule\":\n return new THREE.CapsuleGeometry(\n shape.radius / 1000,\n shape.cylinder_height / 1000,\n )\n case \"cylinder\":\n return new THREE.CylinderGeometry(\n shape.radius / 1000,\n shape.radius / 1000,\n shape.height / 1000,\n )\n case \"rectangle\": {\n return new THREE.BoxGeometry(shape.size_x / 1000, shape.size_y / 1000, 0)\n }\n default: {\n console.warn(`${shape.shape_type} is not supported`)\n return new THREE.BufferGeometry()\n }\n }\n}\n","import type { Collider } from \"@wandelbots/nova-js/v1\"\nimport type React from \"react\"\nimport * as THREE from \"three\"\nimport { colliderShapeToBufferGeometry } from \"./colliderShapeToBufferGeometry\"\n\ntype ColliderElementProps = {\n name?: string\n collider: Collider\n children?: React.ReactNode\n}\n\nexport default function ColliderElement({\n name,\n collider,\n children,\n}: ColliderElementProps) {\n const position = collider.pose?.position ?? [0, 0, 0]\n const rotation = collider.pose?.orientation ?? [0, 0, 0]\n if (collider.margin) {\n console.warn(`${name} margin is not supported`)\n }\n return (\n <mesh\n name={name}\n position={new THREE.Vector3(\n position[0],\n position[1],\n position[2],\n ).divideScalar(1000)}\n rotation={new THREE.Euler(rotation[0], rotation[1], rotation[2], \"XYZ\")}\n geometry={colliderShapeToBufferGeometry(collider.shape)}\n >\n {children}\n </mesh>\n )\n}\n","import type { ThreeElements } from \"@react-three/fiber\"\nimport type { Collider } from \"@wandelbots/nova-js/v1\"\nimport ColliderElement from \"./ColliderElement\"\n\nexport type MeshChildrenProvider = (\n key: string,\n collider: Collider,\n) => React.ReactNode\n\ntype ColliderCollectionProps = {\n name?: string\n colliders: Record<string, Collider>\n meshChildrenProvider: MeshChildrenProvider\n} & ThreeElements[\"group\"]\n\nexport default function ColliderCollection({\n name,\n colliders,\n meshChildrenProvider,\n ...props\n}: ColliderCollectionProps) {\n return (\n <group name={name} {...props}>\n {Object.entries(colliders).map(([colliderKey, collider]) => (\n <ColliderElement\n key={colliderKey}\n name={colliderKey}\n collider={collider}\n children={meshChildrenProvider(colliderKey, collider)}\n />\n ))}\n </group>\n )\n}\n","import type { CollisionScene } from \"@wandelbots/nova-js/v1\"\nimport ColliderCollection, {\n type MeshChildrenProvider,\n} from \"./ColliderCollection\"\n\ntype CollisionSceneRendererProps = {\n scene: CollisionScene\n meshChildrenProvider: MeshChildrenProvider\n}\n\nexport default function CollisionSceneRenderer({\n scene,\n meshChildrenProvider,\n}: CollisionSceneRendererProps) {\n const colliders = scene.colliders\n return (\n <group>\n {colliders && (\n <ColliderCollection\n meshChildrenProvider={meshChildrenProvider}\n colliders={colliders}\n />\n )}\n </group>\n )\n}\n","import { Environment, Lightformer } from \"@react-three/drei\"\n\n/**\n * Renders a preset environment for the 3D scene.\n * This component wraps the scene with an `Environment` component\n * and builds a lightmap build with `Lightformers`.\n */\nexport function PresetEnvironment() {\n return (\n <Environment>\n <Lightformers />\n </Environment>\n )\n}\n\nfunction Lightformers({ positions = [2, 0, 2, 0, 2, 0, 2, 0] }) {\n return (\n <>\n {/* Ceiling */}\n <Lightformer\n intensity={5}\n rotation-x={Math.PI / 2}\n position={[0, 5, -9]}\n scale={[10, 10, 1]}\n />\n <group rotation={[0, 0.5, 0]}>\n <group>\n {positions.map((x, i) => (\n <Lightformer\n key={i}\n form=\"circle\"\n intensity={5}\n rotation={[Math.PI / 2, 0, 0]}\n position={[x, 4, i * 4]}\n scale={[3, 1, 1]}\n />\n ))}\n </group>\n </group>\n {/* Sides */}\n <Lightformer\n intensity={40}\n rotation-y={Math.PI / 2}\n position={[-5, 1, -1]}\n scale={[20, 0.1, 1]}\n />\n <Lightformer\n intensity={20}\n rotation-y={-Math.PI}\n position={[-5, -2, -1]}\n scale={[20, 0.1, 1]}\n />\n\n <Lightformer\n rotation-y={Math.PI / 2}\n position={[-5, -1, -1]}\n scale={[20, 0.5, 1]}\n intensity={5}\n />\n <Lightformer\n rotation-y={-Math.PI / 2}\n position={[10, 1, 0]}\n scale={[20, 1, 1]}\n intensity={10}\n />\n\n {/* Key */}\n <Lightformer\n form=\"ring\"\n color=\"white\"\n intensity={5}\n scale={10}\n position={[-15, 4, -18]}\n target={[0, 0, 0]}\n />\n </>\n )\n}\n","import { useEffect, useMemo } from \"react\"\nimport { type ThreeElements } from \"@react-three/fiber\"\nimport * as THREE from \"three\"\nimport { ConvexGeometry, RoundedBoxGeometry } from \"three-stdlib\"\n\nimport type {\n Collider,\n ConvexHull,\n DHParameter,\n MotionGroupDescription,\n Sphere,\n Capsule,\n RectangularCapsule,\n} from \"@wandelbots/nova-js/v2\"\nimport type { Geometry, SafetySetupSafetyZone } from \"@wandelbots/nova-js/v1\"\n\nimport { dhParametersToPlaneSize, orientationToQuaternion, verticesToCoplanarity } from \"../utils/converters\"\n\nexport type SafetyZonesRendererProps = {\n safetyZones: SafetySetupSafetyZone[] | MotionGroupDescription[\"safety_zones\"]\n dhParameters?: DHParameter[]\n} & ThreeElements[\"group\"]\n\nexport function SafetyZonesRenderer({\n safetyZones,\n dhParameters,\n ...props\n }: SafetyZonesRendererProps) {\n /**\n * Common material properties for safety zone meshes\n */\n const safetyZoneMaterialProps = {\n attach: \"material\" as const,\n color: \"#009f4d\",\n opacity: 0.2,\n depthTest: false,\n depthWrite: false,\n transparent: true,\n polygonOffset: true,\n }\n\n /**\n * Plane size for the plane safety zones, returns the reach distance\n * of the robot\n */\n const planeSize = dhParametersToPlaneSize(dhParameters ?? [])\n\n /**\n * Warning during runtime stating the deprecation of the V1 safety zones\n */\n useEffect(() => {\n Array.isArray(safetyZones) &&\n console.warn(\"SafetyZonesRenderer: The support of V1 safety zones is deprecated. Please migrate to V2 safety zones.\")\n }, [safetyZones])\n\n /**\n * Helper function to render plane, sphere, and capsule meshes\n * @param id number\n * @param zone Collider\n */\n const renderMesh = (id: number, zone: Collider) => {\n if (!zone?.pose?.position || !zone?.pose?.orientation) {\n return null\n }\n\n const position = new THREE.Vector3(zone.pose.position[0] / 1000, zone.pose.position[1] / 1000, zone.pose.position[2] / 1000)\n const orientation = new THREE.Vector3(zone.pose.orientation[0], zone.pose.orientation[1], zone.pose.orientation[2])\n\n let geometry: React.ReactElement | null\n\n const materialProps = zone.shape.shape_type === \"plane\"\n ? { ...safetyZoneMaterialProps, side: THREE.DoubleSide }\n : { ...safetyZoneMaterialProps, side: THREE.FrontSide }\n\n switch (zone.shape.shape_type) {\n /**\n * Plane shape, uses DH parameters to calculate the size of the plane (reach distance of a robot)\n */\n case \"plane\":\n geometry = <planeGeometry args={[planeSize, planeSize]} />\n break\n\n /**\n * Sphere shape\n */\n case \"sphere\": {\n const radius = (zone?.shape as Sphere).radius / 1000\n geometry = <sphereGeometry args={[radius]} />\n break\n }\n\n /**\n * Capsule shape\n */\n case \"capsule\": {\n const capsuleRadius = (zone?.shape as Capsule).radius / 1000\n const height = (zone?.shape as Capsule).cylinder_height / 1000\n geometry = <capsuleGeometry args={[capsuleRadius, height]} />\n break\n }\n\n /**\n * Convex hull, checks at first if the vertices are coplanar - if yes, adds a small offset for\n * renderer to be able to visualize the convex hull.\n */\n case \"convex_hull\": {\n const vertices = (zone?.shape as ConvexHull).vertices.map(\n (v) => new THREE.Vector3(v[0] / 1000, v[1] / 1000, v[2] / 1000),\n )\n // Check if the vertices are on the same plane\n const coplanarityResult = verticesToCoplanarity(vertices)\n if (coplanarityResult.isCoplanar && coplanarityResult.normal) {\n const offset = 0.0001\n const newVertex = new THREE.Vector3().addVectors(\n vertices[0],\n coplanarityResult.normal.multiplyScalar(offset),\n )\n vertices.push(newVertex)\n }\n try {\n geometry = <primitive object={new ConvexGeometry(vertices)} attach=\"geometry\" />\n } catch (error) {\n console.log(\"Error creating ConvexGeometry:\", error)\n return null\n }\n break\n }\n\n /**\n * Convex hull around four spheres. Sphere center points in x/y-plane,\n * offset by either combination \"+/- sizeX\" or \"+/- sizeY\".\n * Alternative description: Rectangle in x/y-plane with a 3D padding (source: nova-api docs)\n *\n * Basically a rounded box with a rectangular cross-section.\n */\n case \"rectangular_capsule\": {\n const shape = (zone.shape as RectangularCapsule)\n const rcRadius = shape.radius / 1000\n const width = shape.sphere_center_distance_x / 1000\n const height = shape.sphere_center_distance_y / 1000\n const depth = rcRadius * 2\n\n geometry = <primitive object={new RoundedBoxGeometry(width, height, depth, 2, rcRadius)} attach=\"geometry\" />\n break\n }\n\n default: {\n console.warn(\"Unsupported safety zone shape type:\", zone.shape.shape_type)\n geometry = null\n }\n }\n\n return (\n <mesh\n key={`safety-zone-${zone.shape.shape_type}-${id}`}\n renderOrder={id}\n position={position}\n quaternion={orientationToQuaternion(orientation)}\n >\n {geometry}\n <meshStandardMaterial\n {...materialProps}\n polygonOffsetFactor={-id}\n />\n </mesh>\n )\n }\n\n /**\n * Helper function to render V2 safety zones\n */\n const renderV2SafetyZones = () => {\n return Object.values(safetyZones ?? {}).map((zone: Collider, index: number) => {\n return renderMesh(index, zone)\n })\n }\n\n /**\n * Helper function to V1 safety zones\n * @deprecated this render function is to be seen as a temporary measure, as the support\n * for the V1 safety zones is to be removed in the future\n */\n const renderV1SafetyZones = () => {\n if (Array.isArray(safetyZones)) {\n return (safetyZones as SafetySetupSafetyZone[]).map((zone: SafetySetupSafetyZone, index) => {\n let geometries: Geometry[] = []\n if (zone.geometry) {\n if (zone.geometry.compound) {\n geometries = zone.geometry.compound.child_geometries\n } else if (zone.geometry.convex_hull) {\n geometries = [zone.geometry]\n }\n }\n\n return geometries.map((geometry, i) => {\n if (!geometry.convex_hull) return null\n\n const vertices = geometry.convex_hull.vertices.map(\n (v) => new THREE.Vector3(v.x / 1000, v.y / 1000, v.z / 1000),\n )\n\n // Check if the vertices are on the same plane and only define a plane\n // Algorithm has troubles with vertices that are on the same plane so we\n // add a new vertex slightly moved along the normal direction\n const coplanarityResult = verticesToCoplanarity(vertices)\n\n if (coplanarityResult.isCoplanar && coplanarityResult.normal) {\n // Add a new vertex slightly moved along the normal direction\n const offset = 0.0001\n const newVertex = new THREE.Vector3().addVectors(\n vertices[0],\n coplanarityResult.normal.multiplyScalar(offset),\n )\n vertices.push(newVertex)\n }\n\n let convexGeometry\n try {\n convexGeometry = new ConvexGeometry(vertices)\n } catch (error) {\n console.log(\"Error creating ConvexGeometry:\", error)\n return null\n }\n return (\n <mesh key={`${index}-${i}`} geometry={convexGeometry}>\n <meshStandardMaterial\n key={index}\n attach=\"material\"\n color=\"#009f4d\"\n opacity={0.2}\n depthTest={false}\n depthWrite={false}\n transparent\n polygonOffset\n polygonOffsetFactor={-i}\n />\n </mesh>\n )\n })\n })\n }\n return null\n }\n\n /**\n * Helper variable to render both api versions of safety zones\n */\n const renderedSafetyZones = useMemo(() => {\n return Array.isArray(safetyZones)\n ? renderV1SafetyZones()\n : renderV2SafetyZones()\n }, [safetyZones, renderV1SafetyZones, renderV2SafetyZones])\n\n return (\n <group {...props}>\n {renderedSafetyZones}\n </group>\n )\n}\n","import { Line } from \"@react-three/drei\"\nimport type { GetTrajectoryResponse } from \"@wandelbots/nova-js/v1\"\nimport * as THREE from \"three\"\n\nexport type TrajectoryRendererProps = {\n trajectory: GetTrajectoryResponse\n} & React.JSX.IntrinsicElements[\"group\"]\n\nexport function TrajectoryRenderer({\n trajectory,\n ...props\n}: TrajectoryRendererProps) {\n const points =\n trajectory.trajectory\n ?.map((point) => {\n if (point.tcp_pose) {\n return new THREE.Vector3(\n point.tcp_pose.position.x / 1000,\n point.tcp_pose.position.z / 1000,\n -point.tcp_pose.position.y / 1000,\n )\n }\n return null\n })\n .filter((point): point is THREE.Vector3 => point !== null) || []\n\n return (\n <group {...props}>\n {points.length > 0 && (\n <Line\n points={points}\n lineWidth={3}\n polygonOffset={true}\n polygonOffsetFactor={10}\n polygonOffsetUnits={10}\n />\n )}\n </group>\n )\n}\n","import { NovaClient } from \"@wandelbots/nova-js/v2\"\nimport type { Object3D } from \"three\"\nimport type { GLTF } from \"three-stdlib\"\n\nconst modelCache = new Map<string, Promise<string>>()\n\n/**\n * Revoke a cached model's object URL to prevent memory leaks.\n * Call this when a component unmounts or no longer needs the model.\n */\nexport async function revokeModelUrl(modelFromController: string): Promise<void> {\n const urlPromise = modelCache.get(modelFromController)\n if (!urlPromise) return\n\n try {\n const url = await urlPromise\n URL.revokeObjectURL(url)\n } catch (e) {\n // Ignore errors - URL may already be revoked\n }\n modelCache.delete(modelFromController)\n}\n\n/**\n * Revoke all cached model object URLs and clear the cache.\n * Useful for cleanup on app teardown.\n */\nexport async function revokeAllModelUrls(): Promise<void> {\n const entries = Array.from(modelCache.entries())\n await Promise.allSettled(\n entries.map(async ([key, urlPromise]) => {\n try {\n const url = await urlPromise\n URL.revokeObjectURL(url)\n } catch (e) {\n // Ignore errors\n }\n })\n )\n modelCache.clear()\n}\n\nexport async function defaultGetModel(modelFromController: string, instanceUrlProp?: string): Promise<string> {\n // Check cache first\n if (modelCache.has(modelFromController)) {\n return modelCache.get(modelFromController)!\n }\n \n // Create the promise and cache it immediately to prevent duplicate calls\n const modelPromise = (async () => {\n const instanceUrl = instanceUrlProp || import.meta.env.WANDELAPI_BASE_URL\n const nova = new NovaClient({ instanceUrl })\n \n // Configure axios to handle binary responses for GLB files\n const apiInstance = nova.api.motionGroupModels as any\n if (apiInstance.axios?.interceptors) {\n apiInstance.axios.interceptors.request.use((config: any) => {\n if (config.url?.includes('/glb')) {\n config.responseType = 'blob'\n }\n return config\n })\n }\n \n try {\n const file = await nova.api.motionGroupModels.getMotionGroupGlbModel(modelFromController)\n \n // Create object URL from the file and return it\n const url = URL.createObjectURL(file)\n return url\n } catch (error) {\n console.error(\"Failed to fetch model:\", error)\n throw error\n }\n })()\n \n // Cache the promise\n modelCache.set(modelFromController, modelPromise)\n return modelPromise\n}\n\n/**\n * Finds all the joint groups in a GLTF tree, as identified\n * by the _Jxx name ending convention.\n */\nexport function collectJoints(rootObject: Object3D): Object3D[] {\n function getAllObjects(root: Object3D): Object3D[] {\n if (root.children.length === 0) {\n return [root]\n }\n return [root, ...root.children.flatMap((child) => getAllObjects(child))]\n }\n\n return getAllObjects(rootObject).filter((o) => isJoint(o))\n}\n\n/**\n * Checks if a specified threejs object represents the flange of a\n * robot, based on the _FLG name ending convention.\n */\nexport function isFlange(node: Object3D) {\n return node.name.endsWith(\"_FLG\")\n}\n\n/**\n * Checks if a specified threejs object represents a joint of a\n * robot, based on the _Jxx name ending convention.\n */\nexport function isJoint(node: Object3D) {\n return /_J[0-9]+$/.test(node.name)\n}\n\n/**\n * Validates that the loaded GLTF file has six joints and a flange group.\n */\nexport function parseRobotModel(gltf: GLTF, filename: string): { gltf: GLTF } {\n let flange: Object3D | undefined\n const joints: Object3D[] = []\n\n function parseNode(node: Object3D) {\n if (isFlange(node)) {\n if (flange) {\n throw Error(\n `Found multiple flange groups in robot model ${filename}; first ${flange.name} then ${node.name}. Only one _FLG group is allowed.`,\n )\n }\n\n flange = node\n }\n\n if (isJoint(node)) {\n joints.push(node)\n }\n\n node.children.map(parseNode)\n }\n\n parseNode(gltf.scene)\n\n if (!flange) {\n throw Error(\n `No flange group found in robot model ${filename}. Flange must be identified with a name ending in _FLG.`,\n )\n }\n\n return { gltf }\n}\n","import { useFrame, useThree } from \"@react-three/fiber\"\nimport type { DHParameter, MotionGroupState } from \"@wandelbots/nova-js/v2\"\nimport React, { useEffect, useRef, useCallback } from \"react\"\nimport type { Group, Object3D } from \"three\"\nimport { useAutorun } from \"../utils/hooks\"\nimport { ValueInterpolator } from \"../utils/interpolation\"\nimport { collectJoints } from \"./robotModelLogic\"\n\ntype RobotAnimatorProps = {\n rapidlyChangingMotionState: MotionGroupState\n dhParameters: DHParameter[]\n onRotationChanged?: (joints: Object3D[], jointValues: number[]) => void\n children: React.ReactNode\n}\n\nexport default function RobotAnimator({\n rapidlyChangingMotionState,\n dhParameters,\n onRotationChanged,\n children,\n}: RobotAnimatorProps) {\n const jointValues = useRef<number[]>([])\n const jointObjects = useRef<Object3D[]>([])\n const interpolatorRef = useRef<ValueInterpolator | null>(null)\n const { invalidate } = useThree()\n\n // Initialize interpolator\n useEffect(() => {\n const initialJointValues = rapidlyChangingMotionState.joint_position.filter(\n (item) => item !== undefined,\n )\n\n interpolatorRef.current = new ValueInterpolator(initialJointValues, {\n tension: 120, // Controls spring stiffness - higher values create faster, more responsive motion\n friction: 20, // Controls damping - higher values reduce oscillation and create smoother settling\n threshold: 0.001,\n })\n\n return () => {\n interpolatorRef.current?.destroy()\n }\n }, [])\n\n // Animation loop that runs at the display's refresh rate\n useFrame((state, delta) => {\n if (interpolatorRef.current) {\n const isComplete = interpolatorRef.current.update(delta)\n setRotation()\n\n // Trigger a re-render only if the animation is still running\n if (!isComplete) {\n invalidate()\n }\n }\n })\n\n function setGroupRef(group: Group | null) {\n if (!group) return\n\n jointObjects.current = collectJoints(group)\n\n // Set initial position\n setRotation()\n invalidate()\n }\n\n function setRotation() {\n const updatedJointValues = interpolatorRef.current?.getCurrentValues() || []\n\n if (onRotationChanged) {\n onRotationChanged(jointObjects.current, updatedJointValues)\n } else {\n for (const [index, object] of jointObjects.current.entries()) {\n const dhParam = dhParameters[index]\n const rotationOffset = dhParam.theta || 0\n const rotationSign = dhParam.reverse_rotation_direction ? -1 : 1\n\n object.rotation.y =\n rotationSign * (updatedJointValues[index] || 0) + rotationOffset\n }\n }\n }\n\n const updateJoints = useCallback(() => {\n const newJointValues = rapidlyChangingMotionState.joint_position.filter(\n (item) => item !== undefined,\n )\n\n requestAnimationFrame(() => {\n jointValues.current = newJointValues\n interpolatorRef.current?.setTarget(newJointValues)\n })\n }, [rapidlyChangingMotionState])\n\n /**\n * Fire an update joints call on every motion state change.\n * requestAnimationFrame used to avoid blocking main thread\n */\n useEffect(() => {\n updateJoints()\n }, [rapidlyChangingMotionState, updateJoints])\n\n /**\n * As some consumer applications (eg. storybook) deliver\n * mobx observable for rapidlyChangingMotionState, we need to\n * register the watcher to get the newest value updates\n */\n useAutorun(() => {\n updateJoints()\n })\n\n return <group ref={setGroupRef}>{children}</group>\n}\n","import { Line } from \"@react-three/drei\"\nimport type { DHParameter } from \"@wandelbots/nova-js/v2\"\nimport React, { useRef } from \"react\"\nimport type * as THREE from \"three\"\nimport { Matrix4, Quaternion, Vector3 } from \"three\"\nimport type { LineGeometry } from \"three/examples/jsm/lines/LineGeometry.js\"\nimport RobotAnimator from \"./RobotAnimator\"\nimport type { DHRobotProps } from \"./SupportedRobot\"\n\nconst CHILD_LINE = \"line\"\nconst CHILD_MESH = \"mesh\"\n\nexport function DHRobot({\n rapidlyChangingMotionState,\n dhParameters,\n ...props\n}: DHRobotProps) {\n // reused in every update\n const accumulatedMatrix = new Matrix4()\n\n // Store direct references to avoid searching by name\n const lineRefs = useRef<any[]>([])\n const meshRefs = useRef<(THREE.Mesh | null)[]>([])\n\n // Initialize refs array when dhParameters change\n React.useEffect(() => {\n lineRefs.current = new Array(dhParameters.length).fill(null)\n meshRefs.current = new Array(dhParameters.length).fill(null)\n }, [dhParameters.length])\n\n // Updates accumulatedMatrix with every execution\n // Reset the matrix to identity if you start a new position update\n function getLinePoints(\n dhParameter: DHParameter,\n jointRotation: number,\n ): {\n a: THREE.Vector3\n b: THREE.Vector3\n } {\n const position = new Vector3()\n const quaternion = new Quaternion()\n const scale = new Vector3()\n accumulatedMatrix.decompose(position, quaternion, scale)\n const prevPosition = position.clone() // Update the previous position\n\n const matrix = new Matrix4()\n .makeRotationY(\n dhParameter.theta! +\n jointRotation * (dhParameter.reverse_rotation_direction ? -1 : 1),\n ) // Rotate around Z\n .multiply(new Matrix4().makeTranslation(0, dhParameter.d! / 1000, 0)) // Translate along Z\n .multiply(new Matrix4().makeTranslation(dhParameter.a! / 1000, 0, 0)) // Translate along X\n .multiply(new Matrix4().makeRotationX(dhParameter.alpha!)) // Rotate around X\n\n // Accumulate transformations\n accumulatedMatrix.multiply(matrix)\n accumulatedMatrix.decompose(position, quaternion, scale)\n return { a: prevPosition, b: position }\n }\n\n function setJointLineRotation(\n jointIndex: number,\n line: any, // Use any for drei Line component\n mesh: THREE.Mesh,\n jointValue: number,\n ) {\n if (!dhParameters) {\n return\n }\n\n const dh_parameter = dhParameters[jointIndex]\n if (!dh_parameter) {\n return\n }\n\n const { a, b } = getLinePoints(dh_parameter, jointValue)\n const lineGeometry = line.geometry as LineGeometry\n lineGeometry.setPositions([a.toArray(), b.toArray()].flat())\n\n mesh.position.set(b.x, b.y, b.z)\n }\n\n function setRotation(joints: THREE.Object3D[], jointValues: number[]) {\n accumulatedMatrix.identity()\n\n // Use direct refs instead of searching by name\n for (\n let jointIndex = 0;\n jointIndex < Math.min(joints.length, jointValues.length);\n jointIndex++\n ) {\n const line = lineRefs.current[jointIndex]\n const mesh = meshRefs.current[jointIndex]\n\n if (line && mesh) {\n setJointLineRotation(jointIndex, line, mesh, jointValues[jointIndex]!)\n }\n }\n }\n\n return (\n <>\n <RobotAnimator\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n onRotationChanged={setRotation}\n >\n <group {...props} name=\"Scene\">\n <mesh>\n <sphereGeometry args={[0.01, 32, 32]} />\n <meshStandardMaterial color={\"black\"} depthTest={true} />\n </mesh>\n {dhParameters!.map((param, index) => {\n const { a, b } = getLinePoints(\n param,\n rapidlyChangingMotionState.joint_position[index] ?? 0,\n )\n const jointName = `dhrobot_J0${index}`\n return (\n <group name={jointName} key={jointName}>\n <Line\n ref={(ref) => {\n lineRefs.current[index] = ref\n }}\n name={CHILD_LINE}\n points={[a, b]}\n color={\"white\"}\n lineWidth={5}\n />\n <mesh\n ref={(ref) => {\n meshRefs.current[index] = ref\n }}\n name={CHILD_MESH}\n key={\"mesh_\" + index}\n position={b}\n >\n <sphereGeometry args={[0.01, 32, 32]} />\n <meshStandardMaterial color={\"black\"} depthTest={true} />\n </mesh>\n </group>\n )\n })}\n </group>\n </RobotAnimator>\n </>\n )\n}\n","\"use client\"\nimport { useEffect } from \"react\"\n\nconst defaultWarn = console.warn\n\nexport default function ConsoleFilter() {\n useEffect(() => {\n console.warn = (data) => {\n // This message is caused by a bug from useSpring in combination with Canvas \"demand\" frameloop.\n // For now we can only suppress this warning there are no sideeffects yet\n // See https://github.com/pmndrs/react-spring/issues/1586#issuecomment-915051856\n if (\n data ===\n \"Cannot call the manual advancement of rafz whilst frameLoop is not set as demand\"\n ) {\n return\n }\n\n defaultWarn(data)\n }\n }, [])\n\n return <></>\n}\n","import { useGLTF } from \"@react-three/drei\"\nimport type { ThreeElements } from \"@react-three/fiber\"\nimport React, { useCallback, useEffect, useState } from \"react\"\nimport type { Group, Mesh } from \"three\"\nimport { type Object3D } from \"three\"\nimport { isFlange, parseRobotModel } from \"./robotModelLogic\"\n\nexport type RobotModelProps = {\n modelURL: string | Promise<string>\n /**\n * Called after a robot model has been loaded and\n * rendered into the threejs scene\n */\n postModelRender?: () => void\n flangeRef?: React.Ref<Group>\n} & ThreeElements[\"group\"]\n\nfunction isMesh(node: Object3D): node is Mesh {\n return node.type === \"Mesh\"\n}\n\n// Separate component that only renders when we have a valid URL\nfunction LoadedRobotModel({ \n url, \n flangeRef, \n postModelRender, \n ...props \n}: { \n url: string\n flangeRef?: React.Ref<Group>\n postModelRender?: () => void\n} & ThreeElements[\"group\"]) {\n const gltfResult = useGLTF(url)\n let gltf\n try {\n const parsed = parseRobotModel(gltfResult, 'robot.glb')\n gltf = parsed.gltf\n } catch (err) {\n throw err;\n }\n\n const groupRef: React.RefCallback<Group> = useCallback(\n (group) => {\n if (group && postModelRender) {\n postModelRender()\n }\n },\n [postModelRender],\n )\n\n function renderNode(node: Object3D): React.ReactNode {\n try {\n if (isMesh(node)) {\n // Defensive: only render mesh if geometry exists\n if ((node as Mesh).geometry) {\n return (\n <mesh\n name={node.name}\n key={node.uuid}\n geometry={(node as Mesh).geometry}\n material={(node as Mesh).material}\n position={node.position}\n rotation={node.rotation}\n />\n )\n }\n // Fallback to empty group if geometry is missing\n return (\n <group name={node.name} key={node.uuid} position={node.position} rotation={node.rotation} />\n )\n } else {\n return (\n <group\n name={node.name}\n key={node.uuid}\n position={node.position}\n rotation={node.rotation}\n ref={isFlange(node) ? flangeRef : undefined}\n >\n {node.children.map(renderNode)}\n </group>\n )\n }\n } catch (e) {\n console.warn('Error rendering node', node.name, e)\n return null\n }\n }\n\n return (\n <group {...props} dispose={null} ref={groupRef}>\n {renderNode(gltf.scene)}\n </group>\n )\n}\n\nexport function GenericRobot({\n modelURL,\n flangeRef,\n postModelRender,\n ...props\n}: RobotModelProps) {\n const [resolvedURL, setResolvedURL] = useState<string | null>(null)\n \n useEffect(() => {\n const resolveURL = async () => {\n try {\n if (typeof modelURL === 'string') {\n setResolvedURL(modelURL)\n } else {\n const url = await modelURL\n setResolvedURL(url)\n }\n } catch (error) {\n console.error('Failed to resolve model URL:', error)\n }\n }\n \n resolveURL()\n }, [modelURL])\n\n // Don't render until we have a resolved URL\n if (!resolvedURL) {\n return null // Loading state\n }\n \n return (\n <LoadedRobotModel \n url={resolvedURL}\n flangeRef={flangeRef}\n postModelRender={postModelRender}\n {...props}\n />\n )\n}\n","import * as THREE from \"three\"\n\nexport const applyGhostStyle = (robot: THREE.Group, color: string) => {\n if (robot.userData.isGhost) return\n\n robot.traverse((obj) => {\n if (obj instanceof THREE.Mesh) {\n if (obj.material instanceof THREE.Material) {\n obj.material.colorWrite = false\n }\n\n // Create a clone of the mesh\n const depth = obj.clone()\n const ghost = obj.clone()\n\n depth.material = new THREE.MeshStandardMaterial({\n depthTest: true,\n depthWrite: true,\n colorWrite: false,\n polygonOffset: true,\n polygonOffsetFactor: -1,\n side: THREE.DoubleSide,\n })\n depth.userData.isGhost = true\n\n // Set the material for the ghost mesh\n ghost.material = new THREE.MeshStandardMaterial({\n color: color,\n opacity: 0.3,\n depthTest: true,\n depthWrite: false,\n transparent: true,\n polygonOffset: true,\n polygonOffsetFactor: -2,\n side: THREE.DoubleSide,\n })\n ghost.userData.isGhost = true\n\n if (obj.parent) {\n obj.parent.add(depth)\n obj.parent.add(ghost)\n }\n }\n })\n\n robot.userData.isGhost = true\n}\n\nexport const removeGhostStyle = (robot: THREE.Group) => {\n if (!robot.userData.isGhost) return\n\n const objectsToRemove: THREE.Object3D[] = []\n\n robot.traverse((obj) => {\n if (obj instanceof THREE.Mesh) {\n if (obj.userData?.isGhost) {\n objectsToRemove.push(obj)\n } else if (obj.material instanceof THREE.Material) {\n obj.material.colorWrite = true\n }\n }\n })\n\n objectsToRemove.forEach((obj) => {\n if (obj.parent) {\n obj.parent.remove(obj)\n }\n })\n\n robot.userData.isGhost = false\n}\n","import type { ThreeElements } from \"@react-three/fiber\"\nimport type { DHParameter, MotionGroupState } from \"@wandelbots/nova-js/v2\"\nimport { Suspense, useCallback, useEffect, useState } from \"react\"\nimport { DHRobot } from \"./DHRobot\"\n\nimport { ErrorBoundary } from \"react-error-boundary\"\nimport type * as THREE from \"three\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport ConsoleFilter from \"../ConsoleFilter\"\nimport { GenericRobot } from \"./GenericRobot\"\nimport RobotAnimator from \"./RobotAnimator\"\nimport { applyGhostStyle, removeGhostStyle } from \"./ghostStyle\"\nimport { defaultGetModel } from \"./robotModelLogic\"\n\nexport type DHRobotProps = {\n rapidlyChangingMotionState: MotionGroupState\n dhParameters: Array<DHParameter>\n} & ThreeElements[\"group\"]\n\nexport type SupportedRobotProps = {\n rapidlyChangingMotionState: MotionGroupState\n modelFromController: string\n dhParameters: DHParameter[]\n flangeRef?: React.Ref<THREE.Group>\n instanceUrl?: string\n getModel?: (modelFromController: string, instanceUrl?: string) => Promise<string> | undefined\n postModelRender?: () => void\n transparentColor?: string\n} & ThreeElements[\"group\"]\n\nexport const SupportedRobot = externalizeComponent(\n ({\n rapidlyChangingMotionState,\n modelFromController,\n dhParameters,\n getModel = defaultGetModel,\n flangeRef,\n postModelRender,\n transparentColor,\n instanceUrl,\n ...props\n }: SupportedRobotProps) => {\n const [robotGroup, setRobotGroup] = useState<THREE.Group | null>(null)\n\n const setRobotRef = useCallback((instance: THREE.Group | null) => {\n setRobotGroup(instance)\n }, [])\n\n useEffect(() => {\n if (!robotGroup) return\n\n if (transparentColor) {\n applyGhostStyle(robotGroup, transparentColor)\n } else {\n removeGhostStyle(robotGroup)\n }\n }, [robotGroup, transparentColor])\n\n const dhrobot = (\n <DHRobot\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n {...props}\n />\n )\n\n return (\n <ErrorBoundary\n fallback={dhrobot}\n onError={(err) => {\n // Missing model; show the fallback for now\n console.warn(err)\n }}\n >\n <Suspense fallback={dhrobot}>\n <group ref={setRobotRef}>\n <RobotAnimator\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n >\n <GenericRobot\n modelURL={(() => {\n const result = getModel(modelFromController, instanceUrl)\n if (!result) {\n const mockBlob = new Blob([], { type: 'model/gltf-binary' })\n const mockFile = new File([mockBlob], `${modelFromController}.glb`, { type: 'model/gltf-binary' })\n return Promise.resolve(URL.createObjectURL(mockFile))\n }\n return result\n })()}\n postModelRender={postModelRender}\n flangeRef={flangeRef}\n {...props}\n />\n </RobotAnimator>\n </group>\n </Suspense>\n <ConsoleFilter />\n </ErrorBoundary>\n )\n },\n)\n","import type { ThreeElements } from \"@react-three/fiber\"\n\nimport type { Group } from \"three\"\nimport type { ConnectedMotionGroup } from \"../../lib/ConnectedMotionGroup\"\nimport { defaultGetModel } from \"./robotModelLogic\"\nimport { SupportedRobot } from \"./SupportedRobot\"\n\nexport type RobotProps = {\n connectedMotionGroup: ConnectedMotionGroup\n getModel?: (modelFromController: string) => Promise<string>\n flangeRef?: React.Ref<Group>\n transparentColor?: string\n postModelRender?: () => void\n} & ThreeElements[\"group\"]\n\n/**\n * The Robot component is a wrapper around the SupportedRobot component\n * for usage with @wandelbots/nova-js ConnectedMotionGroup object.\n *\n * @param {RobotProps} props - The properties for the Robot component.\n * @param {ConnectedMotionGroup} props.connectedMotionGroup - The connected motion group containing motion state and parameters.\n * @param {Function} [props.getModel=defaultGetModel] - Optional function to get the model URL. Defaults to defaultGetModel.\n * @param {Object} props - Additional properties passed to the SupportedRobot component.\n *\n * @returns {JSX.Element} The rendered SupportedRobot component.\n */\nexport function Robot({\n connectedMotionGroup,\n getModel = defaultGetModel,\n flangeRef,\n transparentColor,\n postModelRender,\n ...props\n}: RobotProps) {\n if (!connectedMotionGroup.dhParameters) {\n return null\n }\n\n return (\n <SupportedRobot\n rapidlyChangingMotionState={\n connectedMotionGroup.rapidlyChangingMotionState\n }\n modelFromController={connectedMotionGroup.modelFromController || \"\"}\n dhParameters={connectedMotionGroup.dhParameters}\n getModel={getModel}\n flangeRef={flangeRef}\n transparentColor={transparentColor}\n postModelRender={postModelRender}\n {...props}\n />\n )\n}\n\nexport { defaultGetModel }\n","import { Box, Button, Card, Divider, Typography, useTheme } from \"@mui/material\"\nimport { Bounds } from \"@react-three/drei\"\nimport { Canvas } from \"@react-three/fiber\"\nimport type { OperationMode, SafetyStateType } from \"@wandelbots/nova-js/v2\"\nimport { observer } from \"mobx-react-lite\"\nimport { useCallback, useEffect, useRef, useState } from \"react\"\nimport { useTranslation } from \"react-i18next\"\nimport type { Group } from \"three\"\nimport { externalizeComponent } from \"../externalizeComponent\"\nimport type { ConnectedMotionGroup } from \"../lib/ConnectedMotionGroup\"\nimport { PresetEnvironment } from \"./3d-viewport/PresetEnvironment\"\nimport type { ProgramState } from \"./ProgramControl\"\nimport { ProgramStateIndicator } from \"./ProgramStateIndicator\"\nimport { Robot } from \"./robots/Robot\"\n\nexport interface RobotCardProps {\n /** Name of the robot displayed at the top */\n robotName: string\n /** Current program state */\n programState: ProgramState\n /** Current safety state of the robot controller */\n safetyState: SafetyStateType\n /** Current operation mode of the robot controller */\n operationMode: OperationMode\n /** Whether the \"Drive to Home\" button should be enabled */\n driveToHomeEnabled?: boolean\n /** Callback fired when \"Drive to Home\" button is pressed */\n onDriveToHomePress?: () => void\n /** Callback fired when \"Drive to Home\" button is released */\n onDriveToHomeRelease?: () => void\n /**\n * Callback fired when \"Drive to Home\" button is pressed, with the default home position.\n * If provided, this will be called instead of onDriveToHomePress, providing the recommended\n * home position joint configuration based on the robot manufacturer.\n */\n onDriveToHomePressWithConfig?: (homePosition: number[]) => void\n /**\n * Callback fired when \"Drive to Home\" button is released after using onDriveToHomePressWithConfig.\n * If provided, this will be called instead of onDriveToHomeRelease.\n */\n onDriveToHomeReleaseWithConfig?: () => void\n /**\n * Custom default joint configuration to use if manufacturer-based defaults are not available.\n * Joint values should be in radians.\n */\n defaultJointConfig?: number[]\n /** Connected motion group for the robot */\n connectedMotionGroup: ConnectedMotionGroup\n /** Custom robot component to render (optional, defaults to Robot) */\n robotComponent?: React.ComponentType<{\n connectedMotionGroup: ConnectedMotionGroup\n flangeRef?: React.Ref<Group>\n postModelRender?: () => void\n transparentColor?: string\n getModel?: (modelFromController: string) => Promise<string>\n }>\n /** Custom component to render in the content area (optional) */\n customContentComponent?: React.ComponentType<Record<string, unknown>>\n /** Additional CSS class name */\n className?: string\n}\n\n/**\n * A responsive card component that displays a 3D robot with states and controls.\n * The card automatically adapts to its container's size and aspect ratio.\n *\n * Features:\n * - Fully responsive Material-UI Card that adapts to container dimensions\n * - Automatic layout switching based on aspect ratio:\n * - Portrait mode: Vertical layout with robot in center\n * - Landscape mode: Horizontal layout with robot on left, content on right (left-aligned)\n * - Responsive 3D robot rendering:\n * - Scales dynamically with container size\n * - Hides at very small sizes to preserve usability\n * - Adaptive margin based on available space\n * - Smart spacing and padding that reduces at smaller sizes\n * - Minimum size constraints for usability while maximizing content density\n * - Robot name displayed in Typography h6 at top-left\n * - Program state indicator below the name\n * - Auto-fitting 3D robot model that scales with container size\n * - Customizable content area for displaying custom React components\n * - Transparent gray divider line\n * - \"Drive to Home\" button with press-and-hold functionality\n * - Localization support via react-i18next\n * - Material-UI theming integration\n *\n * Usage with custom content:\n * ```tsx\n * // Example custom timer component\n * const CustomTimer = () => (\n * <Box>\n * <Typography variant=\"body1\" sx={{ color: \"text.secondary\" }}>\n * Runtime\n * </Typography>\n * <Typography variant=\"h6\">05:23</Typography>\n * </Box>\n * )\n *\n * <RobotCard\n * robotName=\"UR5e Robot\"\n * programState={ProgramState.RUNNING}\n * customContentComponent={CustomTimer}\n * // ... other props\n * />\n * ```\n */\nexport const RobotCard = externalizeComponent(\n observer(\n ({\n robotName,\n programState,\n safetyState,\n operationMode,\n driveToHomeEnabled = false,\n onDriveToHomePress,\n onDriveToHomeRelease,\n connectedMotionGroup,\n robotComponent: RobotComponent = Robot,\n customContentComponent: CustomContentComponent,\n className,\n }: RobotCardProps) => {\n const theme = useTheme()\n const { t } = useTranslation()\n const [isDriveToHomePressed, setIsDriveToHomePressed] = useState(false)\n const driveButtonRef = useRef<HTMLButtonElement>(null)\n const cardRef = useRef<HTMLDivElement>(null)\n const [isLandscape, setIsLandscape] = useState(false)\n const [cardSize, setCardSize] = useState<{\n width: number\n height: number\n }>({ width: 400, height: 600 })\n const [modelRenderTrigger, setModelRenderTrigger] = useState(0)\n\n // Hook to detect aspect ratio and size changes\n useEffect(() => {\n const checkDimensions = () => {\n if (cardRef.current) {\n const { offsetWidth, offsetHeight } = cardRef.current\n setIsLandscape(offsetWidth > offsetHeight)\n setCardSize({ width: offsetWidth, height: offsetHeight })\n }\n }\n\n // Initial check\n checkDimensions()\n\n // Set up ResizeObserver to watch for size changes\n const resizeObserver = new ResizeObserver(checkDimensions)\n if (cardRef.current) {\n resizeObserver.observe(cardRef.current)\n }\n\n return () => {\n resizeObserver.disconnect()\n }\n }, [])\n\n const handleModelRender = useCallback(() => {\n // Trigger bounds refresh when model renders\n setModelRenderTrigger((prev) => prev + 1)\n }, [])\n\n const handleDriveToHomeMouseDown = useCallback(() => {\n if (!driveToHomeEnabled || !onDriveToHomePress) return\n setIsDriveToHomePressed(true)\n onDriveToHomePress()\n }, [driveToHomeEnabled, onDriveToHomePress])\n\n const handleDriveToHomeMouseUp = useCallback(() => {\n if (!driveToHomeEnabled || !onDriveToHomeRelease) return\n setIsDriveToHomePressed(false)\n onDriveToHomeRelease()\n }, [driveToHomeEnabled, onDriveToHomeRelease])\n\n const handleDriveToHomeMouseLeave = useCallback(() => {\n if (isDriveToHomePressed && onDriveToHomeRelease) {\n setIsDriveToHomePressed(false)\n onDriveToHomeRelease()\n }\n }, [isDriveToHomePressed, onDriveToHomeRelease])\n\n // Determine if robot should be hidden at small sizes to save space\n const shouldHideRobot = isLandscape\n ? cardSize.width < 350\n : cardSize.height < 200 // Hide robot at height < 200px in portrait\n\n // Determine if custom content should be hidden when height is too low\n // Custom content should be hidden BEFORE the robot (at higher threshold)\n const shouldHideCustomContent = isLandscape\n ? cardSize.height < 310 // Landscape: hide custom content at height < 310px\n : cardSize.height < 450 // Portrait: hide custom content at height < 450px\n\n return (\n <Card\n ref={cardRef}\n className={className}\n sx={{\n width: \"100%\",\n height: \"100%\",\n display: \"flex\",\n flexDirection: isLandscape ? \"row\" : \"column\",\n position: \"relative\",\n overflow: \"hidden\",\n minWidth: { xs: 180, sm: 220, md: 250 },\n minHeight: isLandscape\n ? { xs: 200, sm: 240, md: 260 } // Allow runtime hiding at < 283px\n : { xs: 150, sm: 180, md: 220 }, // Allow progressive hiding in portrait mode\n border: `1px solid ${theme.palette.divider}`,\n borderRadius: \"18px\",\n boxShadow: \"none\",\n backgroundColor:\n theme.palette.backgroundPaperElevation?.[8] || \"#2A2A3F\",\n backgroundImage: \"none\", // Override any gradient from elevation\n }}\n >\n {isLandscape ? (\n <>\n {/* Landscape Layout: Robot on left, content on right */}\n <Box\n sx={{\n flex: \"0 0 50%\",\n position: \"relative\",\n height: \"100%\",\n minHeight: \"100%\",\n maxHeight: \"100%\",\n borderRadius: 1,\n m: { xs: 1.5, sm: 2, md: 3 },\n mr: { xs: 0.75, sm: 1, md: 1.5 },\n overflow: \"hidden\", // Prevent content from affecting container size\n display: shouldHideRobot ? \"none\" : \"block\",\n }}\n >\n {!shouldHideRobot && (\n <Canvas\n orthographic\n camera={{\n position: [3, 2, 3],\n zoom: 1,\n }}\n shadows\n frameloop=\"demand\"\n style={{\n borderRadius: theme.shape.borderRadius,\n width: \"100%\",\n height: \"100%\",\n background: \"transparent\",\n position: \"absolute\",\n top: 0,\n left: 0,\n }}\n dpr={[1, 2]}\n gl={{ alpha: true, antialias: true }}\n >\n <PresetEnvironment />\n <Bounds fit observe margin={1} maxDuration={1}>\n <RobotComponent\n connectedMotionGroup={connectedMotionGroup}\n postModelRender={handleModelRender}\n />\n </Bounds>\n </Canvas>\n )}\n </Box>\n\n {/* Content container on right */}\n <Box\n sx={{\n flex: shouldHideRobot ? \"1\" : \"1\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"flex-start\",\n width: shouldHideRobot ? \"100%\" : \"50%\",\n }}\n >\n {/* Header section with robot name and program state */}\n <Box\n sx={{\n p: { xs: 1.5, sm: 2, md: 3 },\n pb: { xs: 1, sm: 1.5, md: 2 },\n textAlign: \"left\",\n }}\n >\n <Typography variant=\"h6\" component=\"h2\" sx={{ mb: 1 }}>\n {robotName}\n </Typography>\n <ProgramStateIndicator\n programState={programState}\n safetyState={safetyState}\n operationMode={operationMode}\n />\n </Box>\n\n {/* Bottom section with custom content and button */}\n <Box\n sx={{\n p: { xs: 1.5, sm: 2, md: 3 },\n pt: 0,\n flex: \"1\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"space-between\",\n }}\n >\n {/* Custom content section - hidden if height is too low in landscape mode */}\n {!shouldHideCustomContent && CustomContentComponent && (\n <Box>\n <CustomContentComponent />\n\n {/* Divider */}\n <Divider\n sx={{\n mt: 1,\n mb: 0,\n borderColor: theme.palette.divider,\n opacity: 0.5,\n }}\n />\n </Box>\n )}\n\n <Box\n sx={{\n mt:\n !shouldHideCustomContent && CustomContentComponent\n ? \"auto\"\n : 0,\n }}\n >\n {/* Drive to Home button with some space */}\n <Box\n sx={{\n display: \"flex\",\n justifyContent: \"flex-start\",\n mt: { xs: 1, sm: 1.5, md: 2 },\n mb: { xs: 0.5, sm: 0.75, md: 1 },\n }}\n >\n <Button\n ref={driveButtonRef}\n variant=\"contained\"\n color=\"secondary\"\n size=\"small\"\n disabled={!driveToHomeEnabled}\n onMouseDown={handleDriveToHomeMouseDown}\n onMouseUp={handleDriveToHomeMouseUp}\n onMouseLeave={handleDriveToHomeMouseLeave}\n onTouchStart={handleDriveToHomeMouseDown}\n onTouchEnd={handleDriveToHomeMouseUp}\n sx={{\n textTransform: \"none\",\n px: 1.5,\n py: 0.5,\n }}\n >\n {t(\"RobotCard.DriveToHome.bt\")}\n </Button>\n </Box>\n </Box>\n </Box>\n </Box>\n </>\n ) : (\n <>\n {/* Portrait Layout: Header, Robot, Footer */}\n <Box\n sx={{\n p: 3,\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n }}\n >\n {/* Header section with robot name and program state */}\n <Box>\n <Typography variant=\"h6\" component=\"h2\" sx={{ mb: 1 }}>\n {robotName}\n </Typography>\n <ProgramStateIndicator\n programState={programState}\n safetyState={safetyState}\n operationMode={operationMode}\n />\n </Box>\n\n {/* 3D Robot viewport in center */}\n <Box\n sx={{\n flex: shouldHideRobot ? 0 : 1,\n position: \"relative\",\n minHeight: shouldHideRobot\n ? 0\n : { xs: 120, sm: 150, md: 200 },\n height: shouldHideRobot ? 0 : \"auto\",\n borderRadius: 1,\n overflow: \"hidden\",\n display: shouldHideRobot ? \"none\" : \"block\",\n }}\n >\n {!shouldHideRobot && (\n <Canvas\n orthographic\n camera={{\n position: [3, 2, 3],\n zoom: 1,\n }}\n shadows\n frameloop=\"demand\"\n style={{\n borderRadius: theme.shape.borderRadius,\n width: \"100%\",\n height: \"100%\",\n background: \"transparent\",\n position: \"absolute\",\n }}\n dpr={[1, 2]}\n gl={{ alpha: true, antialias: true }}\n >\n <PresetEnvironment />\n <Bounds fit clip observe margin={1} maxDuration={1}>\n <RobotComponent\n connectedMotionGroup={connectedMotionGroup}\n postModelRender={handleModelRender}\n />\n </Bounds>\n </Canvas>\n )}\n </Box>\n\n {/* Bottom section with custom content and button */}\n <Box>\n {/* Custom content section - hidden if height is too low */}\n {!shouldHideCustomContent && CustomContentComponent && (\n <>\n <CustomContentComponent />\n\n {/* Divider */}\n <Divider\n sx={{\n mt: 1,\n mb: 0,\n borderColor: theme.palette.divider,\n opacity: 0.5,\n }}\n />\n </>\n )}\n\n {/* Drive to Home button with some space */}\n <Box\n sx={{\n display: \"flex\",\n justifyContent: \"flex-start\",\n mt:\n !shouldHideCustomContent && CustomContentComponent\n ? { xs: 1, sm: 2, md: 5 }\n : { xs: 0.5, sm: 1, md: 2 },\n mb: { xs: 0.5, sm: 0.75, md: 1 },\n }}\n >\n <Button\n ref={driveButtonRef}\n variant=\"contained\"\n color=\"secondary\"\n size=\"small\"\n disabled={!driveToHomeEnabled}\n onMouseDown={handleDriveToHomeMouseDown}\n onMouseUp={handleDriveToHomeMouseUp}\n onMouseLeave={handleDriveToHomeMouseLeave}\n onTouchStart={handleDriveToHomeMouseDown}\n onTouchEnd={handleDriveToHomeMouseUp}\n sx={{\n textTransform: \"none\",\n px: 1.5,\n py: 0.5,\n }}\n >\n {t(\"RobotCard.DriveToHome.bt\")}\n </Button>\n </Box>\n </Box>\n </Box>\n </>\n )}\n </Card>\n )\n },\n ),\n)\n","export type AxisConfig = number[]\n\nexport const defaultAxisConfig: AxisConfig = Array(6).fill(2 * Math.PI)\n","import { useFrame, useThree } from \"@react-three/fiber\"\nimport type { DHParameter, MotionGroupState } from \"@wandelbots/nova-js/v2\"\nimport React, { useCallback, useEffect, useRef } from \"react\"\nimport type { Group, Object3D } from \"three\"\nimport { useAutorun } from \"../utils/hooks\"\nimport { ValueInterpolator } from \"../utils/interpolation\"\nimport { collectJoints } from \"./robotModelLogic\"\n\ntype LinearAxisAnimatorProps = {\n rapidlyChangingMotionState: MotionGroupState\n dhParameters: DHParameter[]\n onTranslationChanged?: (joints: Object3D[], jointValues: number[]) => void\n children: React.ReactNode\n}\n\nexport default function LinearAxisAnimator({\n rapidlyChangingMotionState,\n dhParameters,\n onTranslationChanged,\n children,\n}: LinearAxisAnimatorProps) {\n const jointValues = useRef<number[]>([])\n const jointObjects = useRef<Object3D[]>([])\n const interpolatorRef = useRef<ValueInterpolator | null>(null)\n const { invalidate } = useThree()\n\n // Initialize interpolator\n useEffect(() => {\n const initialJointValues = rapidlyChangingMotionState.joint_position.filter(\n (item) => item !== undefined,\n )\n\n interpolatorRef.current = new ValueInterpolator(initialJointValues, {\n tension: 120, // Controls spring stiffness - higher values create faster, more responsive motion\n friction: 20, // Controls damping - higher values reduce oscillation and create smoother settling\n threshold: 0.001,\n })\n\n return () => {\n interpolatorRef.current?.destroy()\n }\n }, [])\n\n // Animation loop that runs at the display's refresh rate\n useFrame((state, delta) => {\n if (interpolatorRef.current) {\n const isComplete = interpolatorRef.current.update(delta)\n setTranslation()\n\n // Trigger a re-render only if the animation is still running\n if (!isComplete) {\n invalidate()\n }\n }\n })\n\n function setGroupRef(group: Group | null) {\n if (!group) return\n\n jointObjects.current = collectJoints(group)\n\n // Set initial position\n setTranslation()\n invalidate()\n }\n\n function setTranslation() {\n const updatedJointValues = interpolatorRef.current?.getCurrentValues() || []\n\n if (onTranslationChanged) {\n onTranslationChanged(jointObjects.current, updatedJointValues)\n } else {\n // For linear axes, we apply translation instead of rotation\n for (const [index, object] of jointObjects.current.entries()) {\n const dhParam = dhParameters[index]\n const translationSign = dhParam.reverse_rotation_direction ? -1 : 1\n\n // Apply linear translation along Y axis\n // Convert from millimeters to meters\n object.position.y =\n (translationSign * (updatedJointValues[index] || 0)) / 1000\n }\n }\n }\n\n const updateJoints = useCallback(() => {\n const newJointValues = rapidlyChangingMotionState.joint_position.filter(\n (item) => item !== undefined,\n )\n\n requestAnimationFrame(() => {\n jointValues.current = newJointValues\n interpolatorRef.current?.setTarget(newJointValues)\n })\n }, [rapidlyChangingMotionState])\n\n /**\n * Fire an update joints call on every motion state change.\n * requestAnimationFrame used to avoid blocking main thread\n */\n useEffect(() => {\n updateJoints()\n }, [rapidlyChangingMotionState, updateJoints])\n\n /**\n * As some consumer applications (eg. storybook) deliver\n * mobx observable for rapidlyChangingMotionState, we need to\n * register the watcher to get the newest value updates\n */\n useAutorun(() => {\n updateJoints()\n })\n\n return <group ref={setGroupRef}>{children}</group>\n}\n","import { Line } from \"@react-three/drei\"\nimport type { DHParameter } from \"@wandelbots/nova-js/v2\"\nimport React, { useRef } from \"react\"\nimport type * as THREE from \"three\"\nimport { Matrix4, Quaternion, Vector3 } from \"three\"\nimport LinearAxisAnimator from \"./LinearAxisAnimator\"\nimport type { DHLinearAxisProps } from \"./SupportedLinearAxis\"\n\nexport function DHLinearAxis({\n rapidlyChangingMotionState,\n dhParameters,\n ...props\n}: DHLinearAxisProps) {\n // reused in every update\n const accumulatedMatrix = new Matrix4()\n\n const tcpMeshRef = useRef<THREE.Mesh | null>(null)\n const tcpLineRef = useRef<any>(null)\n\n // Calculate initial TCP position\n function calculateTcpPosition(jointValues: number[]): Vector3 {\n const tempMatrix = new Matrix4()\n \n for (let i = 0; i < dhParameters.length; i++) {\n const param = dhParameters[i]\n const jointValue = jointValues[i] ?? 0\n \n const matrix = new Matrix4()\n .makeRotationY(param.theta!) // Base rotation (if any)\n .multiply(\n new Matrix4().makeTranslation(\n param.a! / 1000,\n (param.d! + jointValue * (param.reverse_rotation_direction ? -1 : 1)) / 1000,\n 0\n )\n ) // Translate along X by a, and Y by d + joint_position\n .multiply(new Matrix4().makeRotationX(param.alpha!)) // Rotate around X\n \n tempMatrix.multiply(matrix)\n }\n \n const position = new Vector3()\n const quaternion = new Quaternion()\n const scale = new Vector3()\n tempMatrix.decompose(position, quaternion, scale)\n return position\n }\n\n // Calculate initial TCP position for rendering\n const initialTcpPosition = calculateTcpPosition(rapidlyChangingMotionState.joint_position)\n\n function setTranslation(joints: THREE.Object3D[], jointValues: number[]) {\n accumulatedMatrix.identity()\n\n let tcpPosition = new Vector3()\n\n // Process all joints based on dhParameters length, not joints array\n // Since we're using DHLinearAxis directly without a model, we don't have joint objects\n for (let jointIndex = 0; jointIndex < dhParameters.length; jointIndex++) {\n const jointValue = jointValues[jointIndex] ?? 0\n const param = dhParameters[jointIndex]\n \n // Calculate and accumulate transformation\n const matrix = new Matrix4()\n .makeRotationY(param.theta!) // Base rotation (if any)\n .multiply(\n new Matrix4().makeTranslation(\n param.a! / 1000,\n (param.d! + jointValue * (param.reverse_rotation_direction ? -1 : 1)) / 1000,\n 0\n )\n )\n .multiply(new Matrix4().makeRotationX(param.alpha!))\n \n accumulatedMatrix.multiply(matrix)\n }\n\n // Get final TCP position from accumulated matrix\n const position = new Vector3()\n const quaternion = new Quaternion()\n const scale = new Vector3()\n accumulatedMatrix.decompose(position, quaternion, scale)\n tcpPosition = position\n\n // Update TCP marker\n if (tcpMeshRef.current) {\n tcpMeshRef.current.position.set(tcpPosition.x, tcpPosition.y, tcpPosition.z)\n }\n\n // Update TCP line\n if (tcpLineRef.current) {\n const lineGeometry = tcpLineRef.current.geometry\n if (lineGeometry && lineGeometry.setPositions) {\n lineGeometry.setPositions([0, 0, 0, tcpPosition.x, tcpPosition.y, tcpPosition.z])\n }\n }\n }\n\n return (\n <>\n <LinearAxisAnimator\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n onTranslationChanged={setTranslation}\n >\n <group {...props} name=\"Scene\">\n {/* Base (origin) - Green sphere representing initial previous position */}\n <mesh name=\"Base\" position={[0, 0, 0]}>\n <sphereGeometry args={[0.02, 32, 32]} />\n <meshStandardMaterial color={\"green\"} depthTest={true} />\n </mesh>\n {/* Line from Base to TCP */}\n <Line\n ref={tcpLineRef}\n points={[new Vector3(0, 0, 0), initialTcpPosition]}\n color={\"White\"}\n lineWidth={5}\n />\n {/* TCP (Tool Center Point) - Red sphere that shows final position */}\n <mesh ref={tcpMeshRef} name=\"TCP\" position={initialTcpPosition}>\n <sphereGeometry args={[0.025, 32, 32]} />\n <meshStandardMaterial color={\"red\"} depthTest={true} />\n </mesh>\n </group>\n </LinearAxisAnimator>\n </>\n )\n}\n","import type { ThreeElements } from \"@react-three/fiber\"\nimport type { DHParameter, MotionGroupState } from \"@wandelbots/nova-js/v2\"\nimport { Suspense, useCallback, useEffect, useState } from \"react\"\nimport { ErrorBoundary } from \"react-error-boundary\"\nimport type * as THREE from \"three\"\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport ConsoleFilter from \"../ConsoleFilter\"\nimport { DHLinearAxis } from \"./DHLinearAxis\"\nimport { GenericRobot } from \"./GenericRobot\"\nimport LinearAxisAnimator from \"./LinearAxisAnimator\"\nimport { applyGhostStyle, removeGhostStyle } from \"./ghostStyle\"\nimport { defaultGetModel } from \"./robotModelLogic\"\n\nexport type DHLinearAxisProps = {\n rapidlyChangingMotionState: MotionGroupState\n dhParameters: Array<DHParameter>\n} & ThreeElements[\"group\"]\n\nexport type SupportedLinearAxisProps = {\n rapidlyChangingMotionState: MotionGroupState\n modelFromController: string\n dhParameters: DHParameter[]\n flangeRef?: React.Ref<THREE.Group>\n instanceUrl?: string\n getModel?: (modelFromController: string, instanceUrl?: string) => Promise<string> | undefined\n postModelRender?: () => void\n transparentColor?: string\n} & ThreeElements[\"group\"]\n\nexport const SupportedLinearAxis = externalizeComponent(\n ({\n rapidlyChangingMotionState,\n modelFromController,\n dhParameters,\n getModel = defaultGetModel,\n flangeRef,\n postModelRender,\n transparentColor,\n instanceUrl,\n ...props\n }: SupportedLinearAxisProps) => {\n const [robotGroup, setRobotGroup] = useState<THREE.Group | null>(null)\n\n const setRobotRef = useCallback((instance: THREE.Group | null) => {\n setRobotGroup(instance)\n }, [])\n\n useEffect(() => {\n if (!robotGroup) return\n\n if (transparentColor) {\n applyGhostStyle(robotGroup, transparentColor)\n } else {\n removeGhostStyle(robotGroup)\n }\n }, [robotGroup, transparentColor])\n\n const dhLinearAxis = (\n <DHLinearAxis\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n {...props}\n />\n )\n\n return (\n <ErrorBoundary\n fallback={dhLinearAxis}\n onError={(err) => {\n // Missing model; show the fallback for now\n console.warn(err)\n }}\n >\n <Suspense fallback={dhLinearAxis}>\n <group ref={setRobotRef}>\n <LinearAxisAnimator\n rapidlyChangingMotionState={rapidlyChangingMotionState}\n dhParameters={dhParameters}\n >\n <GenericRobot\n modelURL={(() => {\n const result = getModel(modelFromController, instanceUrl)\n if (!result) {\n const mockBlob = new Blob([], { type: 'model/gltf-binary' })\n const mockFile = new File([mockBlob], `${modelFromController}.glb`, { type: 'model/gltf-binary' })\n return Promise.resolve(URL.createObjectURL(mockFile))\n }\n return result\n })()}\n postModelRender={postModelRender}\n flangeRef={flangeRef}\n {...props}\n />\n </LinearAxisAnimator>\n </group>\n </Suspense>\n <ConsoleFilter />\n </ErrorBoundary>\n )\n },\n)\n","import type { ThreeElements } from \"@react-three/fiber\"\n\nimport type { Group } from \"three\"\nimport type { ConnectedMotionGroup } from \"../../lib/ConnectedMotionGroup\"\nimport { DHLinearAxis } from \"./DHLinearAxis\"\nimport { defaultGetModel } from \"./robotModelLogic\"\nimport { SupportedLinearAxis } from \"./SupportedLinearAxis\"\n\nexport type LinearAxisProps = {\n connectedMotionGroup: ConnectedMotionGroup\n getModel?: (modelFromController: string) => Promise<string>\n flangeRef?: React.Ref<Group>\n transparentColor?: string\n postModelRender?: () => void\n} & ThreeElements[\"group\"]\n\n/**\n * The LinearAxis component is a wrapper that renders SupportedLinearAxis if a model is available,\n * otherwise falls back to DHLinearAxis for usage with @wandelbots/nova-js ConnectedMotionGroup object.\n *\n * @param {LinearAxisProps} props - The properties for the LinearAxis component.\n * @param {ConnectedMotionGroup} props.connectedMotionGroup - The connected motion group containing motion state and parameters.\n * @param {Function} [props.getModel=defaultGetModel] - Optional function to get the model URL. Defaults to defaultGetModel.\n * @param {Object} props - Additional properties passed to the underlying component.\n *\n * @returns {JSX.Element} The rendered SupportedLinearAxis or DHLinearAxis component.\n */\nexport function LinearAxis({\n connectedMotionGroup,\n getModel = defaultGetModel,\n flangeRef,\n transparentColor,\n postModelRender,\n ...props\n}: LinearAxisProps) {\n if (!connectedMotionGroup.dhParameters) {\n return null\n }\n\n const modelFromController = connectedMotionGroup.modelFromController || \"\"\n const hasModel = modelFromController && getModel(modelFromController)\n\n // Use SupportedLinearAxis if model is available, otherwise fall back to DHLinearAxis\n if (hasModel) {\n return (\n <SupportedLinearAxis\n rapidlyChangingMotionState={\n connectedMotionGroup.rapidlyChangingMotionState\n }\n modelFromController={modelFromController}\n dhParameters={connectedMotionGroup.dhParameters}\n getModel={getModel}\n flangeRef={flangeRef}\n transparentColor={transparentColor}\n postModelRender={postModelRender}\n {...props}\n />\n )\n }\n\n return (\n <DHLinearAxis\n rapidlyChangingMotionState={\n connectedMotionGroup.rapidlyChangingMotionState\n }\n dhParameters={connectedMotionGroup.dhParameters}\n {...props}\n />\n )\n}\n\nexport { defaultGetModel }\n\n","import { Manufacturer } from \"@wandelbots/nova-js/v2\"\n\n/**\n * Default home configs for different robot manufacturers.\n * These joint configurations represent safe home configs for each manufacturer's robots.\n * All angles are in radians.\n */\nexport const MANUFACTURER_HOME_CONFIGS: Record<Manufacturer, number[]> = {\n [Manufacturer.Abb]: [0.0, 0.0, 0.0, 0.0, Math.PI / 2, 0.0, 0.0],\n [Manufacturer.Fanuc]: [0.0, 0.0, 0.0, 0.0, -Math.PI / 2, 0.0, 0.0],\n [Manufacturer.Yaskawa]: [0.0, 0.0, 0.0, 0.0, -Math.PI / 2, 0.0, 0.0],\n [Manufacturer.Kuka]: [\n 0.0,\n -Math.PI / 2,\n Math.PI / 2,\n 0.0,\n Math.PI / 2,\n 0.0,\n 0.0,\n ],\n [Manufacturer.Universalrobots]: [\n 0.0,\n -Math.PI / 2,\n -Math.PI / 2,\n -Math.PI / 2,\n Math.PI / 2,\n -Math.PI / 2,\n 0.0,\n ],\n}\n\n/**\n * Extracts manufacturer from modelFromController string.\n * @param modelFromController - String in format \"Manufacturer_ModelName\"\n * @returns Manufacturer enum value or null if not recognized\n */\nexport function extractManufacturer(\n modelFromController: string,\n): Manufacturer | null {\n const [manufacturerString] = modelFromController.split(\"_\")\n\n // Handle the mapping from string to enum\n switch (manufacturerString) {\n case \"ABB\":\n return Manufacturer.Abb\n case \"FANUC\":\n return Manufacturer.Fanuc\n case \"YASKAWA\":\n return Manufacturer.Yaskawa\n case \"KUKA\":\n return Manufacturer.Kuka\n case \"UniversalRobots\":\n return Manufacturer.Universalrobots\n default:\n return null\n }\n}\n\n/**\n * Gets the default home config for a robot based on its model identifier.\n * @param modelFromController - String in format \"Manufacturer_ModelName\"\n * @param defaultJointConfig - Optional custom default configuration to use if manufacturer not found\n * @returns Array of joint positions in radians, or null if no configuration available\n */\nexport function getDefaultHomeConfig(\n modelFromController: string,\n defaultJointConfig?: number[],\n): number[] | null {\n const manufacturer = extractManufacturer(modelFromController)\n\n if (manufacturer && manufacturer in MANUFACTURER_HOME_CONFIGS) {\n return MANUFACTURER_HOME_CONFIGS[manufacturer]\n }\n\n return defaultJointConfig || null\n}\n","import React, { useEffect, useMemo, useState } from \"react\"\nimport { JointTypeEnum } from \"@wandelbots/nova-js/v2\"\n\nimport { externalizeComponent } from \"../../externalizeComponent\"\nimport { SupportedRobot, type SupportedRobotProps } from \"./SupportedRobot\"\nimport { SupportedLinearAxis, type SupportedLinearAxisProps } from \"./SupportedLinearAxis\"\n\nexport type MotionGroupVisualizerProps = {\n instanceUrl: string\n inverseSolver?: string | null\n} & (SupportedRobotProps | SupportedLinearAxisProps)\n\nexport const MotionGroupVisualizer: React.FC<MotionGroupVisualizerProps> = externalizeComponent((props: MotionGroupVisualizerProps) => {\n const {\n inverseSolver,\n dhParameters,\n ...rest\n } = props\n\n /**\n * Joint type to find out - in combination with inverseSolver - whether the\n * active robot is a turn table\n */\n const [jointType, setJointType] = useState<JointTypeEnum>(JointTypeEnum.RevoluteJoint)\n\n /**\n * Sets the joint type according to delivered dh parameter type\n *\n * TODO as soon as V2 api migration is done, the setting of the default RevoluteJoint value should be\n * deleted, cause the type property is expected to be always delivered. It is not the case in the V1 at the\n * moment.\n */\n useEffect(() => {\n if (dhParameters.length) {\n setJointType(dhParameters[0].type ?? JointTypeEnum.RevoluteJoint)\n }\n }, [dhParameters])\n\n /**\n * The turntable models return inverseSolver = null - however these models\n * should be rendered with SupportedRobot instead of SupportedLinearAxis\n */\n const isTurnTable = useMemo(() => {\n return inverseSolver === null && jointType === JointTypeEnum.RevoluteJoint\n }, [inverseSolver, jointType])\n\n /**\n * Linear axis check\n */\n const isLinearAxis = useMemo(() => {\n return inverseSolver === null && jointType === JointTypeEnum.PrismaticJoint\n }, [inverseSolver, jointType])\n\n /**\n * Robot differentiation for readability reasons\n */\n const isRobot = useMemo(() => {\n return !!inverseSolver\n }, [inverseSolver])\n\n\n if (isRobot || isTurnTable) {\n return (\n <SupportedRobot dhParameters={dhParameters} {...rest} />\n )\n }\n\n if(isLinearAxis) {\n return (\n <SupportedLinearAxis dhParameters={dhParameters} {...rest} />\n )\n }\n\n return <></>\n})"],"names":["colliderShapeToBufferGeometry","shape","ConvexGeometry","vertex","THREE","ColliderElement","name","collider","children","position","_a","rotation","_b","jsx","ColliderCollection","colliders","meshChildrenProvider","props","colliderKey","CollisionSceneRenderer","scene","PresetEnvironment","Environment","Lightformers","positions","jsxs","Fragment","Lightformer","x","i","SafetyZonesRenderer","safetyZones","dhParameters","safetyZoneMaterialProps","planeSize","dhParametersToPlaneSize","useEffect","renderMesh","id","zone","orientation","geometry","materialProps","radius","capsuleRadius","height","vertices","v","coplanarityResult","verticesToCoplanarity","newVertex","error","rcRadius","width","depth","RoundedBoxGeometry","orientationToQuaternion","renderV2SafetyZones","index","renderV1SafetyZones","geometries","convexGeometry","renderedSafetyZones","useMemo","TrajectoryRenderer","trajectory","points","point","Line","modelCache","defaultGetModel","modelFromController","instanceUrlProp","modelPromise","instanceUrl","nova","NovaClient","apiInstance","config","file","collectJoints","rootObject","getAllObjects","root","child","o","isJoint","isFlange","node","parseRobotModel","gltf","filename","flange","parseNode","RobotAnimator","rapidlyChangingMotionState","onRotationChanged","jointValues","useRef","jointObjects","interpolatorRef","invalidate","useThree","initialJointValues","item","ValueInterpolator","useFrame","state","delta","isComplete","setRotation","setGroupRef","group","updatedJointValues","object","dhParam","rotationOffset","rotationSign","updateJoints","useCallback","newJointValues","useAutorun","CHILD_LINE","CHILD_MESH","DHRobot","accumulatedMatrix","Matrix4","lineRefs","meshRefs","React","getLinePoints","dhParameter","jointRotation","Vector3","quaternion","Quaternion","scale","prevPosition","matrix","setJointLineRotation","jointIndex","line","mesh","jointValue","dh_parameter","a","b","joints","param","jointName","ref","defaultWarn","ConsoleFilter","data","isMesh","LoadedRobotModel","url","flangeRef","postModelRender","gltfResult","useGLTF","err","groupRef","renderNode","e","GenericRobot","modelURL","resolvedURL","setResolvedURL","useState","applyGhostStyle","robot","color","obj","ghost","removeGhostStyle","objectsToRemove","SupportedRobot","externalizeComponent","getModel","transparentColor","robotGroup","setRobotGroup","setRobotRef","instance","dhrobot","ErrorBoundary","Suspense","result","mockBlob","mockFile","Robot","connectedMotionGroup","RobotCard","observer","robotName","programState","safetyState","operationMode","driveToHomeEnabled","onDriveToHomePress","onDriveToHomeRelease","RobotComponent","CustomContentComponent","className","theme","useTheme","t","useTranslation","isDriveToHomePressed","setIsDriveToHomePressed","driveButtonRef","cardRef","isLandscape","setIsLandscape","cardSize","setCardSize","modelRenderTrigger","setModelRenderTrigger","checkDimensions","offsetWidth","offsetHeight","resizeObserver","handleModelRender","prev","handleDriveToHomeMouseDown","handleDriveToHomeMouseUp","handleDriveToHomeMouseLeave","shouldHideRobot","shouldHideCustomContent","Card","Box","Canvas","Bounds","Typography","ProgramStateIndicator","Divider","Button","defaultAxisConfig","LinearAxisAnimator","onTranslationChanged","setTranslation","translationSign","DHLinearAxis","tcpMeshRef","tcpLineRef","calculateTcpPosition","tempMatrix","initialTcpPosition","tcpPosition","lineGeometry","SupportedLinearAxis","dhLinearAxis","LinearAxis","MANUFACTURER_HOME_CONFIGS","Manufacturer","extractManufacturer","manufacturerString","getDefaultHomeConfig","defaultJointConfig","manufacturer","MotionGroupVisualizer","inverseSolver","rest","jointType","setJointType","JointTypeEnum","isTurnTable","isLinearAxis"],"mappings":";;;;;;;;;;;;AAIO,SAASA,GACdC,GACsB;AAEtB,UADkBA,EAAM,YAChB;AAAA,IACN,KAAK;AACH,aAAO,IAAIC;AAAA,QACTD,EAAM,SAAS;AAAA,UACb,CAACE,MACC,IAAIC,EAAM;AAAA,YACRD,EAAO,CAAC,IAAI;AAAA,YACZA,EAAO,CAAC,IAAI;AAAA,YACZA,EAAO,CAAC,IAAI;AAAA,UAAA;AAAA,QACd;AAAA,MACJ;AAAA,IAEJ,KAAK;AACH,aAAO,IAAIC,EAAM;AAAA,QACfH,EAAM,SAAS;AAAA,QACfA,EAAM,SAAS;AAAA,QACfA,EAAM,SAAS;AAAA,MAAA;AAAA,IAEnB,KAAK;AACH,aAAO,IAAIG,EAAM,eAAeH,EAAM,SAAS,GAAI;AAAA,IACrD,KAAK;AACH,aAAO,IAAIG,EAAM;AAAA,QACfH,EAAM,SAAS;AAAA,QACfA,EAAM,kBAAkB;AAAA,MAAA;AAAA,IAE5B,KAAK;AACH,aA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