Main

To understand how the nervous system controls movements, it is necessary to understand the repertoire of motor neuron-driven movements available to the brain when choreographing the motion of the body. Any given motor neuron resides deep within a nested hierarchy of neural feedback loops4,5 and can participate in many different movements in which its effects will vary, depending on the state of the rest of the motor system. Thus, a concise, interpretable, but still accurate description, of the movement generated by any given motor neuron remains a fundamental hurdle to understanding how the brain controls movement.

Drosophila offers an emerging platform in which single, identified neurons can be perturbed during behaviour, with the potential to create tools to do so for an entire motor subsystem6,7,8. Here we comprehensively analyse how the behavioural consequences of single motor neuron activation change across motor context. We perform this characterization for most of the motor neurons that control head position, revealing the contribution to behaviour of a population of the most fundamental motor elements of the nervous system.

Neck motor neurons transform vision into movement

Many behaviours incorporate head movements, which in the fly are controlled by about 25 motor neurons driving small muscles in the neck9,10 (Fig. 1a). Flies can rotate their head around all three cardinal axes (roll, pitch and yaw) and such movements are often visually driven. In particular, to stabilize its gaze, the fly must continuously adjust its head in response to visual motion11,12. To ascertain the role of an example neck motor neuron in controlling head movement in Drosophila, we first focused on the neck motor neuron CvN7 and investigated its potential role in gaze stabilization9.

Fig. 1: Motor neuron stimulation generates convergent movements.
figure 1

a,b, Schematic (a) and confocal (b) image showing neck motor neuron dendrites (green) overlapping with LPTCs (magenta; scale bar, 50 μm). Subpanel, synapse counts between LPTCs and two neck motor neurons14,16. HSS is ipsilateral to the motor neuron axons, VS1–3 and H2 are contralateral. c, CvN7 responses to downward (red) or upward (blue) local visual motion. The upward response (blue) is time-reversed so each x axis location corresponds to the same portion of visual space for both traces. d, The visual receptive field of CvN7 (Methods). Black arrows indicate the preferred visual motion direction and response magnitude. Shaded region, data from c. e, The response of CvN7 to full-field visual rotation. Thin lines, individual trials (n = 5); thick line, mean. Dotted blue line, axis of rotation predicted from d to give the strongest response. f, Behavioural setup (Methods). Images are video frames taken simultaneously from two angles; coloured dots are 3D tracked points. g, Red arrow, grand mean axis of head rotation following unilateral CvN7 stimulation; thin red lines, individual fly means. Blue arrow, axis of wide-field visual rotation that elicited the maximum response in e. h,i, Pitch movements induced by bilateral CvN7 stimulation with pitched-up (21 trials) (h) or pitched-down (11 trials) (i) starting postures. Grey lines, individual trials from several flies; black lines, mean; red region, stimulus. Positive angular velocity indicates downward head movement. j,k, The ‘action fields’ of two neurons (Methods), showing the average head rotation elicited during motor neuron activation at different starting postures. Data are plotted in ‘quaternion space’46, not Euler angles; Methods. Colour, time during stimulus. Inset, example image of neurons. j, Bilateral CvN7 (2,442 trials, 32 flies). Solid and dotted circles, starting postures of h and i, respectively. k, DproN2 (3,912 trials, 21 flies). CNS, central nervous system. NMN, neck motor neuron.

In flies, gaze stabilization uses a class of visual projection neurons, the lobula plate tangential cells13,14 (LPTCs), which detect optic flow patterns resulting from particular axes of self-rotation15. To determine if LPTCs input directly to CvN7, we double-labelled LPTCs (magenta, Fig. 1b) and CvN7 (green, Fig. 1b). This showed that the visual neuron axons wrap around the dendrites of CvN7. Reconstruction of two motor neurons in the FAFB whole-brain electron microscopy dataset16 (Extended Data Fig. 1) confirmed synaptic connectivity between five specific visual neurons in the larger bilateral LPTC population14 and the motor neurons CvN6 and CvN7 (refs. 9,17) whose dendrites branch in both sides of the brain (inset, Fig. 1b and Extended Data Fig. 1). To determine the particular optic flow pattern that CvN7 is most responsive to, we performed patch clamp recordings during visual stimulus presentation. This showed that CvN7 responds to downward visual motion (Fig. 1c). Scanning small visual stimuli across the fly’s visual field allows reconstruction of the visual receptive field of the motor neuron15,18 (Fig. 1d), the structure of which suggests that the neuron should respond most strongly during pitch-up movements that result in downward visual motion across the retina15. To test this, we presented the fly with wide-field ‘star field’ stimuli and recorded the responses of the motor neuron as the star field was rotated around different axes (Fig. 1e). CvN7 responds most strongly to rotation of the visual world around the axis predicted from the piecewise receptive field mapping (Fig. 1e, dotted line is the axis predicted from the receptive field in 1d).

