Half-centre oscillators with fatigue drive a walking figure. Tune coupling & frequency to switch gaits.
A central pattern generator (CPG) is a neural circuit that produces rhythmic motor output — walking, swimming, breathing — without rhythmic sensory input. Here each limb is driven by a half-centre oscillator: two neuron pools that mutually inhibit each other, with a slow fatigue (adaptation) current that forces them to take turns. Four such CPGs are coupled with phase lags to drive a four-legged figure across the screen.
Each half-centre pool i obeys a leaky firing-rate unit with adaptation:
where x_j is the antagonist (mutual inhibition w), a_i is the adaptation/fatigue variable, b its strength, and coupling_i sums phase-shifted drive from other legs.
In 1911 Thomas Graham Brown showed that a cat with its spinal cord cut off from the brain and stripped of sensory feedback could still produce rhythmic stepping — proof that the rhythm of walking is generated centrally, inside the spinal cord itself.
Central pattern generators, half-centre oscillators and the neuroscience of gait.
What is a central pattern generator?
A central pattern generator (CPG) is a neural circuit in the spinal cord or brainstem that produces rhythmic, patterned motor output — such as walking, swimming, chewing or breathing — without requiring rhythmic sensory feedback or descending commands.
How does a half-centre oscillator work?
Two neuron pools (half-centres) mutually inhibit each other. When one is active it suppresses the other; a slow adaptation or fatigue current gradually weakens the active pool until inhibition fails, allowing the other pool to take over. This alternation produces a self-sustaining rhythm of antagonistic bursts, like flexor and extensor muscles.
Do CPGs need sensory input to work?
No. A defining feature of CPGs is that they generate rhythm intrinsically. Deafferented (sensory-cut) preparations still produce fictive locomotion. Sensory feedback is not required to create the rhythm but it does shape, correct and stabilise it during real movement.
Adaptation is a slow self-inhibition that builds up while a neuron pool is active and decays while it is silent. Biologically it represents currents such as calcium-activated potassium or slow sodium inactivation. It is the mechanism that lets the dominant half-centre switch off so its partner can switch on.
Each limb is driven by its own CPG. Coupling these oscillators with fixed phase lags sets the inter-limb timing. A diagonal lag pattern gives a trot; an evenly spaced quarter-cycle pattern gives a lateral-sequence walk. Changing the coupling and frequency reorganises these phase relationships, switching the gait.
In this simulation walk uses larger inter-limb phase lags at lower frequency, so feet land one after another in a 4-beat pattern. Trot uses diagonal coupling at higher frequency, so diagonally opposite legs move together in a 2-beat pattern. Raising frequency and coupling shifts the figure from walk to trot.
CPGs are found throughout the animal kingdom — from leech swimming and lamprey undulation to cat and human locomotion. The same half-centre principle inspires robotics, where CPG controllers generate adaptive, energy-efficient gaits for legged and snake-like robots.
Thomas Graham Brown proposed the half-centre hypothesis around 1911, showing that decerebrate, deafferented cats could still produce rhythmic stepping. This challenged the earlier reflex-chain theory and established that rhythm can be generated centrally within the spinal cord.
The traces plot the firing activity of each half-centre over time. You can see the alternating bursts: when one trace rises the antagonist falls. Comparing traces across legs reveals the phase lags that define the gait.
Stronger coupling between limb oscillators pulls their phases toward the relationship enforced by the connection pattern. With diagonal connections strong coupling locks diagonal legs in phase, producing a clean trot; weak coupling lets the natural phase lags spread the steps into a walk.
Engineers build artificial CPGs to control legged robots and exoskeletons, giving smooth, adaptable rhythms with few parameters. In medicine, understanding spinal CPGs guides rehabilitation after spinal cord injury, including epidural stimulation that reactivates dormant locomotor circuits.
A central pattern generator (CPG) is a neural circuit located in the spinal cord or brainstem that autonomously produces rhythmic, coordinated motor output — such as walking, swimming, or breathing — without requiring rhythmic sensory feedback from the periphery. This simulation models four coupled half-centre oscillators, one per limb, each consisting of two mutually inhibiting neuron pools (flexor and extensor) that alternate activity through a slow fatigue mechanism called adaptation. By adjusting frequency, coupling strength, mutual inhibition, and adaptation rate, you can observe how the inter-limb phase relationships shift to produce different gaits.
CPGs are found across the animal kingdom, from the lamprey's undulating spinal cord to the human locomotor network, and their principles underpin the design of bio-inspired robots and neuroprosthetic devices for spinal cord injury rehabilitation.
A central pattern generator is a neural circuit in the spinal cord or brainstem capable of producing rhythmic, patterned motor output — such as walking, swimming, chewing, or breathing — without requiring rhythmic sensory input or descending commands from the brain. The rhythm arises intrinsically from the synaptic and membrane properties of the circuit itself, making CPGs the fundamental engine of repetitive motor behavior.
Click the Walk or Trot preset buttons to load a pre-configured coupling pattern and frequency. You can then fine-tune behavior using the four sliders: Frequency sets the step rate in Hz, Coupling strength controls how strongly each leg's oscillator pulls the others into the correct phase relationship, Mutual inhibition sets how hard the flexor and extensor pools suppress each other, and Adaptation controls the fatigue rate that drives oscillator switching. Increasing frequency and coupling while in trot mode will tighten the diagonal synchrony; reducing them loosens it back toward a walk.
The traces display the firing rate of the flexor half-centre pool for each of the four legs (FL, FR, HL, HR) over time. When a trace is high, that leg is in swing (being lifted); when it is low, the extensor pool dominates and the leg is in stance (on the ground). The relative timing of peaks across the four lanes reveals the inter-limb phase lags that define the current gait — evenly spaced peaks for a walk, paired diagonal peaks for a trot.
Adaptation is a slow self-inhibitory process that builds up in a neuron pool while it is active and decays while it is silent. Biologically it corresponds to currents such as the calcium-activated potassium current (I_AHP) or slow sodium inactivation. In a half-centre oscillator, adaptation is the escape mechanism: the dominant (active) pool gradually fatigues itself until it can no longer suppress its antagonist, allowing the partner pool to burst into activity. Without adaptation, mutual inhibition alone would lock one pool permanently active — the rhythm requires this timed release to sustain alternation indefinitely.
Each neuron pool is modelled as a firing-rate unit obeying: tau * dx/dt = -x + S(I - w*x_anti - b*a + c_coupling), where x is firing rate, x_anti is the antagonist pool's rate, a is the adaptation variable governed by tau_a * da/dt = -a + x, and S(u) = 1/(1 + exp(-4u)) is a sigmoid activation. The parameters w (mutual inhibition), b (adaptation strength), and c (inter-limb coupling) are user-tunable. The time constants tau and tau_a scale inversely with frequency, so raising the Frequency slider compresses the oscillation period uniformly across all four CPGs.
The four-limb coupled CPG model captures the essential architecture of quadruped gait generation seen in cats, horses, and dogs. The walk preset mirrors the lateral-sequence walk used by most mammals at low speeds, where each foot lands approximately one quarter-cycle after the previous one in a 4-beat pattern. The trot preset mirrors the diagonal-couplet trot used at moderate speeds, where the fore-left leg moves in synchrony with the hind-right leg and vice versa. The same CPG principles also describe bipedal walking in humans and undulatory swimming in lampreys and leeches.
A common misconception is that rhythmic movement requires continuous commands from the brain or continuous sensory feedback. In fact, isolated spinal cord preparations from cats and other vertebrates — with the brain disconnected and sensory nerves cut — still produce coordinated fictive locomotion when the spinal cord is pharmacologically activated. The brain sets the speed and initiates movement, and sensory feedback corrects and stabilises it in real time, but the fundamental rhythm is generated entirely within the spinal cord CPG circuitry itself.
Thomas Graham Brown, a Scottish physiologist, published the half-centre hypothesis in 1911. Working with decerebrate, deafferented cats, he demonstrated that rhythmic alternating flexor and extensor bursts persisted even after all afferent (sensory) inputs were severed — directly contradicting the dominant reflex-chain theory championed by Charles Sherrington, which held that each step was triggered by the sensory feedback from the previous one. Brown's work established the central origin of locomotor rhythm, though it was largely overlooked until the 1960s when Sten Grillner revived and extended it.
CPGs belong to the broader family of coupled nonlinear oscillators studied in computational neuroscience and dynamical systems. Related simulations include the Hodgkin-Huxley neuron model (the ionic basis of action potentials that underlie CPG activity), the FitzHugh-Nagumo oscillator (a simplified two-variable excitable cell model), and Kuramoto-type coupled phase oscillators (which describe inter-limb synchronisation at an abstract level). In biology, CPGs are also implicated in respiration (the pre-Botzinger complex in the brainstem), chewing, swallowing, scratching, and circadian rhythm generation.
Engineers implement artificial CPGs as the locomotion controllers for legged robots, snake robots, and exoskeletons because they generate smooth, energy-efficient, and adaptable rhythmic gaits with very few tunable parameters. Coupling the robot's joint actuators through a CPG network allows the system to respond to terrain perturbations and speed changes without high-level replanning. In biomedical engineering, epidural electrical stimulation of the lumbar spinal cord at frequencies that activate dormant CPG circuitry has enabled people with complete spinal cord injury to take voluntary steps, a breakthrough demonstrated by the Courtine and Minassian groups between 2018 and 2022.
Active research areas include: identifying the specific neuron types and synaptic connections that form CPG circuits in the mammalian spinal cord using optogenetics and single-cell sequencing; understanding how CPGs adapt their output to changing loads and speeds through sensory feedback integration (neuromodulation by dopamine and serotonin plays a key role); developing closed-loop neurostimulation systems that read ongoing CPG-like activity from the spinal cord and deliver precisely timed epidural pulses to restore walking after paralysis; and building computational models that bridge the gap between the abstract rate-model used here and the detailed conductance-based neuron models needed to predict stimulation protocols for individual patients.