Swimmer

An abstract anguilliform swimmer: a chain of capsules in a viscous fluid that swims by sending a wave along its body. It is the simplest body that swims this way, which makes it a good first model for asking how body length, taper, joint stiffness and the shape of the body wave trade speed against energy.

Head-first distance –

The sliders change the CPG while it runs; the simulation restarts every 30 s. Drag to orbit, right-drag or shift-drag to pan, scroll to zoom. Physics runs in your browser with the official MuJoCo WebAssembly build.

What you are seeing

The default 8-segment swimmer of swimmer/head_first_swimming, driven by a chain of coupled Van der Pol oscillators (a central pattern generator), one per segment. Each joint's servo follows its oscillator. The forward coupling is stronger than the backward one, so the body wave runs from head to tail and the swimmer moves head first, about 1.45 m in 10 s. Reverse the wave and it swims tail first.

The fluid is MuJoCo's ellipsoid fluid model: drag, added mass and lift on every capsule, without a flow field, in a medium about 100 times as viscous as water. There is no gravity; the floor is only there to show the motion.

In Python

The morphology specification sets the number of segments, their taper, radius and density, and each joint's stiffness, damping and range. The task rewards the head's displacement in the head-first direction and reports the work the servos did. The ellipsoid fluid model runs on the mjc and warp backends; MJX's JAX implementation does not support it.

Read the swimmer README for the model, the task and the backends.