@operato/scene-manufacturing 10.0.0-beta.56 → 10.0.0-beta.58

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.
@@ -133,7 +133,7 @@ export class RobotArm3D extends RealObjectGroup {
133
133
  const holder = this.component;
134
134
  if (typeof holder.attachPointFor !== 'function')
135
135
  return;
136
- const children = holder.components ?? holder.children ?? [];
136
+ const children = holder._holdings ?? holder.components ?? holder.children ?? [];
137
137
  for (const child of children) {
138
138
  if (!child?.isCarriable)
139
139
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"robot-arm-3d.js","sourceRoot":"","sources":["../src/robot-arm-3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EAGX,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EACL,MAAM,EACN,aAAa,EACb,eAAe,EAOhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,eAAe,EACf,cAAc,EACd,iBAAiB,EAGlB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,SAAS,GAAqC;IAClD,CAAC,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAC9B,CAAA;AAED,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAA;AAC7B,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAA;AAE7B;;;;;;GAMG;AACH,MAAM,YAA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C3B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,aAAa;YAAE,OAAO,CAAC,CAAA;QAC/D,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Robot arm 3D — articulated chain renderer.\n *\n * Build pipeline:\n * 1. Resolve chain (state.chain | preset | default 6-axis-industrial).\n * 2. Resolve style (state.style preset, with per-property overrides).\n * 3. Resolve joint values (state.joints array OR object map; missing\n * entries default to 0 and clamp to chain[i].range).\n * 4. If state.target is present, run CCDIK to solve joint values\n * reaching that target; commit the solved values back via the\n * smoothing controller (next tick converges to them).\n * 5. Forward-kinematics walk → emit one Object3D per joint frame,\n * each carrying its joint housing mesh + the link mesh extending\n * along local +Z to the next frame.\n * 6. Add gripper at the end-effector frame.\n * 7. Optional reach sphere (wireframe).\n *\n * Joint frames are real Object3D children, so the rotation set via\n * `frame.rotation.<axis> = jointValue` on each frame produces the right\n * world-space pose without explicit matrix math at render time. CCDIK\n * runs in matrix math (separate from this scene-graph walk) when needed.\n */\n\nimport * as THREE from 'three'\nimport {\n RealObjectGroup,\n resolveMaterial3d,\n applyMaterial3dProps,\n frameClock,\n type Component,\n type Material3D\n} from '@hatiolab/things-scene'\nimport type { Unsubscribe } from '@hatiolab/things-scene'\nimport {\n STYLES,\n CHAIN_PRESETS,\n DEFAULT_GRIPPER,\n type RobotArmStyle,\n type StyleName,\n type ChainPresetName,\n type GripperConfig,\n type LinkShape,\n type JointHousing\n} from './robot-arm-styles.js'\nimport {\n forwardKinematics,\n solveCCDIK,\n maxReach,\n isSixAxisZYYZYZ,\n resolveBaseYaw,\n analyticalIk6Axis,\n type ChainElement,\n type JointAxis\n} from './robot-arm-ik.js'\n\nconst _AXIS_VEC: Record<JointAxis, THREE.Vector3> = {\n x: new THREE.Vector3(1, 0, 0),\n y: new THREE.Vector3(0, 1, 0),\n z: new THREE.Vector3(0, 0, 1)\n}\n\nconst DEG2RAD = Math.PI / 180\nconst RAD2DEG = 180 / Math.PI\n\n/**\n * Length (chain-local units) of the virtual end-extension used to bias\n * CCDIK toward \"gripper pointing world-down\". Longer = stronger orientation\n * bias but reduces effective reach; shorter = closer to position-only.\n * 30 is a moderate default that handles typical pick-and-place poses\n * without sacrificing reach for normal-sized arms.\n */\nconst DESCENT_BIAS = 30\n\n/** Raycast no-op — assigned to non-interactive helper meshes (e.g. the\n * reach-sphere visualization) so clicks pass through to the real body. */\nconst NO_RAYCAST: THREE.Object3D['raycast'] = () => {}\n\nexport class RobotArm3D extends RealObjectGroup {\n private _smoothing?: { current: number[]; target: number[]; speed: number }\n private _unsubTick: Unsubscribe | null = null\n private _chain: ChainElement[] = []\n private _jointFrames: THREE.Object3D[] = []\n\n build() {\n super.build()\n\n const state = this.component.state\n // Geometry mapping (per user contract):\n // width × height = robot footprint (the base pedestal occupies this)\n // depth = robot height (= max reach when fully extended up)\n //\n // The chain preset's lengths are treated as PROPORTIONS — we scale them\n // so the sum matches `effectiveDepth` (with a small base-height\n // reservation). User can still override by passing absolute lengths via\n // `state.chain[i].length`; the same scale is applied so `depth` stays\n // the source of truth for overall robot height.\n const baseHeight = this._baseHeight(state)\n const targetReach = Math.max(this.effectiveDepth - baseHeight, 1)\n const chain = this._resolveChain(state, targetReach)\n const style = this._resolveStyle(state)\n let joints = this._resolveJoints(chain, state)\n\n // If a target is set, solve IK and use the solved joint values as the\n // smoothing-controller's new target. CCDIK works in radians; convert\n // both the input joints and the output back to user-facing units\n // (degrees for revolute) before storing.\n //\n // CRITICAL: IK starts from smoothing.current (the visual joint pose\n // mid-transit) when present, NOT from state-derived joints. CCDIK is\n // path-dependent — different start poses converge to different valid\n // solutions reaching the same TCP. If a rebuild happens DURING transit\n // (e.g. `set('gripper', state:1)` closing the gripper after pick),\n // re-solving from state joints (typically 0,0,0...) would produce a\n // *different* solution than the path the arm was already on, snapping\n // smoothing.target onto a new joint configuration. The arm — and any\n // carried box — would then race toward that alternate solution,\n // sometimes hitting `allReached` almost instantly (if the alternate\n // happens to be close to current), which fires `tcp-reached`\n // prematurely and makes pickAndPlace reparent the carrier to the\n // place holder long before the arm has actually traveled there.\n const target = state.target\n if (target && Number.isFinite(target.x) && Number.isFinite(target.y) && Number.isFinite(target.z)) {\n const targetVec = new THREE.Vector3(target.x, target.y, target.z)\n const targetYaw = Number.isFinite(target.yaw) ? (target.yaw as number) : undefined\n const ikStart = this._smoothing?.current?.slice() ?? joints\n const radJoints = this._toRadians(chain, ikStart)\n const ikValues = this._solveIkDescent(chain, radJoints, targetVec, targetYaw)\n const solvedUser = this._fromRadians(chain, ikValues)\n this._smoothing = {\n current: ikStart.slice(),\n target: solvedUser.slice(),\n speed: this._jointSpeed(state)\n }\n // visible position = current (interpolated by tick)\n joints = ikStart.slice()\n } else if (this._smoothing) {\n // no target — freeze where we are, NOT animate toward stale state\n // joints (which may be 0,0,0... and unrelated to the visual pose).\n this._smoothing.target = this._smoothing.current.slice()\n }\n\n this._chain = chain\n this._buildArm(chain, style, joints, baseHeight)\n this._buildGripper(chain, style, state)\n this._buildReachSphere(chain, state, baseHeight)\n this._buildBase(state, style, baseHeight)\n\n // Animation lifecycle (smooths joint values toward solved target).\n this._stopAnimation()\n if (this._smoothing) {\n this._startAnimation()\n }\n\n // Re-mount any Carriable child whose object3d was orphaned by the\n // build's `clear()`. Without this, ANY structural change while a\n // carrier is held (most commonly the gripper-close `set('gripper',\n // {state:1})` inside pickAndPlace) tears down `_endFrame` along with\n // the carrier mounted onto it — the box vanishes mid-flight.\n //\n // The component-side child list survives a 3D rebuild (only the\n // scene-graph was reset), so we walk it and re-execute the holder's\n // attach-point policy. Uses `add()` (not `attach()`) because the\n // orphaned object3d's matrixWorld is stale; we want the explicit\n // localPosition/localRotation, not whatever world pose was last\n // computed on the old gripper frame.\n this._remountCarriers()\n }\n\n private _remountCarriers() {\n const holder = this.component as any\n if (typeof holder.attachPointFor !== 'function') return\n const children: Component[] =\n holder.components ?? holder.children ?? []\n for (const child of children) {\n if (!(child as any)?.isCarriable) continue\n const obj3d = (child as any)._realObject?.object3d\n if (!obj3d) continue\n const point = holder.attachPointFor(child)\n if (!point?.attach) continue\n point.attach.add(obj3d)\n const lp = point.localPosition ?? { x: 0, y: 0, z: 0 }\n obj3d.position.set(lp.x, lp.y, lp.z)\n if (point.localRotation) {\n obj3d.rotation.set(point.localRotation.x, point.localRotation.y, point.localRotation.z)\n } else {\n obj3d.quaternion.identity()\n }\n }\n }\n\n /**\n * IK with a \"point gripper downward\" bias.\n *\n * CCDIK is position-only — it solves for joint values that put the\n * end-effector at the target, without constraining the gripper's\n * orientation. With no orientation constraint, valid solutions\n * include twisted poses (gripper sideways / upside-down) — typical\n * pick-and-place tasks then look broken: the box gets gripped at a\n * wrong angle, or after release the carrier \"launches\" off because\n * the gripper was facing some weird direction at the moment of\n * release. The arm can also visibly \"lock\" near joint limits trying\n * to satisfy a position-only target through a contorted path.\n *\n * Trick — augment the chain with a virtual rigid extension along the\n * last frame's +Z, length L. When CCDIK puts this extended end at\n * `target + L * (-Ẑ_chainLocal)` (i.e. the original target shifted\n * downward by L in chain-local), the only way the chain can satisfy\n * both placements simultaneously is by orienting the last frame's +Z\n * to point in the chain-local -Z direction = world -Y direction =\n * gripper pointing straight DOWN. Best-effort even when CCDIK can't\n * fully converge — the solver pushes the chain in the right\n * orientation, which matches what a real pick-and-place arm does.\n */\n \n private _gripperTcpZ(style: RobotArmStyle, state: any): number {\n const cfg: GripperConfig = {\n ...DEFAULT_GRIPPER,\n ...((state.gripper as GripperConfig) ?? {}),\n ...(state.gripperType ? { type: state.gripperType } : {})\n }\n if (cfg.type === 'none') return 0\n const linkRadius = style.linkRadius\n switch (cfg.type) {\n case 'parallel': {\n const stroke = cfg.stroke ?? linkRadius * 1.8\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.45\n const fingerLength = stroke * 1.2\n return fingerWidth * 1.8 + fingerLength\n }\n case 'three-finger': {\n const stroke = cfg.stroke ?? linkRadius * 1.5\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.4\n const fingerLength = stroke * 1.2\n return fingerWidth * 1.5 + fingerLength\n }\n case 'suction': {\n const diameter = cfg.diameter ?? linkRadius * 2.4\n return diameter * 0.9\n }\n case 'magnetic': {\n const diameter = cfg.diameter ?? linkRadius * 2.6\n return diameter * 0.25\n }\n }\n return 0\n }\n\n private _solveIkDescent(\n chain: ChainElement[],\n radJoints: number[],\n targetVec: THREE.Vector3,\n targetYaw?: number\n ): number[] {\n const state = this.component.state\n const style = this._resolveStyle(state)\n const tcpZ = this._gripperTcpZ(style, state)\n\n const augChain = chain.map((c, i) =>\n i === chain.length - 1 ? { ...c, length: c.length + tcpZ } : c\n )\n\n // Fast path: analytical IK for the standard 6-axis Z-Y-Y-Z-Y-Z chain\n // (industrial + cobot presets). CCDIK is greedy and produces twisted\n // poses; analytical IK is closed-form, deterministic, and gives the\n // natural \"elbow up, gripper straight down\" pose every time.\n //\n // The implementation lives in `./robot-arm-ik.js` so the unit tests\n // exercise THE SAME code that runs at scene-time. (An earlier version\n // of this file kept a private duplicate, which silently drifted from\n // the tested implementation — easy to introduce subtle bugs that\n // tests miss.)\n if (isSixAxisZYYZYZ(augChain)) {\n const analytical = analyticalIk6Axis(augChain, targetVec, radJoints, targetYaw)\n if (analytical) return analytical\n }\n\n const radChain = augChain.map((c, i) => {\n const isLast = i === chain.length - 1\n const radRanges =\n c.type === 'revolute'\n ? ([c.range[0] * DEG2RAD, c.range[1] * DEG2RAD] as [number, number])\n : c.range\n return {\n ...c,\n length: isLast ? c.length + DESCENT_BIAS : c.length,\n range: radRanges\n }\n })\n // Shift target downward (chain-local -Z = world -Y) by the bias length.\n const augTarget = new THREE.Vector3(targetVec.x, targetVec.y, targetVec.z - DESCENT_BIAS)\n\n // ── Lock joint 0 (base yaw) at the right value, run CCDIK on the rest ──\n //\n // CCDIK has two compounding weaknesses with joint 0 (base yaw, axis\n // = chain-local Z):\n //\n // (a) Singularity when chain is straight along Z: v1 = tip - origin\n // is parallel to the joint axis, projects to zero length on the\n // perpendicular plane, and CCDIK SKIPs the joint entirely.\n //\n // (b) Even with the chain bent, CCDIK walking end→base may settle\n // on a contorted solution where downstream joints (typically\n // the wrist) compensate for an under-rotated joint 0 — the arm\n // \"self-pierces\" reaching backwards over its own base instead\n // of cleanly rotating to face the target.\n //\n // Fix: split into two phases.\n // 1. Compute the base yaw analytically: `atan2(target.y, target.x)`\n // — the unique angle that points the chain's pitch plane through\n // the target.\n // 2. Run CCDIK on the SUB-chain (joints 1..N-1) with a baseMatrix\n // that already includes joint 0's rotation + the first link\n // translation. Joint 0 is fixed — CCDIK can't unwind it.\n //\n // Result: base yaw is always correctly oriented, and the remaining\n // joints handle pitch + wrist + descent bias on top of that.\n const seedJoint0 =\n chain.length > 0 && chain[0].type === 'revolute' && chain[0].axis === 'z'\n ? resolveBaseYaw(targetVec, radChain[0].range, radJoints[0] ?? 0)\n : null\n\n if (seedJoint0 === null) {\n // Chain doesn't have a Z-axis joint at index 0 (e.g. SCARA, prismatic\n // first joint) — fall back to plain CCDIK on the full chain. The\n // singularity above doesn't apply when joint 0 isn't around Z.\n return solveCCDIK(radChain, radJoints, augTarget, undefined, {\n maxIterations: 40,\n damping: 0.5\n }).values\n }\n\n // Build base matrix: rotate around Z by seedJoint0, then translate\n // along Z by chain[0].length (joint 0's link). This places the\n // sub-chain's origin at frame 1.\n const baseMatrix = new THREE.Matrix4()\n .makeRotationZ(seedJoint0)\n .multiply(new THREE.Matrix4().makeTranslation(0, 0, radChain[0].length))\n\n const subChain = radChain.slice(1)\n const subSeed = radJoints.slice(1)\n const result = solveCCDIK(subChain, subSeed, augTarget, baseMatrix, {\n maxIterations: 40,\n damping: 0.5\n })\n return [seedJoint0, ...result.values]\n }\n\n // NOTE: `analyticalIk6Axis` and `resolveBaseYaw` previously lived as\n // private duplicates here. They've been hoisted to `./robot-arm-ik.ts`\n // so the unit tests in `test/ik-unit.test.mjs` exercise the same\n // implementation that runs at scene-time. Don't reintroduce private\n // copies — drift between \"tested\" and \"shipping\" code was a real\n // source of bugs in this file's history.\n\n // ─── Resolution helpers ──────────────────────────────────────────────\n\n private _resolveChain(state: any, targetReach: number): ChainElement[] {\n let raw: ChainElement[]\n if (Array.isArray(state.chain) && state.chain.length > 0) {\n raw = state.chain\n } else {\n const presetName = (state.chainPreset ?? '6-axis-industrial') as ChainPresetName\n raw = CHAIN_PRESETS[presetName] ?? CHAIN_PRESETS['6-axis-industrial']\n }\n // Scale every link.length proportionally so the chain's total reach\n // matches the requested depth. Preserves preset proportions (a SCARA\n // stays SCARA-shaped at any depth). Prismatic ranges scale too —\n // their travel distance is in the same length units.\n const nominal = raw.reduce((s, c) => s + (c.length || 0), 0)\n if (nominal <= 0) return raw\n const scale = targetReach / nominal\n return raw.map(c => ({\n ...c,\n length: c.length * scale,\n range: c.type === 'prismatic' ? ([c.range[0] * scale, c.range[1] * scale] as [number, number]) : c.range\n }))\n }\n\n /**\n * Base pedestal height — small reservation at the bottom of `depth` so\n * the chain doesn't start at z=0 (which would clip into the floor).\n * About 12% of depth, clamped to a sane range.\n */\n private _baseHeight(state: any): number {\n const depth = this.effectiveDepth\n return Math.max(2, Math.min(depth * 0.12, 30))\n }\n\n /**\n * Color resolution priority (high → low):\n * 1. `state.fillStyle` → main link color (overrides style preset)\n * 2. `state.color` → legacy / explicit hex int\n * 3. style preset color\n * Same for accent: state.strokeStyle → state.accentColor → preset accent.\n * This way the user can keep a SCARA's box-link shape but recolor it via\n * the standard fillStyle property without dropping into custom presets.\n */\n private _resolveStyle(state: any): RobotArmStyle {\n const baseStyle = STYLES[(state.style ?? 'industrial') as StyleName] ?? STYLES.industrial\n return {\n linkShape: (state.linkShape as LinkShape) ?? baseStyle.linkShape,\n jointHousing: (state.jointHousing as JointHousing) ?? baseStyle.jointHousing,\n color: pickColorish(state.fillStyle, state.color, baseStyle.color),\n accentColor: pickColorish(state.strokeStyle, state.accentColor, baseStyle.accentColor),\n linkRadius:\n typeof state.linkRadius === 'number' && Number.isFinite(state.linkRadius) && state.linkRadius > 0\n ? state.linkRadius\n : baseStyle.linkRadius\n }\n }\n\n /**\n * Resolution priority for each joint i:\n * 1. state.jointN (e.g. state.joint0, state.joint1, ...) — written\n * by the property panel's per-joint number inputs (one row per\n * joint, range-clamped slider).\n * 2. state.joints[i] — array form, useful for programmatic batch set.\n * 3. state.joints[i] — object form ({0: v, 1: v, ...}).\n * 4. 0 — fallback.\n * Final value is range-clamped against the joint's own limits.\n */\n private _resolveJoints(chain: ChainElement[], state: any): number[] {\n const out: number[] = []\n const src = state.joints\n for (let i = 0; i < chain.length; i++) {\n let v: number | undefined\n const flatKey = state[`joint${i}`]\n if (Number.isFinite(flatKey)) {\n v = flatKey\n } else if (Array.isArray(src) && Number.isFinite(src[i])) {\n v = src[i]\n } else if (src && typeof src === 'object' && Number.isFinite(src[i] ?? src[String(i)])) {\n v = Number(src[i] ?? src[String(i)])\n } else {\n v = 0\n }\n if (!Number.isFinite(v)) v = 0\n v = Math.max(chain[i].range[0], Math.min(chain[i].range[1], v as number))\n out.push(v)\n }\n return out\n }\n\n private _jointSpeed(state: any): number {\n // Degrees per second the joint can travel during smoothing.\n // Length-unit prismatic joints reuse this value as units/sec —\n // typical smoothing speed scales similarly for both axis types.\n //\n // Default 45 deg/s — chosen to feel like a real industrial arm\n // executing a careful pick-and-place rather than a fly-by. Higher\n // speeds (90+) read as \"rushed / unsafe\" in a 3D scene where the\n // viewer expects measured motion. User can override via\n // `state.jointSpeed`.\n const v = Number(state.jointSpeed ?? 45)\n return Number.isFinite(v) && v > 0 ? v : 45\n }\n\n /** Convert revolute joint values from degrees → radians. Prismatic\n * values pass through untouched. */\n private _toRadians(chain: ChainElement[], joints: number[]): number[] {\n return joints.map((v, i) => (chain[i].type === 'revolute' ? v * DEG2RAD : v))\n }\n\n /** Inverse of `_toRadians` — radians → degrees for revolute. */\n private _fromRadians(chain: ChainElement[], joints: number[]): number[] {\n return joints.map((v, i) => (chain[i].type === 'revolute' ? v * RAD2DEG : v))\n }\n\n // ─── Geometry builders ───────────────────────────────────────────────\n\n /**\n * Build the chain as a tree of nested Object3Ds. Each link extends\n * along its parent's +Z by `length` — applying the joint rotation BEFORE\n * the translation. This way `rotateAround joint axis = rotate the\n * downstream subtree`, which matches real arm kinematics.\n */\n private _buildArm(chain: ChainElement[], style: RobotArmStyle, joints: number[], baseHeight: number) {\n const state = this.component.state\n const resolved = resolveMaterial3d(state.material3d as Material3D | undefined)\n const alpha = clamp(numOr(state.alpha, 1), 0, 1)\n\n const linkMat = new THREE.MeshStandardMaterial({\n color: style.color,\n metalness: 0.45,\n roughness: 0.45,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(linkMat, resolved)\n const housingMat = new THREE.MeshStandardMaterial({\n color: style.accentColor,\n metalness: 0.55,\n roughness: 0.4,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(housingMat, resolved)\n\n // Three.js convention is +Y up — but our forward kinematics + CCDIK\n // module is +Z up (matches IK math conventions). Wrap the whole arm\n // in a group rotated -90° around X so chain-local +Z maps to world +Y.\n // Lift by baseHeight so the chain origin sits ON TOP of the pedestal.\n const armRoot = new THREE.Group()\n armRoot.rotation.x = -Math.PI / 2\n armRoot.position.y = -this.effectiveDepth / 2 + baseHeight\n this.object3d.add(armRoot)\n // Cache for worldToChainLocal — IK targets must be in this frame.\n this._armRoot = armRoot\n\n this._jointFrames = []\n let currentParent: THREE.Object3D = armRoot\n\n for (let i = 0; i < chain.length; i++) {\n const link = chain[i]\n // Joint frame — sits at the start of link i, rotates by jointValue.\n const frame = new THREE.Object3D()\n currentParent.add(frame)\n this._jointFrames.push(frame)\n this._applyJointValue(frame, link, joints[i])\n\n // Joint housing at the joint origin (frame's local origin).\n const housing = this._buildJointHousing(style.jointHousing, style.linkRadius, housingMat)\n if (housing) frame.add(housing)\n\n // Link mesh extends along local +Z by link.length. We mount it as a\n // child of the frame so it inherits the joint rotation. The link\n // itself sits with its base at z=0 and grows toward +Z.\n const linkMesh = this._buildLinkMesh(style.linkShape, style.linkRadius, link.length, linkMat)\n if (linkMesh) frame.add(linkMesh)\n\n // The next frame's parent is a translation forward by link.length.\n const next = new THREE.Object3D()\n next.position.set(0, 0, link.length)\n frame.add(next)\n currentParent = next\n }\n\n // Save the end-effector parent so the gripper builder can mount onto it.\n // Also exposed via `getGripperFrame()` so CarrierHolder.attachPointFor\n // can return it — making any Carriable child mount onto the moving\n // gripper TCP and follow IK automatically.\n this._endFrame = currentParent\n }\n\n /**\n * Frame at the gripper TCP (Tool Center Point) — the working point of\n * the gripper, NOT the wrist. For jaw grippers this is the mid-point\n * between finger tips; for suction/magnetic it's the contact face.\n * Carriers held by the arm parent here so they sit at the gripping\n * interface, not buried inside the gripper meshes.\n *\n * Falls back to `_endFrame` (wrist) until `_buildGripper` has run.\n */\n getGripperFrame(): THREE.Object3D | undefined {\n return this._tcpFrame ?? this._endFrame\n }\n\n /**\n * Convert a world-space point to the IK module's chain-local frame.\n *\n * Why this matters: CCDIK + forwardKinematics operate in `armRoot`'s\n * local space (base joint at origin, +Z up — the IK math convention).\n * `state.target` is interpreted in *that* frame. If a caller hands in\n * a world position from another component (a parcel sitting somewhere\n * in the scene), it must be projected through `armRoot`'s inverse\n * world matrix first, otherwise the arm reaches toward \"as if the\n * world coords were base-relative\" — a totally wrong direction once\n * the robot itself isn't at the world origin.\n *\n * Returns the same `{x, y, z}` shape `state.target` accepts, which is\n * already in chain-local space (no further conversion needed by\n * pickAndPlace).\n */\n worldToChainLocal(worldX: number, worldY: number, worldZ: number): { x: number; y: number; z: number } {\n if (!this._armRoot) return { x: 0, y: 0, z: 0 }\n this._armRoot.updateWorldMatrix(true, false)\n const v = new THREE.Vector3(worldX, worldY, worldZ)\n v.applyMatrix4(new THREE.Matrix4().copy(this._armRoot.matrixWorld).invert())\n return { x: v.x, y: v.y, z: v.z }\n }\n\n private _armRoot?: THREE.Object3D\n\n /**\n * Apply a joint value to its scene-graph frame. `value` is in *user\n * units* (degrees for revolute, scene units for prismatic) — convert\n * to radians at the math boundary.\n */\n private _applyJointValue(frame: THREE.Object3D, link: ChainElement, value: number) {\n if (link.type === 'revolute') {\n const ax = _AXIS_VEC[link.axis]\n frame.quaternion.setFromAxisAngle(ax, value * DEG2RAD)\n } else {\n frame.position.copy(_AXIS_VEC[link.axis]).multiplyScalar(value)\n }\n }\n\n /** Cheap path: just refresh joint orientations without rebuilding the\n * geometry tree. Used when only joint values changed. */\n private _refreshJointPoses(joints: number[]) {\n for (let i = 0; i < this._chain.length; i++) {\n const frame = this._jointFrames[i]\n if (frame) this._applyJointValue(frame, this._chain[i], joints[i])\n }\n }\n\n private _buildJointHousing(kind: JointHousing, r: number, mat: THREE.Material): THREE.Mesh | null {\n const radius = r * 1.15\n switch (kind) {\n case 'disk': {\n const geo = new THREE.CylinderGeometry(radius, radius, r * 0.7, 24)\n // disk axis = local Y by default; we want it perpendicular to the\n // link's growth direction. Leaving it on local Y reads as a \"wrist\n // band\" between two link segments — which is what cobot disks do.\n return new THREE.Mesh(geo, mat)\n }\n case 'sphere': {\n const geo = new THREE.SphereGeometry(radius, 16, 12)\n return new THREE.Mesh(geo, mat)\n }\n case 'knuckle': {\n // Asymmetric box — wider in two axes, narrow in third. Reads as\n // industrial cast joint.\n const geo = new THREE.BoxGeometry(radius * 2.1, radius * 1.4, radius * 1.8)\n return new THREE.Mesh(geo, mat)\n }\n case 'none':\n default:\n return null\n }\n }\n\n private _buildLinkMesh(\n shape: LinkShape,\n radius: number,\n length: number,\n mat: THREE.Material\n ): THREE.Mesh | null {\n if (length <= 0.5) return null\n let geo: THREE.BufferGeometry\n switch (shape) {\n case 'cylinder':\n geo = new THREE.CylinderGeometry(radius, radius, length, 16)\n break\n case 'tapered':\n geo = new THREE.CylinderGeometry(radius * 0.7, radius, length, 16)\n break\n case 'tube':\n geo = new THREE.CylinderGeometry(radius * 0.5, radius * 0.5, length, 12)\n break\n case 'box':\n geo = new THREE.BoxGeometry(radius * 1.6, radius * 1.6, length)\n break\n case 'gltf':\n // Placeholder — full GLTF link replacement is a v2 feature.\n // Fall back to cylinder so the chain doesn't break visually.\n geo = new THREE.CylinderGeometry(radius, radius, length, 16)\n break\n default:\n geo = new THREE.CylinderGeometry(radius, radius, length, 16)\n }\n // Three.js cylinder/box default axis = local +Y. Rotate to grow along\n // local +Z (the chain-forward direction) and shift so the BASE sits at\n // z=0 (rather than centered).\n if (shape !== 'box') {\n geo.rotateX(Math.PI / 2)\n }\n geo.translate(0, 0, length / 2)\n const mesh = new THREE.Mesh(geo, mat)\n mesh.castShadow = true\n return mesh\n }\n\n // ─── Gripper ──────────────────────────────────────────────────────────\n\n /**\n * Build the gripper meshes onto `_endFrame` and place a TCP frame at\n * the gripper's working point (between the finger tips for jaw types,\n * at the cup/disk distal face for surface types). Carriers held by the\n * arm mount onto this TCP frame, NOT onto `_endFrame` — `_endFrame` is\n * the wrist (chain end-of-link) and the gripper extends from it in +Z,\n * so a carrier at `_endFrame` origin would visually overlap the gripper\n * meshes (the fingers/cup would pierce through the box).\n */\n private _buildGripper(chain: ChainElement[], style: RobotArmStyle, state: any) {\n const endFrame = this._endFrame\n if (!endFrame) return\n\n // TCP frame — added unconditionally (even for gripper.type='none' or\n // missing gripper) so carrier mount logic always has a stable target.\n // Default at wrist (z=0); per-type builders override below.\n const tcp = new THREE.Object3D()\n endFrame.add(tcp)\n this._tcpFrame = tcp\n\n const cfg: GripperConfig = {\n ...DEFAULT_GRIPPER,\n ...((state.gripper as GripperConfig) ?? {}),\n // gripperType nature property is a shortcut for {gripper: {type}} —\n // expose it so the property panel's <select> works without nested object editing.\n ...(state.gripperType ? { type: state.gripperType } : {})\n }\n if (cfg.type === 'none') return\n\n const color = pickColorish(cfg.color, style.accentColor)\n const resolved = resolveMaterial3d(state.material3d as Material3D | undefined)\n const alpha = clamp(numOr(state.alpha, 1), 0, 1)\n const mat = new THREE.MeshStandardMaterial({\n color,\n metalness: 0.55,\n roughness: 0.4,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(mat, resolved)\n\n let tcpZ = 0\n switch (cfg.type) {\n case 'parallel':\n tcpZ = this._buildParallelGripper(endFrame, cfg, mat, style.linkRadius)\n break\n case 'three-finger':\n tcpZ = this._buildThreeFingerGripper(endFrame, cfg, mat, style.linkRadius)\n break\n case 'suction':\n tcpZ = this._buildSuctionGripper(endFrame, cfg, mat, style.linkRadius)\n break\n case 'magnetic':\n tcpZ = this._buildMagneticGripper(endFrame, cfg, mat, style.linkRadius)\n break\n }\n tcp.position.z = tcpZ\n }\n\n private _tcpFrame?: THREE.Object3D\n /** 마지막 joint(=wrist) frame — 그리퍼 빌드가 부착되는 부모 노드. */\n private _endFrame?: THREE.Object3D\n\n /**\n * Each gripper sub-builder returns its TCP z-offset (in `_endFrame`'s\n * local coordinates) — the point in space where a held carrier's grip\n * face should land. The caller positions `_tcpFrame` at that z so\n * carriers attach there directly.\n */\n private _buildParallelGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n // Default sizes scale with linkRadius so the gripper looks proportional\n // to the arm. A heavy industrial 6-axis (linkRadius ~10) gets a chunky\n // gripper; a slim cobot wrist (linkRadius ~3) gets a small one. User\n // can still override via cfg.stroke / cfg.fingerWidth.\n const stroke = cfg.stroke ?? linkRadius * 1.8\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.45\n const fingerLength = stroke * 1.2\n const closure = THREE.MathUtils.clamp(cfg.state ?? 0, 0, 1) // 0 = open, 1 = closed\n // Wrist plate\n const plate = new THREE.Mesh(\n new THREE.BoxGeometry(stroke * 1.6, fingerWidth * 1.2, fingerWidth * 1.8),\n mat\n )\n plate.position.set(0, 0, fingerWidth * 0.9)\n parent.add(plate)\n // Two fingers, opening width = stroke when state=0, fingerWidth when state=1\n const halfOpen = (stroke / 2) * (1 - closure) + (fingerWidth / 2) * closure\n for (const sign of [-1, 1]) {\n const finger = new THREE.Mesh(\n new THREE.BoxGeometry(fingerWidth, fingerWidth, fingerLength),\n mat\n )\n finger.position.set(sign * halfOpen, 0, fingerWidth * 1.8 + fingerLength / 2)\n parent.add(finger)\n }\n // TCP = finger-tip plane (carrier's top face docks against it).\n return fingerWidth * 1.8 + fingerLength\n }\n\n private _buildThreeFingerGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n const stroke = cfg.stroke ?? linkRadius * 1.5\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.4\n const fingerLength = stroke * 1.2\n const closure = THREE.MathUtils.clamp(cfg.state ?? 0, 0, 1)\n const radius = (stroke / 2) * (1 - closure) + (fingerWidth / 2) * closure\n // Wrist hub\n const hub = new THREE.Mesh(\n new THREE.CylinderGeometry(stroke * 0.55, stroke * 0.55, fingerWidth * 1.5, 16),\n mat\n )\n hub.rotation.x = Math.PI / 2\n hub.position.set(0, 0, fingerWidth * 0.75)\n parent.add(hub)\n // Three fingers around the axis\n for (let i = 0; i < 3; i++) {\n const angle = (i / 3) * Math.PI * 2\n const finger = new THREE.Mesh(\n new THREE.BoxGeometry(fingerWidth, fingerWidth, fingerLength),\n mat\n )\n finger.position.set(Math.cos(angle) * radius, Math.sin(angle) * radius, fingerWidth * 1.5 + fingerLength / 2)\n parent.add(finger)\n }\n return fingerWidth * 1.5 + fingerLength\n }\n\n private _buildSuctionGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n const diameter = cfg.diameter ?? linkRadius * 2.4\n // Mounting stem\n const stem = new THREE.Mesh(\n new THREE.CylinderGeometry(diameter * 0.25, diameter * 0.25, diameter * 0.5, 12),\n mat\n )\n stem.rotation.x = Math.PI / 2\n stem.position.set(0, 0, diameter * 0.25)\n parent.add(stem)\n // Suction cup (cone, narrow end at the stem)\n const cup = new THREE.Mesh(\n new THREE.CylinderGeometry(diameter / 2, diameter * 0.3, diameter * 0.4, 24, 1, true),\n mat\n )\n cup.rotation.x = Math.PI / 2\n cup.position.set(0, 0, diameter * 0.5 + diameter * 0.2)\n parent.add(cup)\n // TCP = cup distal face (suction surface contacts the carrier here).\n return diameter * 0.9\n }\n\n private _buildMagneticGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n const diameter = cfg.diameter ?? linkRadius * 2.6\n // Disk magnet at the end\n const disk = new THREE.Mesh(\n new THREE.CylinderGeometry(diameter / 2, diameter / 2, diameter * 0.25, 24),\n mat\n )\n disk.rotation.x = Math.PI / 2\n disk.position.set(0, 0, diameter * 0.125)\n parent.add(disk)\n // TCP = disk distal face (magnet contacts the carrier here).\n return diameter * 0.25\n }\n\n // ─── Reach sphere visualization ──────────────────────────────────────\n\n private _buildReachSphere(chain: ChainElement[], state: any, baseHeight: number) {\n if (!state.showReachSphere) return\n const reach = maxReach(chain)\n if (reach <= 0) return\n const geo = new THREE.SphereGeometry(reach, 24, 16)\n const wire = new THREE.WireframeGeometry(geo)\n const mat = new THREE.LineBasicMaterial({\n color: 0x44aacc,\n transparent: true,\n opacity: 0.18\n })\n const wireMesh = new THREE.LineSegments(wire, mat)\n // Center on the base joint (top of pedestal), in world-space y.\n wireMesh.position.y = -this.effectiveDepth / 2 + baseHeight\n // Visualization-only — must not catch raycasts. The reach sphere\n // surrounds the arm in 3D and would intercept clicks meant for the\n // actual robot body. NO_RAYCAST keeps it visible but click-through.\n wireMesh.raycast = NO_RAYCAST\n this.object3d.add(wireMesh)\n geo.dispose()\n }\n\n // ─── Base / pedestal ─────────────────────────────────────────────────\n\n /**\n * Pedestal — sized from `state.width × state.height` (the 2D footprint).\n * Cylindrical base whose radius fills ~90% of the smaller footprint\n * dimension; a flared bottom (1.2× radius) gives the visual weight of\n * a real industrial robot anchor.\n */\n private _buildBase(state: any, style: RobotArmStyle, baseHeight: number) {\n const w = Math.max(Math.abs(numOr(state.width, 100)), 1)\n const h2d = Math.max(Math.abs(numOr(state.height, 100)), 1)\n const r = (Math.min(w, h2d) / 2) * 0.9\n const resolved = resolveMaterial3d(state.material3d as Material3D | undefined)\n const alpha = clamp(numOr(state.alpha, 1), 0, 1)\n const mat = new THREE.MeshStandardMaterial({\n color: style.accentColor,\n metalness: 0.6,\n roughness: 0.4,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(mat, resolved)\n const base = new THREE.Mesh(new THREE.CylinderGeometry(r, r * 1.2, baseHeight, 24), mat)\n base.position.set(0, -this.effectiveDepth / 2 + baseHeight / 2, 0)\n base.castShadow = resolved.castShadow\n base.receiveShadow = resolved.receiveShadow\n this.object3d.add(base)\n }\n\n // ─── Animation: smooth joint values toward solved target ─────────────\n\n private _startAnimation() {\n if (this._unsubTick) return\n // RobotArm joint motion 은 시뮬레이션 사건 (pickAndPlace 의\n // 일부). speed 따라 가속, paused 시 정지. dt 는 sim ms.\n this._unsubTick = frameClock.subscribe(\n (dt) => {\n if (!this._smoothing) return\n const dtSec = Math.min(dt / 1000, 0.1) // clamp for stability\n const { current, target, speed } = this._smoothing\n const maxStep = speed * dtSec\n let allReached = true\n for (let i = 0; i < current.length; i++) {\n const diff = (target[i] ?? 0) - current[i]\n if (Math.abs(diff) > 1e-4) allReached = false\n const step = Math.sign(diff) * Math.min(Math.abs(diff), maxStep)\n current[i] += step\n // apply to live frame\n const frame = this._jointFrames[i]\n const link = this._chain[i]\n if (frame && link) this._applyJointValue(frame, link, current[i])\n }\n this.component.invalidate?.()\n if (allReached) {\n this._stopAnimation()\n // Notify external code (pickAndPlace, custom scripts) that the\n // gripper has reached its target. Component.trigger fires the\n // standard things-scene event bus so consumers can subscribe via\n // `component.on('tcp-reached', handler)`.\n this.component.trigger('tcp-reached', { component: this.component })\n }\n },\n { description: 'joint smoothing', component: this.component }\n )\n }\n\n private _stopAnimation() {\n if (this._unsubTick) {\n this._unsubTick()\n this._unsubTick = null\n }\n }\n\n /**\n * Re-run IK toward a new target without rebuilding the scene graph.\n *\n * Mirrors the IK block of `build()` but operates on the *existing*\n * joint frames and meshes. Critically does NOT call `update()` /\n * `clear()` — those tear down `this.object3d`'s children, which would\n * also detach the gripper frame and any Carriable currently mounted\n * onto it. A pickAndPlace operation would lose its held carrier the\n * instant the place target is committed.\n *\n * Falls back to a full `update()` only when the cached chain hasn't\n * been built yet (build pre-condition).\n */\n private _retargetIk() {\n if (this._chain.length === 0 || this._jointFrames.length !== this._chain.length) {\n this.update()\n return\n }\n\n const state = this.component.state\n const chain = this._chain\n const target = state.target\n const speed = this._jointSpeed(state)\n\n // Starting pose for IK = where smoothing currently is (mid-flight)\n // or the resolved joint values from state. Using mid-flight values\n // makes consecutive `pnp` calls chain smoothly without snap-back.\n const previous = this._smoothing?.current?.slice() ?? this._resolveJoints(chain, state)\n\n if (target && Number.isFinite(target.x) && Number.isFinite(target.y) && Number.isFinite(target.z)) {\n const targetVec = new THREE.Vector3(target.x, target.y, target.z)\n const targetYaw = Number.isFinite(target.yaw) ? (target.yaw as number) : undefined\n const radJoints = this._toRadians(chain, previous)\n const ikValues = this._solveIkDescent(chain, radJoints, targetVec, targetYaw)\n const solvedUser = this._fromRadians(chain, ikValues)\n this._smoothing = {\n current: previous,\n target: solvedUser.slice(),\n speed\n }\n // Snap visible pose to the smoothing's \"current\" (= previous IK\n // position). Without this, if external code mutated joint frames\n // between ticks, the first tick would jump.\n this._refreshJointPoses(previous)\n this._stopAnimation()\n this._startAnimation()\n } else {\n // Target cleared — stop animating, freeze where we are.\n if (this._smoothing) {\n this._smoothing.target = this._smoothing.current.slice()\n this._smoothing.speed = speed\n }\n this._stopAnimation()\n }\n }\n\n /**\n * 사용자 설정 home pose (state.joints / state.jointN) 의 joint 값 배열 반환.\n * `goHome()` 의 target 으로 사용. _smoothing 의 current 와 무관 — pick/place 도중\n * 호출되어도 본래 휴식 포즈를 반환.\n */\n getHomeJoints(): number[] {\n if (!this._chain) return []\n return this._resolveJoints(this._chain, this.component.state)\n }\n\n /**\n * IK 를 거치지 않고 forward joint 값 배열을 smoothing target 으로 직접 설정.\n * `goHome()` 외에도 외부에서 joint pose 직접 제어 시 사용.\n * 완료 시 'tcp-reached' 이벤트 발생 (smoothing 의 allReached 경로 공통).\n */\n moveJointsTo(jointValues: number[]): void {\n if (!this._chain) return\n const state = this.component.state\n const previous = this._smoothing?.current?.slice() ?? this._resolveJoints(this._chain, state)\n // 길이 보정 — chain 보다 짧으면 0 으로 채움, 길면 자름. range clamp.\n const target: number[] = []\n for (let i = 0; i < this._chain.length; i++) {\n let v = Number(jointValues[i] ?? 0)\n if (!Number.isFinite(v)) v = 0\n v = Math.max(this._chain[i].range[0], Math.min(this._chain[i].range[1], v))\n target.push(v)\n }\n this._smoothing = {\n current: previous,\n target,\n speed: this._jointSpeed(state)\n }\n this._stopAnimation()\n this._startAnimation()\n }\n\n updateDimension() {}\n\n onchange(after: Record<string, unknown>, before: Record<string, unknown>) {\n // Structural changes — full rebuild.\n if (\n 'style' in after ||\n 'chainPreset' in after ||\n 'chain' in after ||\n 'linkShape' in after ||\n 'jointHousing' in after ||\n 'linkRadius' in after ||\n 'color' in after ||\n 'accentColor' in after ||\n 'fillStyle' in after ||\n 'strokeStyle' in after ||\n 'alpha' in after ||\n 'material3d' in after ||\n 'gripper' in after ||\n 'gripperType' in after ||\n 'showReachSphere' in after ||\n 'width' in after ||\n 'height' in after ||\n 'depth' in after\n ) {\n this.update()\n return\n }\n // Target change → re-run IK + restart smoothing on the EXISTING\n // scene graph. Critically NOT a full rebuild — `update()` calls\n // `clear()` which detaches every child of `this.object3d`, including\n // any Carriable currently mounted on the gripper frame. A pickAndPlace\n // call would invisibly drop the held carrier the moment we set the\n // place target, leaving no mesh between pick and place.\n if ('target' in after || 'jointSpeed' in after) {\n this._retargetIk()\n return\n }\n // Joint value change (state.joint0, state.joint1, ... or state.joints\n // batch) — fast path: just refresh joint poses on the existing scene\n // graph. NO mesh rebuild. This is what makes property-panel slider\n // edits feel live. The match must be done explicitly because dynamic\n // joint property names (joint0, joint1, ...) aren't in any static list.\n const hasJoint = 'joints' in after || Object.keys(after).some(k => /^joint\\d+$/.test(k))\n if (hasJoint) {\n const state = this.component.state\n // chain might be empty if build hasn't run yet (e.g. component just\n // attached). Defer to a full update in that case.\n if (this._chain.length === 0 || this._jointFrames.length !== this._chain.length) {\n this.update()\n return\n }\n const joints = this._resolveJoints(this._chain, state)\n this._refreshJointPoses(joints)\n // smoothing's \"current\" should track the user's manual edits so the\n // next IK target solves from where the user left things.\n if (this._smoothing) this._smoothing.current = joints.slice()\n return\n }\n super.onchange(after, before)\n }\n\n dispose() {\n this._stopAnimation()\n super.dispose()\n }\n\n updateAlpha() {}\n}\n\n/** Returns `v` if a finite number, otherwise `dflt`. */\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n\nfunction clamp(v: number, lo: number, hi: number) {\n return Math.max(lo, Math.min(hi, v))\n}\n\n/**\n * Pick the first valid color in priority order. Accepts both color strings\n * (CSS / hex) and hex int numbers — both are valid `THREE.ColorRepresentation`.\n * Treats 'transparent' / empty strings as \"skip me\".\n */\n/** Returns a number-or-string color (StyleColor). Both flavors are valid\n * THREE.ColorRepresentation, so they pass through to MeshStandardMaterial\n * without conversion. */\nfunction pickColorish(...candidates: unknown[]): number | string {\n for (const c of candidates) {\n if (typeof c === 'string' && c && c !== 'transparent') return c\n if (typeof c === 'number' && Number.isFinite(c)) return c\n }\n return 0x888888\n}\n"]}
1
+ {"version":3,"file":"robot-arm-3d.js","sourceRoot":"","sources":["../src/robot-arm-3d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EAGX,MAAM,w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,EAAE,MAAM,CAAC,CAAA;IAC/B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,cAAc,EAAE,CAAA;QACrB,KAAK,CAAC,OAAO,EAAE,CAAA;IACjB,CAAC;IAED,WAAW,KAAI,CAAC;CACjB;AAED,wDAAwD;AACxD,SAAS,KAAK,CAAC,CAAU,EAAE,IAAY;IACrC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/D,CAAC;AAED,SAAS,KAAK,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU;IAC9C,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;AACtC,CAAC;AAED;;;;GAIG;AACH;;0BAE0B;AAC1B,SAAS,YAAY,CAAC,GAAG,UAAqB;IAC5C,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,aAAa;YAAE,OAAO,CAAC,CAAA;QAC/D,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAA;IAC3D,CAAC;IACD,OAAO,QAAQ,CAAA;AACjB,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Robot arm 3D — articulated chain renderer.\n *\n * Build pipeline:\n * 1. Resolve chain (state.chain | preset | default 6-axis-industrial).\n * 2. Resolve style (state.style preset, with per-property overrides).\n * 3. Resolve joint values (state.joints array OR object map; missing\n * entries default to 0 and clamp to chain[i].range).\n * 4. If state.target is present, run CCDIK to solve joint values\n * reaching that target; commit the solved values back via the\n * smoothing controller (next tick converges to them).\n * 5. Forward-kinematics walk → emit one Object3D per joint frame,\n * each carrying its joint housing mesh + the link mesh extending\n * along local +Z to the next frame.\n * 6. Add gripper at the end-effector frame.\n * 7. Optional reach sphere (wireframe).\n *\n * Joint frames are real Object3D children, so the rotation set via\n * `frame.rotation.<axis> = jointValue` on each frame produces the right\n * world-space pose without explicit matrix math at render time. CCDIK\n * runs in matrix math (separate from this scene-graph walk) when needed.\n */\n\nimport * as THREE from 'three'\nimport {\n RealObjectGroup,\n resolveMaterial3d,\n applyMaterial3dProps,\n frameClock,\n type Component,\n type Material3D\n} from '@hatiolab/things-scene'\nimport type { Unsubscribe } from '@hatiolab/things-scene'\nimport {\n STYLES,\n CHAIN_PRESETS,\n DEFAULT_GRIPPER,\n type RobotArmStyle,\n type StyleName,\n type ChainPresetName,\n type GripperConfig,\n type LinkShape,\n type JointHousing\n} from './robot-arm-styles.js'\nimport {\n forwardKinematics,\n solveCCDIK,\n maxReach,\n isSixAxisZYYZYZ,\n resolveBaseYaw,\n analyticalIk6Axis,\n type ChainElement,\n type JointAxis\n} from './robot-arm-ik.js'\n\nconst _AXIS_VEC: Record<JointAxis, THREE.Vector3> = {\n x: new THREE.Vector3(1, 0, 0),\n y: new THREE.Vector3(0, 1, 0),\n z: new THREE.Vector3(0, 0, 1)\n}\n\nconst DEG2RAD = Math.PI / 180\nconst RAD2DEG = 180 / Math.PI\n\n/**\n * Length (chain-local units) of the virtual end-extension used to bias\n * CCDIK toward \"gripper pointing world-down\". Longer = stronger orientation\n * bias but reduces effective reach; shorter = closer to position-only.\n * 30 is a moderate default that handles typical pick-and-place poses\n * without sacrificing reach for normal-sized arms.\n */\nconst DESCENT_BIAS = 30\n\n/** Raycast no-op — assigned to non-interactive helper meshes (e.g. the\n * reach-sphere visualization) so clicks pass through to the real body. */\nconst NO_RAYCAST: THREE.Object3D['raycast'] = () => {}\n\nexport class RobotArm3D extends RealObjectGroup {\n private _smoothing?: { current: number[]; target: number[]; speed: number }\n private _unsubTick: Unsubscribe | null = null\n private _chain: ChainElement[] = []\n private _jointFrames: THREE.Object3D[] = []\n\n build() {\n super.build()\n\n const state = this.component.state\n // Geometry mapping (per user contract):\n // width × height = robot footprint (the base pedestal occupies this)\n // depth = robot height (= max reach when fully extended up)\n //\n // The chain preset's lengths are treated as PROPORTIONS — we scale them\n // so the sum matches `effectiveDepth` (with a small base-height\n // reservation). User can still override by passing absolute lengths via\n // `state.chain[i].length`; the same scale is applied so `depth` stays\n // the source of truth for overall robot height.\n const baseHeight = this._baseHeight(state)\n const targetReach = Math.max(this.effectiveDepth - baseHeight, 1)\n const chain = this._resolveChain(state, targetReach)\n const style = this._resolveStyle(state)\n let joints = this._resolveJoints(chain, state)\n\n // If a target is set, solve IK and use the solved joint values as the\n // smoothing-controller's new target. CCDIK works in radians; convert\n // both the input joints and the output back to user-facing units\n // (degrees for revolute) before storing.\n //\n // CRITICAL: IK starts from smoothing.current (the visual joint pose\n // mid-transit) when present, NOT from state-derived joints. CCDIK is\n // path-dependent — different start poses converge to different valid\n // solutions reaching the same TCP. If a rebuild happens DURING transit\n // (e.g. `set('gripper', state:1)` closing the gripper after pick),\n // re-solving from state joints (typically 0,0,0...) would produce a\n // *different* solution than the path the arm was already on, snapping\n // smoothing.target onto a new joint configuration. The arm — and any\n // carried box — would then race toward that alternate solution,\n // sometimes hitting `allReached` almost instantly (if the alternate\n // happens to be close to current), which fires `tcp-reached`\n // prematurely and makes pickAndPlace reparent the carrier to the\n // place holder long before the arm has actually traveled there.\n const target = state.target\n if (target && Number.isFinite(target.x) && Number.isFinite(target.y) && Number.isFinite(target.z)) {\n const targetVec = new THREE.Vector3(target.x, target.y, target.z)\n const targetYaw = Number.isFinite(target.yaw) ? (target.yaw as number) : undefined\n const ikStart = this._smoothing?.current?.slice() ?? joints\n const radJoints = this._toRadians(chain, ikStart)\n const ikValues = this._solveIkDescent(chain, radJoints, targetVec, targetYaw)\n const solvedUser = this._fromRadians(chain, ikValues)\n this._smoothing = {\n current: ikStart.slice(),\n target: solvedUser.slice(),\n speed: this._jointSpeed(state)\n }\n // visible position = current (interpolated by tick)\n joints = ikStart.slice()\n } else if (this._smoothing) {\n // no target — freeze where we are, NOT animate toward stale state\n // joints (which may be 0,0,0... and unrelated to the visual pose).\n this._smoothing.target = this._smoothing.current.slice()\n }\n\n this._chain = chain\n this._buildArm(chain, style, joints, baseHeight)\n this._buildGripper(chain, style, state)\n this._buildReachSphere(chain, state, baseHeight)\n this._buildBase(state, style, baseHeight)\n\n // Animation lifecycle (smooths joint values toward solved target).\n this._stopAnimation()\n if (this._smoothing) {\n this._startAnimation()\n }\n\n // Re-mount any Carriable child whose object3d was orphaned by the\n // build's `clear()`. Without this, ANY structural change while a\n // carrier is held (most commonly the gripper-close `set('gripper',\n // {state:1})` inside pickAndPlace) tears down `_endFrame` along with\n // the carrier mounted onto it — the box vanishes mid-flight.\n //\n // The component-side child list survives a 3D rebuild (only the\n // scene-graph was reset), so we walk it and re-execute the holder's\n // attach-point policy. Uses `add()` (not `attach()`) because the\n // orphaned object3d's matrixWorld is stale; we want the explicit\n // localPosition/localRotation, not whatever world pose was last\n // computed on the old gripper frame.\n this._remountCarriers()\n }\n\n private _remountCarriers() {\n const holder = this.component as any\n if (typeof holder.attachPointFor !== 'function') return\n const children: Component[] =\n holder._holdings ?? holder.components ?? holder.children ?? []\n for (const child of children) {\n if (!(child as any)?.isCarriable) continue\n const obj3d = (child as any)._realObject?.object3d\n if (!obj3d) continue\n const point = holder.attachPointFor(child)\n if (!point?.attach) continue\n point.attach.add(obj3d)\n const lp = point.localPosition ?? { x: 0, y: 0, z: 0 }\n obj3d.position.set(lp.x, lp.y, lp.z)\n if (point.localRotation) {\n obj3d.rotation.set(point.localRotation.x, point.localRotation.y, point.localRotation.z)\n } else {\n obj3d.quaternion.identity()\n }\n }\n }\n\n /**\n * IK with a \"point gripper downward\" bias.\n *\n * CCDIK is position-only — it solves for joint values that put the\n * end-effector at the target, without constraining the gripper's\n * orientation. With no orientation constraint, valid solutions\n * include twisted poses (gripper sideways / upside-down) — typical\n * pick-and-place tasks then look broken: the box gets gripped at a\n * wrong angle, or after release the carrier \"launches\" off because\n * the gripper was facing some weird direction at the moment of\n * release. The arm can also visibly \"lock\" near joint limits trying\n * to satisfy a position-only target through a contorted path.\n *\n * Trick — augment the chain with a virtual rigid extension along the\n * last frame's +Z, length L. When CCDIK puts this extended end at\n * `target + L * (-Ẑ_chainLocal)` (i.e. the original target shifted\n * downward by L in chain-local), the only way the chain can satisfy\n * both placements simultaneously is by orienting the last frame's +Z\n * to point in the chain-local -Z direction = world -Y direction =\n * gripper pointing straight DOWN. Best-effort even when CCDIK can't\n * fully converge — the solver pushes the chain in the right\n * orientation, which matches what a real pick-and-place arm does.\n */\n \n private _gripperTcpZ(style: RobotArmStyle, state: any): number {\n const cfg: GripperConfig = {\n ...DEFAULT_GRIPPER,\n ...((state.gripper as GripperConfig) ?? {}),\n ...(state.gripperType ? { type: state.gripperType } : {})\n }\n if (cfg.type === 'none') return 0\n const linkRadius = style.linkRadius\n switch (cfg.type) {\n case 'parallel': {\n const stroke = cfg.stroke ?? linkRadius * 1.8\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.45\n const fingerLength = stroke * 1.2\n return fingerWidth * 1.8 + fingerLength\n }\n case 'three-finger': {\n const stroke = cfg.stroke ?? linkRadius * 1.5\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.4\n const fingerLength = stroke * 1.2\n return fingerWidth * 1.5 + fingerLength\n }\n case 'suction': {\n const diameter = cfg.diameter ?? linkRadius * 2.4\n return diameter * 0.9\n }\n case 'magnetic': {\n const diameter = cfg.diameter ?? linkRadius * 2.6\n return diameter * 0.25\n }\n }\n return 0\n }\n\n private _solveIkDescent(\n chain: ChainElement[],\n radJoints: number[],\n targetVec: THREE.Vector3,\n targetYaw?: number\n ): number[] {\n const state = this.component.state\n const style = this._resolveStyle(state)\n const tcpZ = this._gripperTcpZ(style, state)\n\n const augChain = chain.map((c, i) =>\n i === chain.length - 1 ? { ...c, length: c.length + tcpZ } : c\n )\n\n // Fast path: analytical IK for the standard 6-axis Z-Y-Y-Z-Y-Z chain\n // (industrial + cobot presets). CCDIK is greedy and produces twisted\n // poses; analytical IK is closed-form, deterministic, and gives the\n // natural \"elbow up, gripper straight down\" pose every time.\n //\n // The implementation lives in `./robot-arm-ik.js` so the unit tests\n // exercise THE SAME code that runs at scene-time. (An earlier version\n // of this file kept a private duplicate, which silently drifted from\n // the tested implementation — easy to introduce subtle bugs that\n // tests miss.)\n if (isSixAxisZYYZYZ(augChain)) {\n const analytical = analyticalIk6Axis(augChain, targetVec, radJoints, targetYaw)\n if (analytical) return analytical\n }\n\n const radChain = augChain.map((c, i) => {\n const isLast = i === chain.length - 1\n const radRanges =\n c.type === 'revolute'\n ? ([c.range[0] * DEG2RAD, c.range[1] * DEG2RAD] as [number, number])\n : c.range\n return {\n ...c,\n length: isLast ? c.length + DESCENT_BIAS : c.length,\n range: radRanges\n }\n })\n // Shift target downward (chain-local -Z = world -Y) by the bias length.\n const augTarget = new THREE.Vector3(targetVec.x, targetVec.y, targetVec.z - DESCENT_BIAS)\n\n // ── Lock joint 0 (base yaw) at the right value, run CCDIK on the rest ──\n //\n // CCDIK has two compounding weaknesses with joint 0 (base yaw, axis\n // = chain-local Z):\n //\n // (a) Singularity when chain is straight along Z: v1 = tip - origin\n // is parallel to the joint axis, projects to zero length on the\n // perpendicular plane, and CCDIK SKIPs the joint entirely.\n //\n // (b) Even with the chain bent, CCDIK walking end→base may settle\n // on a contorted solution where downstream joints (typically\n // the wrist) compensate for an under-rotated joint 0 — the arm\n // \"self-pierces\" reaching backwards over its own base instead\n // of cleanly rotating to face the target.\n //\n // Fix: split into two phases.\n // 1. Compute the base yaw analytically: `atan2(target.y, target.x)`\n // — the unique angle that points the chain's pitch plane through\n // the target.\n // 2. Run CCDIK on the SUB-chain (joints 1..N-1) with a baseMatrix\n // that already includes joint 0's rotation + the first link\n // translation. Joint 0 is fixed — CCDIK can't unwind it.\n //\n // Result: base yaw is always correctly oriented, and the remaining\n // joints handle pitch + wrist + descent bias on top of that.\n const seedJoint0 =\n chain.length > 0 && chain[0].type === 'revolute' && chain[0].axis === 'z'\n ? resolveBaseYaw(targetVec, radChain[0].range, radJoints[0] ?? 0)\n : null\n\n if (seedJoint0 === null) {\n // Chain doesn't have a Z-axis joint at index 0 (e.g. SCARA, prismatic\n // first joint) — fall back to plain CCDIK on the full chain. The\n // singularity above doesn't apply when joint 0 isn't around Z.\n return solveCCDIK(radChain, radJoints, augTarget, undefined, {\n maxIterations: 40,\n damping: 0.5\n }).values\n }\n\n // Build base matrix: rotate around Z by seedJoint0, then translate\n // along Z by chain[0].length (joint 0's link). This places the\n // sub-chain's origin at frame 1.\n const baseMatrix = new THREE.Matrix4()\n .makeRotationZ(seedJoint0)\n .multiply(new THREE.Matrix4().makeTranslation(0, 0, radChain[0].length))\n\n const subChain = radChain.slice(1)\n const subSeed = radJoints.slice(1)\n const result = solveCCDIK(subChain, subSeed, augTarget, baseMatrix, {\n maxIterations: 40,\n damping: 0.5\n })\n return [seedJoint0, ...result.values]\n }\n\n // NOTE: `analyticalIk6Axis` and `resolveBaseYaw` previously lived as\n // private duplicates here. They've been hoisted to `./robot-arm-ik.ts`\n // so the unit tests in `test/ik-unit.test.mjs` exercise the same\n // implementation that runs at scene-time. Don't reintroduce private\n // copies — drift between \"tested\" and \"shipping\" code was a real\n // source of bugs in this file's history.\n\n // ─── Resolution helpers ──────────────────────────────────────────────\n\n private _resolveChain(state: any, targetReach: number): ChainElement[] {\n let raw: ChainElement[]\n if (Array.isArray(state.chain) && state.chain.length > 0) {\n raw = state.chain\n } else {\n const presetName = (state.chainPreset ?? '6-axis-industrial') as ChainPresetName\n raw = CHAIN_PRESETS[presetName] ?? CHAIN_PRESETS['6-axis-industrial']\n }\n // Scale every link.length proportionally so the chain's total reach\n // matches the requested depth. Preserves preset proportions (a SCARA\n // stays SCARA-shaped at any depth). Prismatic ranges scale too —\n // their travel distance is in the same length units.\n const nominal = raw.reduce((s, c) => s + (c.length || 0), 0)\n if (nominal <= 0) return raw\n const scale = targetReach / nominal\n return raw.map(c => ({\n ...c,\n length: c.length * scale,\n range: c.type === 'prismatic' ? ([c.range[0] * scale, c.range[1] * scale] as [number, number]) : c.range\n }))\n }\n\n /**\n * Base pedestal height — small reservation at the bottom of `depth` so\n * the chain doesn't start at z=0 (which would clip into the floor).\n * About 12% of depth, clamped to a sane range.\n */\n private _baseHeight(state: any): number {\n const depth = this.effectiveDepth\n return Math.max(2, Math.min(depth * 0.12, 30))\n }\n\n /**\n * Color resolution priority (high → low):\n * 1. `state.fillStyle` → main link color (overrides style preset)\n * 2. `state.color` → legacy / explicit hex int\n * 3. style preset color\n * Same for accent: state.strokeStyle → state.accentColor → preset accent.\n * This way the user can keep a SCARA's box-link shape but recolor it via\n * the standard fillStyle property without dropping into custom presets.\n */\n private _resolveStyle(state: any): RobotArmStyle {\n const baseStyle = STYLES[(state.style ?? 'industrial') as StyleName] ?? STYLES.industrial\n return {\n linkShape: (state.linkShape as LinkShape) ?? baseStyle.linkShape,\n jointHousing: (state.jointHousing as JointHousing) ?? baseStyle.jointHousing,\n color: pickColorish(state.fillStyle, state.color, baseStyle.color),\n accentColor: pickColorish(state.strokeStyle, state.accentColor, baseStyle.accentColor),\n linkRadius:\n typeof state.linkRadius === 'number' && Number.isFinite(state.linkRadius) && state.linkRadius > 0\n ? state.linkRadius\n : baseStyle.linkRadius\n }\n }\n\n /**\n * Resolution priority for each joint i:\n * 1. state.jointN (e.g. state.joint0, state.joint1, ...) — written\n * by the property panel's per-joint number inputs (one row per\n * joint, range-clamped slider).\n * 2. state.joints[i] — array form, useful for programmatic batch set.\n * 3. state.joints[i] — object form ({0: v, 1: v, ...}).\n * 4. 0 — fallback.\n * Final value is range-clamped against the joint's own limits.\n */\n private _resolveJoints(chain: ChainElement[], state: any): number[] {\n const out: number[] = []\n const src = state.joints\n for (let i = 0; i < chain.length; i++) {\n let v: number | undefined\n const flatKey = state[`joint${i}`]\n if (Number.isFinite(flatKey)) {\n v = flatKey\n } else if (Array.isArray(src) && Number.isFinite(src[i])) {\n v = src[i]\n } else if (src && typeof src === 'object' && Number.isFinite(src[i] ?? src[String(i)])) {\n v = Number(src[i] ?? src[String(i)])\n } else {\n v = 0\n }\n if (!Number.isFinite(v)) v = 0\n v = Math.max(chain[i].range[0], Math.min(chain[i].range[1], v as number))\n out.push(v)\n }\n return out\n }\n\n private _jointSpeed(state: any): number {\n // Degrees per second the joint can travel during smoothing.\n // Length-unit prismatic joints reuse this value as units/sec —\n // typical smoothing speed scales similarly for both axis types.\n //\n // Default 45 deg/s — chosen to feel like a real industrial arm\n // executing a careful pick-and-place rather than a fly-by. Higher\n // speeds (90+) read as \"rushed / unsafe\" in a 3D scene where the\n // viewer expects measured motion. User can override via\n // `state.jointSpeed`.\n const v = Number(state.jointSpeed ?? 45)\n return Number.isFinite(v) && v > 0 ? v : 45\n }\n\n /** Convert revolute joint values from degrees → radians. Prismatic\n * values pass through untouched. */\n private _toRadians(chain: ChainElement[], joints: number[]): number[] {\n return joints.map((v, i) => (chain[i].type === 'revolute' ? v * DEG2RAD : v))\n }\n\n /** Inverse of `_toRadians` — radians → degrees for revolute. */\n private _fromRadians(chain: ChainElement[], joints: number[]): number[] {\n return joints.map((v, i) => (chain[i].type === 'revolute' ? v * RAD2DEG : v))\n }\n\n // ─── Geometry builders ───────────────────────────────────────────────\n\n /**\n * Build the chain as a tree of nested Object3Ds. Each link extends\n * along its parent's +Z by `length` — applying the joint rotation BEFORE\n * the translation. This way `rotateAround joint axis = rotate the\n * downstream subtree`, which matches real arm kinematics.\n */\n private _buildArm(chain: ChainElement[], style: RobotArmStyle, joints: number[], baseHeight: number) {\n const state = this.component.state\n const resolved = resolveMaterial3d(state.material3d as Material3D | undefined)\n const alpha = clamp(numOr(state.alpha, 1), 0, 1)\n\n const linkMat = new THREE.MeshStandardMaterial({\n color: style.color,\n metalness: 0.45,\n roughness: 0.45,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(linkMat, resolved)\n const housingMat = new THREE.MeshStandardMaterial({\n color: style.accentColor,\n metalness: 0.55,\n roughness: 0.4,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(housingMat, resolved)\n\n // Three.js convention is +Y up — but our forward kinematics + CCDIK\n // module is +Z up (matches IK math conventions). Wrap the whole arm\n // in a group rotated -90° around X so chain-local +Z maps to world +Y.\n // Lift by baseHeight so the chain origin sits ON TOP of the pedestal.\n const armRoot = new THREE.Group()\n armRoot.rotation.x = -Math.PI / 2\n armRoot.position.y = -this.effectiveDepth / 2 + baseHeight\n this.object3d.add(armRoot)\n // Cache for worldToChainLocal — IK targets must be in this frame.\n this._armRoot = armRoot\n\n this._jointFrames = []\n let currentParent: THREE.Object3D = armRoot\n\n for (let i = 0; i < chain.length; i++) {\n const link = chain[i]\n // Joint frame — sits at the start of link i, rotates by jointValue.\n const frame = new THREE.Object3D()\n currentParent.add(frame)\n this._jointFrames.push(frame)\n this._applyJointValue(frame, link, joints[i])\n\n // Joint housing at the joint origin (frame's local origin).\n const housing = this._buildJointHousing(style.jointHousing, style.linkRadius, housingMat)\n if (housing) frame.add(housing)\n\n // Link mesh extends along local +Z by link.length. We mount it as a\n // child of the frame so it inherits the joint rotation. The link\n // itself sits with its base at z=0 and grows toward +Z.\n const linkMesh = this._buildLinkMesh(style.linkShape, style.linkRadius, link.length, linkMat)\n if (linkMesh) frame.add(linkMesh)\n\n // The next frame's parent is a translation forward by link.length.\n const next = new THREE.Object3D()\n next.position.set(0, 0, link.length)\n frame.add(next)\n currentParent = next\n }\n\n // Save the end-effector parent so the gripper builder can mount onto it.\n // Also exposed via `getGripperFrame()` so CarrierHolder.attachPointFor\n // can return it — making any Carriable child mount onto the moving\n // gripper TCP and follow IK automatically.\n this._endFrame = currentParent\n }\n\n /**\n * Frame at the gripper TCP (Tool Center Point) — the working point of\n * the gripper, NOT the wrist. For jaw grippers this is the mid-point\n * between finger tips; for suction/magnetic it's the contact face.\n * Carriers held by the arm parent here so they sit at the gripping\n * interface, not buried inside the gripper meshes.\n *\n * Falls back to `_endFrame` (wrist) until `_buildGripper` has run.\n */\n getGripperFrame(): THREE.Object3D | undefined {\n return this._tcpFrame ?? this._endFrame\n }\n\n /**\n * Convert a world-space point to the IK module's chain-local frame.\n *\n * Why this matters: CCDIK + forwardKinematics operate in `armRoot`'s\n * local space (base joint at origin, +Z up — the IK math convention).\n * `state.target` is interpreted in *that* frame. If a caller hands in\n * a world position from another component (a parcel sitting somewhere\n * in the scene), it must be projected through `armRoot`'s inverse\n * world matrix first, otherwise the arm reaches toward \"as if the\n * world coords were base-relative\" — a totally wrong direction once\n * the robot itself isn't at the world origin.\n *\n * Returns the same `{x, y, z}` shape `state.target` accepts, which is\n * already in chain-local space (no further conversion needed by\n * pickAndPlace).\n */\n worldToChainLocal(worldX: number, worldY: number, worldZ: number): { x: number; y: number; z: number } {\n if (!this._armRoot) return { x: 0, y: 0, z: 0 }\n this._armRoot.updateWorldMatrix(true, false)\n const v = new THREE.Vector3(worldX, worldY, worldZ)\n v.applyMatrix4(new THREE.Matrix4().copy(this._armRoot.matrixWorld).invert())\n return { x: v.x, y: v.y, z: v.z }\n }\n\n private _armRoot?: THREE.Object3D\n\n /**\n * Apply a joint value to its scene-graph frame. `value` is in *user\n * units* (degrees for revolute, scene units for prismatic) — convert\n * to radians at the math boundary.\n */\n private _applyJointValue(frame: THREE.Object3D, link: ChainElement, value: number) {\n if (link.type === 'revolute') {\n const ax = _AXIS_VEC[link.axis]\n frame.quaternion.setFromAxisAngle(ax, value * DEG2RAD)\n } else {\n frame.position.copy(_AXIS_VEC[link.axis]).multiplyScalar(value)\n }\n }\n\n /** Cheap path: just refresh joint orientations without rebuilding the\n * geometry tree. Used when only joint values changed. */\n private _refreshJointPoses(joints: number[]) {\n for (let i = 0; i < this._chain.length; i++) {\n const frame = this._jointFrames[i]\n if (frame) this._applyJointValue(frame, this._chain[i], joints[i])\n }\n }\n\n private _buildJointHousing(kind: JointHousing, r: number, mat: THREE.Material): THREE.Mesh | null {\n const radius = r * 1.15\n switch (kind) {\n case 'disk': {\n const geo = new THREE.CylinderGeometry(radius, radius, r * 0.7, 24)\n // disk axis = local Y by default; we want it perpendicular to the\n // link's growth direction. Leaving it on local Y reads as a \"wrist\n // band\" between two link segments — which is what cobot disks do.\n return new THREE.Mesh(geo, mat)\n }\n case 'sphere': {\n const geo = new THREE.SphereGeometry(radius, 16, 12)\n return new THREE.Mesh(geo, mat)\n }\n case 'knuckle': {\n // Asymmetric box — wider in two axes, narrow in third. Reads as\n // industrial cast joint.\n const geo = new THREE.BoxGeometry(radius * 2.1, radius * 1.4, radius * 1.8)\n return new THREE.Mesh(geo, mat)\n }\n case 'none':\n default:\n return null\n }\n }\n\n private _buildLinkMesh(\n shape: LinkShape,\n radius: number,\n length: number,\n mat: THREE.Material\n ): THREE.Mesh | null {\n if (length <= 0.5) return null\n let geo: THREE.BufferGeometry\n switch (shape) {\n case 'cylinder':\n geo = new THREE.CylinderGeometry(radius, radius, length, 16)\n break\n case 'tapered':\n geo = new THREE.CylinderGeometry(radius * 0.7, radius, length, 16)\n break\n case 'tube':\n geo = new THREE.CylinderGeometry(radius * 0.5, radius * 0.5, length, 12)\n break\n case 'box':\n geo = new THREE.BoxGeometry(radius * 1.6, radius * 1.6, length)\n break\n case 'gltf':\n // Placeholder — full GLTF link replacement is a v2 feature.\n // Fall back to cylinder so the chain doesn't break visually.\n geo = new THREE.CylinderGeometry(radius, radius, length, 16)\n break\n default:\n geo = new THREE.CylinderGeometry(radius, radius, length, 16)\n }\n // Three.js cylinder/box default axis = local +Y. Rotate to grow along\n // local +Z (the chain-forward direction) and shift so the BASE sits at\n // z=0 (rather than centered).\n if (shape !== 'box') {\n geo.rotateX(Math.PI / 2)\n }\n geo.translate(0, 0, length / 2)\n const mesh = new THREE.Mesh(geo, mat)\n mesh.castShadow = true\n return mesh\n }\n\n // ─── Gripper ──────────────────────────────────────────────────────────\n\n /**\n * Build the gripper meshes onto `_endFrame` and place a TCP frame at\n * the gripper's working point (between the finger tips for jaw types,\n * at the cup/disk distal face for surface types). Carriers held by the\n * arm mount onto this TCP frame, NOT onto `_endFrame` — `_endFrame` is\n * the wrist (chain end-of-link) and the gripper extends from it in +Z,\n * so a carrier at `_endFrame` origin would visually overlap the gripper\n * meshes (the fingers/cup would pierce through the box).\n */\n private _buildGripper(chain: ChainElement[], style: RobotArmStyle, state: any) {\n const endFrame = this._endFrame\n if (!endFrame) return\n\n // TCP frame — added unconditionally (even for gripper.type='none' or\n // missing gripper) so carrier mount logic always has a stable target.\n // Default at wrist (z=0); per-type builders override below.\n const tcp = new THREE.Object3D()\n endFrame.add(tcp)\n this._tcpFrame = tcp\n\n const cfg: GripperConfig = {\n ...DEFAULT_GRIPPER,\n ...((state.gripper as GripperConfig) ?? {}),\n // gripperType nature property is a shortcut for {gripper: {type}} —\n // expose it so the property panel's <select> works without nested object editing.\n ...(state.gripperType ? { type: state.gripperType } : {})\n }\n if (cfg.type === 'none') return\n\n const color = pickColorish(cfg.color, style.accentColor)\n const resolved = resolveMaterial3d(state.material3d as Material3D | undefined)\n const alpha = clamp(numOr(state.alpha, 1), 0, 1)\n const mat = new THREE.MeshStandardMaterial({\n color,\n metalness: 0.55,\n roughness: 0.4,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(mat, resolved)\n\n let tcpZ = 0\n switch (cfg.type) {\n case 'parallel':\n tcpZ = this._buildParallelGripper(endFrame, cfg, mat, style.linkRadius)\n break\n case 'three-finger':\n tcpZ = this._buildThreeFingerGripper(endFrame, cfg, mat, style.linkRadius)\n break\n case 'suction':\n tcpZ = this._buildSuctionGripper(endFrame, cfg, mat, style.linkRadius)\n break\n case 'magnetic':\n tcpZ = this._buildMagneticGripper(endFrame, cfg, mat, style.linkRadius)\n break\n }\n tcp.position.z = tcpZ\n }\n\n private _tcpFrame?: THREE.Object3D\n /** 마지막 joint(=wrist) frame — 그리퍼 빌드가 부착되는 부모 노드. */\n private _endFrame?: THREE.Object3D\n\n /**\n * Each gripper sub-builder returns its TCP z-offset (in `_endFrame`'s\n * local coordinates) — the point in space where a held carrier's grip\n * face should land. The caller positions `_tcpFrame` at that z so\n * carriers attach there directly.\n */\n private _buildParallelGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n // Default sizes scale with linkRadius so the gripper looks proportional\n // to the arm. A heavy industrial 6-axis (linkRadius ~10) gets a chunky\n // gripper; a slim cobot wrist (linkRadius ~3) gets a small one. User\n // can still override via cfg.stroke / cfg.fingerWidth.\n const stroke = cfg.stroke ?? linkRadius * 1.8\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.45\n const fingerLength = stroke * 1.2\n const closure = THREE.MathUtils.clamp(cfg.state ?? 0, 0, 1) // 0 = open, 1 = closed\n // Wrist plate\n const plate = new THREE.Mesh(\n new THREE.BoxGeometry(stroke * 1.6, fingerWidth * 1.2, fingerWidth * 1.8),\n mat\n )\n plate.position.set(0, 0, fingerWidth * 0.9)\n parent.add(plate)\n // Two fingers, opening width = stroke when state=0, fingerWidth when state=1\n const halfOpen = (stroke / 2) * (1 - closure) + (fingerWidth / 2) * closure\n for (const sign of [-1, 1]) {\n const finger = new THREE.Mesh(\n new THREE.BoxGeometry(fingerWidth, fingerWidth, fingerLength),\n mat\n )\n finger.position.set(sign * halfOpen, 0, fingerWidth * 1.8 + fingerLength / 2)\n parent.add(finger)\n }\n // TCP = finger-tip plane (carrier's top face docks against it).\n return fingerWidth * 1.8 + fingerLength\n }\n\n private _buildThreeFingerGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n const stroke = cfg.stroke ?? linkRadius * 1.5\n const fingerWidth = cfg.fingerWidth ?? linkRadius * 0.4\n const fingerLength = stroke * 1.2\n const closure = THREE.MathUtils.clamp(cfg.state ?? 0, 0, 1)\n const radius = (stroke / 2) * (1 - closure) + (fingerWidth / 2) * closure\n // Wrist hub\n const hub = new THREE.Mesh(\n new THREE.CylinderGeometry(stroke * 0.55, stroke * 0.55, fingerWidth * 1.5, 16),\n mat\n )\n hub.rotation.x = Math.PI / 2\n hub.position.set(0, 0, fingerWidth * 0.75)\n parent.add(hub)\n // Three fingers around the axis\n for (let i = 0; i < 3; i++) {\n const angle = (i / 3) * Math.PI * 2\n const finger = new THREE.Mesh(\n new THREE.BoxGeometry(fingerWidth, fingerWidth, fingerLength),\n mat\n )\n finger.position.set(Math.cos(angle) * radius, Math.sin(angle) * radius, fingerWidth * 1.5 + fingerLength / 2)\n parent.add(finger)\n }\n return fingerWidth * 1.5 + fingerLength\n }\n\n private _buildSuctionGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n const diameter = cfg.diameter ?? linkRadius * 2.4\n // Mounting stem\n const stem = new THREE.Mesh(\n new THREE.CylinderGeometry(diameter * 0.25, diameter * 0.25, diameter * 0.5, 12),\n mat\n )\n stem.rotation.x = Math.PI / 2\n stem.position.set(0, 0, diameter * 0.25)\n parent.add(stem)\n // Suction cup (cone, narrow end at the stem)\n const cup = new THREE.Mesh(\n new THREE.CylinderGeometry(diameter / 2, diameter * 0.3, diameter * 0.4, 24, 1, true),\n mat\n )\n cup.rotation.x = Math.PI / 2\n cup.position.set(0, 0, diameter * 0.5 + diameter * 0.2)\n parent.add(cup)\n // TCP = cup distal face (suction surface contacts the carrier here).\n return diameter * 0.9\n }\n\n private _buildMagneticGripper(\n parent: THREE.Object3D,\n cfg: GripperConfig,\n mat: THREE.Material,\n linkRadius: number\n ): number {\n const diameter = cfg.diameter ?? linkRadius * 2.6\n // Disk magnet at the end\n const disk = new THREE.Mesh(\n new THREE.CylinderGeometry(diameter / 2, diameter / 2, diameter * 0.25, 24),\n mat\n )\n disk.rotation.x = Math.PI / 2\n disk.position.set(0, 0, diameter * 0.125)\n parent.add(disk)\n // TCP = disk distal face (magnet contacts the carrier here).\n return diameter * 0.25\n }\n\n // ─── Reach sphere visualization ──────────────────────────────────────\n\n private _buildReachSphere(chain: ChainElement[], state: any, baseHeight: number) {\n if (!state.showReachSphere) return\n const reach = maxReach(chain)\n if (reach <= 0) return\n const geo = new THREE.SphereGeometry(reach, 24, 16)\n const wire = new THREE.WireframeGeometry(geo)\n const mat = new THREE.LineBasicMaterial({\n color: 0x44aacc,\n transparent: true,\n opacity: 0.18\n })\n const wireMesh = new THREE.LineSegments(wire, mat)\n // Center on the base joint (top of pedestal), in world-space y.\n wireMesh.position.y = -this.effectiveDepth / 2 + baseHeight\n // Visualization-only — must not catch raycasts. The reach sphere\n // surrounds the arm in 3D and would intercept clicks meant for the\n // actual robot body. NO_RAYCAST keeps it visible but click-through.\n wireMesh.raycast = NO_RAYCAST\n this.object3d.add(wireMesh)\n geo.dispose()\n }\n\n // ─── Base / pedestal ─────────────────────────────────────────────────\n\n /**\n * Pedestal — sized from `state.width × state.height` (the 2D footprint).\n * Cylindrical base whose radius fills ~90% of the smaller footprint\n * dimension; a flared bottom (1.2× radius) gives the visual weight of\n * a real industrial robot anchor.\n */\n private _buildBase(state: any, style: RobotArmStyle, baseHeight: number) {\n const w = Math.max(Math.abs(numOr(state.width, 100)), 1)\n const h2d = Math.max(Math.abs(numOr(state.height, 100)), 1)\n const r = (Math.min(w, h2d) / 2) * 0.9\n const resolved = resolveMaterial3d(state.material3d as Material3D | undefined)\n const alpha = clamp(numOr(state.alpha, 1), 0, 1)\n const mat = new THREE.MeshStandardMaterial({\n color: style.accentColor,\n metalness: 0.6,\n roughness: 0.4,\n transparent: alpha < 1,\n opacity: alpha\n })\n applyMaterial3dProps(mat, resolved)\n const base = new THREE.Mesh(new THREE.CylinderGeometry(r, r * 1.2, baseHeight, 24), mat)\n base.position.set(0, -this.effectiveDepth / 2 + baseHeight / 2, 0)\n base.castShadow = resolved.castShadow\n base.receiveShadow = resolved.receiveShadow\n this.object3d.add(base)\n }\n\n // ─── Animation: smooth joint values toward solved target ─────────────\n\n private _startAnimation() {\n if (this._unsubTick) return\n // RobotArm joint motion 은 시뮬레이션 사건 (pickAndPlace 의\n // 일부). speed 따라 가속, paused 시 정지. dt 는 sim ms.\n this._unsubTick = frameClock.subscribe(\n (dt) => {\n if (!this._smoothing) return\n const dtSec = Math.min(dt / 1000, 0.1) // clamp for stability\n const { current, target, speed } = this._smoothing\n const maxStep = speed * dtSec\n let allReached = true\n for (let i = 0; i < current.length; i++) {\n const diff = (target[i] ?? 0) - current[i]\n if (Math.abs(diff) > 1e-4) allReached = false\n const step = Math.sign(diff) * Math.min(Math.abs(diff), maxStep)\n current[i] += step\n // apply to live frame\n const frame = this._jointFrames[i]\n const link = this._chain[i]\n if (frame && link) this._applyJointValue(frame, link, current[i])\n }\n this.component.invalidate?.()\n if (allReached) {\n this._stopAnimation()\n // Notify external code (pickAndPlace, custom scripts) that the\n // gripper has reached its target. Component.trigger fires the\n // standard things-scene event bus so consumers can subscribe via\n // `component.on('tcp-reached', handler)`.\n this.component.trigger('tcp-reached', { component: this.component })\n }\n },\n { description: 'joint smoothing', component: this.component }\n )\n }\n\n private _stopAnimation() {\n if (this._unsubTick) {\n this._unsubTick()\n this._unsubTick = null\n }\n }\n\n /**\n * Re-run IK toward a new target without rebuilding the scene graph.\n *\n * Mirrors the IK block of `build()` but operates on the *existing*\n * joint frames and meshes. Critically does NOT call `update()` /\n * `clear()` — those tear down `this.object3d`'s children, which would\n * also detach the gripper frame and any Carriable currently mounted\n * onto it. A pickAndPlace operation would lose its held carrier the\n * instant the place target is committed.\n *\n * Falls back to a full `update()` only when the cached chain hasn't\n * been built yet (build pre-condition).\n */\n private _retargetIk() {\n if (this._chain.length === 0 || this._jointFrames.length !== this._chain.length) {\n this.update()\n return\n }\n\n const state = this.component.state\n const chain = this._chain\n const target = state.target\n const speed = this._jointSpeed(state)\n\n // Starting pose for IK = where smoothing currently is (mid-flight)\n // or the resolved joint values from state. Using mid-flight values\n // makes consecutive `pnp` calls chain smoothly without snap-back.\n const previous = this._smoothing?.current?.slice() ?? this._resolveJoints(chain, state)\n\n if (target && Number.isFinite(target.x) && Number.isFinite(target.y) && Number.isFinite(target.z)) {\n const targetVec = new THREE.Vector3(target.x, target.y, target.z)\n const targetYaw = Number.isFinite(target.yaw) ? (target.yaw as number) : undefined\n const radJoints = this._toRadians(chain, previous)\n const ikValues = this._solveIkDescent(chain, radJoints, targetVec, targetYaw)\n const solvedUser = this._fromRadians(chain, ikValues)\n this._smoothing = {\n current: previous,\n target: solvedUser.slice(),\n speed\n }\n // Snap visible pose to the smoothing's \"current\" (= previous IK\n // position). Without this, if external code mutated joint frames\n // between ticks, the first tick would jump.\n this._refreshJointPoses(previous)\n this._stopAnimation()\n this._startAnimation()\n } else {\n // Target cleared — stop animating, freeze where we are.\n if (this._smoothing) {\n this._smoothing.target = this._smoothing.current.slice()\n this._smoothing.speed = speed\n }\n this._stopAnimation()\n }\n }\n\n /**\n * 사용자 설정 home pose (state.joints / state.jointN) 의 joint 값 배열 반환.\n * `goHome()` 의 target 으로 사용. _smoothing 의 current 와 무관 — pick/place 도중\n * 호출되어도 본래 휴식 포즈를 반환.\n */\n getHomeJoints(): number[] {\n if (!this._chain) return []\n return this._resolveJoints(this._chain, this.component.state)\n }\n\n /**\n * IK 를 거치지 않고 forward joint 값 배열을 smoothing target 으로 직접 설정.\n * `goHome()` 외에도 외부에서 joint pose 직접 제어 시 사용.\n * 완료 시 'tcp-reached' 이벤트 발생 (smoothing 의 allReached 경로 공통).\n */\n moveJointsTo(jointValues: number[]): void {\n if (!this._chain) return\n const state = this.component.state\n const previous = this._smoothing?.current?.slice() ?? this._resolveJoints(this._chain, state)\n // 길이 보정 — chain 보다 짧으면 0 으로 채움, 길면 자름. range clamp.\n const target: number[] = []\n for (let i = 0; i < this._chain.length; i++) {\n let v = Number(jointValues[i] ?? 0)\n if (!Number.isFinite(v)) v = 0\n v = Math.max(this._chain[i].range[0], Math.min(this._chain[i].range[1], v))\n target.push(v)\n }\n this._smoothing = {\n current: previous,\n target,\n speed: this._jointSpeed(state)\n }\n this._stopAnimation()\n this._startAnimation()\n }\n\n updateDimension() {}\n\n onchange(after: Record<string, unknown>, before: Record<string, unknown>) {\n // Structural changes — full rebuild.\n if (\n 'style' in after ||\n 'chainPreset' in after ||\n 'chain' in after ||\n 'linkShape' in after ||\n 'jointHousing' in after ||\n 'linkRadius' in after ||\n 'color' in after ||\n 'accentColor' in after ||\n 'fillStyle' in after ||\n 'strokeStyle' in after ||\n 'alpha' in after ||\n 'material3d' in after ||\n 'gripper' in after ||\n 'gripperType' in after ||\n 'showReachSphere' in after ||\n 'width' in after ||\n 'height' in after ||\n 'depth' in after\n ) {\n this.update()\n return\n }\n // Target change → re-run IK + restart smoothing on the EXISTING\n // scene graph. Critically NOT a full rebuild — `update()` calls\n // `clear()` which detaches every child of `this.object3d`, including\n // any Carriable currently mounted on the gripper frame. A pickAndPlace\n // call would invisibly drop the held carrier the moment we set the\n // place target, leaving no mesh between pick and place.\n if ('target' in after || 'jointSpeed' in after) {\n this._retargetIk()\n return\n }\n // Joint value change (state.joint0, state.joint1, ... or state.joints\n // batch) — fast path: just refresh joint poses on the existing scene\n // graph. NO mesh rebuild. This is what makes property-panel slider\n // edits feel live. The match must be done explicitly because dynamic\n // joint property names (joint0, joint1, ...) aren't in any static list.\n const hasJoint = 'joints' in after || Object.keys(after).some(k => /^joint\\d+$/.test(k))\n if (hasJoint) {\n const state = this.component.state\n // chain might be empty if build hasn't run yet (e.g. component just\n // attached). Defer to a full update in that case.\n if (this._chain.length === 0 || this._jointFrames.length !== this._chain.length) {\n this.update()\n return\n }\n const joints = this._resolveJoints(this._chain, state)\n this._refreshJointPoses(joints)\n // smoothing's \"current\" should track the user's manual edits so the\n // next IK target solves from where the user left things.\n if (this._smoothing) this._smoothing.current = joints.slice()\n return\n }\n super.onchange(after, before)\n }\n\n dispose() {\n this._stopAnimation()\n super.dispose()\n }\n\n updateAlpha() {}\n}\n\n/** Returns `v` if a finite number, otherwise `dflt`. */\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n\nfunction clamp(v: number, lo: number, hi: number) {\n return Math.max(lo, Math.min(hi, v))\n}\n\n/**\n * Pick the first valid color in priority order. Accepts both color strings\n * (CSS / hex) and hex int numbers — both are valid `THREE.ColorRepresentation`.\n * Treats 'transparent' / empty strings as \"skip me\".\n */\n/** Returns a number-or-string color (StyleColor). Both flavors are valid\n * THREE.ColorRepresentation, so they pass through to MeshStandardMaterial\n * without conversion. */\nfunction pickColorish(...candidates: unknown[]): number | string {\n for (const c of candidates) {\n if (typeof c === 'string' && c && c !== 'transparent') return c\n if (typeof c === 'number' && Number.isFinite(c)) return c\n }\n return 0x888888\n}\n"]}
package/dist/robot-arm.js CHANGED
@@ -33,7 +33,7 @@
33
33
  */
34
34
  import { __decorate } from "tslib";
35
35
  import * as THREE from 'three';
36
- import { ContainerAbstract, ContainerCapacity, Transfer, frameClock, sceneComponent } from '@hatiolab/things-scene';
36
+ import { ContainerAbstract, ContainerCapacity, Holdable, Transfer, frameClock, sceneComponent } from '@hatiolab/things-scene';
37
37
  import { CarrierHolder, Legendable, Mover, Placeable } from '@operato/scene-base';
38
38
  import { RobotArm3D } from './robot-arm-3d.js';
39
39
  import { CHAIN_PRESETS } from './robot-arm-styles.js';
@@ -143,7 +143,7 @@ const STATIC_PROPERTIES = [
143
143
  // ContainerCapacity inserted between CarrierHolder and Legendable — same pattern
144
144
  // as Forklift/AGV: receive()/dispatch() for slot-tracking + event emission;
145
145
  // CarrierHolder.attachPointFor() (overridden below) provides 3D TCP positioning.
146
- const Base = Mover(CarrierHolder(ContainerCapacity(Legendable(Placeable(ContainerAbstract)))));
146
+ const Base = Mover(CarrierHolder(ContainerCapacity(Holdable(Legendable(Placeable(ContainerAbstract))))));
147
147
  let RobotArm = class RobotArm extends Base {
148
148
  // `Base` is cast through `typeof Component` so TS sees `state` as an
149
149
  // accessor; `declare state: …` would conflict with TS2610. Override the
@@ -1 +1 @@
1
- {"version":3,"file":"robot-arm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AAC,CAAU,EAAE,IAAY;IACrC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,CAAY;IAChC,MAAM,GAAG,GAAI,CAAS,EAAE,WAAW,EAAE,cAAc,CAAA;IACnD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAA;IAC/D,OAAO,KAAK,CAAE,CAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,SAAS,CAAC,GAAG,UAAqB;IACzC,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,aAAa;YAAE,OAAO,CAAC,CAAA;IACjE,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Robot Arm — generalized articulated manipulator component.\n *\n * Designed to cover the visualization needs of robot arms WITHOUT a\n * specific URDF model. Configurable kinematic chain, link shape, joint\n * housing, gripper type — same component renders as a sleek cobot, a\n * heavy industrial 6-axis, a SCARA, or a minimal educational arm.\n *\n * State schema (all top-level properties optional except width/height):\n *\n * {\n * // structure\n * style?: 'industrial' | 'cobot' | 'scara' | 'minimal',\n * chainPreset?: '6-axis-industrial' | 'cobot-6-axis' | 'scara-4-axis' | 'pick-and-place-3-axis',\n * chain?: ChainElement[], // overrides preset\n * joints?: number[] | { [i]: number }, // current joint values\n *\n * // styling overrides\n * linkShape?, jointHousing?, linkRadius?, color?, accentColor?,\n *\n * // gripper\n * gripper?: GripperConfig,\n *\n * // IK target (TCP world position relative to component center, in\n * // 3D-z-up convention used by IK module)\n * target?: { x: number, y: number, z: number },\n *\n * // visualization\n * showReachSphere?: boolean\n * }\n */\n\nimport * as THREE from 'three'\nimport { Component, ComponentNature, ContainerAbstract, ContainerCapacity, RealObject, Transfer, frameClock, sceneComponent } from '@hatiolab/things-scene'\nimport type { SlotDef, State, Material3D } from '@hatiolab/things-scene'\nimport {\n CarrierHolder,\n Legendable,\n Mover,\n Placeable,\n type Alignment,\n type Heights,\n type LegendBinding,\n type MoveOptions,\n type PlacementArchetype\n} from '@operato/scene-base'\n\nimport { RobotArm3D } from './robot-arm-3d.js'\nimport { CHAIN_PRESETS, type ChainPresetName } from './robot-arm-styles.js'\nimport type { ChainElement } from './robot-arm-ik.js'\nimport type { GripperConfig, LinkShape, JointHousing, StyleName } from './robot-arm-styles.js'\n\n// ── ComponentEventMap 도메인 augmentation ─────────────────────────────────\n// RobotArm 이 발생시키는 도메인 이벤트들. things-scene 의 ComponentEventMap 에\n// 추가 등록하여 component.on/trigger 에서 자동완성 + 페이로드 타입 검증.\ndeclare module '@hatiolab/things-scene' {\n interface ComponentEventMap {\n /** TCP 가 목표 도달 시 발생 (pickAndPlace 시퀀싱용). */\n 'tcp-reached': [info: { component: Component }]\n }\n}\n\nexport type RobotArmStatus = 'idle' | 'moving' | 'gripping' | 'warn' | 'error'\n\n/** RobotArm 컴포넌트 state */\nexport interface RobotArmState extends State {\n // ── 구조 ──\n style?: StyleName\n chainPreset?: ChainPresetName\n chain?: ChainElement[]\n joints?: number[] | Record<string, number>\n linkShape?: LinkShape\n jointHousing?: JointHousing\n linkRadius?: number\n color?: string | number\n accentColor?: string | number\n\n // ── 그리퍼 ──\n gripper?: GripperConfig\n gripperType?: GripperConfig['type']\n\n // ── IK 타겟 ──\n target?: { x: number; y: number; z: number; yaw?: number }\n\n // ── 시각화 ──\n showReachSphere?: boolean\n\n // ── 모션 ──\n jointSpeed?: number\n\n // ── 운영 상태 ──\n status?: RobotArmStatus\n\n // ── 3D 재질 ──\n material3d?: Material3D\n}\n\nconst BODY_LEGEND = {\n idle: '#ccc',\n moving: '#afd0f1',\n gripping: '#cfe6c8',\n warn: '#ffba00',\n error: '#e9746b',\n default: '#ccc'\n}\n\nconst BORDER_LEGEND = {\n idle: '#888',\n moving: '#87b1db',\n gripping: '#7aa274',\n warn: '#d96f21',\n error: '#a73928',\n default: '#888'\n}\n\nconst LAMP_EMISSIVE_LEGEND = {\n idle: '#333333',\n moving: '#44aaff',\n gripping: '#33aa44',\n warn: '#ffaa00',\n error: '#ff3333',\n default: '#333333'\n}\n\nconst STATIC_PROPERTIES = [\n {\n type: 'select',\n label: 'style',\n name: 'style',\n property: {\n options: [\n { display: 'Industrial', value: 'industrial' },\n { display: 'Cobot', value: 'cobot' },\n { display: 'SCARA', value: 'scara' },\n { display: 'Minimal', value: 'minimal' }\n ]\n }\n },\n {\n type: 'select',\n label: 'chain-preset',\n name: 'chainPreset',\n property: {\n options: [\n { display: '6-Axis Industrial', value: '6-axis-industrial' },\n { display: 'Cobot 6-Axis', value: 'cobot-6-axis' },\n { display: 'SCARA 4-Axis', value: 'scara-4-axis' },\n { display: 'Pick & Place 3-Axis', value: 'pick-and-place-3-axis' }\n ]\n }\n },\n { type: 'number', label: 'link-radius', name: 'linkRadius' },\n {\n type: 'select',\n label: 'gripper-type',\n name: 'gripperType',\n property: {\n options: [\n { display: 'Parallel', value: 'parallel' },\n { display: 'Suction', value: 'suction' },\n { display: 'Magnetic', value: 'magnetic' },\n { display: 'Three-Finger', value: 'three-finger' },\n { display: 'None', value: 'none' }\n ]\n }\n },\n { type: 'checkbox', label: 'show-reach-sphere', name: 'showReachSphere' },\n {\n type: 'select',\n label: 'status',\n name: 'status',\n property: {\n options: [\n { display: 'Idle', value: 'idle' },\n { display: 'Moving', value: 'moving' },\n { display: 'Gripping', value: 'gripping' },\n { display: 'Warn', value: 'warn' },\n { display: 'Error', value: 'error' }\n ]\n }\n }\n]\n\n// CarrierHolder + ContainerAbstract: the arm needs the container's child-list\n// machinery (addComponent / reparent / events) AND CarrierHolder's\n// attachPointFor hook. CarrierHolder mixin alone only publishes the attach\n// policy; it doesn't add child management. RectPath(Shape) was wrong here —\n// Shape is a leaf so reparent silently failed. ContainerAbstract provides\n// the missing piece.\n//\n// `ContainerAbstract` (not `Container`) — Container = MixinHTMLElement(ContainerAbstract),\n// which forces `isHTMLElement(): true` and trips the 3D pipeline's\n// addObject DOM-skip gate. Robot arm exists purely in the 3D scene graph\n// (URDF/IK joints, no DOM overlay), so the bare logical container is correct.\n//\n// Mover wraps the chain to publish pick/place/pickAndPlace primitives. It\n// must sit OUTSIDE CarrierHolder because Mover's defaults call this.reparent,\n// which CarrierHolder provides (overrides the base ContainerAbstract\n// version with the attach-frame-aware variant).\n//\n// The instance type cast surfaces Mover's API on `this` so subclass\n// `override` keywords compile and `this.pickAndPlace(...)` resolves —\n// without it, the `as unknown as typeof Component` cast erases all\n// mixin contributions to the static side.\n// ContainerCapacity inserted between CarrierHolder and Legendable — same pattern\n// as Forklift/AGV: receive()/dispatch() for slot-tracking + event emission;\n// CarrierHolder.attachPointFor() (overridden below) provides 3D TCP positioning.\nconst Base = Mover(CarrierHolder(ContainerCapacity(Legendable(Placeable(ContainerAbstract))))) as unknown as typeof Component & {\n new (...args: any[]): Component & {\n isMover: boolean\n pick(carrier: Component, options?: MoveOptions): Promise<void>\n place(carrier: Component, holder: Component, options?: MoveOptions): Promise<void>\n pickAndPlace(carrier: Component, holder: Component, options?: MoveOptions): Promise<void>\n }\n}\n\n@sceneComponent('robot-arm')\nexport default class RobotArm extends Base {\n // `Base` is cast through `typeof Component` so TS sees `state` as an\n // accessor; `declare state: …` would conflict with TS2610. Override the\n // getter instead — runtime behavior is identical (just delegates to super).\n override get state(): RobotArmState {\n return super.state as RobotArmState\n }\n\n declare _realObject: RobotArm3D | undefined\n\n // Phase ZT-V PR-6 — ProcessStep marker.\n // RobotArm 은 *_kinematic transform_* 단계 — pickAndPlace 의 input/output slot\n // 이 의미적으로 process step. CapabilityRegistry 가 자동 발견 가능.\n readonly isProcessStep = true as const\n\n /**\n * Phase H — pickup contract 호환성 검사용. 보편적 'gripper' type — vacuum,\n * 2-finger, 3-finger 등 다양한 gripper 모두 이 type 으로 매칭. carrier 가\n * 더 세분화된 호환성을 원하면 `pickupFramesFor` override 로 size 등 추가 검증.\n *\n * (override 키워드 미사용 — Base 캐스트가 Mover 의 toolType 을 노출하지 않아\n * TS4113 회피.)\n */\n get toolType(): string {\n return 'gripper'\n }\n\n static legends: Record<string, LegendBinding> = {\n bodyColor: { from: 'status', legend: BODY_LEGEND },\n borderColor: { from: 'status', legend: BORDER_LEGEND },\n lampEmissive: { from: 'status', legend: LAMP_EMISSIVE_LEGEND }\n }\n\n /**\n * Robot arms sit on the floor (or mount to a ceiling/wall — that's a\n * v2 feature). Default depth = operation - floor like other floor-\n * mounted equipment, so the chain reach scales with the configured\n * facility height.\n */\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (h: Heights) => h.operation - h.floor\n\n // ── ContainerCapacity ─────────────────────────────────────────────────────\n\n /** Single gripper slot — robot arm grips one item at a time. */\n get slots(): SlotDef[] {\n return [{ id: 'gripper', maxCount: 1 }]\n }\n\n /**\n * Dynamic nature — appends one number property per joint in the active\n * chain. Each property uses the joint's range as `min`/`max` so the\n * property panel can render a constrained slider/spinner. The chain\n * preset can change at runtime, and `get nature()` is re-evaluated\n * whenever the property panel queries it, so the joint count stays in\n * sync with the active preset.\n *\n * For revolute joints the value is in radians; for prismatic, scene units.\n */\n get nature(): ComponentNature {\n const chain = this._activeChain\n // Joint values: revolute = degrees (range usually ±180), prismatic =\n // scene length units. CHAIN_PRESETS already encode revolute ranges in\n // degrees; the 3D side converts to radians at the math boundary.\n const jointProps = chain.map((c, i) => ({\n type: 'number',\n label: `joint-${i + 1}`,\n name: `joint${i}`,\n property: {\n min: c.range[0],\n max: c.range[1],\n step: c.type === 'revolute' ? 1 : 1\n }\n }))\n return {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [...STATIC_PROPERTIES, ...jointProps] as any,\n help: 'scene/component/robot-arm'\n }\n }\n\n /**\n * Resolve the active chain for property-panel introspection. Mirrors\n * the resolution in robot-arm-3d.ts (state.chain wins, else preset,\n * else default 6-axis-industrial). Kept simple — the 3D side does the\n * same logic with depth-based scaling, but for property labeling we\n * only need the structure (axis count + ranges), not absolute lengths.\n */\n private get _activeChain(): ChainElement[] {\n const state = this.state\n if (Array.isArray(state.chain) && state.chain.length > 0) return state.chain\n const presetName = (state.chainPreset ?? '6-axis-industrial') as ChainPresetName\n return CHAIN_PRESETS[presetName] ?? CHAIN_PRESETS['6-axis-industrial']\n }\n\n get anchors() {\n return []\n }\n\n /**\n * 2D — base rectangle + a stylized arm silhouette pointing toward the\n * top-right. Just enough to identify the component as a robot arm in\n * plan view; the real visual lives in 3D.\n */\n render(ctx: CanvasRenderingContext2D) {\n const { left = 0, top = 0, width = 100, height = 100 } = this.state\n const bodyFill = pickColor(this.state.fillStyle, this.state.bodyColor, BODY_LEGEND.default)\n const borderColor = pickColor(this.state.strokeStyle, this.state.borderColor, BORDER_LEGEND.default)\n const lineWidth = numOr(this.state.lineWidth, 1)\n\n ctx.beginPath()\n ctx.rect(left, top, width, height)\n ctx.fillStyle = bodyFill\n ctx.fill()\n ctx.strokeStyle = borderColor\n ctx.lineWidth = lineWidth\n ctx.stroke()\n\n // Stylized arm silhouette: base square at center → up → bent right.\n const cx = left + width / 2\n const cy = top + height / 2\n const r = Math.min(width, height) * 0.32\n ctx.save()\n ctx.strokeStyle = borderColor\n ctx.lineWidth = Math.max(lineWidth, Math.min(width, height) * 0.025)\n\n // Base pedestal\n ctx.fillStyle = borderColor\n ctx.fillRect(cx - r * 0.5, cy + r * 0.6, r, r * 0.3)\n // Upper arm\n ctx.beginPath()\n ctx.moveTo(cx, cy + r * 0.6)\n ctx.lineTo(cx, cy - r * 0.2)\n ctx.stroke()\n // Forearm\n ctx.beginPath()\n ctx.moveTo(cx, cy - r * 0.2)\n ctx.lineTo(cx + r * 0.7, cy - r * 0.7)\n ctx.stroke()\n // Joint dots\n ctx.fillStyle = borderColor as string\n ctx.beginPath()\n ctx.arc(cx, cy - r * 0.2, Math.max(2, r * 0.1), 0, Math.PI * 2)\n ctx.fill()\n ctx.beginPath()\n ctx.arc(cx + r * 0.7, cy - r * 0.7, Math.max(1.5, r * 0.08), 0, Math.PI * 2)\n ctx.fill()\n ctx.restore()\n }\n\n onchange(after: Record<string, unknown>, before: Record<string, unknown>) {\n // Per-joint number properties (joint0 … jointN-1) are dynamic; treat\n // any key matching the pattern as a joint update.\n const hasJoint = Object.keys(after).some(k => /^joint\\d+$/.test(k))\n if (\n hasJoint ||\n 'style' in after ||\n 'chainPreset' in after ||\n 'chain' in after ||\n 'joints' in after ||\n 'linkShape' in after ||\n 'jointHousing' in after ||\n 'linkRadius' in after ||\n 'color' in after ||\n 'accentColor' in after ||\n 'fillStyle' in after ||\n 'strokeStyle' in after ||\n 'lineWidth' in after ||\n 'alpha' in after ||\n 'material3d' in after ||\n 'gripper' in after ||\n 'gripperType' in after ||\n 'target' in after ||\n 'showReachSphere' in after ||\n 'status' in after ||\n 'bodyColor' in after ||\n 'borderColor' in after\n ) {\n this.clearCache('fillStyle')\n this.invalidate()\n }\n super.onchange(after, before)\n }\n\n buildRealObject(): RealObject | undefined {\n return new RobotArm3D(this)\n }\n\n /**\n * CarrierHolder hook — return the gripper TCP frame so any Carriable\n * child (parcel/box/pallet/...) mounts onto the moving end-effector.\n * IK rotation propagates to the carrier through Three.js scene-graph.\n *\n * Pose convention (real-world pick-and-place: gripper pointing toward\n * the work, carrier hanging *beyond* the gripper tip):\n *\n * - Frame: TCP (gripper working point — between finger tips for\n * jaws, contact face for suction/magnetic). Built by\n * `RobotArm3D._buildGripper`. TCP's +Z = gripper-forward direction\n * (away from the wrist).\n *\n * - Rotation: x:-π/2 — maps carrier's local +Y axis (\"up\" in the\n * carrier's authored frame) to TCP's -Z direction. With the gripper\n * pointing down (typical work pose), TCP +Z = world -Y (down), so\n * TCP -Z = world +Y (up). Result: carrier's \"up\" stays world-up\n * during transit, and the carrier's body extends from TCP origin\n * in TCP +Z direction (down in world) — i.e. hanging BELOW the\n * gripper, not buried inside it.\n *\n * - Position: z = +halfDepth — places the carrier's TOP face center\n * at the TCP origin (where the fingers grip). Carrier's local +Y\n * extent (top) = halfDepth, which after x:-π/2 rotation maps to\n * TCP -halfDepth Z. Shifting carrier center to TCP +halfDepth Z\n * puts that top point exactly at TCP origin. Carrier body then\n * extends through TCP +Z, ending at TCP +depth (bottom face).\n *\n * Earlier (x:+π/2, z:-halfDepth) inverted the carrier's body direction\n * — body extended back into the wrist, leaving the box visually inside\n * the finger area. The current convention pushes the body OUT past the\n * fingertips, where a real gripper would hold it.\n */\n attachPointFor(carrier: Component) {\n const ro = this._realObject\n const frame = ro?.getGripperFrame?.()\n if (!frame) return undefined\n const halfDepth = resolveDepth(carrier) / 2\n return {\n attach: frame,\n localPosition: { x: 0, y: 0, z: halfDepth },\n localRotation: { x: -Math.PI / 2, y: 0, z: 0 }\n }\n }\n\n /**\n * Pick: TCP descends vertically onto the carrier's top face, gripper\n * closes, carrier becomes our child.\n *\n * 1. TCP → APPROACH above pick (carrier's xy, +clearance in world Y)\n * 2. TCP → pick (descend straight down to carrier's top face)\n * 3. close gripper + reparent(carrier → this)\n *\n * The approach waypoint exists so the FINAL leg is a clean vertical\n * descent — the gripper enters the carrier from straight above, not a\n * sideways sweep that could clip or grab at a wrong angle.\n *\n * Pose resolution: TCP lands on the CARRIER'S TOP FACE (carrier.world.y +\n * carrier.depth/2). After grip, `attachPointFor`'s `localPosition.z =\n * +halfDepth` keeps the carrier's top at TCP origin during transit —\n * exact, no offset drift.\n *\n * Each waypoint includes the carrier's world yaw so IK can spin joint 5\n * (tool roll) to align the gripper's \"side\" with the carrier's. Without\n * it, reparent at pick instantly snaps the carrier to the gripper's\n * axis, visibly twisting it 0° → up to 360° in one frame.\n *\n * @param options.approachClearance Vertical offset (world units)\n * between approach and pick targets. Default 10.\n * @param options.timeoutMs Per-segment IK timeout (default 15000ms).\n * @param options.reparentDuration Animation duration for reparent (default 800ms).\n */\n override async pick(carrier: Component, options: MoveOptions = {}): Promise<void> {\n const timeoutMs = (options.timeoutMs as number | undefined) ?? 15000\n const reparentDuration = (options.reparentDuration as number | undefined) ?? 800\n const clearance = (options.approachClearance as number | undefined) ?? 10\n // Read carrier height via _realObject.effectiveDepth — `state.depth`\n // is often not explicitly set (carriers like Box rely on\n // `static defaultDepth`), and reading state alone returns 0, which\n // collapses every Y offset and drives the gripper into the carrier's\n // volumetric center instead of its top face.\n const carrierDepth = resolveDepth(carrier)\n const halfDepth = carrierDepth / 2\n const yaw = this._yawOf(carrier)\n const target = this._targetFor(carrier, halfDepth, yaw)\n const approach = this._targetFor(carrier, halfDepth + clearance, yaw)\n\n this.set('target', approach)\n await waitForTcpReached(this, timeoutMs)\n\n this.set('target', target)\n await waitForTcpReached(this, timeoutMs)\n\n // Pick = transfer from carrier.parent → RobotArm. Transfer 객체로 monitor\n // panel 가시성 유지. *physical phase 는 비움* — handoff 의 target.receive\n // (ContainerCapacity) 가 reparent + mark + transition 단일 entry. 이전 physical\n // 에서 this.reparent 호출하던 패턴은 *이중 reparent 결함* (handoff receive 가\n // 또 reparent 시도 → self-count race → silent reject) 의 원인이었음.\n //\n // executeSync 사용 — pickAndPlace 의 await sequence 안에서 *frame 안 동기 완료*\n // 보장. execute (async) 는 micro-task gap 으로 다음 단계 (place) 와 race.\n const source = (carrier as any).parent\n const xferOptions = { animated: true, duration: reparentDuration }\n if (source) {\n try {\n new (Transfer as any)({\n source,\n target: this,\n carrier,\n options: xferOptions\n // physical 없음 — handoff 의 receive 가 단일 책임.\n }).executeSync()\n } catch (e) {\n throw new Error('RobotArm.pick: transfer rolled back (target full or rejected)', { cause: e })\n }\n } else {\n await (this as any).receive?.(carrier, xferOptions)\n }\n this.set('gripper', { ...(this.state.gripper ?? {}), state: 1 })\n await sleep(reparentDuration, this)\n }\n\n /**\n * Place: TCP descends vertically over the holder, gripper opens,\n * carrier becomes the holder's child.\n *\n * 1. TCP → APPROACH above place (carrier's xy, +clearance)\n * 2. TCP → place (descend straight down to drop point)\n * 3. open gripper + dispatch (carrier → holder)\n *\n * Pose resolution: TCP lands at where the carrier's top WILL BE after\n * the drop, so the carrier lands with its bottom on the holder's attach\n * surface. Computed as `holder.attachFrame.world.y + carrier.depth` (so\n * yOffset = carrierDepth, not halfDepth like pick).\n *\n * Handoff: if this arm has `dispatch` (ContainerCapacity) and the holder\n * exposes `receive`, route via dispatch — slot tracking, `transfer-received`\n * trigger (which downstream conveyance components like InductStation listen\n * to for belt-animation kickoff), and `canReceive` pre-flight all flow\n * through the standard contract. Falls back to raw `holder.reparent()` for\n * holders without ContainerCapacity (plain Spot, etc.). Mirrors Mover.place.\n *\n * @see pick — same option semantics.\n */\n override async place(carrier: Component, holder: Component, options: MoveOptions = {}): Promise<void> {\n if (!holder || !carrier) {\n // holder/carrier 가 dispose 됐거나 호출자가 null 인자 전달한 케이스 — 명시 throw.\n // 이전 silent return 은 *pickAndPlace 의 sequence* (pick → place → goHome) 가\n // place 를 skip 하고 *home 으로 진행* 하게 만들어 결함 (carrier 들고 home).\n // 호출자가 catch 해서 holder 결정 재시도 또는 cancel.\n throw new Error(`RobotArm.place: ${!holder ? 'holder' : 'carrier'} is null/undefined`)\n }\n const timeoutMs = (options.timeoutMs as number | undefined) ?? 15000\n const reparentDuration = (options.reparentDuration as number | undefined) ?? 800\n const clearance = (options.approachClearance as number | undefined) ?? 10\n const carrierDepth = resolveDepth(carrier)\n // Phase G5.2 — holder 가 acceptanceRotation 을 선언하면 그 world equivalent\n // (deliveryWorldRotation) 의 yaw 를 TCP yaw 로 사용. 그러면 carrier 가 holder\n // 의 acceptance pose 와 정확히 일치한 채 release 되어 handoff 시 zero-delta\n // (시각적 점프 없음). holder 가 미정의면 holder 자체의 world yaw 사용\n // (이전 동작).\n const yaw = this._deliveryYawOf(holder, carrier)\n // Phase G9 — carrier 도 함께 전달해 holder 의 deliveryWorldPosition 을 정확히\n // query. holder 가 contract 노출 안 하면 fallback (object3d 원점) 으로.\n const target = this._targetFor(holder, carrierDepth, yaw, carrier) // top-of-carrier after drop\n const approach = this._targetFor(holder, carrierDepth + clearance, yaw, carrier)\n\n this.set('target', approach)\n await waitForTcpReached(this, timeoutMs)\n\n this.set('target', target)\n await waitForTcpReached(this, timeoutMs)\n\n // Holder 가 currently full 이면 *canReceive 가 true 될 때까지 polling 대기*.\n // robot 이 carrier 를 들고 있으니 *조용히 포기 / home 으로 가는* 동작은 부적절 —\n // 둘 자리가 비울 때까지 자연 대기가 real-world model. options.placeTimeoutMs\n // 미명시 기본은 *영원 대기*.\n const canReceiveFn = (holder as any)?.canReceive\n if (typeof canReceiveFn === 'function') {\n const placeTimeoutMs = (options as any).placeTimeoutMs as number | undefined\n const startedAt = (this.root as any)?.frameClock?.simTime ?? Date.now()\n const now = () => (this.root as any)?.frameClock?.simTime ?? Date.now()\n while (!canReceiveFn.call(holder, carrier)) {\n if (placeTimeoutMs !== undefined && now() - startedAt > placeTimeoutMs) {\n throw new Error(`RobotArm.place: holder did not become available within ${placeTimeoutMs}ms`)\n }\n await sleep(200, this)\n }\n }\n\n // animated:false — ContainerCapacity.receive 의 reparent transition 과\n // holder 의 transfer-received listener (예: InductStation.receiveItem) 의\n // transitionEffect 가 중복 begin → cancel + jump → 튐. reparent snap +\n // holder 측 transition 만 작동.\n const xferOptions = { animated: false, duration: reparentDuration }\n const canDispatch =\n typeof (this as any).dispatch === 'function' && typeof (holder as any).receive === 'function'\n if (canDispatch) {\n // Case A — ContainerCapacity path. dispatch 내부에서 Transfer + mark cleanup.\n await (this as any).dispatch(carrier, holder, xferOptions)\n } else {\n // Case B fallback — holder 가 ContainerCapacity 미구현 (예: plain Spot).\n // Transfer 객체로 wrap → panel 가시성 + physical 안에서 mark cleanup + reparent.\n try {\n new (Transfer as any)({\n source: this,\n target: holder,\n carrier,\n options: xferOptions,\n physical: async () => {\n delete (carrier as any)._transferSlotId\n ;(holder as any).reparent?.(carrier, xferOptions)\n }\n }).executeSync()\n } catch (e) {\n throw new Error('RobotArm.place: holder reparent failed', { cause: e })\n }\n }\n this.set('gripper', { ...(this.state.gripper ?? {}), state: 0 })\n await sleep(reparentDuration, this)\n }\n\n /**\n * `pickAndPlace` is inherited from the `Mover` mixin default — runs\n * `pick(carrier)` then `place(carrier, holder)` sequentially. The\n * decomposition is safe: the carrier's world position only matters\n * during pick (carrier-relative waypoints), and after pick the carrier\n * is the TCP's child (so re-querying it would chase its own tail —\n * which we don't, since place uses holder-relative waypoints only).\n *\n * @example\n * ```ts\n * await robotArm.pickAndPlace(box, spotB)\n * await robotArm.pnp(parcel, palletA, { approachClearance: 30 })\n * ```\n */\n /** Short alias for `pickAndPlace`. Same arguments, same behavior. */\n pnp(carrier: Component, placeHolder: Component, options?: MoveOptions): Promise<void> {\n return this.pickAndPlace(carrier, placeHolder, options)\n }\n\n /**\n * Return all joints to the configured home pose (state.joints / state.jointN).\n *\n * IK target 을 클리어하고 forward joint 제어로 부드럽게 휴식 포즈로 복귀.\n * `pickAndPlace` 의 마지막 단계로 자동 호출되며, 사용자가 명시적으로 호출도 가능.\n *\n * **인터럽트 가능**: 집에 도달하기 전에 새 `pick`/`place` 가 호출되면 (`set('target', ...)`)\n * `_retargetIk()` 가 발동되어 smoothing 이 home 으로 가던 걸 멈추고 새 IK target 쪽으로\n * redirect. mid-flight joint 값을 새 IK 의 시작점으로 사용해 끊김 없이 전환. tcp-reached\n * 가 redirect 후의 새 target 에서 발생하면 goHome 의 await 도 함께 resolve (정상).\n * 즉 \"집으로 가다가 다음 pick 으로 자연스럽게 이어진다\".\n *\n * @param options.timeoutMs joint smoothing 의 'tcp-reached' 대기 timeout (default 15000ms).\n */\n async goHome(options: MoveOptions = {}): Promise<void> {\n const timeoutMs = (options.timeoutMs as number | undefined) ?? 15000\n const ro = this._realObject as any\n if (!ro?.moveJointsTo || !ro?.getHomeJoints) return\n // IK target 제거 — 다음 rebuild 시 _smoothing.target 이 IK 로 다시 풀리지 않도록.\n // 외부에서 set('target', ...) 호출하면 다시 IK 모드로 전환되며 redirect.\n this.set('target', undefined)\n ro.moveJointsTo(ro.getHomeJoints())\n await waitForTcpReached(this, timeoutMs)\n }\n\n /**\n * pick → place → goHome 시퀀스. 마지막에 home pose 복귀가 robot-arm 의\n * pickAndPlace 표준 동작. (Mover mixin 의 default 는 pick + place 만)\n */\n override async pickAndPlace(\n carrier: Component,\n holder: Component,\n options: MoveOptions = {}\n ): Promise<void> {\n await this.pick(carrier, options)\n await this.place(carrier, holder, options)\n await this.goHome(options)\n }\n\n /**\n * Resolve a TCP position in this arm's chain-local frame.\n *\n * Resolution priority:\n * 1. `attachPointFor` (CarrierHolder) — canonical TCP frame for arms /\n * Spot pads / gripper-on-gripper.\n * 2. `deliveryWorldPosition` (Phase G9 — Holder contract). Holder 가\n * ContainerCapacity 의 default 또는 자체 override 로 정확한 도달\n * world XYZ 를 직접 제공. 이전 SCAFFOLDING 의 cz 공식 역연산이\n * 여기로 이전됨.\n * 3. Component's own `_realObject.object3d` world center.\n * 4. 2D bounds center (only before 3D builds).\n *\n * `carrierForDelivery` 가 주어지면 (place 케이스) `component` 를 holder 로\n * 간주하고 `component.deliveryWorldPosition(carrierForDelivery)` 를 query.\n * 미지정 (pick 케이스 — `component` 자체가 carrier) 시 #3 으로.\n *\n * `worldYOffset` is added to the resolved world Y before projecting\n * back to chain-local — used by pickAndPlace to lift the TCP above\n * the target (approach waypoints) and to land it on the carrier's\n * top face rather than its volumetric center.\n */\n private _targetFor(\n component: Component,\n worldYOffset = 0,\n yaw?: number,\n carrierForDelivery?: Component\n ): { x: number; y: number; z: number; yaw?: number } {\n const ro3d = this._realObject\n\n let baseWp: THREE.Vector3 | undefined\n // Prefer holder's attach frame when available.\n const attachPointFor = (component as any).attachPointFor\n if (typeof attachPointFor === 'function') {\n const point = attachPointFor.call(component, this)\n if (point?.attach) {\n point.attach.updateWorldMatrix?.(true, false)\n baseWp = point.attach.getWorldPosition?.(new THREE.Vector3())\n }\n }\n if (!baseWp) {\n // Phase G9 — Holder.deliveryWorldPosition contract 를 우선 사용 (place\n // 케이스: carrierForDelivery 가 주어진 경우). ContainerCapacity 가 default\n // 로 receivingSurfaceY/geometricOffsetY 보정 + 표면 변환을 제공하므로\n // robot-arm 이 cz 공식 역연산을 직접 알지 않아도 됨.\n if (carrierForDelivery) {\n const deliveryPos = (component as any).deliveryWorldPosition?.(carrierForDelivery)\n if (deliveryPos) {\n baseWp = new THREE.Vector3(deliveryPos.x, deliveryPos.y, deliveryPos.z)\n }\n }\n // Fallback (pick 케이스 또는 holder 가 contract 미노출): component 자체의\n // obj3d world center.\n if (!baseWp) {\n const obj = (component as any)._realObject?.object3d\n if (obj) {\n obj.updateWorldMatrix(true, false)\n baseWp = obj.getWorldPosition(new THREE.Vector3())\n }\n }\n }\n if (!ro3d || !baseWp) {\n // Final fallback: 2D bounds center — only before 3D builds.\n const c = component.center\n return { x: c.x, y: worldYOffset, z: c.y, yaw }\n }\n const local = ro3d.worldToChainLocal(baseWp.x, baseWp.y + worldYOffset, baseWp.z)\n return { x: local.x, y: local.y, z: local.z, yaw }\n }\n\n /**\n * Extract a component's world yaw (rotation around world +Y) from its\n * 3D object's world matrix. Returns 0 if the object isn't built yet.\n * Used by `pickAndPlace` so the gripper can match the carrier's /\n * placeHolder's current orientation — preventing a yaw snap at the\n * moment of reparent.\n */\n private _yawOf(component: Component): number {\n const obj = (component as any)._realObject?.object3d\n if (!obj) return 0\n obj.updateWorldMatrix(true, false)\n const q = new THREE.Quaternion()\n obj.getWorldQuaternion(q)\n const e = new THREE.Euler().setFromQuaternion(q, 'YXZ')\n return e.y\n }\n\n /**\n * Phase G5.2 — Delivery yaw 결정.\n *\n * holder 가 ContainerCapacity contract 의 deliveryWorldRotation 을 노출하면\n * 그 world quaternion 에서 yaw 를 추출 (carrier 가 acceptance pose 와 일치\n * 한 채 release 되도록). InductStation 같은 holder 가 sorter forward 방향을\n * 자기 acceptanceRotation 으로 선언하면 자동으로 그 방향이 TCP yaw 가 됨.\n *\n * holder 가 deliveryWorldRotation 을 안 노출하거나 _realObject 미빌드 시\n * 기존 동작 (holder 자체의 world yaw) 으로 fallback.\n */\n private _deliveryYawOf(holder: Component, carrier: Component): number {\n if (!holder) return 0\n const deliveryRot = (holder as any).deliveryWorldRotation?.(carrier)\n if (deliveryRot) {\n const q = new THREE.Quaternion(deliveryRot.x, deliveryRot.y, deliveryRot.z, deliveryRot.w)\n const e = new THREE.Euler().setFromQuaternion(q, 'YXZ')\n return e.y\n }\n return this._yawOf(holder)\n }\n}\n\n/**\n * Resolve when the robot arm fires `tcp-reached`, reject on **simulation-time**\n * timeout. 3D smoothing 은 frameClock 의 simDt 로 진행 (sim-time-driven),\n * 따라서 timeout 도 sim-time 으로 누적해야 sim speed 변경에 일관 동작:\n * - speed=1 → sim time = real time (기존과 동일)\n * - speed=2 → IK 도 2× 빨라지고 timeout 도 2× 빠르게 도달 (real time 기준)\n * - speed=0.5 → IK 가 2× 느려지지만 timeout 도 sim 기준이라 spurious\n * reject 없음 (이전 real-time setTimeout 으로는 1 미만 speed\n * 에서 IK 도달 전에 timeout 발화하던 버그 수정)\n * - paused → simDt=0 누적도 정지 → 일시정지 동안 무한 대기 (의도)\n */\nfunction waitForTcpReached(component: Component, timeoutMs: number): Promise<void> {\n return new Promise((resolve, reject) => {\n let elapsedSim = 0\n let unsub: (() => void) | null = null\n const cleanup = () => {\n component.off('tcp-reached', onReached)\n if (unsub) {\n ;(component as any)._moverActiveUnsubs?.delete(unsub)\n unsub()\n unsub = null\n }\n }\n const onReached = () => {\n cleanup()\n resolve()\n }\n component.on('tcp-reached', onReached)\n unsub = frameClock.subscribe(\n simDt => {\n // robot 이 dispose 되면 즉시 빠져나옴.\n if ((component as any)._moverDisposed) { cleanup(); resolve(); return }\n elapsedSim += simDt\n if (elapsedSim >= timeoutMs) {\n cleanup()\n reject(new Error('TCP reach timeout'))\n }\n },\n { description: 'robot-arm tcp-reached timeout', component }\n )\n ;(component as any)._moverActiveUnsubs?.add(unsub)\n })\n}\n\n/**\n * sim-time aware sleep — frameClock 의 simDt 를 누적해 ms 도달 시 resolve.\n * speed=0.5 이면 real time 으로 2배 걸리지만 sim time 으로는 동일 — animation\n * 시간과 일관. paused 시 무한 대기 (의도). waitForTcpReached 와 같은 시간축.\n */\nfunction sleep(ms: number, component?: Component): Promise<void> {\n return new Promise(resolve => {\n let elapsedSim = 0\n let unsub: (() => void) | null = null\n const cleanup = () => {\n if (unsub) {\n if (component) (component as any)._moverActiveUnsubs?.delete(unsub)\n unsub()\n unsub = null\n }\n }\n unsub = frameClock.subscribe(\n simDt => {\n // component 가 dispose 되면 즉시 빠져나옴 (closure 강참조 해제).\n if (component && (component as any)._moverDisposed) { cleanup(); resolve(); return }\n elapsedSim += simDt\n if (elapsedSim >= ms) {\n cleanup()\n resolve()\n }\n },\n { description: 'robot-arm sim-sleep', component }\n )\n if (component) (component as any)._moverActiveUnsubs?.add(unsub)\n })\n}\n\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n\n/**\n * Resolve a component's 3D height. things-scene v10 carriers (Box, Pallet,\n * etc.) typically declare `static defaultDepth` rather than setting\n * `state.depth`, so reading state alone returns 0 — wrong for a\n * default-sized box. The framework resolves the actual value into\n * `_realObject.effectiveDepth`. Falls back to `state.depth` for\n * components built before their RealObject exists.\n */\nfunction resolveDepth(c: Component): number {\n const eff = (c as any)?._realObject?.effectiveDepth\n if (typeof eff === 'number' && Number.isFinite(eff)) return eff\n return numOr((c as any)?.state?.depth, 0)\n}\n\nfunction pickColor(...candidates: unknown[]): string {\n for (const c of candidates) {\n if (typeof c === 'string' && c && c !== 'transparent') return c\n }\n return '#888'\n}\n"]}
1
+ {"version":3,"file":"robot-arm.js","sourceRoot":"","sources":["../src/robot-arm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,CAAY;IAChC,MAAM,GAAG,GAAI,CAAS,EAAE,WAAW,EAAE,cAAc,CAAA;IACnD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAA;IAC/D,OAAO,KAAK,CAAE,CAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,SAAS,CAAC,GAAG,UAAqB;IACzC,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,KAAK,aAAa;YAAE,OAAO,CAAC,CAAA;IACjE,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n *\n * Robot Arm — generalized articulated manipulator component.\n *\n * Designed to cover the visualization needs of robot arms WITHOUT a\n * specific URDF model. Configurable kinematic chain, link shape, joint\n * housing, gripper type — same component renders as a sleek cobot, a\n * heavy industrial 6-axis, a SCARA, or a minimal educational arm.\n *\n * State schema (all top-level properties optional except width/height):\n *\n * {\n * // structure\n * style?: 'industrial' | 'cobot' | 'scara' | 'minimal',\n * chainPreset?: '6-axis-industrial' | 'cobot-6-axis' | 'scara-4-axis' | 'pick-and-place-3-axis',\n * chain?: ChainElement[], // overrides preset\n * joints?: number[] | { [i]: number }, // current joint values\n *\n * // styling overrides\n * linkShape?, jointHousing?, linkRadius?, color?, accentColor?,\n *\n * // gripper\n * gripper?: GripperConfig,\n *\n * // IK target (TCP world position relative to component center, in\n * // 3D-z-up convention used by IK module)\n * target?: { x: number, y: number, z: number },\n *\n * // visualization\n * showReachSphere?: boolean\n * }\n */\n\nimport * as THREE from 'three'\nimport { Component, ComponentNature, ContainerAbstract, ContainerCapacity, Holdable, RealObject, Transfer, frameClock, sceneComponent } from '@hatiolab/things-scene'\nimport type { SlotDef, State, Material3D } from '@hatiolab/things-scene'\nimport {\n CarrierHolder,\n Legendable,\n Mover,\n Placeable,\n type Alignment,\n type Heights,\n type LegendBinding,\n type MoveOptions,\n type PlacementArchetype\n} from '@operato/scene-base'\n\nimport { RobotArm3D } from './robot-arm-3d.js'\nimport { CHAIN_PRESETS, type ChainPresetName } from './robot-arm-styles.js'\nimport type { ChainElement } from './robot-arm-ik.js'\nimport type { GripperConfig, LinkShape, JointHousing, StyleName } from './robot-arm-styles.js'\n\n// ── ComponentEventMap 도메인 augmentation ─────────────────────────────────\n// RobotArm 이 발생시키는 도메인 이벤트들. things-scene 의 ComponentEventMap 에\n// 추가 등록하여 component.on/trigger 에서 자동완성 + 페이로드 타입 검증.\ndeclare module '@hatiolab/things-scene' {\n interface ComponentEventMap {\n /** TCP 가 목표 도달 시 발생 (pickAndPlace 시퀀싱용). */\n 'tcp-reached': [info: { component: Component }]\n }\n}\n\nexport type RobotArmStatus = 'idle' | 'moving' | 'gripping' | 'warn' | 'error'\n\n/** RobotArm 컴포넌트 state */\nexport interface RobotArmState extends State {\n // ── 구조 ──\n style?: StyleName\n chainPreset?: ChainPresetName\n chain?: ChainElement[]\n joints?: number[] | Record<string, number>\n linkShape?: LinkShape\n jointHousing?: JointHousing\n linkRadius?: number\n color?: string | number\n accentColor?: string | number\n\n // ── 그리퍼 ──\n gripper?: GripperConfig\n gripperType?: GripperConfig['type']\n\n // ── IK 타겟 ──\n target?: { x: number; y: number; z: number; yaw?: number }\n\n // ── 시각화 ──\n showReachSphere?: boolean\n\n // ── 모션 ──\n jointSpeed?: number\n\n // ── 운영 상태 ──\n status?: RobotArmStatus\n\n // ── 3D 재질 ──\n material3d?: Material3D\n}\n\nconst BODY_LEGEND = {\n idle: '#ccc',\n moving: '#afd0f1',\n gripping: '#cfe6c8',\n warn: '#ffba00',\n error: '#e9746b',\n default: '#ccc'\n}\n\nconst BORDER_LEGEND = {\n idle: '#888',\n moving: '#87b1db',\n gripping: '#7aa274',\n warn: '#d96f21',\n error: '#a73928',\n default: '#888'\n}\n\nconst LAMP_EMISSIVE_LEGEND = {\n idle: '#333333',\n moving: '#44aaff',\n gripping: '#33aa44',\n warn: '#ffaa00',\n error: '#ff3333',\n default: '#333333'\n}\n\nconst STATIC_PROPERTIES = [\n {\n type: 'select',\n label: 'style',\n name: 'style',\n property: {\n options: [\n { display: 'Industrial', value: 'industrial' },\n { display: 'Cobot', value: 'cobot' },\n { display: 'SCARA', value: 'scara' },\n { display: 'Minimal', value: 'minimal' }\n ]\n }\n },\n {\n type: 'select',\n label: 'chain-preset',\n name: 'chainPreset',\n property: {\n options: [\n { display: '6-Axis Industrial', value: '6-axis-industrial' },\n { display: 'Cobot 6-Axis', value: 'cobot-6-axis' },\n { display: 'SCARA 4-Axis', value: 'scara-4-axis' },\n { display: 'Pick & Place 3-Axis', value: 'pick-and-place-3-axis' }\n ]\n }\n },\n { type: 'number', label: 'link-radius', name: 'linkRadius' },\n {\n type: 'select',\n label: 'gripper-type',\n name: 'gripperType',\n property: {\n options: [\n { display: 'Parallel', value: 'parallel' },\n { display: 'Suction', value: 'suction' },\n { display: 'Magnetic', value: 'magnetic' },\n { display: 'Three-Finger', value: 'three-finger' },\n { display: 'None', value: 'none' }\n ]\n }\n },\n { type: 'checkbox', label: 'show-reach-sphere', name: 'showReachSphere' },\n {\n type: 'select',\n label: 'status',\n name: 'status',\n property: {\n options: [\n { display: 'Idle', value: 'idle' },\n { display: 'Moving', value: 'moving' },\n { display: 'Gripping', value: 'gripping' },\n { display: 'Warn', value: 'warn' },\n { display: 'Error', value: 'error' }\n ]\n }\n }\n]\n\n// CarrierHolder + ContainerAbstract: the arm needs the container's child-list\n// machinery (addComponent / reparent / events) AND CarrierHolder's\n// attachPointFor hook. CarrierHolder mixin alone only publishes the attach\n// policy; it doesn't add child management. RectPath(Shape) was wrong here —\n// Shape is a leaf so reparent silently failed. ContainerAbstract provides\n// the missing piece.\n//\n// `ContainerAbstract` (not `Container`) — Container = MixinHTMLElement(ContainerAbstract),\n// which forces `isHTMLElement(): true` and trips the 3D pipeline's\n// addObject DOM-skip gate. Robot arm exists purely in the 3D scene graph\n// (URDF/IK joints, no DOM overlay), so the bare logical container is correct.\n//\n// Mover wraps the chain to publish pick/place/pickAndPlace primitives. It\n// must sit OUTSIDE CarrierHolder because Mover's defaults call this.reparent,\n// which CarrierHolder provides (overrides the base ContainerAbstract\n// version with the attach-frame-aware variant).\n//\n// The instance type cast surfaces Mover's API on `this` so subclass\n// `override` keywords compile and `this.pickAndPlace(...)` resolves —\n// without it, the `as unknown as typeof Component` cast erases all\n// mixin contributions to the static side.\n// ContainerCapacity inserted between CarrierHolder and Legendable — same pattern\n// as Forklift/AGV: receive()/dispatch() for slot-tracking + event emission;\n// CarrierHolder.attachPointFor() (overridden below) provides 3D TCP positioning.\nconst Base = Mover(CarrierHolder(ContainerCapacity(Holdable(Legendable(Placeable(ContainerAbstract)))))) as unknown as typeof Component & {\n new (...args: any[]): Component & {\n isMover: boolean\n pick(carrier: Component, options?: MoveOptions): Promise<void>\n place(carrier: Component, holder: Component, options?: MoveOptions): Promise<void>\n pickAndPlace(carrier: Component, holder: Component, options?: MoveOptions): Promise<void>\n }\n}\n\n@sceneComponent('robot-arm')\nexport default class RobotArm extends Base {\n // `Base` is cast through `typeof Component` so TS sees `state` as an\n // accessor; `declare state: …` would conflict with TS2610. Override the\n // getter instead — runtime behavior is identical (just delegates to super).\n override get state(): RobotArmState {\n return super.state as RobotArmState\n }\n\n declare _realObject: RobotArm3D | undefined\n\n // Phase ZT-V PR-6 — ProcessStep marker.\n // RobotArm 은 *_kinematic transform_* 단계 — pickAndPlace 의 input/output slot\n // 이 의미적으로 process step. CapabilityRegistry 가 자동 발견 가능.\n readonly isProcessStep = true as const\n\n /**\n * Phase H — pickup contract 호환성 검사용. 보편적 'gripper' type — vacuum,\n * 2-finger, 3-finger 등 다양한 gripper 모두 이 type 으로 매칭. carrier 가\n * 더 세분화된 호환성을 원하면 `pickupFramesFor` override 로 size 등 추가 검증.\n *\n * (override 키워드 미사용 — Base 캐스트가 Mover 의 toolType 을 노출하지 않아\n * TS4113 회피.)\n */\n get toolType(): string {\n return 'gripper'\n }\n\n static legends: Record<string, LegendBinding> = {\n bodyColor: { from: 'status', legend: BODY_LEGEND },\n borderColor: { from: 'status', legend: BORDER_LEGEND },\n lampEmissive: { from: 'status', legend: LAMP_EMISSIVE_LEGEND }\n }\n\n /**\n * Robot arms sit on the floor (or mount to a ceiling/wall — that's a\n * v2 feature). Default depth = operation - floor like other floor-\n * mounted equipment, so the chain reach scales with the configured\n * facility height.\n */\n static placement: PlacementArchetype = 'floor'\n static align: Alignment = 'bottom'\n static defaultDepth = (h: Heights) => h.operation - h.floor\n\n // ── ContainerCapacity ─────────────────────────────────────────────────────\n\n /** Single gripper slot — robot arm grips one item at a time. */\n get slots(): SlotDef[] {\n return [{ id: 'gripper', maxCount: 1 }]\n }\n\n /**\n * Dynamic nature — appends one number property per joint in the active\n * chain. Each property uses the joint's range as `min`/`max` so the\n * property panel can render a constrained slider/spinner. The chain\n * preset can change at runtime, and `get nature()` is re-evaluated\n * whenever the property panel queries it, so the joint count stays in\n * sync with the active preset.\n *\n * For revolute joints the value is in radians; for prismatic, scene units.\n */\n get nature(): ComponentNature {\n const chain = this._activeChain\n // Joint values: revolute = degrees (range usually ±180), prismatic =\n // scene length units. CHAIN_PRESETS already encode revolute ranges in\n // degrees; the 3D side converts to radians at the math boundary.\n const jointProps = chain.map((c, i) => ({\n type: 'number',\n label: `joint-${i + 1}`,\n name: `joint${i}`,\n property: {\n min: c.range[0],\n max: c.range[1],\n step: c.type === 'revolute' ? 1 : 1\n }\n }))\n return {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [...STATIC_PROPERTIES, ...jointProps] as any,\n help: 'scene/component/robot-arm'\n }\n }\n\n /**\n * Resolve the active chain for property-panel introspection. Mirrors\n * the resolution in robot-arm-3d.ts (state.chain wins, else preset,\n * else default 6-axis-industrial). Kept simple — the 3D side does the\n * same logic with depth-based scaling, but for property labeling we\n * only need the structure (axis count + ranges), not absolute lengths.\n */\n private get _activeChain(): ChainElement[] {\n const state = this.state\n if (Array.isArray(state.chain) && state.chain.length > 0) return state.chain\n const presetName = (state.chainPreset ?? '6-axis-industrial') as ChainPresetName\n return CHAIN_PRESETS[presetName] ?? CHAIN_PRESETS['6-axis-industrial']\n }\n\n get anchors() {\n return []\n }\n\n /**\n * 2D — base rectangle + a stylized arm silhouette pointing toward the\n * top-right. Just enough to identify the component as a robot arm in\n * plan view; the real visual lives in 3D.\n */\n render(ctx: CanvasRenderingContext2D) {\n const { left = 0, top = 0, width = 100, height = 100 } = this.state\n const bodyFill = pickColor(this.state.fillStyle, this.state.bodyColor, BODY_LEGEND.default)\n const borderColor = pickColor(this.state.strokeStyle, this.state.borderColor, BORDER_LEGEND.default)\n const lineWidth = numOr(this.state.lineWidth, 1)\n\n ctx.beginPath()\n ctx.rect(left, top, width, height)\n ctx.fillStyle = bodyFill\n ctx.fill()\n ctx.strokeStyle = borderColor\n ctx.lineWidth = lineWidth\n ctx.stroke()\n\n // Stylized arm silhouette: base square at center → up → bent right.\n const cx = left + width / 2\n const cy = top + height / 2\n const r = Math.min(width, height) * 0.32\n ctx.save()\n ctx.strokeStyle = borderColor\n ctx.lineWidth = Math.max(lineWidth, Math.min(width, height) * 0.025)\n\n // Base pedestal\n ctx.fillStyle = borderColor\n ctx.fillRect(cx - r * 0.5, cy + r * 0.6, r, r * 0.3)\n // Upper arm\n ctx.beginPath()\n ctx.moveTo(cx, cy + r * 0.6)\n ctx.lineTo(cx, cy - r * 0.2)\n ctx.stroke()\n // Forearm\n ctx.beginPath()\n ctx.moveTo(cx, cy - r * 0.2)\n ctx.lineTo(cx + r * 0.7, cy - r * 0.7)\n ctx.stroke()\n // Joint dots\n ctx.fillStyle = borderColor as string\n ctx.beginPath()\n ctx.arc(cx, cy - r * 0.2, Math.max(2, r * 0.1), 0, Math.PI * 2)\n ctx.fill()\n ctx.beginPath()\n ctx.arc(cx + r * 0.7, cy - r * 0.7, Math.max(1.5, r * 0.08), 0, Math.PI * 2)\n ctx.fill()\n ctx.restore()\n }\n\n onchange(after: Record<string, unknown>, before: Record<string, unknown>) {\n // Per-joint number properties (joint0 … jointN-1) are dynamic; treat\n // any key matching the pattern as a joint update.\n const hasJoint = Object.keys(after).some(k => /^joint\\d+$/.test(k))\n if (\n hasJoint ||\n 'style' in after ||\n 'chainPreset' in after ||\n 'chain' in after ||\n 'joints' in after ||\n 'linkShape' in after ||\n 'jointHousing' in after ||\n 'linkRadius' in after ||\n 'color' in after ||\n 'accentColor' in after ||\n 'fillStyle' in after ||\n 'strokeStyle' in after ||\n 'lineWidth' in after ||\n 'alpha' in after ||\n 'material3d' in after ||\n 'gripper' in after ||\n 'gripperType' in after ||\n 'target' in after ||\n 'showReachSphere' in after ||\n 'status' in after ||\n 'bodyColor' in after ||\n 'borderColor' in after\n ) {\n this.clearCache('fillStyle')\n this.invalidate()\n }\n super.onchange(after, before)\n }\n\n buildRealObject(): RealObject | undefined {\n return new RobotArm3D(this)\n }\n\n /**\n * CarrierHolder hook — return the gripper TCP frame so any Carriable\n * child (parcel/box/pallet/...) mounts onto the moving end-effector.\n * IK rotation propagates to the carrier through Three.js scene-graph.\n *\n * Pose convention (real-world pick-and-place: gripper pointing toward\n * the work, carrier hanging *beyond* the gripper tip):\n *\n * - Frame: TCP (gripper working point — between finger tips for\n * jaws, contact face for suction/magnetic). Built by\n * `RobotArm3D._buildGripper`. TCP's +Z = gripper-forward direction\n * (away from the wrist).\n *\n * - Rotation: x:-π/2 — maps carrier's local +Y axis (\"up\" in the\n * carrier's authored frame) to TCP's -Z direction. With the gripper\n * pointing down (typical work pose), TCP +Z = world -Y (down), so\n * TCP -Z = world +Y (up). Result: carrier's \"up\" stays world-up\n * during transit, and the carrier's body extends from TCP origin\n * in TCP +Z direction (down in world) — i.e. hanging BELOW the\n * gripper, not buried inside it.\n *\n * - Position: z = +halfDepth — places the carrier's TOP face center\n * at the TCP origin (where the fingers grip). Carrier's local +Y\n * extent (top) = halfDepth, which after x:-π/2 rotation maps to\n * TCP -halfDepth Z. Shifting carrier center to TCP +halfDepth Z\n * puts that top point exactly at TCP origin. Carrier body then\n * extends through TCP +Z, ending at TCP +depth (bottom face).\n *\n * Earlier (x:+π/2, z:-halfDepth) inverted the carrier's body direction\n * — body extended back into the wrist, leaving the box visually inside\n * the finger area. The current convention pushes the body OUT past the\n * fingertips, where a real gripper would hold it.\n */\n attachPointFor(carrier: Component) {\n const ro = this._realObject\n const frame = ro?.getGripperFrame?.()\n if (!frame) return undefined\n const halfDepth = resolveDepth(carrier) / 2\n return {\n attach: frame,\n localPosition: { x: 0, y: 0, z: halfDepth },\n localRotation: { x: -Math.PI / 2, y: 0, z: 0 }\n }\n }\n\n /**\n * Pick: TCP descends vertically onto the carrier's top face, gripper\n * closes, carrier becomes our child.\n *\n * 1. TCP → APPROACH above pick (carrier's xy, +clearance in world Y)\n * 2. TCP → pick (descend straight down to carrier's top face)\n * 3. close gripper + reparent(carrier → this)\n *\n * The approach waypoint exists so the FINAL leg is a clean vertical\n * descent — the gripper enters the carrier from straight above, not a\n * sideways sweep that could clip or grab at a wrong angle.\n *\n * Pose resolution: TCP lands on the CARRIER'S TOP FACE (carrier.world.y +\n * carrier.depth/2). After grip, `attachPointFor`'s `localPosition.z =\n * +halfDepth` keeps the carrier's top at TCP origin during transit —\n * exact, no offset drift.\n *\n * Each waypoint includes the carrier's world yaw so IK can spin joint 5\n * (tool roll) to align the gripper's \"side\" with the carrier's. Without\n * it, reparent at pick instantly snaps the carrier to the gripper's\n * axis, visibly twisting it 0° → up to 360° in one frame.\n *\n * @param options.approachClearance Vertical offset (world units)\n * between approach and pick targets. Default 10.\n * @param options.timeoutMs Per-segment IK timeout (default 15000ms).\n * @param options.reparentDuration Animation duration for reparent (default 800ms).\n */\n override async pick(carrier: Component, options: MoveOptions = {}): Promise<void> {\n const timeoutMs = (options.timeoutMs as number | undefined) ?? 15000\n const reparentDuration = (options.reparentDuration as number | undefined) ?? 800\n const clearance = (options.approachClearance as number | undefined) ?? 10\n // Read carrier height via _realObject.effectiveDepth — `state.depth`\n // is often not explicitly set (carriers like Box rely on\n // `static defaultDepth`), and reading state alone returns 0, which\n // collapses every Y offset and drives the gripper into the carrier's\n // volumetric center instead of its top face.\n const carrierDepth = resolveDepth(carrier)\n const halfDepth = carrierDepth / 2\n const yaw = this._yawOf(carrier)\n const target = this._targetFor(carrier, halfDepth, yaw)\n const approach = this._targetFor(carrier, halfDepth + clearance, yaw)\n\n this.set('target', approach)\n await waitForTcpReached(this, timeoutMs)\n\n this.set('target', target)\n await waitForTcpReached(this, timeoutMs)\n\n // Pick = transfer from carrier.parent → RobotArm. Transfer 객체로 monitor\n // panel 가시성 유지. *physical phase 는 비움* — handoff 의 target.receive\n // (ContainerCapacity) 가 reparent + mark + transition 단일 entry. 이전 physical\n // 에서 this.reparent 호출하던 패턴은 *이중 reparent 결함* (handoff receive 가\n // 또 reparent 시도 → self-count race → silent reject) 의 원인이었음.\n //\n // executeSync 사용 — pickAndPlace 의 await sequence 안에서 *frame 안 동기 완료*\n // 보장. execute (async) 는 micro-task gap 으로 다음 단계 (place) 와 race.\n const source = (carrier as any).parent\n const xferOptions = { animated: true, duration: reparentDuration }\n if (source) {\n try {\n new (Transfer as any)({\n source,\n target: this,\n carrier,\n options: xferOptions\n // physical 없음 — handoff 의 receive 가 단일 책임.\n }).executeSync()\n } catch (e) {\n throw new Error('RobotArm.pick: transfer rolled back (target full or rejected)', { cause: e })\n }\n } else {\n await (this as any).receive?.(carrier, xferOptions)\n }\n this.set('gripper', { ...(this.state.gripper ?? {}), state: 1 })\n await sleep(reparentDuration, this)\n }\n\n /**\n * Place: TCP descends vertically over the holder, gripper opens,\n * carrier becomes the holder's child.\n *\n * 1. TCP → APPROACH above place (carrier's xy, +clearance)\n * 2. TCP → place (descend straight down to drop point)\n * 3. open gripper + dispatch (carrier → holder)\n *\n * Pose resolution: TCP lands at where the carrier's top WILL BE after\n * the drop, so the carrier lands with its bottom on the holder's attach\n * surface. Computed as `holder.attachFrame.world.y + carrier.depth` (so\n * yOffset = carrierDepth, not halfDepth like pick).\n *\n * Handoff: if this arm has `dispatch` (ContainerCapacity) and the holder\n * exposes `receive`, route via dispatch — slot tracking, `transfer-received`\n * trigger (which downstream conveyance components like InductStation listen\n * to for belt-animation kickoff), and `canReceive` pre-flight all flow\n * through the standard contract. Falls back to raw `holder.reparent()` for\n * holders without ContainerCapacity (plain Spot, etc.). Mirrors Mover.place.\n *\n * @see pick — same option semantics.\n */\n override async place(carrier: Component, holder: Component, options: MoveOptions = {}): Promise<void> {\n if (!holder || !carrier) {\n // holder/carrier 가 dispose 됐거나 호출자가 null 인자 전달한 케이스 — 명시 throw.\n // 이전 silent return 은 *pickAndPlace 의 sequence* (pick → place → goHome) 가\n // place 를 skip 하고 *home 으로 진행* 하게 만들어 결함 (carrier 들고 home).\n // 호출자가 catch 해서 holder 결정 재시도 또는 cancel.\n throw new Error(`RobotArm.place: ${!holder ? 'holder' : 'carrier'} is null/undefined`)\n }\n const timeoutMs = (options.timeoutMs as number | undefined) ?? 15000\n const reparentDuration = (options.reparentDuration as number | undefined) ?? 800\n const clearance = (options.approachClearance as number | undefined) ?? 10\n const carrierDepth = resolveDepth(carrier)\n // Phase G5.2 — holder 가 acceptanceRotation 을 선언하면 그 world equivalent\n // (deliveryWorldRotation) 의 yaw 를 TCP yaw 로 사용. 그러면 carrier 가 holder\n // 의 acceptance pose 와 정확히 일치한 채 release 되어 handoff 시 zero-delta\n // (시각적 점프 없음). holder 가 미정의면 holder 자체의 world yaw 사용\n // (이전 동작).\n const yaw = this._deliveryYawOf(holder, carrier)\n // Phase G9 — carrier 도 함께 전달해 holder 의 deliveryWorldPosition 을 정확히\n // query. holder 가 contract 노출 안 하면 fallback (object3d 원점) 으로.\n const target = this._targetFor(holder, carrierDepth, yaw, carrier) // top-of-carrier after drop\n const approach = this._targetFor(holder, carrierDepth + clearance, yaw, carrier)\n\n this.set('target', approach)\n await waitForTcpReached(this, timeoutMs)\n\n this.set('target', target)\n await waitForTcpReached(this, timeoutMs)\n\n // Holder 가 currently full 이면 *canReceive 가 true 될 때까지 polling 대기*.\n // robot 이 carrier 를 들고 있으니 *조용히 포기 / home 으로 가는* 동작은 부적절 —\n // 둘 자리가 비울 때까지 자연 대기가 real-world model. options.placeTimeoutMs\n // 미명시 기본은 *영원 대기*.\n const canReceiveFn = (holder as any)?.canReceive\n if (typeof canReceiveFn === 'function') {\n const placeTimeoutMs = (options as any).placeTimeoutMs as number | undefined\n const startedAt = (this.root as any)?.frameClock?.simTime ?? Date.now()\n const now = () => (this.root as any)?.frameClock?.simTime ?? Date.now()\n while (!canReceiveFn.call(holder, carrier)) {\n if (placeTimeoutMs !== undefined && now() - startedAt > placeTimeoutMs) {\n throw new Error(`RobotArm.place: holder did not become available within ${placeTimeoutMs}ms`)\n }\n await sleep(200, this)\n }\n }\n\n // animated:false — ContainerCapacity.receive 의 reparent transition 과\n // holder 의 transfer-received listener (예: InductStation.receiveItem) 의\n // transitionEffect 가 중복 begin → cancel + jump → 튐. reparent snap +\n // holder 측 transition 만 작동.\n const xferOptions = { animated: false, duration: reparentDuration }\n const canDispatch =\n typeof (this as any).dispatch === 'function' && typeof (holder as any).receive === 'function'\n if (canDispatch) {\n // Case A — ContainerCapacity path. dispatch 내부에서 Transfer + mark cleanup.\n await (this as any).dispatch(carrier, holder, xferOptions)\n } else {\n // Case B fallback — holder 가 ContainerCapacity 미구현 (예: plain Spot).\n // Transfer 객체로 wrap → panel 가시성 + physical 안에서 mark cleanup + reparent.\n try {\n new (Transfer as any)({\n source: this,\n target: holder,\n carrier,\n options: xferOptions,\n physical: async () => {\n delete (carrier as any)._transferSlotId\n ;(holder as any).reparent?.(carrier, xferOptions)\n }\n }).executeSync()\n } catch (e) {\n throw new Error('RobotArm.place: holder reparent failed', { cause: e })\n }\n }\n this.set('gripper', { ...(this.state.gripper ?? {}), state: 0 })\n await sleep(reparentDuration, this)\n }\n\n /**\n * `pickAndPlace` is inherited from the `Mover` mixin default — runs\n * `pick(carrier)` then `place(carrier, holder)` sequentially. The\n * decomposition is safe: the carrier's world position only matters\n * during pick (carrier-relative waypoints), and after pick the carrier\n * is the TCP's child (so re-querying it would chase its own tail —\n * which we don't, since place uses holder-relative waypoints only).\n *\n * @example\n * ```ts\n * await robotArm.pickAndPlace(box, spotB)\n * await robotArm.pnp(parcel, palletA, { approachClearance: 30 })\n * ```\n */\n /** Short alias for `pickAndPlace`. Same arguments, same behavior. */\n pnp(carrier: Component, placeHolder: Component, options?: MoveOptions): Promise<void> {\n return this.pickAndPlace(carrier, placeHolder, options)\n }\n\n /**\n * Return all joints to the configured home pose (state.joints / state.jointN).\n *\n * IK target 을 클리어하고 forward joint 제어로 부드럽게 휴식 포즈로 복귀.\n * `pickAndPlace` 의 마지막 단계로 자동 호출되며, 사용자가 명시적으로 호출도 가능.\n *\n * **인터럽트 가능**: 집에 도달하기 전에 새 `pick`/`place` 가 호출되면 (`set('target', ...)`)\n * `_retargetIk()` 가 발동되어 smoothing 이 home 으로 가던 걸 멈추고 새 IK target 쪽으로\n * redirect. mid-flight joint 값을 새 IK 의 시작점으로 사용해 끊김 없이 전환. tcp-reached\n * 가 redirect 후의 새 target 에서 발생하면 goHome 의 await 도 함께 resolve (정상).\n * 즉 \"집으로 가다가 다음 pick 으로 자연스럽게 이어진다\".\n *\n * @param options.timeoutMs joint smoothing 의 'tcp-reached' 대기 timeout (default 15000ms).\n */\n async goHome(options: MoveOptions = {}): Promise<void> {\n const timeoutMs = (options.timeoutMs as number | undefined) ?? 15000\n const ro = this._realObject as any\n if (!ro?.moveJointsTo || !ro?.getHomeJoints) return\n // IK target 제거 — 다음 rebuild 시 _smoothing.target 이 IK 로 다시 풀리지 않도록.\n // 외부에서 set('target', ...) 호출하면 다시 IK 모드로 전환되며 redirect.\n this.set('target', undefined)\n ro.moveJointsTo(ro.getHomeJoints())\n await waitForTcpReached(this, timeoutMs)\n }\n\n /**\n * pick → place → goHome 시퀀스. 마지막에 home pose 복귀가 robot-arm 의\n * pickAndPlace 표준 동작. (Mover mixin 의 default 는 pick + place 만)\n */\n override async pickAndPlace(\n carrier: Component,\n holder: Component,\n options: MoveOptions = {}\n ): Promise<void> {\n await this.pick(carrier, options)\n await this.place(carrier, holder, options)\n await this.goHome(options)\n }\n\n /**\n * Resolve a TCP position in this arm's chain-local frame.\n *\n * Resolution priority:\n * 1. `attachPointFor` (CarrierHolder) — canonical TCP frame for arms /\n * Spot pads / gripper-on-gripper.\n * 2. `deliveryWorldPosition` (Phase G9 — Holder contract). Holder 가\n * ContainerCapacity 의 default 또는 자체 override 로 정확한 도달\n * world XYZ 를 직접 제공. 이전 SCAFFOLDING 의 cz 공식 역연산이\n * 여기로 이전됨.\n * 3. Component's own `_realObject.object3d` world center.\n * 4. 2D bounds center (only before 3D builds).\n *\n * `carrierForDelivery` 가 주어지면 (place 케이스) `component` 를 holder 로\n * 간주하고 `component.deliveryWorldPosition(carrierForDelivery)` 를 query.\n * 미지정 (pick 케이스 — `component` 자체가 carrier) 시 #3 으로.\n *\n * `worldYOffset` is added to the resolved world Y before projecting\n * back to chain-local — used by pickAndPlace to lift the TCP above\n * the target (approach waypoints) and to land it on the carrier's\n * top face rather than its volumetric center.\n */\n private _targetFor(\n component: Component,\n worldYOffset = 0,\n yaw?: number,\n carrierForDelivery?: Component\n ): { x: number; y: number; z: number; yaw?: number } {\n const ro3d = this._realObject\n\n let baseWp: THREE.Vector3 | undefined\n // Prefer holder's attach frame when available.\n const attachPointFor = (component as any).attachPointFor\n if (typeof attachPointFor === 'function') {\n const point = attachPointFor.call(component, this)\n if (point?.attach) {\n point.attach.updateWorldMatrix?.(true, false)\n baseWp = point.attach.getWorldPosition?.(new THREE.Vector3())\n }\n }\n if (!baseWp) {\n // Phase G9 — Holder.deliveryWorldPosition contract 를 우선 사용 (place\n // 케이스: carrierForDelivery 가 주어진 경우). ContainerCapacity 가 default\n // 로 receivingSurfaceY/geometricOffsetY 보정 + 표면 변환을 제공하므로\n // robot-arm 이 cz 공식 역연산을 직접 알지 않아도 됨.\n if (carrierForDelivery) {\n const deliveryPos = (component as any).deliveryWorldPosition?.(carrierForDelivery)\n if (deliveryPos) {\n baseWp = new THREE.Vector3(deliveryPos.x, deliveryPos.y, deliveryPos.z)\n }\n }\n // Fallback (pick 케이스 또는 holder 가 contract 미노출): component 자체의\n // obj3d world center.\n if (!baseWp) {\n const obj = (component as any)._realObject?.object3d\n if (obj) {\n obj.updateWorldMatrix(true, false)\n baseWp = obj.getWorldPosition(new THREE.Vector3())\n }\n }\n }\n if (!ro3d || !baseWp) {\n // Final fallback: 2D bounds center — only before 3D builds.\n const c = component.center\n return { x: c.x, y: worldYOffset, z: c.y, yaw }\n }\n const local = ro3d.worldToChainLocal(baseWp.x, baseWp.y + worldYOffset, baseWp.z)\n return { x: local.x, y: local.y, z: local.z, yaw }\n }\n\n /**\n * Extract a component's world yaw (rotation around world +Y) from its\n * 3D object's world matrix. Returns 0 if the object isn't built yet.\n * Used by `pickAndPlace` so the gripper can match the carrier's /\n * placeHolder's current orientation — preventing a yaw snap at the\n * moment of reparent.\n */\n private _yawOf(component: Component): number {\n const obj = (component as any)._realObject?.object3d\n if (!obj) return 0\n obj.updateWorldMatrix(true, false)\n const q = new THREE.Quaternion()\n obj.getWorldQuaternion(q)\n const e = new THREE.Euler().setFromQuaternion(q, 'YXZ')\n return e.y\n }\n\n /**\n * Phase G5.2 — Delivery yaw 결정.\n *\n * holder 가 ContainerCapacity contract 의 deliveryWorldRotation 을 노출하면\n * 그 world quaternion 에서 yaw 를 추출 (carrier 가 acceptance pose 와 일치\n * 한 채 release 되도록). InductStation 같은 holder 가 sorter forward 방향을\n * 자기 acceptanceRotation 으로 선언하면 자동으로 그 방향이 TCP yaw 가 됨.\n *\n * holder 가 deliveryWorldRotation 을 안 노출하거나 _realObject 미빌드 시\n * 기존 동작 (holder 자체의 world yaw) 으로 fallback.\n */\n private _deliveryYawOf(holder: Component, carrier: Component): number {\n if (!holder) return 0\n const deliveryRot = (holder as any).deliveryWorldRotation?.(carrier)\n if (deliveryRot) {\n const q = new THREE.Quaternion(deliveryRot.x, deliveryRot.y, deliveryRot.z, deliveryRot.w)\n const e = new THREE.Euler().setFromQuaternion(q, 'YXZ')\n return e.y\n }\n return this._yawOf(holder)\n }\n}\n\n/**\n * Resolve when the robot arm fires `tcp-reached`, reject on **simulation-time**\n * timeout. 3D smoothing 은 frameClock 의 simDt 로 진행 (sim-time-driven),\n * 따라서 timeout 도 sim-time 으로 누적해야 sim speed 변경에 일관 동작:\n * - speed=1 → sim time = real time (기존과 동일)\n * - speed=2 → IK 도 2× 빨라지고 timeout 도 2× 빠르게 도달 (real time 기준)\n * - speed=0.5 → IK 가 2× 느려지지만 timeout 도 sim 기준이라 spurious\n * reject 없음 (이전 real-time setTimeout 으로는 1 미만 speed\n * 에서 IK 도달 전에 timeout 발화하던 버그 수정)\n * - paused → simDt=0 누적도 정지 → 일시정지 동안 무한 대기 (의도)\n */\nfunction waitForTcpReached(component: Component, timeoutMs: number): Promise<void> {\n return new Promise((resolve, reject) => {\n let elapsedSim = 0\n let unsub: (() => void) | null = null\n const cleanup = () => {\n component.off('tcp-reached', onReached)\n if (unsub) {\n ;(component as any)._moverActiveUnsubs?.delete(unsub)\n unsub()\n unsub = null\n }\n }\n const onReached = () => {\n cleanup()\n resolve()\n }\n component.on('tcp-reached', onReached)\n unsub = frameClock.subscribe(\n simDt => {\n // robot 이 dispose 되면 즉시 빠져나옴.\n if ((component as any)._moverDisposed) { cleanup(); resolve(); return }\n elapsedSim += simDt\n if (elapsedSim >= timeoutMs) {\n cleanup()\n reject(new Error('TCP reach timeout'))\n }\n },\n { description: 'robot-arm tcp-reached timeout', component }\n )\n ;(component as any)._moverActiveUnsubs?.add(unsub)\n })\n}\n\n/**\n * sim-time aware sleep — frameClock 의 simDt 를 누적해 ms 도달 시 resolve.\n * speed=0.5 이면 real time 으로 2배 걸리지만 sim time 으로는 동일 — animation\n * 시간과 일관. paused 시 무한 대기 (의도). waitForTcpReached 와 같은 시간축.\n */\nfunction sleep(ms: number, component?: Component): Promise<void> {\n return new Promise(resolve => {\n let elapsedSim = 0\n let unsub: (() => void) | null = null\n const cleanup = () => {\n if (unsub) {\n if (component) (component as any)._moverActiveUnsubs?.delete(unsub)\n unsub()\n unsub = null\n }\n }\n unsub = frameClock.subscribe(\n simDt => {\n // component 가 dispose 되면 즉시 빠져나옴 (closure 강참조 해제).\n if (component && (component as any)._moverDisposed) { cleanup(); resolve(); return }\n elapsedSim += simDt\n if (elapsedSim >= ms) {\n cleanup()\n resolve()\n }\n },\n { description: 'robot-arm sim-sleep', component }\n )\n if (component) (component as any)._moverActiveUnsubs?.add(unsub)\n })\n}\n\nfunction numOr(v: unknown, dflt: number): number {\n return typeof v === 'number' && Number.isFinite(v) ? v : dflt\n}\n\n/**\n * Resolve a component's 3D height. things-scene v10 carriers (Box, Pallet,\n * etc.) typically declare `static defaultDepth` rather than setting\n * `state.depth`, so reading state alone returns 0 — wrong for a\n * default-sized box. The framework resolves the actual value into\n * `_realObject.effectiveDepth`. Falls back to `state.depth` for\n * components built before their RealObject exists.\n */\nfunction resolveDepth(c: Component): number {\n const eff = (c as any)?._realObject?.effectiveDepth\n if (typeof eff === 'number' && Number.isFinite(eff)) return eff\n return numOr((c as any)?.state?.depth, 0)\n}\n\nfunction pickColor(...candidates: unknown[]): string {\n for (const c of candidates) {\n if (typeof c === 'string' && c && c !== 'transparent') return c\n }\n return '#888'\n}\n"]}
@@ -89,6 +89,7 @@ declare const TactTimer_base: (new (...args: any[]) => {
89
89
  setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
90
90
  get model(): any;
91
91
  get state(): import("@hatiolab/things-scene").State;
92
+ get refid(): any;
92
93
  get hierarchy(): any;
93
94
  get volatile(): never[];
94
95
  _applyProps(target: any, props: any, options: any): any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@operato/scene-manufacturing",
3
3
  "description": "Things scene components for manufacturing industry",
4
- "version": "10.0.0-beta.56",
4
+ "version": "10.0.0-beta.58",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "things-scene": true,
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@hatiolab/things-scene": "^10.0.0-beta.1",
33
- "@operato/scene-base": "^10.0.0-beta.56",
33
+ "@operato/scene-base": "^10.0.0-beta.58",
34
34
  "three": "^0.183.0"
35
35
  },
36
36
  "devDependencies": {
@@ -66,5 +66,5 @@
66
66
  "prettier --write"
67
67
  ]
68
68
  },
69
- "gitHead": "0f2063b2545025837fa21ef15bfb47e7b4a07f1d"
69
+ "gitHead": "89aeb338a2a685bfe67b89ed532537bfe7564092"
70
70
  }