If CvN7 participates in gaze stabilization, it should, in response to the pitch-up motion it detects, drive pitch-down head rotations to stabilize the fly’s gaze. We tested this by optogenetically stimulating CvN7 and measuring in three dimensions (3D) the resulting head movements (Fig. 1f). CvN7 activation pitches the head downward as predicted from its visual responses (Fig. 1g, mean axis of head rotation: 69° azimuth, 18° elevation with a spherical variance19 of 0.09 where 0 indicates that all data are perfectly aligned and 1 indicates that the data are distributed equally across the entire sphere). As in other fly species18, Drosophila neck motor neurons are thus compactly transforming the visual consequences of the fly rotating in space into the appropriate counter-rotation of the head to stabilize the fly’s gaze.

Motor neuron-induced movement is pose-dependent

Unexpectedly, the head rotations resulting from neck motor neuron stimulations were highly variable. Grouping CvN7-elicited movements by the initial posture of the head showed that the induced head rotations were highly dependent on the starting posture (Fig. 1h–j and Supplementary Videos 1 and 2). For example, when the head started in a pitched-up posture, stimulating the motor neuron-induced pitch-downward movements (Fig. 1h). However, when the head started in a pitched-down posture, activation of the same motor neuron induced much weaker movements in the opposite direction (Fig. 1i). To understand this posture dependence, we grouped trials with similar starting head postures and plotted the mean trajectory of the head for each group (Fig. 1j and Extended Data Fig. 2). We name such a plot the ‘action field’ of the motor neuron. For all starting postures, stimulating a given motor neuron caused the head posture to move towards a point of convergence in the action field (Fig. 1j). This means that stimulating the same motor neuron can lead the head to move in different directions, depending on starting posture. Which posture the head converges towards changed, depending on the identity of the motor neuron stimulated (Fig. 1k, single DproN2 motor neuron), in such a way to span the range of possible head movements (Supplementary Figs. 116).

Convergent movements resulting from microstimulation20 have previously been attributed by some21 to long and intense stimulation leading antagonistic muscles to be artificially co-activated. To test whether the convergent movements we observe are an artefact of our stimulus parameters, we tested the effect that length and intensity of stimulation had on the observed movement. We performed patch clamp recordings from the CvN7 motor neuron and identified stimulus intensities that spanned the range of action potential frequencies of the neuron (Extended Data Fig. 3). When using identical stimuli to activate CvN7 neurons in our behavioural experiments we observed convergent head movements, regardless of stimulus intensity (Extended Data Fig. 3). Increasing stimulus intensity does, however, increase the rotational velocity with which the head moves towards the convergence point (Extended Data Fig. 3). The convergence is not due to the head reaching the limit of its range of motion; the point of convergence of CvN7 is positioned 10–15° pitched down, whereas the head can pitch downward unimpeded as far as 35°. Restricting our analysis to only the first 80 ms of the stimulus period still shows convergent head movements (Extended Data Fig. 4). Similarly, excluding fast, saccadic movements of the head from our analysis or using a different head-fixed reference frame to measure rotations22 still results in convergent head movements (Extended Data Fig. 4).

Feedback model captures pose-dependence

