EPFL · CoBAR
Controlling Behavior in Simulated Animals
Built for EPFL's Controlling Behavior in Animals and Robots (CoBAR) course, this project reproduces a real Drosophila behaviour in the NeuroMechFly physics simulation (MuJoCo): a fly walks forward until it touches an obstacle, then switches to backward walking, echoing the moonwalker descending neurons (MDN) that trigger reverse locomotion in the real animal.
Touch is sensed through force sensors on the left and right aristae (antennal tips). At each simulation step the controller takes the Euclidean norm of each antenna's (x, y, z) contact force and compares it to an empirically calibrated threshold; the side with the larger force decides the turn direction, so the fly steers away from whatever it hit.
Locomotion is driven by a central pattern generator (CPG): on contact, the controller reverses the CPG's intrinsic frequencies to flip gait direction, and to match the real backward gait it raises the coxa-pitch amplitude of the hind legs while lowering it on the front legs. A small decision tree with a post-collision delay ties sensing and control together into stable obstacle avoidance.