Fig. 2: Flight imitation.

a, Overview of RL set-up. A single policy network is trained to imitate the CoM position and body orientation across a dataset of 216 trajectories of freely flying Drosophila (around 43 s in total). The flight controller consists of a trainable MLP and a WPG. The motor command is the sum of the MLP and WPG outputs. Top right, one period of the fixed baseline wing-beat pattern produced by the WPG. Grey stripe indicates wing downstroke. b, Top, wing coordinate system and wing angle definition. Bottom, body coordinate system and example model sensory inputs: the direction to the goal CoM position and the gravity direction. c, Fluid model forces exerted on the left wing, and the corresponding wing kinematics, during a stable horizontal flight at 30 cm s−1. d, Filmstrip of the model flying straight at 30 cm s−1 during one full wing-beat cycle. e, Wing kinematics during a saccade manoeuvre produced by the model and real fly. f, Wings produce body movements through a phenomenologically modelled fluid. The real (black) and model (coloured) fly body pose while traversing a test trajectory. Circles, heads; lines, tails. g, Median and percentiles of body angular velocity, heading and speed for real and model flies during test saccades. The trajectories are aligned to peak acceleration at t = 0. Roll and pitch angular velocities (ωx and ωy) are similarly important in model flies’ and real flies’ turns. A small divergence between model and real occurs after the saccade. Solid lines, medians; shading, 25th–75th percentiles. h, Percentiles of errors between the model and the corresponding real fly’s body CoM, and orientation for 56 test trajectories. i, Wing angles during steady (small body acceleration) and unsteady (large body acceleration) wing beats for model and real flies in the test set. Large body accelerations are achieved by similarly small alterations to the median wing-beat pattern.