One potential explanation for the convergence behaviour is that the motor neuron stimulus is adding an offset to the control signal in a continuing feedback loop responsible for centring the head. To test for this, we computationally extracted an estimate of the stimulus-induced control signal from the recorded head movements. The plot in Fig. 2a shows the action field for CvN7. We generate an equivalent plot for control data, in which no stimulus was present and the head showed a tendency to return to its central position (Fig. 2b). For each time point of each trajectory in these plots, we compute the rotation required to transform the posture recorded in the control trajectory to the posture recorded at the same time in the matching stimulus trajectory. The resulting trajectories are plotted in Fig. 2c. These trajectories are approximately straight, reflecting a reduction in the correlation between head posture and stimulus-induced rotation (R2 reduced from 0.45 to 0.22; Extended Data Fig. 2g). This analysis shows an approximately constant stimulus-induced offset which our optogenetic stimulus added to the head control feedback loop. The ability to extract this constant control signal from the curved and convergent head movements suggests that, although the head movement system is probably nonlinear, a linear feedback model may still be able to approximate a significant portion of the stimulus-induced behaviour.

Fig. 2: A feedback model explains the convergent movements elicited by motor neuron stimulation.
figure 2

a, The action field of the bilateral pair of CvN7 neurons (3,912 trials, 32 flies). b, The equivalent plot to a for a period of no stimulus (3,260 trials, 32 flies). c, The rotations required to transform each data point in b into its equivalent data point in a. d, The feedback model. The step-like optogenetic stimulus is bandpass filtered and drives a rotation of the head around a 3D axis (blue arrow). This drive is summed (⊗) with the weighted 3D pose and velocity of the head. This results in the modelled net rotational change (Δ) in head position which is integrated (∫) to give the modelled head position (red arrow). e, An illustration of the effect on the model of the same motor neuron stimulus delivered at different starting head postures. Grey arrows plot the acceleration vector that the feedback loop alone applies to the head (see Extended Data Fig. 5w for plot of velocity dependence). Blue arrows plot the acceleration component purely caused by the drive from the optogenetic stimulus. Red arrows plot the net head movement that occurs as a result of the interaction of the optogenetically driven activity (blue) and pose-dependent feedback (grey). f, The feedback model (FB) simulating held-out validation data. g, A feedforward (FF) model applied to the same data as in f. Any variance in trajectory length in g is due to variance in the data being simulated, not because of any postural dependence of the model. h, Percentage of simulated trials that predicted head poses within 5° of the actual head pose in the corresponding validation data. i, The NRMSE of the performance of each model (0, perfect match; 1, no better than model where head does not move).

On the basis of these results, we developed a linear feedback model in which motor neuron drive interacts with feedback carrying information about head position and velocity (Fig. 2d). The modelled head movement generated at any given time is proportional to the weighted sum of the external motor neuron stimulus and the current pose of the head (Fig. 2e). Thus, the convergent movements observed during motor neuron stimulation are modelled by the stimulus adding bias to a feedback loop that centres the head. The model was fit to half of our dataset and then used to simulate the other half without access to the data. The resulting simulated movements are qualitatively similar to the data, having the same convergent behaviour (compare Figs. 2f and 1j). The performance of the feedback model on simulating single trials was compared to that of a model without the feedback component, which reflects the more classical view that motor neurons generate the same movement independent of the animal’s initial posture (Fig. 2g). The feedback model performs better at simulating individual trials, with a normalized root mean squared error (NRMSE) of 0.4 compared to the 0.6 of the feedforward model (Fig. 2i). An NRMSE value of zero means that the model predicted the trajectory of all individual trials perfectly and an NRMSE of one means that a model where the head does not move from its initial position would have performed better. Similarly, the proportion of trials where the error in the simulated head pose was below 5° is 71% compared to the 45% of the feedforward model (Fig. 2h).

Proprioception sculpts pose-dependence

The source of postural feedback predicted by our model could be of neural or biomechanical origin. To distinguish the relative contributions of these mechanisms we performed proprioceptive manipulations, which are unlikely to affect the biomechanics but will alter any neural mechanisms reliant on proprioceptive feedback.

To perturb specific subsets of proprioceptors and change the proprioceptive feedback in a targeted manner we generated two split-GAL4 lines. Each line expresses in a different subpopulation of proprioceptive sensory neurons that innervate the neck chordotonal organ. The neck chordotonal organ is a stretch-sensitive internal mechanoreceptor9,23,24 strung parallel to the neck muscles by connective tissue (Fig. 3a–f and Extended Data Fig. 5). One sensory neuron type, which we call the lateral neck chordotonal neurons (LNCs), innervates the lateral side of the chordotonal organ (Fig. 3a–c). Another anatomically distinct sensory neuron type, which we call the medial neck chordotonal neurons (MNCs), innervates the far medial side of the organ (Fig. 3d–f). Both sensory neuron types project to the ventral nerve cord through the prothoracic nerve, where they travel through the dorsal medial tract and send process towards the midline (Fig. 3a,d and Extended Data Fig. 5).

