Magflow: Differentiable Simulation of Industrial-Grade 6D Magnetic Levitation

TL;DR A differentiable, GPU-parallel electromagnetic simulator trains a neural controller for an industrial 6D maglev system, and the controller transfers zero-shot to the hardware at 4 kHz. It turns the mover through full yaw rotations beyond the engineered limit and levitates a plain bar magnet that no hand-built controller supports, at about 0.3 mm RMS position error against under 0.1 mm for the factory controller.
What they do
Industrial 6D maglev stays real-time through co-design: magnets and coils are shaped so that a first-harmonic “commutation” model maps a desired wrench to coil currents. That model holds only near zero yaw and for co-designed movers. Magflow instead simulates the full electromagnetics offline and trains a neural controller in it. The controller then runs unmodified on a Beckhoff XPlanar tile.
How it works
- Simulator. Written in JAX, it models cuboid magnet fields in closed form, Biot-Savart fields of 3 mm coil segments, Lorentz forces, rigid-body dynamics and the 50 three-axis Hall sensors. All of this compiles together with the controller into one GPU graph.
- Controller. A 4-layer GRU maps 150 raw Hall readings and a reference pose to currents for 24 stator units. Worst-case inference takes 242 µs, inside the 250 µs cycle.
- Training. Truncated backpropagation through time at 4 kHz, with random external wrenches and domain randomization over magnets, sensors and coils. The loss adds height, current and power limits to tracking. Each controller trains for five days on one A40.
Results
- Magflow’s field matches measurements under the mover; the first-harmonic model deviates systematically.
- Zero-shot, the controller rotates the mover through full yaw while tracking a circle of 15 mm radius. A behavior-cloned controller loses control immediately.
- Retrained for a 100×30×10 mm bar magnet, it levitates the magnet in 6D and rotates it continuously about a horizontal axis.
- On a Vicon-measured 60 s trajectory, RMS position error is 0.34/0.30/0.14 mm (x/y/z), against 0.09/0.07/0.06 mm for the proprietary controller. Simulated and real errors agree within 0.06 mm. It hovers with a 1.3 kg payload.
Limitations
It is less precise than the proprietary controller, which the authors attribute to the network, not the simulator. Tests use one tile and one mover. The simulator treats coils as thin wires and magnets as ideal cuboids and ignores ferromagnetic material. The rotating bar occasionally touches the tile.
Figures



Abstract
Magnetic levitation with six-degrees-of-freedom enables frictionless transport and micrometer-scale positioning in principle, but low-level control is inherently challenging due to its complex and unstable dynamics. Industrial systems typically rely on deep hardware-software co-design, where mover and stator geometries are jointly designed to enable a compact, hand-crafted approximation of the electromagnetic force computation, thereby keeping control computationally tractable at kilohertz rates. However, this approach imposes overly conservative constraints on the operating workspace and the range of supported mover topologies. Instead of reducing the underlying physics to a hand-crafted approximation, we compute the physics directly. We introduce Magflow, a fully differentiable, GPU-parallel simulator for 6D magnetic levitation. It is used to train the first neural controller for an industrial-grade 6D magnetic levitation system that is learned purely from simulated physics. We show that the learned neural controller transfers zero-shot from simulation to real hardware while satisfying hard real-time constraints at 4 kHz. The learned controller achieves qualitatively new behaviors and even levitates a mover topology for which no hand-crafted solution exists. These results demonstrate that co-design is not a physical necessity for 6D magnetic levitation control. More broadly, control learning from simulated physics can find solutions beyond the reach of control engineering in demanding industrial domains. Source code and demonstration videos are publicly available at https://sites.google.com/view/magflow.
Summaries are written automatically from each paper's text. Figures and videos come from the paper and its project page; all credit goes to the authors.
