Manuscript Offprint
arXiv:2610.40902FlapSim: A Composable MuJoCo Simulation Platform and Reduced-Order Aerodynamic Model Hierarchy for Flapping-Wing Robotics
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Mingshan He

Fig. 1. Overview of FlapSim. The main view illustrates a gimbaled flapping-wing robot, its stroke trajectory, passive feathering mechanism, and blade-element forces. Insets show the stroke from above, the drivetrain, a parametric robot, and illustrative free-flight and wind/gust configurations. The quantitative aerodynamic benchmark in this report uses the fixed-base configuration.
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 ms with a 50 µs quasi-steady blade-element reference. The built-in hover cycle-averaged baseline achieves a 67.51× 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–6f harmonics raises mean fidelity to 0.9646 at a 65.19× 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× 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.
I. INTRODUCTION
Flapping-wing micro air vehicles (FWMAVs) and bio-inspired aerial robots generate lift, thrust, and control moments through rapid, large-amplitude wing reciprocation coupled with passive or active feathering rotation [1]–[4]. Unlike fixed-wing aircraft or rotary-wing quadrotors whose aerodynamic loads vary smoothly at the rigid-body attitude control rate, flapping wings operate in an unsteady low-to-moderate Reynolds number regime ( ) characterized by leading-edge vortex (LEV) attachment [5], [6], rotational circulation during stroke reversal [7], [8], wing-wake interaction [9]–[11], and aeroelastic pitch recoil [12]–[14]. While direct Navier–Stokes computational fluid
Corresponding author. Mingshan He is with the Department of Mechanical Engineering, School of Engineering, Institute of Science Tokyo, Tokyo, 1528550, Japan. Email: mshe.research@gmail.com. ORCID: 0000-0002-0369-5181.
dynamics (CFD) captures these three-dimensional vortex structures [15], [16], its computational cost of hours per wingbeat precludes closed-loop flight controller synthesis, system identification, or reinforcement learning.
Quasi-steady blade-element models—evaluating spanwise wing-section kinematics with empirical RoboFly translational and rotational force coefficient fits [7], [9], [10], [14]—provide a tractable middle ground whose accuracy depends on the kinematics and aerodynamic effects included [16]–[18]. However, because the wing's instantaneous velocity, angle of attack, and pitching rate oscillate at 20–50 Hz (with higher harmonics up to 300 Hz), resolving blade-element loads alongside multibody dynamics motivates small integration steps; this study uses (20 kHz) [19], [20]. At , simulating 1 s of flight requires 20,000 multibody and aerodynamic evaluations, making simulation cost relevant to model-predictive control [21], [22] and large-scale policy optimization [23]. Conversely, rigid-body cycle-averaged models step at (1 kHz) by replacing within-stroke blade-element integration with stroke-averaged thrust and moment maps, with model-dependent speed and accuracy tradeoffs; simple hover formulations can omit 3D ambient wind drag, unsteady gust transients, cross-robot planform scaling, and within-cycle harmonic forces [24]–[27].
To investigate and bridge this fidelity-versus-compute gap systematically, we present FlapSim, a modular simulation platform for flapping-wing robotics built on MuJoCo 3.8 [28], [29]. FlapSim treats aerodynamic models, environmental wind/gust fields, wing kinematics, sensors, and controllers as composable plugins communicating over a deterministic signal bus. FlapSim provides a hierarchy of aerodynamic plugins ranging from a regression-tested per-step quasi-steady blade-element simulator down to a 1 ms cycle-averaged rigid-body model equipped with automated virtual-wind-tunnel identification.
This paper makes two contributions:
-
Platform Architecture and Software Characterization: We document FlapSim's software architecture, robot manifest and CAD/MJCF/URDF import pipeline, first-class wing planform integral engine, phase-ordered plugin execution loop, Gymnasium learning interfaces, and identification tooling, grounded in a deterministic codebase inventory (69 Python modules, 9,177 lines of code across 13 subpackages, 17 registered plugins, 117 unit and regression tests).
-
Quantitative Characterization of the Reduced-Order Aerodynamic Hierarchy: Across 48 held-out test scenarios spanning six operating regimes (frequency, gimbal, wind, frequency-step, gust, and parametric flat-plate robots), we benchmark five 1 ms reduced-order aerodynamic configurations against the per-step blade-element reference. We demonstrate that combining multirate 21-substep clock synchronization, 3D linear/quadratic wind and multi-rate gust coupling, analytical blade-element planform scaling, and stroke-harmonic synthesis raises 48-scenario mean wrench fidelity from 0.6593 (built-in hover base-
line) and 0.8280 (first-principles wind-lag baseline) to 0.9646 ( speedup) in a five-block surrogate and 0.9662 ( speedup) in a streamlined four-block surrogate. Through controlled ablations and transfer-function analysis, we explain why within-cycle harmonics govern mid-flight frequency-step fidelity (+0.3176 held-out step lift) and show no additional benefit from explicit step-transient lag states in this benchmark.
Figure 1 provides a visual overview of the platform. The central view connects the robot's gimbaled mounting, stroke kinematics, passive feathering, and blade-element force application. The insets relate this physical model to the stroke trajectory, drivetrain, parametric robot construction, and illustrative free-flight and wind/gust configurations. These views place the aerodynamic hierarchy in its broader simulation context; the quantitative comparisons in this report use the fixed-base protocol described in the experimental section.
The source code is available at https://github.com/MingshanHe/FlapSim; the project website is https://mingshanhe.github.io/FlapSim/.
A. Related Simulators and Flapping-Wing Aerodynamic Models
General-purpose robotics simulators—including MuJoCo [21], [22], [28], [29], Drake, NVIDIA Isaac/Orbit, Gazebo, and PyBullet—provide fast rigid-body contact and articulated multibody solvers, and recent differentiable or graph-network physics engines extend these capabilities to gradient-based system identification [23]. However, flapping-wing applications require specialized aerodynamic models beyond generic rigid-body and drag formulations to capture chordwise blade-element velocity gradients, rotational circulation, Wagner circulation lag, and stroke-plane inflow coupling required for flapping flight [1], [2].
The flapping-wing simulators compared here were developed around specific organisms or robot platforms and aerodynamic formulations. Table I summarizes the four open projects we compare against, using only facts stated in their repositories and papers. (i) flybody is an anatomically detailed MuJoCo body model of the fruit fly Drosophila melanogaster with reinforcement-learning tasks for walking imitation, flight and vision-guided flight, exposed through a Python action-step environment API with optional Acme/TensorFlow and Ray training extras [30]. (ii) Flappy Hummingbird is an open-source dynamic simulation of a dual-motor flapping-wing micro air vehicle based on the Purdue Hummingbird robot, built on the DART physics engine through the Python DART binding; it exposes Gym-style hover environments (fwmav_hover-v0/v1) used with Stable Baselines and ships PID and adaptive robust controller baselines [31]. (iii) SJTU flapping-wing simulator is a C++ (CMake) re-implementation of Flappy Hummingbird on DART for the SJTU flapping wing, with ROS-based debugging and visualization (URDF, rviz and launch files) and no associated publication. (iv) FlappingwingSimu is a flapping-wing simulation in the Webots robot simulator, mainly Python with MATLAB scripts, whose blade-element aerodynamics comprise translational lift, translational drag, rotational lift and added mass; its version 2.0 targets trajectory tracking and was validated experimentally [32]. FlapSim differs from these in being robot-agnostic by construction: robot models supplied as URDF, MJCF, or programmatic MuJoCo specifications acquire flapping-wing functionality through a compact manifest, and the aerodynamics, actuators, sensors and controllers are plugins from one registry. Its per-step quasi-steady model reproduces the formulation of the FlapX simulator (Whitney & Wood 2010 with the Dickinson et al. coefficient fits), as its documentation states [7], [9], [10], and its regression tests pin the resulting fixed-base lift sweep.
III. METHOD
A. Platform Architecture and Codebase Inventory
FlapSim v0.2.0 is a modular Python library built on MuJoCo 3.8. The evaluated implementation is fixed at revision 19fa57f. Table II summarizes the software inventory of the evaluated implementation: 69 Python modules comprising 9,177 lines of source code organized into 13 subpackages (plus root package exports), verified by 117 test functions across 23 test files and accompanied by 22 documentation pages and 24 runnable examples.
Simulation Step Pipeline and Signal Bus.
Figure 2 summarizes the software architecture. The simulation core manages the compiled MuJoCo model and dynamic state, an ordered set of plugins, and a shared signal bus. Scalar and array-valued signals represent quantities such as wing angle of attack, angular velocity, and commanded stroke frequency, allowing plugins to communicate through named channels. Each integration step follows a fixed sequence: sensing, control, actuation, aerodynamic and drag-force evaluation, multibody integration, kinematic target updates, and recording. The plugin interface separates actuation, aerodynamics, atmosphere, control, external forces, recording, and sensing. The evaluated version includes 17 plugins: sinusoidal, position-controlled, servo, and motor-crank actuation; quasi-steady, composite, and cycle-averaged aerodynamics; atmospheric density, steady wind, 1 – cos, sinusoidal and step gusts, and Ornstein–Uhlenbeck turbulence; body drag; hover, scheduled, and user-defined control; inertial, range, encoder, and wrench sensing; and in-memory recording. Sensor outputs support sample-and-hold, low-pass filtering, delay, noise, bias, and quantization. Third-party plugins can extend these interfaces, while declarative YAML configurations support simulation, inspection, recording, and parameter sweeps.
Robot Manifests and First-Class Wing Planform Geometry.
The robot-description subsystem (7 modules, 1,834 lines) and wing-geometry subsystem (3 modules, 805 lines) couple a robot model (URDF, MJCF, or a programmatic MuJoCo specification) to a declarative manifest. The manifest specifies
the root body, base type, joint and body modifications, and wing descriptions that are resolved into runtime geometry. Each wing specifies its body, side, aerodynamic frame (span and chord axes or a site), stroke and feathering joints with signs, a planform given as a rectangular or elliptic profile, a chord polyline, a polygon or an STL mesh, hinge offsets, and a mass model such as the spar-plate distribution used by the example robot. At initialization, the wing-geometry subsystem precomputes the blade-element strip geometry and exact spanwise moment integrals:
which govern translational aerodynamic force , aerodynamic roll/pitch moments , rotational circulation , and added-mass inertia [7], [13]. The primary benchmark platform is a 30 g (0.030 kg) gimbaled flapping-wing robot with wing span m (70 mm) and reference timestep s ( s), complemented by a parametric flat-plate model generator that constructs two-wing robots of arbitrary span m and chord m.
B. Composable Aerodynamic Hierarchy and Reduced-Order Surrogate Formulation
At each integration step, the aerodynamic engine evaluates additive per-wing force models and multiplicative corrections. Four models are available: regression-tested quasi-steady blade-element aerodynamics, rotational lift, added mass, and wake capture, together with a ground-effect correction. A composite interface combines these contributions, while a cycle-averaged rigid-body model identifies lift, thrust-vector tilt, control-moment, and damping parameters from fixed-base sweeps. In this study's calibration probes, the additive added-mass and rotational-lift models produced unphysical mean loads on the example robot (negative or strongly lateral mean force). The regression-tested quasi-steady model therefore serves as the reference; agreement with this simulator is not an independent validation against physical measurements.
- Quasi-Steady Blade-Element Reference (). The reference simulator integrates blade-element loads using precomputed spanwise planform moments. At a representative span location , the relative velocity can be written in the general rigid-body form below; the implementation evaluates its spanwise dependence analytically. At each step, the local relative airflow velocity in the wing-strip frame combines the flapping/pitching velocity of the strip, body translational/angular velocity, and transformed ambient wind :
The evaluated reference uses FlapSim's quasi-steady normal-force model.
TABLE I
OPEN FLAPPING-WING SIMULATORS COMPARED IN THIS REPORT, DESCRIBED ONLY WITH FACTS STATED IN THEIR REPOSITORYES OR CITED PAPERS. QS: QUASI-STEADY BLADE-ELEMENT AERODYNAMICS.
| Project | Physics core | Language | Subject | Aerodynamics | Learning interface |
|---|---|---|---|---|---|
| flybody [30] | MuJoCo | Python | Anatomical Drosophila body | Not described in repository | step(action) RL tasks; Acme, Ray |
| Flappy Hummingbird [31] | DART (pydart2) | Python | Dual-motor hummingbird MAV | Not described in repository | Gym fwmav_hover-v0/v1; Stable Baselines |
| fwmav_sim_sjtu | DART | C++ (CMake), ROS | SJTU flapping wing | Port of Flappy Hummingbird | None stated |
| FlappingwingSimu [32] | Webots | Python, MATLAB | Flapping-wing biomimetic robot | QS: translational lift/drag, rotational lift, added mass | Trajectory tracking (v2.0) |
| FlapSim v0.2.0 (this report) | MuJoCo 3.8 | Python | Any URDF/MJCF/ MjSpec robot via manifest | QS reference + 3 additive models + ground-effect modifier; cycle-averaged reduced model | Gymnasium SimulationEnv; parameter studies |