Fig. 3: Silencing proprioceptors reshapes motor neuron-driven convergent movements.
figure 3

af, Anatomy of the neck chordotonal organ. a, Horizontal section of the anterior thorax, muscles shown in magenta (phalloidin), cuticle in blue (calcofluor white) and the LNCs in green (anti-GFP). b, Higher magnification of the highlighted region in a. c, Sensory LNC neuron dendrites insert into the centre of each scolopale (magenta tubes) on the lateral edge of the organ. d, Horizontal section of the anterior thorax, muscles shown in magenta (phalloidin), cuticle in blue (calcofluor white) and the MNCs in green (anti-GFP). e, Higher magnification of the highlighted region in d. f, MNC neuron dendrites innervate the scolopale cells at the medial edge of the chorodontonal organ. g, Action field of CvN7, colour-coded by angular velocity (35 flies, 2,132 trials). h, Example CNS of the genotype whose data is plotted in g. Green indicates CsChrimson-mVenus expression in the CvN7 motor neuron. i,j, The results (i) of using a feedback model (j) to simulate the data in g. k, The action field of the same CvN7 neuron type when the LNC proprioceptive neurons are hyperpolarized (43 flies, 2,623 trials). l, Example CNS of the genotype whose data are plotted in k. Green indicates CsChrimson-mVenus expression in CvN7 neck motor neuron, magenta indicates Kir2.1::tdTomato expression in the LNC neurons and few unrelated abdominal neuromere neurons. m, The results (m) of using the feedback model with its pitch velocity feedback term reduced (n) to simulate the LNC-hyperpolarized data in k. n,o, The result of fitting each of the model parameters to the LNC-hyperpolarized data (Supplementary Methods). Two-dimensional versions of the plots in gm are shown in Extended Data Fig. 5. Scale bars, 50 µm.

If neural integration of proprioceptive feedback contributes to the convergence behaviour during motor neuron stimulation, then changing the proprioceptive feedback should change the action field of the motor neuron. We tested this hypothesis by perturbing the LNC proprioceptive neurons with Kir2.1-induced hyperpolarization during CvN7 stimulation (Fig. 3l). Our hypothesis predicts that this should change proprioceptive feedback to the entire neck motor system, making the system more permissive around the axis the LNCs monitor and hence making any CvN7-induced head movement stronger around this axis. As predicted, changing the proprioceptive feedback changes the motor neuron action field (compare Fig. 3g with 3k or Extended Data Fig. 5p with 5r). Specifically, the resulting head movements are, on average, faster around the pitch axis than for proprioceptor-intact flies (Fig. 3g,k and Extended Data Fig. 5u,v, median pitch velocity at peak: 34° s−1 ± 43° median ± interquartile range for control flies, 60° s−1 ± 66° for LNC-hyperpolarized flies, P = 5 × 10−4, n = 43, two-sample Kolmogorov–Smirnov test whether the per-fly peak pitch velocities for the two genotypes are from the same continuous distribution, median difference effect size: 21° ± 13° s−1). As a result, the head overshoots the normal convergence point (12° pitch, measured by the starting posture that results in the smallest average head movement) of CvN7 and converges instead towards a more pitched pose (19° pitch). This suggests that the LNC proprioceptor neurons and their downstream circuit function to damp the pitch velocity of the head. Indeed, freeing different parameters of the previously fit feedback model one-by-one (Fig. 3n and Supplementary Methods) shows that the best fit to the LNC-hyperpolarized data is obtained by allowing the model parameter responsible for pitch velocity feedback to be reduced by 53% (Fig. 3m–o). In contrast to the strong effect observed during motor neuron stimulation, expressing Kir2.1 in the LNCs did not measurably affect the resting posture of the head, probably because the velocity damping performed by the LNCs falls outside the velocity range of normal head movements at rest (Extended Data Fig. 5t, two-sample Kolmogorov–Smirnov test whether the data are from the same continuous distribution: P = 0.3, 0.9 and 0.2 for roll, pitch and yaw, respectively, median difference effect sizes: 0.12°, 0.09°, −0.09°, n = 43 flies). Expressing Kir2.1 in either the MNCs or another neck proprioceptor, the prosternal organ25, also changed the action field of CvN7 (Extended Data Fig. 5) but the effect could not be captured by changing a single parameter in our model.

