MH-FLOCKE MH-FLOCKE
HomeDocsGitHubBlogPapersYouTubeReddit𝕏

v0.4.3: The Wall — When a Spiking Neural Network Learns to Stop

12 Apr 2026 4 min read Marc Hesse
v0.4.3: The Wall — When a Spiking Neural Network Learns to Stop

A dog doesn’t need to crash into a wall twice. The first bump tells the whiskers something is wrong, the brainstem slams the brakes, and the cerebellum remembers: next time, slow down earlier.

Today’s update teaches the Freenove robot dog the same lesson — using the same biological architecture.

The Experiment

The setup is simple: a small quadruped robot, 232 spiking neurons, a wall 80cm ahead. No pre-programming, no path planner, no reward shaping beyond “hitting the wall is bad.” The question: can a biologically grounded spiking neural network learn active behavior change from a clear binary signal?

The answer, after 9 bug fixes and 8 training runs: yes.

What I Found (and What Broke Along the Way)

The first seven runs produced corrections of exactly 0.0000. The cerebellum was learning — PF→PkC weights were growing — but the corrections never reached the motors. Three fundamental architecture bugs were hiding in the pipeline:

Bug 1: The DCN was deaf. Deep Cerebellar Nuclei compute motor corrections as the difference between “push” and “pull” populations. But the DCN was reading Purkinje cell spike activity — an exponential moving average that was essentially zero because PkC rarely fire discrete spikes. The fix: read the graded compartment state (apical voltage + dendritic calcium), not just spikes. This is more biologically accurate — PkC→DCN synapses show graded GABAergic release proportional to membrane potential.

Bug 2: Symmetric climbing fibers. When the robot hit the wall, the Inferior Olive sent identical error signals to both push and pull Purkinje cells. Identical calcium → identical DCN inhibition → push minus pull = zero → corrections = zero. Always. The fix: asymmetric CF — push PkC get strong CF (0.9), pull PkC get weak CF (0.1). Biology does the same thing: when an animal hits an obstacle, the correction is to reduce forward drive and increase braking.

Bug 3: Weighted blending killed corrections. The CPG-SNN blend was cpg × weight + correction × (1 - weight). With CPG at 90%, corrections were multiplied by 0.1 — a 10× attenuation. The fix: additive blendingcpg × weight + correction. The cerebellum modulates the CPG via the reticulospinal tract; it doesn’t compete with it.

The Breakthrough: Run 8

After fixing all three bugs, Run 8 showed something I’d never seen before:

The robot walks toward the wall. The ultrasonic sensor (Channel 18) fires. DA drops from 0.22 to 0.05. The obstacle climbing fiber activates asymmetrically. The cerebellum learns. After each collision, the robot is reset to the start — like a puppy’s owner picking it up after it bumps into furniture.

The Architecture

The obstacle avoidance system adds three new components to MH-FLOCKE’s biological stack:

Ultrasonic Sensor (Channel 18): Simulated HC-SR04 rangefinder in MuJoCo, real HC-SR04 on the Raspberry Pi. Same encoding in both: nonlinear proximity mapping (√ function for urgency). The sensor channel is identical between simulation and hardware, enabling direct brain transfer.

Obstacle Climbing Fiber: Three zones with asymmetric error signals — COLLISION (<10cm, strong CF on push PkC), DANGER (<30cm, graded asymmetric CF), WARNING (<80cm, hip yaw CF for turning).

Trigeminal Brake: A hardwired reflex that reduces CPG amplitude near obstacles. Without this, the CPG at 90% overpowers any cerebellar correction. The brake creates space for learning.

What This Means

This is the first time in MH-FLOCKE’s history that the SNN has produced non-zero motor corrections that actually changed the robot’s behavior. The CPG handoff — from 90% to 55% — means the spiking neural network is taking over motor control from the innate rhythm generator.

The graded DCN fix alone improves every training run, not just obstacle scenes. Any user cloning the repo now gets a cerebellum that actually works.

Try It

git clone https://github.com/MarcHesse/mhflocke
cd mhflocke

# Obstacle avoidance (Freenove, 20k steps)
python scripts/train_v032.py --creature-name freenove \
  --scene "walk toward wall" --steps 20000 \
  --no-terrain --no-sensory --no-vision --hardware-sensors \
  --auto-reset 500 --fresh

# Normal walking (Go2, flat)
python scripts/train_v032.py --creature-name go2 \
  --scene "walk on flat meadow" --steps 50000 --no-terrain

What’s Next

The 50k run with episodic wall training, the same experiment on the Go2 (4,500 neurons), and eventually on the real Freenove hardware with the HC-SR04 sensor. The wall is just the beginning — the architecture now supports any binary sensory signal → cerebellar correction loop.

Named after Flocke — my dog who never needed 9 bug fixes to avoid a wall.

#cerebellum #CPG #DCN #Freenove #obstacle avoidance #R-STDP #SNN #ultrasonic