Fig. 2. FlapSim architecture and aerodynamic model hierarchy. (a) Robot descriptions and wing geometry are assembled into a MuJoCo 3.8 simulation, with a deterministic sequence of sensing, control, actuation, force evaluation, integration, post-step updates, and recording. Plugins exchange state through a shared signal bus. (b) The hierarchy connects the 50 µs blade-element reference to alternative 1 ms reduced models (65 × −68× speedup). Dashed connections denote offline identification.
The wing axes are +X (surface normal), +Y (feathering), and −Z (chord). The angle of attack is evaluated at the spanwise center of pressure using the local flow and feathering angle. The implemented coefficient and chordwise pressure-center fraction are
The model applies the integrated normal force at its spanwise and chordwise center of pressure, together with a rotational damping moment about the feathering axis. Summing the applied forces and their moment arms about the root body’s center of mass yields . Quasi-steady formulations in the broader literature account for translational loading and wing interactions [7], [9], [10], [16], rotational circulation [8], [14], [20], added mass [1], and unsteady circulation effects [6]. The benchmark reference does not enable separate rotational-lift or added-mass plugins, or a Wagner lag state.
2. Hover Cycle-Averaged (CA) Baseline ( ms).
FlapSim’s built-in reduced plugin steps at ms (20× larger than ) and approximates the stroke-averaged hover thrust and gimbal control moments [4], [24], [27] as:
(3)
The identification fit gives and from 11 wind-tunnel sweeps (22.5 s).
TABLE II
DETERMINISTIC SOFTWARE INVENTORY OF FLAPSIM V0.2.0 (COMMIT 19FA57F) ACROSS ITS 13 SUBPACKAGES AND ROOT NAMESPACE (69 PYTHON MODULES, 9,177 LINES, 17 REGISTERED PLUGINS, 117 TESTS ACROSS 23 TEST FILES, 22 DOCS, 24 EXAMPLES).
| Subpackage | Modules | Lines | Core responsibilities |
|---|---|---|---|
| flapsim.robot | 7 | 1,834 | RobotManifest, URDF/MJCF/MjSpec import, patches, builders |
| flapsim.aero | 13 | 1,754 | Aero engine, 4 models, ground-effect modifier, atmosphere, drag, identify |
| flapsim.wings | 3 | 805 | Runtime Wing, planform integrals (profile, polyline, polygon, STL) |
| flapsim.actuators | 5 | 713 | Sinusoidal stroke, PD position, servo, DC motor + crank |
| flapsim.sensors | 6 | 623 | IMU, range finder, encoder, load cell; noise/delay conditioner |
| flapsim.fluid | 4 | 592 | Blade-element math, legacy averaged hover model, MuJoCo adapter |
| flapsim(root) | 4 | 527 | Package exports, SimCore wrapper, study, CLI |
| flapsim.core | 5 | 498 | Simulation, phases, SignalBus, flapsim.sim/1 configs |
| flapsimControllers | 4 | 447 | hover_pid, schedule, callback |
| flapsim.envs | 3 | 415 | Gymnasium SimulationEnv, hover reward and termination |
| flapsim.io | 4 | 382 | MemoryRecorder, force-arrow overlays, video export |
| flapsim-plugins | 4 | 375 | Base classes, registry, entry-point discovery |
| flapsim.config | 5 | 114 | Typed aero options and wing/torso inputs |
| flapsim.testing | 2 | 98 | Plugin conformance checks (117 tests in tests/) |
For flat-plate scenarios, a single hover coefficient is scaled analytically by . As documented in the platform roadmap, the cycle-averaged model omits the effect of ambient wind w, applies frequency changes instantaneously without transient lag, and omits within-cycle stroke harmonics.
3. Linear/Quadratic (LQ) Wind-Lag Baseline
().
To test how much of the fidelity gap can be closed by a compact first-principles extension without high-order basis functions or harmonic synthesis, this baseline augments Eq. (3) with: (i) a first-order actuator/inflow frequency lag with ; (ii) linear flapping-coupled wind drag representing cycle-averaged blade-element advance-ratio damping [24]–[27]; (iii) quadratic bluff-body wind drag ; and (iv) analytical strip-integral scaling for parametric flat plates.
4. Multi-Block Harmonic Surrogate ( )
To achieve near-reference accuracy across the evaluated conditions while preserving a CPU speedup, the proposed force model decomposes the 6-DoF aerodynamic wrench into a cycle-averaged mean trajectory plus a phase-locked within-cycle harmonic trajectory:
(4)
where denotes the kinematic, gimbal, wind, gust, and planform state features evaluated at the multirate-synchronized clock , and is the direct wing stroke phase matching the sinusoidal actuator.
Multirate Clock Alignment: The recording protocol calls the simulator's duration-based advance routine once per nominal 1 ms sample. Each call forms a new target from the current floating-point simulation time plus 1 ms. With 50 s reference steps, rounding can make 20 steps fall just below that target, requiring an extra substep. Repeated calls therefore produce approximately 5% clock dilation over this recording window. The surrogate uses the following affine clock map to align with the recorded reference:
This mapping approximately aligns stroke phase , frequency-step transition times, and gust arrival windows with the 50 s reference simulator without altering the 1 ms MuJoCo integrator timestep.
Hierarchical Feature Blocks (B): The surrogate organizes features into five physically motivated blocks calibrated via ridge regression across 356 space-filling training trajectories (304 on the gimbaled flapper and 52 on the flat-plate flapper, using seeds 49,999 within the 300 s training budget): (i) Blocks 1 & 2 (Hover & Gimbal Control): polynomial basis in normalized stroke frequency f, amplitude , and dynamic pressure ( ) (12 mean features), coupled with trigonometric gimbal roll/pitch terms (27 mean features) and 1f, 2f, 3f, 4f, 6f Fourier harmonics (66 harmonic features), calibrated via two-pass joint Gauss–Seidel ridge regression across steady hover, gimbal, and pre/post-step segments; (ii) Block 3 (Frequency-Step Transients—Included in the Five-Block Model, Omitted in the Four-Block Model): multi-timescale low-pass filtered frequency states and exponential step-decay basis functions ( ms, 48 mean features) plus dual-phase step harmonics (56 harmonic features); (iii) Blocks 4a & 4b (3D Steady Wind & Multi-Rate Gust Coupling): linear and quadratic 3D wind components ( ), advance-ratio cross-terms , gimbal–wind interactions (54 mean, 24 harmonic features in 4a), and multi-rate filtered wind accelerations capturing unsteady gust lags (36 mean, 24 harmonic features in 4b); and (iv) Block 5 (Parametric Flat-Plate Planform Scaling): analytical blade-element basis combining , , aspect ratio , and inverse aspect ratio (26 mean, 32 harmonic features). At runtime, the model evaluates pre-allocated one-dimensional feature arrays against contiguous weight matrices in per 1 ms step.
C. Experimental Protocol and Six-Family Evaluation Benchmark
The benchmark tests each surrogate across 48 held-out test scenarios (8 space-filling scenarios per family generated from hidden test seeds > 49,999). Each scenario runs for a 200ms unrecorded settle period followed by a 600ms evaluation recording (600 samples at 1 kHz) on a fixed base with kinematically imposed stroke and gimbal angles across six regimes: (1) frequency: constant-frequency and amplitude sweeps across Hz and rad in still air; (2) gimbal: combined roll and pitch thrust-vector tilt deflections ( ) across flapping frequencies; (3) wind: steady 3D ambient wind vectors up to m/s across arbitrary azimuth and elevation angles; (4) frequency-step: abrupt mid-flight frequency steps ( Hz) occurring at s into the recording; (5) gust: transient 3D 1 - cos wind gusts superimposed on flapping flight during the recording window; and (6) flat-plate: cross-robot transfer to flat-plate flapper instances with randomized wing span m and chord m.
To evaluate cycle-averaged mean loads and transient responses without penalizing pure cycle-averaged models for omitting within-stroke oscillations on steady scenarios, both the reference wrench and surrogate wrench are passed through a two-pass one-stroke-period moving-average filter of integer window length , where [7]. Let denote the filtered reference samples. The implementation uses
where because both filter passes use valid convolution. The torque scale is . For vector signals, RMSE is the square root of the temporal mean of the squared Euclidean error norm. The normalized RMS force error , normalized RMS torque error , scenario wrench fidelity , and overall benchmark score are:
Any configuration achieving at least a CPU speedup saturates the speed factor at 1.0, so its benchmark score equals its 48-scenario mean wrench fidelity .
IV. RESULTS
A. Fidelity vs. Compute Across the Aerodynamic Hierarchy
Table III and Figure 3 present the complete held-out benchmark performance across the five evaluated 1 ms aerodynamic hierarchy tiers compared against the 50 µs per-step quasi-steady reference simulator. Because all five 1 ms models execute in 2.031–2.173 s of total CPU time across the 48 scenarios—compared to 132.40–146.68 s for the 50 µs reference simulator—every reduced configuration achieves an overall CPU speedup between 65.19× and 68.29× (exceeding the 20× threshold with a unit speed factor of 1.0).
Where the Built-In Hover Model Succeeds and Fails
As shown in Table III and Figure 3(a), FlapSim's built-in cycle-averaged model reproduces the 50 µs blade-element simulator well in still-air hover (frequency fidelity 0.9275, , ) and constant-tilt attitude control (gimbal fidelity 0.9440, , ). However, its fidelity decreases in four regimes: (1) 3D Steady Wind (wind fidelity 0.2356): ignoring ambient airflow w yields (physical RMSE 37.83 mN) and (1.966 mN · m), approximately the reference force normalization scale; (2) Mid-Flight Frequency Steps (frequency-step fidelity 0.4874): instantaneous changes in without clock synchronization or harmonic synthesis produce (15.14 mN) and (1.142 mN · m); (3) Unsteady Wind Gusts (gust fidelity 0.6153): unmodeled 1 - cos gust impingement yields (16.10 mN) and (0.847 mN · m); and (4) Parametric Wing Geometries (flat-plate fidelity 0.7462): extrapolating a single hover coefficient via leaves a vertical thrust residual (9.25 mN) despite low zero-gimbal torque error (0.019 mN · m) [13].
Closing the 3D Wind, Gust, and Planform Scaling Gaps. Figure 4 decomposes normalized force error and torque error on a logarithmic scale across all six families. Introducing the compact first-principles linear/quadratic wind-drag and 12 ms lag baseline lifts overall 48-scenario fidelity by +0.1687 to 0.828039 (68.29× speedup): wind fidelity increases from 0.2356 to 0.8250 ( reduced 6.0× from 1.8124 to 0.3035; reduced 13.9× from 1.3454 to 0.0967), gust fidelity rises from 0.6153 to 0.9088, and flat-plate rises from 0.7462 to 0.8734. Expanding to the full multi-block inflow and planform formulation reduces steady wind force error by 50.1× relative to the hover baseline ( , physical RMSE 37.83 mN 0.77 mN) and wind torque error by 41.1× ( , physical RMSE 1.966 mN · m 0.048 mN · m). Similarly, multi-rate filtered gust states reduce gust force error by 20.4× (0.5810 0.0285, fidelity 0.9714), and the polynomial planform basis reduces flat-plate force error by 27.3× (0.6030 0.0221, physical RMSE 9.25 mN 0.30 mN, fidelity 0.9814).
TABLE III
HELD-OUT BENCHMARK RESULTS FOR FIVE 1 MS CONFIGURATIONS AGAINST THE 50 µS BLADE-ELEMENT REFERENCE. (A) FIDELITY , NORMALIZED FORCE ERROR , AND NORMALIZED TORQUE ERROR FOR EACH OF SIX REGIMES (8 SCENARIOS EACH). (B) MEAN FIDELITY OVER ALL 48 SCENARIOS, CPU SPEEDUP, AND OFFLINE TRAINING TIME.
| (a) Per-family results | ||||||
|---|---|---|---|---|---|---|
| Metric | Frequency | Gimbal | Wind | Step | Gust | Flat plate |
| Hover CA | ||||||
| Fidelity | 0.9275 | 0.9440 | 0.2356 | 0.4874 | 0.6153 | 0.7462 |
| Force error | 0.0838 | 0.0508 | 1.8124 | 0.6922 | 0.5810 | 0.6030 |
| Torque error | 0.0669 | 0.0647 | 1.3454 | 0.7563 | 0.4399 | 0.0184 |
| LQ wind-lag | ||||||
| Fidelity | 0.9522 | 0.9248 | 0.8250 | 0.4840 | 0.9088 | 0.8734 |
| Force error | 0.0545 | 0.1159 | 0.3035 | 0.7013 | 0.1454 | 0.2609 |
| Torque error | 0.0436 | 0.0417 | 0.0967 | 0.7676 | 0.0469 | 0.0183 |
| Mean-only | ||||||
| Fidelity | 0.9543 | 0.9576 | 0.9535 | 0.6028 | 0.9594 | 0.9646 |
| Force error | 0.0499 | 0.0456 | 0.0517 | 0.5209 | 0.0440 | 0.0539 |
| Torque error | 0.0438 | 0.0413 | 0.0437 | 0.4960 | 0.0389 | 0.0183 |
| Five-block harmonic | ||||||
| Fidelity | 0.9755 | 0.9730 | 0.9662 | 0.9204 | 0.9712 | 0.9814 |
| Force error | 0.0231 | 0.0267 | 0.0362 | 0.1095 | 0.0285 | 0.0221 |
| Torque error | 0.0266 | 0.0283 | 0.0327 | 0.0571 | 0.0300 | 0.0155 |
| Four-block harmonic | ||||||
| Fidelity | 0.9752 | 0.9730 | 0.9662 | 0.9299 | 0.9714 | 0.9814 |
| Force error | 0.0231 | 0.0267 | 0.0362 | 0.0805 | 0.0285 | 0.0221 |
| Torque error | 0.0273 | 0.0282 | 0.0328 | 0.0674 | 0.0297 | 0.0155 |
| (b) Overall fidelity and computational cost | |||
|---|---|---|---|
| Configuration | Mean fidelity | Speedup (×) | Training (s) |
| Hover CA | 0.659313 | 67.51 | 22.5 |
| LQ wind-lag | 0.828039 | 68.29 | 137.3 |
| Mean-only | 0.898705 | 66.25 | 137.8 |
| Five-block harmonic | 0.964630 | 65.19 | 160.5 |
| Four-block harmonic | 0.966191 | 67.98 | 165.0 |
B. Component Ablations: Harmonic Synthesis and Transient Lag States
We next examine why a cycle-averaged evaluation benchmark—which explicitly filters both reference and surrogate wrenches with a two-pass one-stroke-period moving average —is sensitive to within-cycle stroke harmonics during frequency steps. Figure 5 and Figure 6 present the controlled ablation results and mathematical transfer-function analysis.
1. Ablating Stroke-Phase Harmonics.
Zeroing all within-cycle harmonic weights () while retaining all cycle-averaged mean blocks, 21-substep clock synchronization, and Block-3 step-transient mean filters reduces the 48-scenario composite score by (from 0.964630 to 0.898705). Across the five constant-frequency families, removing harmonics causes only a modest fidelity reduction of 0.0118–0.0212 (frequency , gimbal , wind , gust , flat-plate ). In comparison, during mid-flight frequency steps, removing harmonics changes fidelity by on the held-out test set (; force error increasing from 0.1095 to 0.5209, torque error increasing from 0.0571 to 0.4960) and by on the separate 48-scenario post-hoc evaluation suite (, paired , , exact Wilcoxon ).
2. Transfer-Function Analysis of Moving-Average Filter Leakage.
For a harmonic oscillating at , two passes of a discrete boxcar moving average of integer length have the exact amplitude transfer gain:
Post-hoc evaluation across all 48 scenarios (Figure 6) reveals two physical regimes: (i) Constant-Frequency Integer-Millisecond Rounding Leakage ( scenarios): because rounds the stroke period to the nearest integer millisecond, with , yielding a non-zero two-
○ Hover CA ◆ LQ wind-lag ▽ No harmonics ■ 5-block ▲ 4-block