A library of neck motor neuron types

We have found that stimulating a single motor neuron elicits convergent movements of the head which can be concisely described by its action field. To more fully characterize the motor system and determine if this convergent behaviour was a general property of motor neurons, we measured action fields for most of the motor neurons innervating the neck motor system.

We constructed a library of genetic drivers (Extended Data Fig. 6 and Supplementary Table 1) which between them expressed in at least 16 of the about 25 pairs of motor neurons that drive fly head movements10. This is probably an undercount of the unique neuron types we performed experiments on, as some neurons could not be uniquely identified by their anatomy. For example, we could not separate the three VCvN motor neurons and so treat them as one class. We stochastically drove the optogenetic protein CsChrimson in single neurons from within the expression patterns of our genetic drivers and measured the head movements resulting from stimulating each neuron type. After the behavioural experiment we used confocal imaging of the same individual flies to identify the neurons that had been stimulated. Figure 4a,b shows the individually identified neurons we discovered. In addition, we obtained confocal images of the same neuron types in situ with the muscles still present to determine the structure of the neck motor system and identify which muscles each motor neuron innervates (Fig. 4c–h).

Fig. 4: An anatomical and functional library of neck motor neurons.
figure 4

a,b, Confocal images of neck motor neurons surveyed in this study whose cell bodies are in the brain (a) and ventral nerve cord (VNC) (b). Grey, standard brain/VNC template (male JRC201847), which each image is aligned to48. Black, CsChrimson-mVenus expression in the neuron of interest. c,d, Side (sagittal plane) view confocal image (c) and diagram (d) of the CvN7 neck motor neuron in situ in the head (left), neck and thorax (right) of the body. The cell body of the motor neuron (green, anti-GFP) can be seen at the left of the image in the back of the fly’s brain; its axon passes through the neck towards the thorax on the right of the image where it innervates the VL1 muscle (magenta, phalloidin), which moves the head by means of cuticular structures (blue, calcofluor white). e,f, The same as in c (e) and d (f) from an above (horizontal plane) view. Scale bars, 50 µm; colour-channel separated images available in Supplementary Fig. 17. g, Diagram of all identified neck muscles; key muscle types labelled. View from inside the prothorax facing towards the neck. Red, muscle; orange, tendon; grey, cuticle; green, chordotonal organ. See Extended Data Fig. 7 for the complete set of muscle and cuticle structure labels. h, Motor neuron to muscle connectivity table (note that OH indicates a group of three muscles). See Extended Data Fig. 7 for all muscle name abbreviations. i, The mean axis of induced head rotation for each motor neuron. j, The speed of rotation around the mean axis of rotation of each motor neuron (those shown in i). See Supplementary Figs. 116 for number of trials and flies contributing to each trace in i,j. SC-CO DV, dorsoventral muscles linking the cervical sclerite and the condyle; VL, ventral longitudinal muscles; DE, depressor muscles; SC-RO, sclerite rotator muscle; LEV, levator muscle; TH, transverse horizontal muscles; OH, oblique horizontal muscles; AD, adductor muscle.

Anatomically, the motor neuron population falls into two groups: those whose cell bodies are in the brain and those in the ventral nerve cord. Neck motor neurons in the brain send axons posteriorly down the neck connective where they branch off to innervate muscles. Those neck motor neurons in the ventral nerve cord send axons anteriorly to the muscles either through nerves that leave the ventral nerve cord directly or by sending axons half way up the neck connective to then branch off (Fig. 4a,b and Extended Data Fig. 7). Most neck muscles do not directly enter the neck and are contained in the fly’s thorax. These muscles control head movements either through long tendons that travel through the neck to attach to the head directly or indirectly by moving the cervical sclerite: a triangular shaped, hardened cuticle segment in the thorax that comes to a point in the neck where it contacts the head9 (Fig. 4g and Extended Data Fig. 7). The exceptions to this organization are three small oblique horizontal muscles whose tendons, unusually, do not attach directly to cuticle structures but instead fuse at a roughly 45° angle with the thick tendon of the much larger transverse horizontal muscle (Extended Data Fig. 8). Most muscles are innervated by a single motor neuron9 (Fig. 4h) but many muscles have similar attachment points and therefore probably similar pulling planes. Figure 4h gives a summary of the motor neuron to muscle connectivity.

