Steal in this order
Ranked by value to a hand-rolled pick-and-place loop, straight from the research. Do 1–4 and most of the current failure modes — swinging, dipping, clipping, mm-off placements — are gone.
- 1Quintic time scaling + waypoint state machine Steal firstFixes swinging, dipping, jerky starts and obstacle clipping in one change. ~50 lines. Every real system does exactly this. §2 ↓
- 2Orientation IK flip — no flip planner StealDeletes the hardest part of the problem by reframing it as IK. Single grasp, no regrasp. §1 ↓
- 3Grasp-offset transform correction StealOne matrix multiply, measured post-grasp from cannon.js. Converts systematic mm-level place error to ~zero. §3 ↓
- 4Slow vertical place + settle + vertical retract StealMakes pyramid stacking robust — the difference between 100% and knock-over failures. §4 ↓
- 5Pre-grasp / pre-place + safe-height transit StealThe collision-avoidance substitute that makes RRT unnecessary in an open sim.
- 6Flip-station regrasp fallback Fallback onlyCovers orientations the wrist can’t reach. Reuses the existing pick/place machine — run it twice into a V-groove cradle.
- 7Post-release verification + one bounded retry Safety netCheck the placed cup’s pose; if off-target beyond tolerance, re-grasp and re-place once.
- 8Extrinsic dexterity Skip for nowGravity rolls and edge pushes (Dafle et al.) are real and proven — but they solve a problem this system doesn’t have once #2 is in.
- 9RRT / sampling-based planning SkipThe real default for cluttered cells; overkill for an open tabletop. Add only if clutter arrives.
- 10JS IK libraries Adopt nothingNo maintained option beats hand-written analytic IK for a 5-DOF chain. §5 ↓
The flip is just the difference between two IK solutions
MoveIt literally “attaches” the grasped object to the end-effector link in its planning scene. Copy that mental model: grasp a side-lying cup with the gripper axis aligned to the cup’s axis (wrist pitched ~90°, gripper pointing horizontally), then rotate wrist pitch ~90° during lift/transport so the cup arrives upright. No in-hand motion, no regrasp, no flip planning — joint interpolation between two IK solutions does it.
Write analytic IK that takes (x, y, z, tool-axis direction, roll) — not a full 6D pose. Grasp pose = cup axis direction; place pose = straight down (upright). Interpolate joint angles between the two solutions with the quintic profile (§2) and the cup flips itself. Check the place orientation is IK-reachable before committing to the grasp — the regrasp literature’s first check is always “does one grasp serve both the initial and the goal pose?” If yes: direct transfer, no regrasp.
Why 5-DOF is enough — for cups
Six axes is the minimum to reach any orientation at any point; a 5-DOF arm gets position plus partial orientation only, so generic 6D-pose IK is off the table. Cups forgive this: a cup is rotationally symmetric about its own axis, so the orientation task collapses to 2-DOF (tilt direction + tilt angle) — which base yaw + wrist pitch cover. The practical rule: choose the grasp so the required flip is a rotation about the wrist-pitch axis (or wrist roll, for yaw misalignment).
Sources: MoveIt 2 pick pattern — github.com/dbwls99706/ros2-engineering-skills · 5-DOF partial orientation — tycherobot.com · IK for 6-DOF arms — robotacademy.net.au
The fallbacks, in order
Flip station (place-down-and-regrasp)
If the wrist can’t reach a flip, set the cup into a fixed V-groove, tilted ramp or cradle that constrains it to a known orientation, then re-grasp upright and place. This is Wan et al.’s regrasp graph reduced to one intermediate placement — no new code beyond running the standard pick/place machine twice.
Wan et al., mid-level reorientation planner — ar5iv.labs.arxiv.org/html/1608.03140 (code: github.com/wanweiwei07/hiromatlab)
Extrinsic dexterity — concept only
Chavan-Dafle & Rodriguez (ICRA 2014) reposition objects using gravity, table edges and walls — 12 open-loop, hand-scripted regrasp actions validated over 1,200+ trials; the 2018 follow-up adds “fixtureless fixturing” and robust motion cones. Powerful, but it solves changing the grasp on a held object — a problem you don’t have. In cannon.js its gravity-pivot version means tuning friction and contact: exactly the fiddly physics to avoid.
ICRA 2014 paper (U. Washington) · CASE 2018 (arXiv) · MIT summary
“Factory automation engineers avoid regrasps whenever possible. Eliminating a regrasp can halve a cycle time.”
One state machine, one easing curve
Real systems split motion into three layers: sampling-based planning for free-space transit, Cartesian straight lines near contact, and time parameterization on top. In an open tabletop sim the first layer collapses to “transit at a safe height above everything” — no RRT needed.
The canonical sequence — tap through it
Sequence per the Pilz planner + MoveIt pick pattern — pypi.org/project/devagent-physical-engine · MoveIt 2 manipulation reference
The quintic is the minimum-jerk trajectory
With zero boundary velocity and acceleration, the quintic profile is the minimum-jerk trajectory (Flash & Hogan 1985) — which is why it’s the default. Apply one profile to a scalar path parameter s ∈ [0,1] so all joints start and stop together, with limits set by the slowest joint.
Quintic vs. plain lerp — position & velocity
Peak quintic velocity is 1.875·h/T and peak acceleration is 5.7735·h/T² — so T = max(1.875·h/vmax, √(5.7735·h/amax)). Caveat: that timing formula comes from a single secondary source (the Kinetica planner page); the polynomial itself is corroborated by multiple sources.
A trapezoidal profile (constant accel → cruise → decel) is faster for the same peak limits — 1.73 s vs 2.08 s for a 1.5-rad move in one benchmark — and degenerates to a triangle for short moves. S-curves are smoothest. Quintic stays the pick for rest-to-rest sim moves: one formula, zero tuning.
Derivations & benchmarks — stanleyjacob.dev · timing formulas — kineticatrajectoryplanner.usefulweb.site · Lynch & Park, Modern Robotics Ch. 9–10, free preprint — hades.mech.northwestern.edu (PDF)
One transform multiplication
The whole game is measuring where the cup actually sits in the gripper after the grasp, instead of assuming it. Let T_world_ee be the gripper pose from forward kinematics and T_ee_obj the cup’s pose in the gripper frame — the grasp offset:
T_world_ee_desired = T_world_obj_desired · T_ee_obj⁻¹
In hardware, T_ee_obj comes from a wrist camera, depth or tactile sensing. In your sim the measurement is free and exact: after the grasp settles, read both poses from cannon.js and compute T_ee_obj = T_world_ee⁻¹ · T_world_obj once, then derive every place pose from the desired object pose — never from a nominal “gripper holds cup at origin.” In three.js that’s literally gripper.matrixWorld.invert() × cup.matrixWorld.
simPLE (Bauza et al., Science Robotics 2024) success on 1 mm-clearance placements for 6 objects using pick → localize-in-hand → regrasp → place; >80% for 11 of 15 objects. arXiv:2307.13133
Insertion success gained by a 2026 system combining post-grasp planar pose validation (image-based visual servoing) with force-based offset estimation. arXiv:2608.17691
Cheaper alternative: calibrate the offset once, offline, as the robust median of object_position − end_effector_position over successful expert lifts (reported in a simulated Franka pick-and-place system). github.com/antonia-dada
Also: Hagelskjær & Kraft, in-hand pose estimation for insertion — arXiv:2208.01284 · Frame conventions: Lynch & Park, Modern Robotics Ch. 2–3.
Quick take, put down gently
Stacking systems converge on the same four practices. For cups the pyramid is pure geometry — each upper cup sits in the pocket formed by the cups below — so the place target is fully determined by the base positions.
1 · Vertical in, vertical out
Approach the place pose from directly above along the place normal; retract straight up after release so fingers never drag sideways across neighbours. “By approaching placement vertically each time, we avoid slippage.” — Lerner et al.
2 · Slow final descent
Transport fast, then a slow quasi-static final descent at ~10–20% of transit speed. Industrial take-out robots are specified exactly this way: quick descent to remove, slow descent to place.
3 · Release only when stable
Lerner et al.’s force-torque criterion: lower until contact resistance is felt, centre the mass over the contact point, release only when the net wrench on the object is ~zero — letting go then cannot disturb it. Cannon.js analog: descend until contact, hold still one or two physics steps, then open the gripper at zero arm velocity.
4 · Build on measured positions
Compute each upper cup’s target from the measured, post-settle positions of its supporters — not the nominal ones. Placement error gets absorbed layer by layer instead of compounding up the pyramid.
Plus a 100–200 ms settle after release, and never a lateral move before the vertical retract clears. Never release while the arm is still moving laterally.
Lerner, Tam & Equi, “Precise Object Placement Using Force-Torque Feedback” — arXiv:2404.17668 · “Quick take, put down gently” industrial spec — made-in-china.com (Tongyi Machine)
Published cup-stacking numbers
Every published demo treats cup stacking as precise pick-and-place with vertical alignment — none publishes a “cup orientation trick.” That absence is itself evidence for §1: orientation is handled by the wrist.
Success rates
The published numbers reflect perception and learning error — not placement difficulty. A scripted sim with exact geometry should target ~100%.
- AIRoA-0 (Nov 2026, bimanual VLA): cup pyramid 80% over 15 trials, needing 17.9 hours of demonstrations — the second-highest data requirement of its ten tasks; its orange pyramid scored 90%. The difficulty is precision + sequencing, not perception. arXiv:2611.03815
- DexImit (RSS 2026): two-handed six-cup pyramid, 52%. roboticsproceedings.org (PDF)
- Lerner et al.: force-torque placement, 100% on basic stacking (46 trials), but only 17% on cases requiring adjustment (irregular rocks). arXiv:2404.17668
- Elephant Robotics myArm M&C (2024): small commercial arm stacking/unstacking paper cups on an air-hockey table — qualitative only, no numbers; confirms cup stacking is a standard small-arm demo. manuals.plus
- ST-VLA: “stack 5 paper cups into a stable pyramid… precise pick-and-place with vertical alignment and gravity stability.” arXiv:2603.13788
Adopt nothing — write ~60 lines of analytic IK
Honest headline from the research: there is no mature, maintained JavaScript motion-planning library for arms. OMPL/MoveIt are C++/ROS-only. The JS options are IK solvers with a fatal flaw for this task — they position the tool but don’t orient it.
| Library | What it is | Verdict |
|---|---|---|
| THREE.IK | FABRIK iterative IK for three.js; multiple chains/effectors. GitHub · docs | Inactive since 2020; FABRIK is position-only — no tool orientation, so it cannot do the cup flip by itself. |
| three.js CCDIKSolver | Ships with three.js (three/addons/animation/CCDIKSolver.js); CCD algorithm. Demo | Built for SkinnedMesh/MMD characters, not robot arms; CCD is position-only — “classic CCD does not solve for rotation of the end effector.” (layer3.space) |
| KinEval | U. Michigan EECS 367 teaching package: FK, iterative IK, RRT / RRT-Connect / RRT* in the browser. GitHub | Closest browser-native IK+RRT reference — but 2014-era stencil code. Read it; don’t depend on it. |
| fullik / webIK / fabrik-2d | JS ports of Caliko (FABRIK), VRIK, 2D FABRIK — named on jsantell.com/three-ik | Niche; same position-only limitation. Repo URLs unverified — see Open questions. |
| Modern Robotics code | Lynch & Park reference implementations: IK, trajectory generation (Ch. 9), motion planning (Ch. 10). modernrobotics.org | MATLAB/Python, not JS — but the algorithms port in an afternoon and are the canonical reference. |
| Johnny-Five | JS servo/hardware control (Node) | Hardware control only; no IK or planning. |
For a simple serial 5-DOF chain, analytic IK is simpler and orientation-aware: base yaw = atan2(y, x) · shoulder/elbow = 2-link planar law-of-cosines in the vertical plane · wrist pitch/roll from the desired tool-axis direction. ~60 lines, plus the quintic (~5 lines) and the state machine (§2). FABRIK’s paper is still worth reading — the algorithm is genuinely ~50 lines — but it can’t aim the tool.
What practitioners warn against
- Linear interpolation / no velocity profile“If you use linear math, jerk becomes infinite” — motors jump instantly to max speed and “the payload will be thrown across the room.” This is the #1 cause of carried-object swinging and dipping in hand-rolled loops: plain lerp has infinite acceleration at the endpoints. cubicequationsolver.com
- Confusing joint moves with linear movesmovej interpolates joints along an unpredictable curve — fine between free points, wrong anywhere the path itself matters. Joint interpolation for transit only; Cartesian lines near objects. nottldr.com / MechMind
- IK without a planner — or without clearance waypointsIK gives a goal configuration, not a collision-free path; straight joint interpolation to an IK solution can drive the gripper centimetres into an obstacle. Minimum mitigation: the pre-grasp/pre-place + safe-height waypoints. threads.com/@embodied.dev
- Hand-rolled in-hand flip planners / mid-air flippingParallel-jaw grippers “lack the dexterity to autonomously adjust the grasp on an object” (Chavan-Dafle & Rodriguez 2018). Even the research regrasps were open-loop, hand-scripted, and needed 1,200+ trials to validate. Toss-and-catch is the least robust option of all. Flip with the wrist, not the fingers or the air.
- Regrasping when a single grasp would doCheck single-grasp feasibility first — Wan et al.’s regrasp graph does this before anything else. A regrasp can double cycle time (Mason 2018).
- Blending through grasp/release boundaries“DevAgent never blends through grasp, the support-contact departure boundary, or release.” Come to a full stop at grasp and release; round corners only mid-transit. pypi.org
- Forgetting the carried object in planningMoveIt attaches the object to the end-effector after grasping so the planner keeps it clear. Skipping this is how carried cups clip obstacles.
- Position-only IK (CCD/FABRIK) for orientation-critical tasks“Full orientation control (aiming the tool, not just placing it) needs a Jacobian solver” — or analytic IK. CCD/FABRIK only chase a 3D position. layer3.space
- Standard MoveIt failure modesCartesian path returning a low fraction (shrink the step, add waypoints) · jerk at trajectory start (always start a segment from the actual current joints) · IK trouble near singularities · trajectories rejected for limit violations (scale velocity down).
Open questions — what the research could not verify
Marked plainly, per the report
- fullik / webIK / fabrik-2d repository URLs — named as links on jsantell.com/three-ik, but the page fetch didn’t expose their hrefs. Find them by name search before citing.
- Whether a cup-specific “flip in mid-air” demo exists — none was found; every demo located treats orientation as a wrist/IK matter. The absence is consistent with §1 but is not proof no such demo exists.
- The quintic timing constant T = max(1.875·h/v, √(5.7735·h/a)) rests on a single secondary source (Kinetica planner page). The polynomial 10τ³−15τ⁴+6τ⁵ itself is corroborated by multiple sources, including the Stanley Jacob derivation.
- THREE.IK’s GitHub URL appears verbatim in a three.js forum thread and a GitHub doc found via search, but the repo itself was not opened.
- All findings are web-index sourced (search + page fetches, read 12 Nov 2026); nothing depended on live/current state, so no live-browser verification was needed.
Built from the 12 Nov 2026 deep-research report on pick-and-place reorientation. Every number above carries its source inline. Further primary reading: Goldberg, “Geometry and Part Feeding” — goldberg.berkeley.edu (PDF) · FlexiBowl flexible feeder — universal-robots.com · Wan & Harada, single- vs dual-arm regrasp — archive.org (PDF)