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.
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:
- A cycle-averaged mean trajectory: Captures the steady-state loads.
- 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.
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.
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