To generate a compact characterization of the function of each motor neuron and thus the whole neck motor system, we stimulated each neuron one-by-one and fit the feedback model to each set of generated movements (Supplementary Figs. 116). As with the CvN7 data, convergent movements were observed in most motor neurons and a feedback model fit the data from all neuron types better than a feedforward one (mean NMSE 0.5 for the feedback model, 0.8 for the feedforward model) indicating that convergent movements are a general property of this motor neuron population. The axis each motor neuron rotates the head around is summarized in Fig. 4i and the speed of the induced head movement in Fig. 4j. The convergent action field of each motor neuron is shown in Supplementary Figs. 116.

Discussion

Related work

Our data imply that motor commands from the brain cannot generate a fixed movement by always activating the same set of motor neurons. This is because the movement produced by motor neurons changes with posture. Instead, our data suggest that motor neuron inputs can control movement by adding bias to a continuing proprioceptive control loop. Similar, but distinct, ideas have been proposed previously as part of the ‘equilibrium point hypothesis’26,27 but have been contentious28. The equilibrium point hypothesis has two discrete components as follows. (1) That the combination of multimuscle biomechanics and spinal proprioceptive loops lead a limb to converge to a given posture and that this equilibrium posture can be changed by descending inputs altering the threshold to proprioceptive inputs of the spinal circuitry. (2) That the brain takes advantage of this convergence behaviour to specify desired movements as a sequence of such equilibrium points. Our data are consistent with the first part of the hypothesis. Indeed, previous work29 on some fly neck motor neurons has found that descending input from the visual system alone does not lead to action potentials but instead changes the action potential threshold for mechanosensory inputs29. However, our data provide no evidence either way for the second part of the equilibrium point hypothesis. Rather than critically supporting the equilibrium point hypothesis, our data argue for the more general conclusion that the nervous system generates movement by changing ongoing control laws that govern the relationship between estimates of the state of the body and actual movements of the body30,31. This is probably a multilevel process consisting of several nested feedback loops4,5 using different levels of abstraction in the estimate of the state of the body of which our direct proprioceptive–motor neuron loop is a low-level example.

Limitations

Our approach of stimulating individual motor neurons one-by-one relied on an assumption of pseudolinearity: that stimulating an individual motor neuron is informative about its role when acting in concert with others. This approach succeeded because we stimulated the same motor neuron many times during free behaviour, capturing and analysing its effects during many different movements and thus many different motor neuron population states. However, by definition, this approach will not capture nonlinear interactions between motor neurons. For example, we found that the tendons of the small oblique horizontal muscles fuse at an approximately 45° angle with the much larger transverse horizontal muscle tendon, possibly enabling the oblique horizontal muscles to adjust the line of action of the transverse horizontal muscle (Extended Data Fig. 8). This tendon fusion probably results in a nonlinear inter-reliance of the muscles which our analysis will not have captured32,33.

For all single-neuron studies, the isolation of the influence of a single neuron is only an approximation; stimulating one neuron will in turn activate connected neurons. Studies in other species17 have shown electrical synapses between synergistic motor neurons. Additionally, our analysis does not consider the temporal patterning of motor neuron activity34.

Mechanism of convergence

In vertebrates, convergent force fields resulting from spinal stimulation are robust to proprioceptive de-afferentation35 and are thought to be constructed by spinal interneurons indirectly engaging muscles with opposing viscoelastic properties27. Indeed, gross stimulation of vertebrate motor neuron pools did not result in convergent forces (after correction for forces at rest) as frequently as interneuron stimulation36. We have found that motor neurons produce convergent movements which change when a single subclass of proprioceptive neuron is perturbed. This suggests that one of the mechanisms underlying the convergence in our data is proprioceptive feedback. Proprioceptive feedback is, however, unlikely to be the only mechanism underlying the effects we observe; passive properties of the fly neck are likely to also contribute37,38.

Functional role of convergence

