FlapSim: A Composable MuJoCo Simulation Platform and Reduced-Order Aerodynamic Model Hierarchy for Flapping-Wing Robotics

Mingshan He

TL;DR

FlapSim is a new open-source MuJoCo-based simulation platform that bridges the gap between slow, high-fidelity aerodynamic models and fast, oversimplified ones for flapping-wing robots. By combining phase-locked harmonics with multirate clock synchronization, it achieves over 96% fidelity relative to a high-frequency reference while running nearly 70x faster, making it ideal for reinforcement learning and controller design.

What Problem Does This Paper Address?

Flapping-wing micro air vehicles (FWMAVs) operate in a challenging aerodynamic regime. Their wings beat at high frequencies (20–50 Hz), creating complex, unsteady vortex structures. To simulate this accurately, researchers typically use "blade-element" models that require tiny integration steps (e.g., 50 µs). However, flight controllers and reinforcement learning (RL) algorithms operate on much slower timescales and require millions of simulation steps.

This creates a "fidelity-versus-compute gap." You can either have a high-fidelity model that is too slow for RL, or a "cycle-averaged" model that runs fast (1 ms steps) but fails to capture crucial dynamics during maneuvers, wind gusts, or changes in wingbeat frequency. FlapSim aims to close this gap by providing a hierarchy of reduced-order models that are both fast and accurate.

Overview of FlapSim showing the gimbaled robot, its stroke trajectory, and various simulation configurations.

Methods

FlapSim is built on MuJoCo 3.8 and features a modular, plugin-based architecture. It treats aerodynamic models, wind fields, and controllers as composable blocks that communicate over a deterministic signal bus.

The core technical contribution is a Multi-Block Harmonic Surrogate model. Instead of just calculating an average force, this model decomposes the aerodynamic "wrench" (force and torque) into two parts:

  1. A cycle-averaged mean trajectory: Captures the steady-state loads.
  2. A phase-locked harmonic trajectory: Reconstructs the within-cycle oscillations using $1f$ to $6f$ Fourier harmonics.

To keep the fast 1 ms model in sync with the high-frequency physics, the authors implemented a multirate 21-substep clock synchronization law. This prevents "time-base drift" that can occur when rounding high-frequency steps into a lower-frequency recording loop.

Datasets

The authors introduced a rigorous benchmark consisting of 48 held-out scenarios across six operating regimes:

  • Frequency: Constant-frequency sweeps in still air.
  • Gimbal: Combined roll and pitch thrust-vectoring.
  • Wind: Steady 3D ambient wind vectors.
  • Frequency-step: Abrupt mid-flight changes in wingbeat frequency.
  • Gust: Transient 3D "1 − cos" wind gusts.
  • Flat-plate: Cross-robot transfer to different wing geometries.

The models were trained on a separate set of 356 space-filling trajectories, representing a 300-second training budget.

Key Insights and Ideas

  • Harmonics matter for the "average": A surprising finding was that including within-cycle harmonics significantly improves the fidelity of filtered (averaged) results, especially during frequency transitions. This is due to "filter leakage"—when the wingbeat frequency changes, a fixed-window averaging filter fails to perfectly suppress oscillations. Reconstructing these harmonics allows the model to cancel out this leakage.
  • Clock alignment is critical: Omitting the clock synchronization law leads to a 5% time-base drift, which can drop overall fidelity from 0.96 to 0.89.
  • Redundancy of lag states: Once phase-locked harmonics are included, explicit transient "lag" states (often used to model aerodynamic latency) provided no additional benefit. The harmonic basis functions already capture the necessary transition dynamics.
Harmonic reconstruction significantly reduces force error and improves fidelity, particularly in the 'Step' regime where frequency changes occur.

Key Results

The benchmark compared five reduced-order configurations against a 50 µs quasi-steady reference:

  • Speedup: All reduced models achieved a 65x to 68x CPU speedup.
  • Fidelity: The standard "hover baseline" model only achieved a mean fidelity of 0.6593. The proposed four-block harmonic model raised this to 0.9662.
  • Wind & Gusts: The new models reduced steady wind force error by 50.1x and gust force error by 20.4x compared to the baseline.
  • Frequency Steps: Including harmonics improved fidelity during frequency transitions by +0.3176, a massive jump for dynamic maneuvers.
Comparison of wrench fidelity across different flight regimes and model configurations.

Limitations and Future Work

The authors acknowledge several areas for further development:

  • Fixed-Base vs. Free-Flight: The current benchmark uses a fixed-base protocol with prescribed wing strokes. While body velocities are included in the math, full closed-loop free-flight maneuvers might introduce new attitude feedback dynamics that need testing.
  • Calibration Complexity: While the ridge-calibrated models performed excellently, more complex calibration schemes (like LOSO hybrid calibration) didn't offer significant gains, suggesting a plateau in current model complexity.
  • Generalization: Testing the platform's performance in complex RL tasks and with more diverse bio-inspired wing morphologies remains a goal for future releases.

The source code and project details are available at https://github.com/MingshanHe/FlapSim.

Summary updated

Abstract

Flapping-wing simulation must reconcile high-frequency wingbeat aerodynamics with the slower dynamics relevant to flight control and reinforcement learning. We present FlapSim, a modular open-source MuJoCo simulation platform that combines robot descriptions, wing geometry, and composable aerodynamic models in a deterministic simulation pipeline. Across $48$ held-out scenarios spanning frequency, gimbal, wind, frequency-step, gust, and cross-robot flat-plate regimes, we compare five reduced-order configurations operating at $1\,\text{ms}$ with a $50\,μ\text{s}$ quasi-steady blade-element reference. The built-in hover cycle-averaged baseline achieves a $67.51\times$ CPU speedup but only $0.6593$ mean wrench fidelity. Combining multirate $21$-substep clock synchronization, three-dimensional linear/quadratic inflow and gust coupling, analytical blade-element geometry scaling, and phase-locked $1f\text{--}6f$ harmonics raises mean fidelity to $0.9646$ at a $65.19\times$ speedup in a five-block model. A streamlined four-block model without explicit step-transient lag states achieves $0.9662$ fidelity at a $67.98\times$ speedup. Controlled ablations show that stroke harmonics are particularly important during frequency transitions, improving held-out frequency-step fidelity by $+0.3176$. Transfer-function analysis explains this effect: fixed-window cycle averaging retains harmonic contributions when the wingbeat frequency changes, so within-cycle reconstruction also improves the filtered wrench. Once phase alignment and harmonic synthesis are included, explicit transient lag states provide no additional benefit in this benchmark. These results characterize the accuracy--computation tradeoff of the aerodynamic hierarchy and identify timing, inflow, geometry, and harmonic representation as central considerations for reduced-order flapping-wing simulation.
BibTeX
@misc{he2026flapsim,
  author = {Mingshan He},
  title = {{FlapSim: A Composable MuJoCo Simulation Platform and Reduced-Order Aerodynamic Model Hierarchy for Flapping-Wing Robotics}},
  year = {2026},
  eprint = {2610.40902},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.40902},
}
Figure