An interactive demo of our musculoskeletal model, running MuJoCo in your browser via MuJoCo WebAssembly. You can drag to rotate and scroll to zoom using your mouse. Click on the "Actuators" drop-down to visualize and modify muscle activations to see their effect on joint movements. Note that loading may take up to 30 seconds.
Computational models are critical for advancing our understanding of how neural, biomechanical, and physical systems interact to orchestrate animal behaviors. Despite the availability of near-complete reconstructions of the Drosophila melanogaster central nervous system, musculature, and exoskeleton, anatomically and physically grounded models of fly leg muscles are still missing. These models provide an indispensable bridge between motor neuron activity and joint movements.
Here, we introduce the first 3D, data-driven musculoskeletal model of Drosophila legs, implemented in both OpenSim and MuJoCo simulation environments. Our model incorporates a Hill-type muscle representation based on high-resolution X-ray scans from multiple fixed specimens. We present a pipeline for constructing muscle models using morphological imaging data and for optimizing unknown muscle parameters specific to the fly. We then combine our musculoskeletal models with detailed 3D pose estimation data from behaving flies to achieve muscle-actuated behavioral replay in OpenSim. Simulations of muscle activity across diverse walking and grooming behaviors predict coordinated muscle synergies that can be tested experimentally. Furthermore, by training imitation learning policies in MuJoCo, we test the effect of different passive joint properties on learning speed and find that damping and stiffness facilitate learning. Overall, our model enables the investigation of motor control in an experimentally tractable model organism, providing insights into how biomechanics contribute to the generation of complex limb movements. Moreover, our model can be used to control embodied artificial agents to generate naturalistic and compliant locomotion in simulated environments.
To reconstruct front leg muscles, we used multiple high-resolution X-ray datasets, each capturing different foreleg postures. We annotated muscle fibers spanning the thorax–coxa, coxa–trochanter, and femur–tibia joints, and modeled 15 muscle-tendon units (MTUs) per foreleg, capturing 12 of the 19 anatomically distinct muscle groups.
Reconstructed muscle dataset and musculoskeletal model of the front legs: Front leg muscle reconstructions from high-resolution X-ray scans visualized in Blender (left), and corresponding muscle-tendon units implemented in OpenSim (right). Colors denote anatomically grouped muscles.
Experimental data pertaining to muscle physiological parameters (e.g., maximum isometric force) in the fly legs are limited. We therefore explored parameter values through multi-objective optimization using NSGA-II in a biologically plausible value range per parameter. For each candidate parameter set, static optimization inferred muscle activations from reference joint angles, and forward dynamics simulated joint trajectories. To avoid overfitting, optimization was performed across two behaviors—antennal grooming and locomotion—retaining solutions that performed well for both. Our model correctly reproduces opposing moment arm signs for flexor and extensor muscles, consistent with their known functional roles.
Hill-type muscle model and optimization of muscle parameters: Hill-type muscle model schematic (A) and optimization pipeline (B).
Using OpenSim's static optimization, we estimated muscle activations during forward walking and grooming. Applying Non-negative Matrix Factorization (NMF), we find that just three muscle primitives explain over 90% of the variance in muscle activity across both behaviors. These synergies exhibit distinct temporal dynamics and task-specific muscle weights—predicting that the fly flexibly repurposes the same musculature for different behaviors by engaging distinct, task-specific synergies.
Investigating muscle synergies during walking and grooming: Simulated joint angle trajectories (A), muscle activation dynamics (B), variance explained by NMF synergies (C), synergy time courses (D), and synergy weight matrix (E) during locomotion and grooming.
To study muscle-driven control strategies, we trained PPO policies in MuJoCo to imitate animal kinematics. We systematically varied passive joint properties—stiffness, damping, and armature—across four conditions. We find that combining stiffness and damping yields the fastest learning and highest performance, supporting the hypothesis that passive mechanics offload control effort from the neural controller, allowing the policy to focus on producing coordinated muscle patterns rather than correcting instability.
Joint passive properties facilitate imitation learning: Passive joint property conditions (A–B), imitation learning reward curves (C), early vs. late performance statistics (D), joint angle tracking (E), and time-averaged muscle activations (F).
The muscle parameter optimization and imitation learning experiments described above were performed without contact forces: the fly model moves through free space while tracking recorded joint angle trajectories. Despite this, the optimized musculoskeletal model transfers to ground locomotion without any additional training or fine-tuning, suggesting that the muscles produces sufficent forces to support the body weight.
@misc{ozdil2025musculofly,
title={Musculoskeletal simulation of limb movement biomechanics in Drosophila melanogaster},
author={Pembe Gizem Özdil and Chuanfang Ning and Jasper S. Phelps and Sibo Wang-Chen and Guy Elisha and Alexander Blanke and Auke Ijspeert and Pavan Ramdya},
year={2025},
eprint={2509.06426},
archivePrefix={arXiv},
primaryClass={q-bio.NC},
url={https://arxiv.org/abs/2509.06426},
}