In robotics, flexible movements have been achieved through dynamic movement primitives39, where time-varying inputs modulate the behaviour of lower-level dynamical systems which behave similarly to the motor neuron-elicited movements reported here. These low-level dynamical systems ensure that the trajectory specified by their inputs reaches the desired target. Analogously, neuron–proprioceptor loops may transform descending motor commands into control laws useful for generating complex movements that are robust to perturbations.

Motor neurons driving convergent movements may be useful for behaviours where a stimulus triggers the adoption of a particular posture such as in grooming40 or escape preparation41. However, many other behaviours require the generation of movements in a fixed direction, such as the control of head movements by the superior colliculus in mammals42 or fly optomotor head movements (Fig. 1). In such systems, descending control from the brain must dynamically adjust with posture to account for the posture dependence of the downstream motor neurons43,44,45. In some cases, generating fixed motion in the relevant sensory reference frame may require convergent movements22.

The motor system is able to produce flexible and diverse outputs because of the ability of the same motor neurons to contribute in different ways to many different movements. Because of this multifunctionality it has been challenging to obtain a condensed, interpretable description of the output of a motor neuron that also captures its changing roles across different movements. Here, we obtain such a condensed description of motor neuron output for a population of motor neurons. This description paves the way for understanding how the descending control of movement interfaces with a dynamic motor system.

Methods

Generation of genetic lines

Genetic lines were generated that expressed in sparse subsets of one to ten neck motor neurons by using the split-GAL4 technique49,50 to generate intersections from published hemidrivers2,51.

For most motor neurons, it is necessary to activate only a single neuron out of each bilateral pair expressed by the split-GAL4 line to ensure that the innervated muscles of the two neurons do not oppose each other. For example, in the case of a yaw-inducing motor neuron, the left and right neurons of the bilateral pair will drive the head to move in opposite directions making interpretation of the movement induced by bilateral stimulation challenging. In the special case of pitch-inducing motor neurons, for example CvN7, unilateral stimulation is not necessary as both motor neurons in the bilateral pair drive the same pitch movements. Accordingly, for CvN7 we used genotypes that only expressed in one unilateral neuron or both bilateral neurons as the experimental constraints demanded. For all other motor neurons, we only performed unilateral simulation. To achieve expression of the optogenetic protein CsChrimson52 in single motor neurons we stochastically expressed it in each of the split-GAL4 lines (Supplementary Methods). Flies were dissected after the behavioural experiments to identify the motor neuron expressing CsChrimson. Flies that did not express CsChrimson in any neurons served as genetically identical controls. To determine the effect of silencing proprioceptors on motor neuron-elicited movements, we used similar fly lines but with the CsChrimson driven by a sparse LexA driver that expressed in CvN7 and proprioceptor-specific split-GAL4 lines expressing Kir2.1 in specific subsets of neck proprioceptive neurons. See Supplementary Methods, Extended Data Table 1 and Supplementary Table 1 for details of genotypes and protocols. See Supplementary Table 2 for details of neurons identified in electron microscopy connectome datasets.

Behavioural experiment pipeline

Tethered, flying flies were videoed from two orthogonal angles at 125 frames per second while presenting 300 ms flashes of red light (625 nm, 0.37 mW mm−2) spaced 1.5 s apart for a total of 120 flashes. Owing to the presence of a loss-of-function allele of norpA53, flies were blind and did not show any behavioural reaction to the red light stimulus. The resulting videos were then tracked in 3D54. Flies were individually dissected, subject to direct-label immunohistochemistry and imaged using confocal microscopy while keeping track of fly identity. This enabled us to determine which neurons were optogenetically activated in each fly. See Supplementary Methods for details of histology and imaging.

Head tracking

To track head movements we used the animal part tracker54 to track five points on the fly head. We tracked these landmarks in two dimensions using a custom deep learning-based network (Supplementary Methods) and then combining these estimates to generate a 3D estimate of their position. The resulting set of 3D points are rotated so that the hand-annotated 3D body axis is aligned across all flies and the origin sits in the neck at the computationally estimated pivot point. The data are presented rotated so that the body axis is pitched upwards 40° relative to the horizon in approximately the posture seen during Drosophila flight. The 3D rotations between frames are then calculated from the tracked points using Horn’s method55. The global, laboratory frame coordinate conventions used are described in Extended Data Fig. 2c.

Action field plots