Fig. 3. Wrench fidelity across the aerodynamic model hierarchy. (a) Mean fidelity in each flight regime (n = 8 scenarios per regime). (b) Mean fidelity across all 48 scenarios, increasing from 0.6593 for the hover cycle-averaged baseline to 0.9662 for the four-block harmonic model. Error bars represent ±1 sample standard deviation across scenarios: n = 8 in (a), and n = 48 in (b). The plotted scenario-level values are from a local re-evaluation; family means agree with the original benchmark in Table III within 0.001. The bars describe scenario variability, rather than uncertainty across repeated runs.
○ Hover CA ◆ LQ wind-lag ▽ No harmonics ▲ 4-block


Fig. 4. Force and torque errors by flight regime. (a) Normalized force error . (b) Normalized torque error . Both axes are logarithmic. The original benchmark records a wind force-error reduction (1.8124 → 0.0362) and a flat-plate force-error reduction (0.6030 → 0.0221). Points and error bars show means and sample standard deviation across the 8 scenarios per regime in the local re-evaluation.
pass transmission on average. Because the raw blade-element flapping force oscillation has an RMS amplitude of 0.34–0.48 N ( larger than N), the evaluation records 0.6–1.5 mN of filtered error in pure mean models. This aggregate residual also depends on higher harmonics and time-varying loads; it cannot be inferred from the fundamental-frequency gain alone. Synthesizing phase-locked harmonics passes the matching waveform through , cutting filtered force RMSE in half ( reduction) and yielding a +0.0173 mean fidelity lift across the 40 constant-frequency scenarios (95% CI , paired , ). (ii) Mid-Flight Frequency-Step Period Mismatch and Phase-Jump Leakage ( scenarios): in frequency-step scenarios, the stroke frequency jumps at s between and , but the evaluator applies a single fixed window tuned exclusively to . During the 300 ms interval where the wing flaps at , spans stroke cycles. Consequently, single-pass transmission increases to 11.19%–21.09% (mean 15.59%) and two-pass transmission increases from to 0.02515—a increase
in 1f transmission and a increase in 2f transmission. Combined with the 2W-sample window straddling the phase jump at s, this leaks 9.56 mN of harmonic oscillation ( of ) into the filtered reference trajectory. Phase-locked 1f–6f synthesis reduces filtered frequency-step force RMSE by while simultaneously reconstructing the unfiltered within-stroke waveform across all 48 scenarios, reducing raw unfiltered 3D force RMSE by , paired , ) and raw torque RMSE by .
3. Redundancy of Explicit Step-Transient Lag States and Multirate Clock Alignment
Whereas removing stroke harmonics reduces frequency-step fidelity, removing the 104-feature Block-3 frequency-step transient module (setting and ) slightly improves held-out 48-scenario mean fidelity from 0.964630 to 0.966191 ( ), lifting held-out frequency-step fidelity from 0.9204 to 0.9299 (reducing frequency-step force error from 0.1095 to 0.0805) and increasing CPU speedup from to . This result reveals that once steady-form harmonics (Blocks 1 & 2)


