§ CHEMOTAXIS
Spend the closed loop on something alive: the fly forages up an odor gradient. It never measures where the source is — it only compares what its left and right antennae smell, and the steering falls out of that one asymmetry.
Smell it out — live, in your browser
The real closed loop: one live MuJoCo fly running the trained controller, and a top-down arena where you drag the food source. Each control step it reads the fly's pose from the sim, evaluates the odor field C(p) = exp(−‖p − src‖ / λ) at each antenna, and feeds the two readings in. Watch the two antennae light up— brighter the more odor each one catches — and the fly bias toward the stronger side and walk in to the source. Move the source anywhere and it re-aims. The turn isn't scripted; it falls out of the cL − cR difference. (The why is unpacked just below.)
The trained forager walking the real fly, live — and smelling the source you place. Each control step it reads its thorax position + heading from the sim, samples the odor field at its two antennae, and steers up the gradient. Drag the source and watch the turn fall out of the cL − cR difference — no turn is hard-coded.
top-down · fly-centred (north up). drag anywhere to place the source.
Loading the trained controller…
live MuJoCo · the loop reads thorax pose from the sim and the odor field from the source you place, every step · loading controller…. The lateral antenna baseline (2.0 units) is deliberately wider than a real fly's — it stands in for the temporal “casting” a fly uses to amplify a weak gradient.
Why it turns: the cL − cR difference
The same idea, frozen so you can see the mechanism. A top-down odor field with the source at the centre of the bump; the fly samples concentration at two antennae, cL on the left and cR on the right, and the only thing that drives a turn is the difference cL − cR. Drag the source across the field, or grab the fly's nose to turn it, and watch the two readings and the implied turn flip.
cL − cR → turn
Δ = cL − cR+0.176↰ turn left
Left antenna 0.621, right antenna 0.445, difference cL−cR = 0.176. Odor is stronger on the left, so the fly turns left.
cL and cR. The steering you see is emergent: whenever one antenna reads stronger, turning toward it is enough to climb the gradient. No turn is hard-coded.It reaches the source — turning both ways
Two recorded rollouts of the trained fly: the source to its left and to its right. Same controller, opposite turns — and the turn is emergent, the controller's response to a left-vs-right antenna difference, never a hard-coded rule. Across the three trained directions — ahead (0.36), left (2.02), right (0.52) — it reaches the source on all 3 of 3 (closest-approach distance, world units).
Every path, top-down
The same three rollouts as a map: from one spawn, the fly's path curving to the source whether it's placed ahead, left, or right. The source is marked, the dashed ring is the 3-unit reach radius, and the closest approach is annotated.
cL − cR antenna difference rather than any hard-coded rule.What it senses
A bilateral odor gradient. Two new sensor channels — the odor concentration at the left and right antenna — written back into the grid each control step, exactly the way proprioception is wired in the Sensing tab (the controller grows to 8→16: 4 state + 2 proprioception + 2 chemo). Absolute concentration barely matters; the signal that carries direction is the difference between the two. This is tropotaxis — steering by a simultaneous left−right comparison across a paired sensor.
The reward
Get closer to the source. Fitness rewards closest approach to the source over an episode (a documented deviation from a literal end-distance reward: the warm-started walker overshoots, so closest-approach is what cleanly scores how well it steered; arriving-and-stopping is future work). No term tells it which wayto turn; that has to be discovered. (Don't read the fitness scalar against the other behaviors — it's a different objective.)
The result
It reaches the source on all three trained directions, and steering is emergent. Warm-started from the closed-loop walker (so it still walks and stays robust), the 1236-param controller reaches the source placed ahead (0°, closest 0.36), left (90°, 2.02), and right (270°, 0.52) — 3/3. Nothing in the controller says “turn toward the stronger antenna”; that reflex falls out of cL − cR under selection. Two honest caveats: the antenna lateral baseline (2.0 units) is deliberately wider than biological— it stands in for the temporal “casting” a real fly uses to amplify a weak instantaneous gradient — and only the symmetric ahead / left / right cases were trained: 180° (behind) is out of scope (a ~180° U-turn inside the 3 s rollout) and stayed unreached.
Connectome link
Real insects navigate odor gradients with exactly this bilateral comparison — paired antennae in flies, the two antennal lobes, spatial sampling in walking Drosophila; larvae and ants do the analogous left−right trick by casting their heads. It is also the shape of Eon's embodied foragingdemo, where a connectome-driven body chases a resource. It's a closed-loop rung on the Embodied ladder: a hand-built sensor front-end now, a real olfactory sub-circuit from the connectome later.
The math behind this — equations and constants — is in the appendix.