To visualize how the movements induced by single-neuron activation change with time and posture we plot ‘action fields’ for each neuron, for example Fig. 1j. The head rotations from individual motor neuron stimulation trials were grouped into bins56 according to the starting posture of the head in the frame before the stimulus started. We plot the average57 rotation trajectory of each group, colour-coded by time or rotational velocity. The position in the three axes describes the 3D rotational pose of the head at any given time. The three axes of the plot are labelled roll, pitch and yaw but are not Euler angles; instead, they plot the 3D axis of rotation scaled by the magnitude of the same rotation46. Thus, the data are plotted in what has previously been termed ‘quaternion space’46: the axis the head is rotated about relative to its normal resting position determines in which 3D direction the point is plotted; the magnitude of the rotation determines how far from the origin the point is plotted along that direction. No interpolation is performed on these data.

Electrophysiology

To both measure the visual responses of a motor neuron (Fig. 1c–e) and also to calibrate the optogenetic stimulus (Extended Data Fig. 3) we performed patch clamp recordings from the CvN7 motor neuron using previously described methods58 (Supplementary Methods). The optic fibre was placed in a similar location and distance relative to the neck as in the behavioural experiments and the same stimulus sequence delivered as in the behavioural experiments while monitoring the spike rate of CvN7.

Visual stimuli

The fly head was placed in between three orthogonal projector screens that formed the corner of a cube. Stimuli were corrected in OpenGL for perspective and individually measured head angle to appear as if stimuli were on the sphere surrounding the fly. Data are presented for motor neurons whose axon exits the nervous system on the right-hand side of the fly. Data from motor neurons with axons that exited through a nerve on the left side of the fly are flipped to appear as if they came from the equivalent neuron on the right side of the fly.

Visual receptive fields were mapped by scanning a 5° circular black target at 50° s−1 in the four cardinal directions across a grid that covered the virtual sphere surrounding the fly59. The responses of the neuron to wide-field rotation were measured by rotating a panoramic ‘star field’ stimulus around different axes relative to the fly.

Modelling head movements

The head movements induced by single motor neuron stimulation were modelled with a linear time invariant model. In this model, the head acceleration at any given time is proportional to the weighted sum of a motor neuron-specific 3D vector and feedback which is dependent on the current head position and velocity (Fig. 2d,e). The bandpass filtered LED stimulus r (Supplementary Methods) is multiplied by the stimulated direction of pull [mx,my,mz] of the motor neuron in the quaternion space representation46 and linearly combined with a weighted sum of the current head posture and velocity to model any pose-dependent feedback. This sum determines the acceleration of the modelled head in the x, y and z dimensions of the modelled action field according to:

$$\ddot{x}=r{m}_{x}+x{p}_{11}+\dot{x}{p}_{14}$$
$$\ddot{y}=r{m}_{y}+y{p}_{22}+\dot{y}{p}_{25}+z{p}_{23}$$
$$\ddot{z}=r{m}_{z}+z{p}_{33}+\dot{z}{p}_{36}$$
$${p}_{23}=\left\{\begin{array}{c}-{p}_{23},\,{z}_{0} < 0\\ {p}_{23},\,{z}_{0}\ge 0\end{array}\right.$$

where x, y, z, \(\mathop{x}\limits^{\mathrm{.}}\), \(\mathop{y}\limits^{\mathrm{.}}\), \(\mathop{z}\limits^{\mathrm{.}}\) are the current position and velocity of the head in the action field 3D representation of rotational pose and pi,j are the weights applied to the current position and velocity of the head. The feedforward model was the same as the above, except the feedback parameters pi,j were all set to zero. See Supplementary Methods for details of the model, fitting and simulation. Model performance was measured in two different ways. The NRMSE was computed between the simulated and real individual trials over the entire 300 ms simulated period. The NRMSE was computed as:

$${\rm{NRMSE}}=\frac{\parallel {\rm{data}}-{\rm{model}}\parallel }{\parallel {\rm{data}}-{\rm{mean}}({\rm{data}})\parallel }$$

An NRMSE value of zero means the simulation was a perfect match to the validation data; an NRMSE value of one means the simulation performed no better than one in which the head does not move from its starting posture. The angular error was also computed for each frame of the validation data. The rotation required to align the simulated head pose with the actual head pose was calculated for each frame and averaged across the entire trial. We report the fraction of trials where this average angular error was less than 5°.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.