Fig. 5. Computational speedup and component ablations. (a) CPU speedup by regime, relative to the reference simulator; the dashed line marks the 20× score-saturation threshold. Points and error bars show means and ±1 sample standard deviation across the 8 scenarios per regime in the local re-evaluation. Original benchmark family speedups span 52.07× to 109.85×. (b) Changes in frequency-step and overall fidelity when removing harmonics, explicit transient states, or clock synchronization. Frequency-step changes are −0.3176, +0.0095, and −0.3243, respectively. Panel (b) shows aggregate benchmark differences and has no error bars; the clock comparison uses the completed pre- and post-synchronization runs described in the text.


Fig. 6. Harmonic reconstruction and moving-average filter leakage. (a) Raw and cycle-filtered three-dimensional force RMSE. Harmonic synthesis reduces raw RMSE by . (b) Mean-only and harmonic-model fidelity by regime in the original post-hoc evaluation. The frequency-step improvement is +0.3680, consistent with cancellation of the increase in fundamental-frequency transmission at . Values are aggregate results; neither panel displays standard-deviation bars.
and 21-substep clock synchronization are active, quasi-static switching between the calibrated pre-step and post-step harmonic basis functions already captures the moving-average filter transition accurately in this benchmark across s, whereas the slight degradation with Block 3 is consistent with overfitting of training step magnitudes. Conversely, omitting the 21-substep clock synchronization law (Eq. 5) leaves a 5% time-base drift that reduces overall fidelity from 0.964536 to 0.893374 ( ) and drops frequency-step fidelity to 0.5957 (Figure 5(b)).
C. Per-Scenario Wrench Error Clustering, Asymmetry, and Limitations
Beyond family averages, Figure 7 summarizes our scenario-level error clustering and force-versus-torque asymmetry analysis across all 48 evaluation trajectories.
1. Concentration of Tail Risk and Force-vs-Torque Asymmetry
In the original 48-scenario post-hoc evaluation (a separate seed set from the held-out benchmark), 100% of the bottom-
decile tail risk (5 out of 5 lowest-fidelity scenarios below the 10th percentile cutoff ) in the harmonic surrogate is concentrated in the frequency-step family (scenarios #28, #25, #31, #32, and #29). The single worst-case scenario is frequency-step #28 (seed 22193, stepping upward from Hz to Hz with filter window duration ms), which records a fidelity of 0.8924 with strongly force-dominated residual asymmetry ( vs. , ratio ; held-out test frequency-step ratio in the five-block harmonic model and 1.194 in the four-block harmonic model). In the flat-plate family, error is structurally force-dominated across all surrogates (held-out in the harmonic surrogates vs. 14.26 in the first-principles linear/quadratic baseline and 32.77 in the hover baseline) because symmetric vertical thrust errors at zero gimbal tilt do not induce roll or pitch moments. In comparison, across the 24 3D inflow and gimbal scenarios (gimbal, wind, gust), our harmonic surrogate restores tightly balanced 6-DoF residuals (held-out , with Pearson correlation


Fig. 7. Force–torque asymmetry and fidelity dispersion. (a) Mean scenario-wise error ratio with sample standard deviation ( per regime). (b) Minimum–maximum ranges (lines) and medians (points) of the five-block model's fidelity across those scenarios. Both panels use the local re-evaluation. The original post-hoc evaluation discussed in the text is a separate record: 100% of scenarios below its bottom-decile threshold are frequency-step cases, with a minimum of 0.8924 at scenario #28. The starred lower SD bar for the hover baseline in the flat-plate regime crosses zero and is displayed at 0.001 times its mean on the logarithmic axis; its upper SD is unchanged.
between physical force and torque RMSEs and r = 0.8568 between physical force RMSE and the reference force scale .
2. Discussion of Platform Limitations and Roadmap
While the streamlined four-block harmonic surrogate achieves 0.9662 mean fidelity across all 48 scenarios at a CPU speedup, three limitations define the scope of our findings and motivate future platform development: (i) Fixed-Base Protocol vs. Free-Flight Coupling: all 48 benchmark scenarios evaluate aerodynamic wrenches on a fixed base with prescribed wing strokes following wind-tunnel practice [7], [16]; while local body velocities enter Eq. (2), closed-loop free-flight maneuvers [17] introduce attitude feedback that should be benchmarked via FlapSim's Gymnasium simulation environment wrapper; (ii) Multirate Substep Clock Semantics: our identification of the 21-substep (1.05 ms) reference clock advancement for s highlights a floating-point pitfall when driving a reference simulator inside a 1 ms recording loop, which motivates integer substepping (20 substeps per recording interval) and a separate re-evaluation under the corrected clock; and (iii) Calibration Complexity vs. Generalization: higher-complexity calibration schemes—filter-projected scale-normalized IRLS/L-BFGS-B refinement (scoring 0.963339 at speedup) and exact rank-1 leave-one-scenario-out (LOSO) hybrid passband-stopband calibration (scoring 0.963467 at speedup)—did not outperform the simpler ridge-calibrated four-block harmonic hierarchy (0.966191). Of 11 total model configurations evaluated during the study, 10 completed validly and 1 terminated with a score of 0.0 due to a Python multiprocessing process-spawning module-name mismatch prior to switching to forked workers; similarly, in the six-variant ablation runner, 5 variants completed full evaluation and 1 standalone nominal-clock ablation variant had zero completed runs (completed evaluations = 0), so the clock-synchronization delta is grounded in the completed pre-synchronization versus post-synchronization 5-block evaluations (0.893374 vs. 0.964536).
V. CONCLUSION
FlapSim v0.2.0 combines a modular MuJoCo 3.8 platform with an aerodynamic model hierarchy evaluated across 48 fixed-base scenarios in six regimes. Against the 50 µs blade-element reference, the 1 ms hover baseline achieves 0.6593 mean wrench fidelity at a 67.51× CPU speedup. Combining clock alignment, inflow and gust coupling, planform scaling, and phase-locked harmonics raises fidelity to 0.9646 (65.19× speedup) in the five-block model and 0.9662 (67.98×) in the four-block model without explicit step-transient states.
Harmonic synthesis reduces raw force RMSE by approximately 85% relative to the mean-only model (6.65× reduction) and reproduces oscillations retained by the fixed-window filter during frequency steps, where fundamental-frequency transmission increases by 244.2×. These results establish the accuracy-computation tradeoff within the evaluated protocol. Generalization to a corrected reference clock, closed-loop flight, and reinforcement-learning tasks remains to be evaluated.
LLM USAGE STATEMENT
Coding agents and large language models assisted with plugin implementation, evaluation in the fixed FlapSim harness, reference retrieval, post-hoc statistical analysis, telemetry-based figures, and LaTeX drafting and validation. Reported metrics, codebase counts, and statistical tests are grounded in recorded simulator outputs in paper_data.json.
REFERENCES
[1] D. D. Chin and D. Lentink, “Flapping wing aerodynamics: from insects to vertebrates,” Journal of Experimental Biology, vol. 219, no. 7, p. 920–932, Apr. 2016. [Online]. Available: http://dx.doi.org/10.1242/feb.042317
[2] H. Liu, S. Ravi, D. Kolomenskiy, and H. Tanaka, “Biomechanics and biomimetics in insect-inspired flight systems,” Philosophical Transactions of the Royal Society B: Biological Sciences, vol. 371, no. 1704, p. 20150390, 2016. [Online]. Available: http://dx.doi.org/10.1098/rstb.2015.0390
[3] D. Kolomenskiy, S. Ravi, R. Xu, K. Ueyama, T. Jakobi, T. Engels, T. Nakata, J. L. Sesterhenn, M. F. A, R. Onishi, and H. Liu, "The dynamics of passive feathering rotation in hovering flight of bumblebees," Journal of Fluids and Structures, vol. 91, p. 102628, Nov. 2019. [Online]. Available: http://dx.doi.org/10.1016/j.jfluidsstructs.2019.03.021
[4] S. Xiao, K. Hu, B. Huang, H. Deng, and X. Ding, “A review of research on the mechanical design of hoverable flapping wing micro-air vehicles,” Journal of Bionic Engineering, vol. 18, no. 6, p. 1235–1254, Nov. 2021. [Online]. Available: http://dx.doi.org/10.1007/s42235-021-00118-4
[5] L. A. Miller and C. S. Peskin, “When vortices stick: an aerodynamic transition in tiny insect flight,” Journal of Experimental Biology, vol. 207, no. 17, p. 3073–3088, Aug. 2004. [Online]. Available: http://dx.doi.org/10.1242/jeb.01138
[6] Y. Su, X. Fan, K. Onoue, H. R. Vejdani, and K. Breuer, “An improved aerodynamic model for quasi-steady simulations of animal flight at moderate reynolds numbers,” Annals of the New York Academy of Sciences, vol. 1557, no. 1, Dec. 2025. [Online]. Available: http://dx.doi.org/10.1111/nyas.70142
[7] Q. Wang, J. Goosen, and F. van Keulen, “A predictive quasi-steady model of aerodynamic loads on flapping wings,” Journal of Fluid Mechanics, vol. 800, p. 688–719, 2016. [Online]. Available: http://dx.doi.org/10.1017/jfm.2016.413
[8] D. Ishihara and T. Horie, “Passive mechanism of pitch recoil in flapping insect wings,” Bioinspiration & Biomimetics, vol. 12, no. 1, p. 016008, Dec. 2016. [Online]. Available: http://dx.doi.org/10.1088/1748-3190/12/1/016008
[9] J. M. Birch and M. H. Dickinson, “The influence of wing-wake interactions on the production of aerodynamic forces in flapping flight,” Journal of Experimental Biology, vol. 206, no. 13, p. 2257–2272, 2003. [Online]. Available: http://dx.doi.org/10.1242/jeb.00381
[10] F. Lehmann, S. P. Sane, and M. H. Dickinson, “The aerodynamic effects of wing-wing interaction in flapping insect wings,” Journal of Experimental Biology, vol. 208, no. 16, p. 3075–3092, Aug. 2005. [Online]. Available: http://dx.doi.org/10.1242/jeb.01744
[11] F. Lehmann and S. Pick, “The aerodynamic benefit of wing–wing interaction depends on stroke trajectory in flapping insect wings,” Journal of Experimental Biology, vol. 210, no. 8, p. 1362–1377, Apr. 2007. [Online]. Available: http://dx.doi.org/10.1242/jeb.02746
[12] S. A. Combes and T. L. Daniel, “Into thin air: contributions of aerodynamic and inertial-elastic forces to wing bending in the hawkmoth<sup>i</sup> manduca sexta<sup>i</sup>,” Journal of Experimental Biology, vol. 206, no. 17, p. 2999–3006, 2003. [Online]. Available: http://dx.doi.org/10.1242/jeb.00502
[13] J. Fu, X. Liu, W. Shyy, and H. Qiu, “Effects of flexibility and aspect ratio on the aerodynamic performance of flapping wings,” Bioinspiration & Biomimetics, vol. 13, no. 3, p. 036001, Mar. 2018. [Online]. Available: http://dx.doi.org/10.1088/1748-3190/aaac1
[14] S. Agrawal, B. W. Tobalske, M. Z. Anwar, H. Luo, T. L. Hedrick, and B. Cheng, “Musculoskeletal wing-actuation model of hummingbirds predicts diverse effects of primary flight muscles in hovering flight,” Proceedings of the Royal Society B: Biological Sciences, vol. 289, no. 1988, Dec. 2022. [Online]. Available: http://dx.doi.org/10.1098/rspb.2022.2076
[15] T. Nakata, H. Liu, and R. J. Bomphrey, “A cfd-informed quasi-steady model of flapping-wing aerodynamics,” Journal of Fluid Mechanics, vol. 783, p. 323–343, Oct. 2015. [Online]. Available: http://dx.doi.org/10.1017/jfm.2015.537
[16] J. A. Pohly, J. L. Salmon, J. E. Bluman, K. Nedunchezian, and C.-K. Kang, “Quasi-steady versus navier–stokes solutions of flapping wing aerodynamics,” Fluids, vol. 3, no. 4, p. 81, Oct. 2018. [Online]. Available: http://dx.doi.org/10.3390/fluids3040081
[17] B. Cheng, B. W. Tobalske, D. R. Powers, T. L. Hedrick, Y. Wang, S. M. Wethington, G. T. Chiu, and X. Deng, “Flight mechanics and control of escape manoeuvres in hummingbirds ii. aerodynamic force production, flight control and performance limitations,” Journal of Experimental Biology, Jan. 2016. [Online]. Available: http://dx.doi.org/10.1242/jeb.137570
[18] M. Sidebottom, L. Margetts, and M. R. A. Nabawy, “Quasi-steady aerodynamic modelling of hovering miniature insects,” in AIAA SCITECH 2025 Forum. American Institute of Aeronautics and Astronautics, Jan. 2025. [Online]. Available: http://dx.doi.org/10.2514/6.2025-1075
[19] J. Gerdes, H. A. Bruck, and S. K. Gupta, “Improving prediction of flapping-wing motion by incorporating actuator constraints with
models of aerodynamic loads using in-flight data," Journal of Mechanisms and Robotics, vol. 9, no. 2, Mar. 2017. [Online]. Available: http://dx.doi.org/10.1115/1.4035994
[20] Q. Wang, J. Goosen, and F. van Keulen, “Optimal pitching axis location of flapping wings for efficient hovering flight,” Bioinspiration & Biomimetics, vol. 12, no. 5, p. 056001, 2017. [Online]. Available: http://dx.doi.org/10.1088/1748-3190/aa7795
[21] J. Z. Zhang, T. A. Howell, Z. Yi, C. Pan, G. Shi, G. Qu, T. Erez, Y. Tassa, and Z. R. Manchester, “Whole-body model-predictive control of legged robots with mujoco,” in 2026 IEEE International Conference on Robotics and Automation (ICRA). IEEE, 2026, p. 17478–17485. [Online]. Available: http://dx.doi.org/10.1109/icra57385.2026.11696981
[22] S. Akki and T. Chen, “Benchmarking model predictive control and reinforcement learning-based control for legged robot locomotion in mujoco simulation,” IEEE Access, vol. 13, p. 108732–108742, 2025. [Online]. Available: http://dx.doi.org/10.1109/access.2025.3582523
[23] J. Degrave, M. Hermans, J. Dambre, and F. wyffels, “A differentiable physics engine for deep learning in robotics,” Frontiers in Neurorobotics, vol. 13, Mar. 2019. [Online]. Available: http://dx.doi.org/10.3389/fnbot.2019.00006
[24] F. Fei, Z. Tu, J. Zhang, and X. Deng, “Learning extreme hummingbird maneuvers on flapping wing robots,” in 2019 International Conference on Robotics and Automation (ICRA). IEEE, May 2019, p. 109–115. [Online]. Available: http://dx.doi.org/10.1109/icra.2019.8794100
[25] J.-S. Han and C. Breitsamter, “Aerodynamic investigation on shifted-back vertical stroke plane of flapping wing in forward flight,” Bioinspiration & Biomimetics, vol. 16, no. 6, p. 064001, Nov. 2021. [Online]. Available: http://dx.doi.org/10.1088/1748-3190/ac305f
[26] H. K. Kwon and J.-W. Chang, “Aerodynamic and visualization study based on advance ratio and insect-like wing shape in insect forward flight,” International Journal of Aeronautical and Space Sciences, vol. 27, no. 4, p. 2818–2834, Feb. 2026. [Online]. Available: http://dx.doi.org/10.1007/s42405-026-01151-5
[27] S. Valencia, J. E. Orduy, P. F. Melo, and C. L. Tafur, “Pulley-based flapping propulsion for hoverable micro air vehicles: A critical review, comparative metrics and roadmap,” Drones, vol. 10, no. 2, p. 143, Feb. 2026. [Online]. Available: http://dx.doi.org/10.3390/drones10020143
[28] R. Singh, P. Gergondet, and F. Kanehiro, “Mc-mujoco: Simulating articulated robots with fsm controllers in mujoco,” in 2023 IEEE/SICE International Symposium on System Integration (SII). IEEE, Jan. 2023, p. 1–5. [Online]. Available: http://dx.doi.org/10.1109/sii55687.2023.10039218
[29] H. Wang, V. Caggiano, G. Durandau, M. Sartori, and V. Kumar, “Myosim: Fast and physiologically realistic mujoco models for musculoskeletal and exoskeletal studies,” in 2022 International Conference on Robotics and Automation (ICRA). IEEE, May 2022, p. 8104–8111. [Online]. Available: http://dx.doi.org/10.1109/icra46639.2022.9811684
[30] G. Vaxenburg, I. Siwanowicz, J. Merel, A. A. Robie, C. Morrow, R. Novati, Z. Stefanidi, G.-J. Both, G. M. Card, M. B. Reisner, M. M. Botvinick, K. M. Branson, Y. Tassa, and S. C. Turaga, “Whole-body physics simulation of fruit fly locomotion,” Nature, vol. 643, pp. 1312–1320, 2025. [Online]. Available: https://doi.org/10.1038/s41586-025-09029-4
[31] F. Fei, Z. Tu, Y. Yang, J. Zhang, and X. Deng, “Flappy hummingbird: An open source dynamic simulation of flapping wing robots and animals,” in 2019 International Conference on Robotics and Automation (ICRA). IEEE, 2019, pp. 9223–9229.
[32] Qian, Fang, Jia, Yan, Liang, and Li, “Toward practical autonomous flight simulation for flapping wing biomimetic robots with experimental validation,” IEEE Transactions on Automation Science and Engineering, 2024.
APPENDIX I
SUPPLEMENTARY INFORMATION
A. Complete FlapSim v0.2.0 Codebase, Plugin, and Robot Manifest Inventory
Table IV lists all 17 registered plugins across the seven plugin kinds of FlapSim v0.2.0, together with the 4 aerodynamic models and 1 modifier available to the composite aerodynamic model, the robot descriptions shipped with the package, and the verification suite (117 test functions across 23 test files).
B. Physical Force (N) and Torque (N m) RMSE and Runtime Breakdown by Scenario Family
While Table III in the main text reports normalized force error and normalized torque error , Table V provides the complete dimensional force RMSE (mN), dimensional torque RMSE (mN·m), per-family CPU speedup ( ), total candidate and reference CPU seconds, step throughput (steps/s), and offline training and testing wall-clock times for all five completed ablation-study variants in paper_data.json.
C. Mathematical Analysis of Multirate 21-Substep Clock Drift and Filter-Window Non-Commutativity
1. Derivation of the 21-Substep Reference Clock Drift
At the start of recording call , let be the accumulated simulation time. The implemented advance routine sets the relative target and repeatedly increments time by until this target is reached. Floating-point rounding can require 21 rather than 20 substeps. Since the next target is based on the newly accumulated time, these overruns accumulate; a target anchored to would instead prevent this cumulative dilation. Approximating the repeated calls by 21 substeps gives 1.05 ms per recording call and about 30 ms of drift over 600 calls (0.75–1.35 wingbeat cycles at 25–45 Hz). Exact substep counts depend on the floating-point trajectory, so Eq. (5) is an implementation-specific alignment approximation, not a general identity of IEEE-754 arithmetic. Frequency changes are scheduled by recording index; their reference-clock time consequently differs from the nominal timestamp. The completed pre- and post-alignment runs report frequency-step fidelity of 0.5957 and 0.9204, respectively, but the isolated nominal-clock ablation did not complete.
2. Non-Commutativity of Fixed-Window Moving-Average Filtering Across Frequency Steps
Let denote the fixed moving-average window length for a frequency-step scenario with pre-step frequency and post-step frequency , where and . Consider the -th harmonic component of the blade-element wrench, , where for and for . Applying the two-pass discrete moving-average operator yields three distinct regimes:
-
Low-frequency segment : Because , the recorded mean fundamental gain is , strongly attenuating the harmonic.
-
Straddle window : The averaging window sums samples from both and across the phase discontinuity , producing a non-zero transient pulse of duration ms whose sign and magnitude depend on the exact phase at .
-
High-frequency segment : Because is generally non-integer, the filter need not suppress the harmonics, with the recorded mean increasing two-pass transmission by at (mean ) and at .
Thus, can be nonzero in both and the entire half of the trajectory. Because is a linear operator, generating the matching phase-locked harmonics inside the 1 ms surrogate guarantees , so accurate harmonic reconstruction can reproduce both the straddle pulse and the leaked oscillation; linearity alone does not guarantee that the fitted harmonics are accurate.
D. Multi-Block Ridge Weight Norms, Cross-Validation Sensitivity, and Training Budget Analysis
Figure 8 and Table VI present the complete offline identification and cross-validation analysis.
- Offline Compute Partition and 8-Worker Parallelism. In the five-block harmonic model (160.50s total training wall-clock time), 72.2% (115.96s) is spent simulating the 356 space-filling 50 s reference trajectories (304 gimbaled-flapper trajectories requiring 822.18s reference CPU time at 2.705 s mean CPU time per trajectory, and 52 flat-plate flapper trajectories requiring 104.36s reference CPU time at 2.007 s per trajectory). Executing these 926.55 s of cumulative reference CPU work across 8 forked worker processes yields a parallel throughput gain ( relative to the gimbaled flapper's CPU time alone), while the 8-step ridge regression pipeline consumes 41.51 s (25.9%, of which 37.29 s is spent in Step 5's 6-candidate cross-validation grid) and post-fit verification across 48 scenarios takes 3.03 s (1.9%).
2. Why Removing Harmonics Causes a Weight-Norm Increase in Step 5
As shown in Table VI and Figure 8(a), subtracting the filtered Stage 1–2 harmonic predictions prior to fitting Block 3 in the five-block harmonic model keeps the Step-5 Frobenius weight norm small ( , or 0.8718 in the 4-block model) with a low normalized residual RMSE of 0.03621. When harmonics are zeroed, the unsubtracted oscillatory filter leakage remains inside the Step-5 target residual, forcing Block 3's 48 collinear real exponential-decay and low-pass-filter features ( ms) to fit oscillatory ringdown with large opposing weights. This increases by to 5.0885, leaves a larger training residual (0.17224), and coincides with a generalization gap (frequency-step fidelity dropping from 0.6953 in-sample to 0.6215 on CV validation and 0.6028 on the held-out test set).
3. Cross-Validation Phase-Mode Selection
Across the 6-candidate CV grid (Figure 8(b)), selecting direct phase with harmonic sample weight 3.0) achieves a held-out CV frequency-step fidelity of 0.90580 in the five-block harmonic model and 0.91203 in the four-block
TABLE IV
COMPLETE REGISTRY OF FLAPSIM V0.2.0 PLUGINS (17 ACROSS 7 KINDS), AERODYNAMIC MODELS (4) AND MODIFIERS (1), SHIPPED ROBOT DESCRIPTIONS, AND VERIFICATION SUITE.
| Kind / category | Count | Registered identifiers and scope |
|---|---|---|
| actuator | 4 | sinusoidal_stroke (kinematic or position-only stroke), pd_position (PD or kinematic hold), servo (rate-limited lagged target), dc_motor_crank (voltage-driven motor, gearbox, crank) |
| aero | 3 | quasi_steady (single-model stack), stack (additive models and modifiers), cycle_averaged (rigid-body hover model, identified parameters) |
| atmosphere | 1 | standard (ISA density or , steady wind, gust, Ornstein–Uhlenbeck turbulence) |
| controller | 3 | hover_pid (cascaded altitude and attitude PID), schedule (time-scheduled set points), callback (user Python function) |
| force | 1 | body_drag (quadratic drag per body axis relative to the wind) |
| recorder | 1 | memory (samples matching signals every ; export) |
| sensor | 4 | imu, rangefinder, encoder, wrench, each with sample-and-hold, low-pass, delay, noise, bias and quantization conditioning |
| Aerodynamic models | 4 | quasi_steady (Whitney & Wood 2010; Dickinson et al. fits), rotational_lift, added_mass, wake_capture |
| Aerodynamic modifiers | 1 | ground_effect (exponential or Cheeseman–Bennett factor) |
| Robot descriptions | 1 + builder | SingleThrustFlapper (30 g, mm; URDF, robot.yaml, sim.yaml, hover.yaml) and the parametric flat_plate_flapper builder |
| Verification suite | 117 | 117 unit, regression (lift sweep), conformance and example tests across 23 files; 22 documentation pages; 24 example scripts |
TABLE V
CYCLE-FILTERED ERRORS AND RUNTIME OVER 48 HELD-OUT SCENARIOS; 5-BLOCK AND 4-BLOCK DENOTE HARMONIC MODELS. FORCE/TORQUE RMSE UNITS ARE mN/mN·m ( N/10 N·m). CPU SPEEDUP USES THE BLADE-ELEMENT REFERENCE.
| (a) Dimensional errors and per-family speedup | |||||||
|---|---|---|---|---|---|---|---|
| Model | Metric | Frequency | Gimbal | Wind | Step | Gust | Flat plate |
| Hover CA | Force RMSE (mN) | 1.50 | 1.52 | 37.83 | 15.14 | 16.10 | 9.25 |
| Torque RMSE (mN · m) | 0.086 | 0.133 | 1.966 | 1.142 | 0.847 | 0.019 | |
| Family Speedup (×) | 65.83 | 82.09 | 65.38 | 61.97 | 60.40 | 87.20 | |
| LQ wind-lag | Force RMSE (mN) | 1.04 | 3.57 | 6.09 | 15.20 | 3.92 | 3.72 |
| Torque RMSE (mN · m) | 0.057 | 0.087 | 0.145 | 1.153 | 0.094 | 0.019 | |
| Family Speedup (×) | 81.27 | 69.96 | 53.26 | 66.90 | 63.17 | 97.29 | |
| Mean-only | Force RMSE (mN) | 0.93 | 1.36 | 1.07 | 11.18 | 1.26 | 0.76 |
| Torque RMSE (mN · m) | 0.057 | 0.086 | 0.063 | 0.746 | 0.078 | 0.019 | |
| Family Speedup (×) | 77.72 | 75.78 | 55.55 | 56.49 | 59.32 | 115.69 | |
| 5-block | Force RMSE (mN) | 0.47 | 0.80 | 0.77 | 2.27 | 0.84 | 0.30 |
| Torque RMSE (mN · m) | 0.036 | 0.059 | 0.048 | 0.084 | 0.060 | 0.015 | |
| Family Speedup (×) | 86.57 | 77.33 | 52.69 | 64.31 | 52.07 | 92.68 | |
| 4-block | Force RMSE (mN) | 0.47 | 0.80 | 0.77 | 1.70 | 0.84 | 0.30 |
| Torque RMSE (mN · m) | 0.037 | 0.058 | 0.048 | 0.099 | 0.060 | 0.015 | |
| Family Speedup (×) | 79.20 | 66.03 | 52.57 | 68.92 | 61.38 | 109.85 | |
| (b) Overall runtime summary | |||||||
|---|---|---|---|---|---|---|---|
| Configuration | Candidate | Reference | Wall time | Speedup (×) | |||
| CPU (s) | Steps/s | CPU (s) | Steps/s | Train (s) | Test (s) | ||
| Hover CA | 2.173 | 13,027.6 | 146.68 | 3,987.4 | 22.5 | 20.9 | 67.506 |
| LQ wind-lag | 2.054 | 13,780.0 | 140.28 | 4,169.2 | 137.3 | 18.4 | 68.290 |
| Mean-only | 2.115 | 13,384.5 | 140.12 | 4,174.1 | 137.8 | 18.8 | 66.252 |
| 5-block | 2.031 | 13,936.8 | 132.40 | 4,417.2 | 160.5 | 17.9 | 65.189 |
| 4-block | 2.055 | 13,774.8 | 139.70 | 4,186.5 | 165.0 | 18.7 | 67.982 |
harmonic model. Without Block 3, switching to continuous phase at either the nominal or synchronized rate shifts post-
■ 5-block ▲ 4-block ▽ No harmonics ◇ LQ wind-lag


Fig. 8. Ridge-regression weight norms and sensitivity to the phase model. (a) Frobenius weight norm by identification stage. Subtracting the Block 1–2 harmonic predictions before Step 5 avoids a increase in weight norm (0.9920 for the five-block model versus 5.0885 without harmonics). (b) Held-out frequency-step cross-validation fidelity for six combinations of phase convention (direct phase, or continuous phase at nominal or synchronized rate) and harmonic sample weight (1.5 or 3.0). Points are the recorded fit results; no standard-deviation bars are shown.
TABLE VI
OFFLINE RIDGE IDENTIFICATION: FIT WALL TIME (S), FROBENIUS NORM , AND NORMALIZED TRAINING RMSE. 5B/4B: FIVE-/FOUR-BLOCK HARMONIC; MO: MEAN-ONLY. RMSE RATIO: MO/5B.
(a) Identification stages and fit times
| Step | Block and active features | Fit (s) |
|---|---|---|
| 1 | Pass-1 Block 1 Hover Mean (, 12 feat.) | 0.048 |
| 2 | Pass-1 Block 2 Gimbal Mean (, 27 feat.) | 0.413 |
| 3 | Pass-2 Joint Gauss–Seidel (12 feat.) | 0.361 |
| 4 | Pass-2 Joint Gauss–Seidel (27 feat.) | 0.364 |
| 5 | 6-Grid CV + Harmonics (, 2, 66) + Block 3 (104) | 37.289 |
| 6 | Block 4a Steady 3D Wind (54 mean, 24 harm.) | 1.439 |
| 7 | Block 4b Unsteady 3D Gust (36 mean, 24 harm.) | 0.877 |
| 8 | Block 5 Parametric Flat Plate (26 mean, 32 harm.) | 0.722 |
(b) Weight norms and residuals
| Step | Weight norm | RMSE | Ratio | |||
|---|---|---|---|---|---|---|
| 5B | 4B | MO | 5B | MO | ||
| 1 | 0.1639 | 0.1639 | 0.1639 | 0.01961 | 0.01961 | – |
| 2 | 0.0638 | 0.0638 | 0.0638 | 0.01920 | 0.01920 | – |
| 3 | 0.1708 | 0.1708 | 0.1708 | 0.01924 | 0.01924 | – |
| 4 | 0.0638 | 0.0638 | 0.0638 | 0.01919 | 0.01919 | – |
| 5 | 0.9920 | 0.8718 | 5.0885 | 0.03621 | 0.17224 | 4.76 |
| 6 | 0.1986 | 0.1943 | 0.1360 | 0.01334 | 0.02211 | 1.66 |
| 7 | 0.0076 | 0.0055 | 0.0017 | 0.01328 | 0.02394 | 1.80 |
| 8 | 0.3673 | 0.3673 | 0.0845 | 0.00649 | 0.01264 | 1.95 |
Step 5: MO/5B weight-norm ratio ; residual RMSE ratio .
step harmonics out of phase with the sinusoidal actuator, changing CV frequency-step fidelity by to (span ). With both phase conventions in Block 3, the five-block model spans CV fidelity (range narrower).