FlapSim: A Composable MuJoCo Simulation Platform and Reduced-Order Aerodynamic Model Hierarchy for Flapping-Wing Robotics
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.
From the abstract. Our summary is in progress.
Full paper
FlapSim: A Composable MuJoCo Simulation Platform and Reduced-Order Aerodynamic Model Hierarchy for Flapping-Wing Robotics
Published under CC BY 4.0. Reproduced with attribution; original at arXiv:2610.40902 (PDF).
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\,\mu\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.
†
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, 2, 3, 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 (Re\in[10^{2},10^{4}]) characterized by leading-edge vortex (LEV) attachment [5, 6], rotational circulation during stroke reversal [7, 8], wing–wake interaction [9, 10, 11], and aeroelastic pitch recoil [12, 13, 14]. While direct Navier–Stokes computational fluid 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 [9, 10, 7, 14]—provide a tractable middle ground whose accuracy depends on the kinematics and aerodynamic effects included [17, 16, 18]. However, because the wing’s instantaneous velocity, angle of attack, and pitching rate oscillate at 20\text{--}50\,\text{Hz} (with higher harmonics up to 300\,\text{Hz}), resolving blade-element loads alongside multibody dynamics motivates small integration steps; this study uses \Delta t_{\text{ref}}=50\,\mu\text{s} (20\,\text{kHz}) [19, 20]. At 50\,\mu\text{s}, simulating 1\,\text{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 \Delta t=1\,\text{ms} (1\,\text{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, 25, 26, 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 50\,\mu\text{s} per-step quasi-steady blade-element simulator down to a 1\,\text{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 (
69Python modules,9{,}177lines of code across13subpackages,17registered plugins,117unit and regression tests). - Quantitative Characterization of the Reduced-Order Aerodynamic Hierarchy: Across
48held-out test scenarios spanning six operating regimes (frequency, gimbal, wind, frequency-step, gust, and parametric flat-plate robots), we benchmark five1\,\text{ms}reduced-order aerodynamic configurations against the50\,\mu\text{s}per-step blade-element reference. We demonstrate that combining multirate21-substep clock synchronization, 3D linear/quadratic wind and multi-rate gust coupling, analytical blade-element planform scaling, and1f\text{--}6fstroke-harmonic synthesis raises48-scenario mean wrench fidelity from0.6593(built-in hover baseline) and0.8280(first-principles wind-lag baseline) to0.9646(65.19\timesspeedup) in a five-block surrogate and0.9662(67.98\timesspeedup) in a streamlined four-block surrogate. Through controlled ablations and transfer-function analysis, we explain why within-cycle1f\text{--}6fharmonics govern mid-flight frequency-step fidelity (+0.3176held-out step lift) and show no additional benefit from explicit step-transient lag states in this benchmark.
Figure 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/.
II Related Work
II-A Related Simulators and Flapping-Wing Aerodynamic Models
General-purpose robotics simulators—including MuJoCo [28, 29, 21, 22], 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 [9, 10, 7], and its regression tests pin the resulting fixed-base lift sweep.
- 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
III Method
III-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.
50\,\mu\text{s} blade-element reference to alternative 1\,\text{ms} reduced models (65\times\text{--}68\times speedup). Dashed connections denote offline identification.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.
- 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
- flapsim.controllers
- 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/)
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:
\displaystyle I_{k} \\ \displaystyle=\int_{0}^{R}r^{k}c(r)\,dr, \\ \displaystyle J_{m} \\ \displaystyle=\int_{0}^{R}r^{m}c(r)^{2}\,dr,\quad k,m\in\{0,1,2,3\}.which govern translational aerodynamic force (I_{2}), aerodynamic roll/pitch moments (I_{3}), rotational circulation (J_{1}), and added-mass inertia (J_{2}) [7, 13]. The primary benchmark platform is a 30\,\text{g} (0.030\,\text{kg}) gimbaled flapping-wing robot with wing span R=0.070\,\text{m} (70\,\text{mm}) and reference timestep \Delta t_{\text{ref}}=50\,\mu\text{s} (5\times 10^{-5}\,\text{s}), complemented by a parametric flat-plate model generator that constructs two-wing robots of arbitrary span R\in[0.06,0.09]\,\text{m} and chord c\in[0.015,0.025]\,\text{m}.
III-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.
1. Quasi-Steady Blade-Element Reference (\Delta t_{\text{ref}}=50\,\mu\text{s}).
The reference simulator integrates blade-element loads using precomputed spanwise planform moments. At a representative span location r_{i}, the relative velocity can be written in the general rigid-body form below; the implementation evaluates its spanwise dependence analytically. At each 50\,\mu\text{s} step, the local relative airflow velocity \mathbf{u}_{i}(t)\in\mathbb{R}^{3} in the wing-strip frame combines the flapping/pitching velocity of the strip, body translational/angular velocity, and transformed ambient wind \mathbf{w}(\mathbf{x}_{i},t):
\displaystyle\mathbf{u}_{i}(t)={} \\ \displaystyle\mathbf{R}_{w}^{\top}(t)\bigl(\mathbf{v}_{\text{body}}(t)+\boldsymbol{\omega}_{\text{body}}(t)\times\mathbf{r}_{i}(t) \\ \displaystyle}{\displaystyle-\mathbf{w}(\mathbf{x}_{i},t)\bigr)+\mathbf{v}_{\text{strip,rel}}(r_{i},t).The evaluated reference uses FlapSim’s quasi-steady normal-force model.
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
\displaystyle C_{N}(\alpha)={} \\ \displaystyle 1.8\sin(2\alpha)\cos\alpha+1.95\sin\alpha \\ \displaystyle}{\displaystyle-1.5\cos(2\alpha)\sin\alpha, \\ \displaystyle d_{\mathrm{cp}}(\alpha)={} \\ \displaystyle 0.46-0.332\cos\alpha \\ \displaystyle}{\displaystyle-0.037\cos(3\alpha)-0.013\cos(5\alpha).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 \mathbf{W}_{\mathrm{ref}}=[\mathbf{F}_{\mathrm{ref}}^{\top},\boldsymbol{\tau}_{\mathrm{ref}}^{\top}]^{\top}\in\mathbb{R}^{6}. Quasi-steady formulations in the broader literature account for translational loading and wing interactions [9, 10, 7, 16], rotational circulation [8, 20, 14], 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 (\Delta t=1\,\text{ms}).
FlapSim’s built-in reduced plugin steps at \Delta t=1\,\text{ms} (20\times larger than \Delta t_{\text{ref}}) and approximates the stroke-averaged hover thrust and gimbal control moments [24, 4, 27] as:
\displaystyle\bar{F}_{z}(f,\Phi) \\ \displaystyle=k_{L}f^{2}(\Phi/\Phi_{0})^{p}, \\ \displaystyle\mathbf{F}_{\text{hover}} \\ \displaystyle=\bar{F}_{z}\begin{bmatrix}\sin\theta_{\text{pitch}}\\
-\sin\theta_{\text{roll}}\\
\cos\theta_{\text{pitch}}\cos\theta_{\text{roll}}\end{bmatrix}, \\ \displaystyle\boldsymbol{\tau}_{\text{gimbal}} \\ \displaystyle=\begin{bmatrix}k_{\tau,x}\theta_{\text{roll}}\\
k_{\tau,y}\theta_{\text{pitch}}\\
0\end{bmatrix}(\bar{F}_{z}/\bar{F}_{z,0}).The identification fit gives k_{L}=1.85175\times 10^{-4}\,\text{N/Hz}^{2} and p=2.5002 from 11 wind-tunnel sweeps (22.5\,\text{s}). For flat-plate scenarios, a single hover coefficient k_{\text{plate}}=1.04517\times 10^{-4}\,\text{N/Hz}^{2} is scaled analytically by cR^{3}/(c_{\text{ref}}R_{\text{ref}}^{3}). As documented in the platform roadmap, the cycle-averaged model omits the effect of ambient wind \mathbf{w}, applies frequency changes instantaneously without transient lag, and omits within-cycle stroke harmonics.
3. Linear/Quadratic (LQ) Wind-Lag Baseline (\Delta t=1\,\text{ms}).
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 \tau_{\text{lag}}\dot{f}_{\text{eff}}+f_{\text{eff}}=f_{\text{cmd}} with \tau_{\text{lag}}=12\,\text{ms}; (ii) linear flapping-coupled wind drag \mathbf{D}_{\text{lin}}=-\mathbf{C}_{1}(f_{\text{eff}}\Phi)\mathbf{w} representing cycle-averaged blade-element advance-ratio damping [24, 25, 26, 27]; (iii) quadratic bluff-body wind drag \mathbf{D}_{\text{quad}}=-\mathbf{C}_{2}\|\mathbf{w}\|\mathbf{w}; and (iv) analytical strip-integral scaling cR^{3}f^{2}\Phi^{2} for parametric flat plates.
4. Multi-Block Harmonic Surrogate (\Delta t=1\,\text{ms}).
To achieve near-reference accuracy across the evaluated conditions while preserving a \sim 65\times\text{--}68\times 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:
\displaystyle\mathbf{W}_{\text{surr}}(t) \\ \displaystyle=\bar{\mathbf{W}}(t)+\tilde{\mathbf{W}}(t), \\ \displaystyle\bar{\mathbf{W}}(t) \\ \displaystyle=\sum_{b\in\mathcal{B}}\boldsymbol{\phi}_{\text{mean}}^{(b)}(\mathbf{s}(t_{\text{eval}}))^{\top}\mathbf{W}_{m}^{(b)}, \\ \displaystyle\tilde{\mathbf{W}}(t) \\ \displaystyle=\sum_{b\in\mathcal{B}}\boldsymbol{\phi}_{\text{harm}}^{(b)}(\mathbf{s}(t_{\text{eval}}),\psi(t_{\text{eval}}))^{\top}\mathbf{W}_{h}^{(b)}.where \mathbf{s}(t_{\text{eval}}) denotes the kinematic, gimbal, wind, gust, and planform state features evaluated at the multirate-synchronized clock t_{\text{eval}}, and \psi(t_{\text{eval}})=2\pi f(t_{\text{eval}})t_{\text{eval}} 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\,\mathrm{ms} sample. Each call forms a new target from the current floating-point simulation time plus 1\,\mathrm{ms}. With 50\,\mu\mathrm{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:
t_{\text{eval}}(t)=\begin{cases}t+0.001,&t<0.2\,\text{s},\\
0.2+1.05(t-0.2)+0.001,&t\geq 0.2\,\text{s}.\end{cases}This mapping approximately aligns stroke phase \psi(t_{\text{eval}}), frequency-step transition times, and 1-\cos gust arrival windows with the 50\,\mu\text{s} reference simulator without altering the 1\,\text{ms} MuJoCo integrator timestep.
Hierarchical Feature Blocks (\mathcal{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 \leq 49{,}999 within the 300\,\text{s} training budget): (i) Blocks 1 & 2 (Hover & Gimbal Control): polynomial basis in normalized stroke frequency f, amplitude \Phi, and dynamic pressure (f\Phi)^{2} (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 (\tau\in\{2,5,12,25,50,100\}\,\text{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 (w_{x},w_{y},w_{z}), advance-ratio cross-terms \mathbf{w}\otimes(f\Phi,f^{2}\Phi^{2}), gimbal–wind interactions (54 mean, 24 harmonic features in 4a), and multi-rate filtered wind accelerations \dot{\mathbf{w}}_{\text{lpf}} capturing unsteady 1-\cos gust lags (36 mean, 24 harmonic features in 4b); and (iv) Block 5 (Parametric Flat-Plate Planform Scaling): analytical blade-element basis combining cR^{3}f^{2}\Phi^{2}, c^{2}R^{2}f^{2}\Phi^{2}, aspect ratio R/c, and inverse aspect ratio c/R (26 mean, 32 harmonic features). At runtime, the model evaluates pre-allocated one-dimensional feature arrays against contiguous weight matrices in <70\,\mu\text{s} per 1\,\text{ms} step.
III-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 200\,\text{ms} unrecorded settle period followed by a 600\,\text{ms} evaluation recording (600 samples at 1\,\text{kHz}) on a fixed base with kinematically imposed stroke and gimbal angles across six regimes: (1) frequency: constant-frequency and amplitude sweeps across f\in[22,48]\,\text{Hz} and \Phi\in[1.1,1.5]\,\text{rad} in still air; (2) gimbal: combined roll and pitch thrust-vector tilt deflections (\theta_{\text{roll}},\theta_{\text{pitch}}) across flapping frequencies; (3) wind: steady 3D ambient wind vectors \mathbf{w}\in\mathbb{R}^{3} up to \|\mathbf{w}\|\approx 3.0\,\text{m/s} across arbitrary azimuth and elevation angles; (4) frequency-step: abrupt mid-flight frequency steps f_{1}\to f_{2} (|f_{2}-f_{1}|\geq 5\,\text{Hz}) occurring at t=0.3\,\text{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 R\in[0.06,0.09]\,\text{m} and chord c\in[0.015,0.025]\,\text{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 \mathbf{W}_{\text{ref}}(t) and surrogate wrench \mathbf{W}_{\text{surr}}(t) are passed through a two-pass one-stroke-period moving-average filter \mathcal{F}_{W} of integer window length W=\max(1,\text{round}(1/(f_{\min}\Delta t))), where f_{\min}=\min(f_{1},f_{2}) [7]. Let \mathbf{f}_{j}=\mathcal{F}_{W}[\mathbf{F}_{\mathrm{ref}}]_{j} denote the filtered reference samples. The implementation uses
F_{\mathrm{scale}}=\max\!\left(0.10\left\|\frac{1}{N_{f}}\sum_{j=1}^{N_{f}}\mathbf{f}_{j}\right\|_{2},\;0.01\,\mathrm{N}\right),where N_{f}=600-2(W-1) because both filter passes use valid convolution. The torque scale is \tau_{\mathrm{scale}}=RF_{\mathrm{scale}}. For vector signals, RMSE is the square root of the temporal mean of the squared Euclidean error norm. The normalized RMS force error e_{F}, normalized RMS torque error e_{\tau}, scenario wrench fidelity \mathcal{M}_{s}, and overall benchmark score S are:
\displaystyle e_{F} \\ \displaystyle=\frac{\operatorname{RMSE}(\mathcal{F}_{W}[\mathbf{F}_{\text{surr}}],\mathcal{F}_{W}[\mathbf{F}_{\text{ref}}])}{F_{\text{scale}}}, \\ \displaystyle e_{\tau} \\ \displaystyle=\frac{\operatorname{RMSE}(\mathcal{F}_{W}[\boldsymbol{\tau}_{\text{surr}}],\mathcal{F}_{W}[\boldsymbol{\tau}_{\text{ref}}])}{\tau_{\text{scale}}}, \\ \displaystyle\mathcal{M}_{s} \\ \displaystyle=e^{-(e_{F}+e_{\tau})/2}, \\ \displaystyle S \\ \displaystyle=\bar{\mathcal{M}}\cdot\operatorname{clip}\left(\frac{\ln(\text{CPU}_{\text{ref}}/\text{CPU}_{\text{surr}})}{\ln 20},0,1\right).Any configuration achieving at least a 20\times CPU speedup saturates the speed factor at 1.0, so its benchmark score S equals its 48-scenario mean wrench fidelity \bar{\mathcal{M}}=\frac{1}{48}\sum_{s=1}^{48}\mathcal{M}_{s}.
IV Results
IV-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\,\text{ms} aerodynamic hierarchy tiers compared against the 50\,\mu\text{s} per-step quasi-steady reference simulator. Because all five 1\,\text{ms} models execute in 2.031\text{--}2.173\,\text{s} of total CPU time across the 48 scenarios—compared to 132.40\text{--}146.68\,\text{s} for the 50\,\mu\text{s} reference simulator—every reduced configuration achieves an overall CPU speedup between 65.19\times and 68.29\times (exceeding the 20\times threshold with a unit speed factor of 1.0).
- Metric
- Frequency
- Gimbal
- Wind
- Step
- Gust
- Flat plate
- Hover CA
- Fidelity \mathcal{M}
- 0.9275
- 0.9440
- 0.2356
- 0.4874
- 0.6153
- 0.7462
- Force error e_{F}
- 0.0838
- 0.0508
- 1.8124
- 0.6922
- 0.5810
- 0.6030
- Torque error e_{\tau}
- 0.0669
- 0.0647
- 1.3454
- 0.7563
- 0.4399
- 0.0184
- LQ wind-lag
- Fidelity \mathcal{M}
- 0.9522
- 0.9248
- 0.8250
- 0.4840
- 0.9088
- 0.8734
- Force error e_{F}
- 0.0545
- 0.1159
- 0.3035
- 0.7013
- 0.1454
- 0.2609
- Torque error e_{\tau}
- 0.0436
- 0.0417
- 0.0967
- 0.7676
- 0.0469
- 0.0183
- Mean-only
- Fidelity \mathcal{M}
- 0.9543
- 0.9576
- 0.9535
- 0.6028
- 0.9594
- 0.9646
- Force error e_{F}
- 0.0499
- 0.0456
- 0.0517
- 0.5209
- 0.0440
- 0.0539
- Torque error e_{\tau}
- 0.0438
- 0.0413
- 0.0437
- 0.4960
- 0.0389
- 0.0183
- Five-block harmonic
- Fidelity \mathcal{M}
- 0.9755
- 0.9730
- 0.9662
- 0.9204
- 0.9712
- 0.9814
- Force error e_{F}
- 0.0231
- 0.0267
- 0.0362
- 0.1095
- 0.0285
- 0.0221
- Torque error e_{\tau}
- 0.0266
- 0.0283
- 0.0327
- 0.0571
- 0.0300
- 0.0155
- Four-block harmonic
- Fidelity \mathcal{M}
- 0.9752
- 0.9730
- 0.9662
- 0.9299
- 0.9714
- 0.9814
- Force error e_{F}
- 0.0231
- 0.0267
- 0.0362
- 0.0805
- 0.0285
- 0.0221
- Torque error e_{\tau}
- 0.0273
- 0.0282
- 0.0328
- 0.0674
- 0.0297
- 0.0155
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 \pm 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.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\,\mu\text{s} blade-element simulator well in still-air hover (frequency fidelity 0.9275, e_{F}=0.0838, e_{\tau}=0.0669) and constant-tilt attitude control (gimbal fidelity 0.9440, e_{F}=0.0508, e_{\tau}=0.0647). However, its fidelity decreases in four regimes: (1) 3D Steady Wind (wind fidelity 0.2356): ignoring ambient airflow \mathbf{w} yields e_{F}=1.8124 (physical RMSE 37.83\,\text{mN}) and e_{\tau}=1.3454 (1.966\,\text{mN}\cdot\text{m}), approximately 1.81\times the reference force normalization scale; (2) Mid-Flight Frequency Steps (frequency-step fidelity 0.4874): instantaneous changes in \bar{F}_{z}\propto f^{2} without clock synchronization or harmonic synthesis produce e_{F}=0.6922 (15.14\,\text{mN}) and e_{\tau}=0.7563 (1.142\,\text{mN}\cdot\text{m}); (3) Unsteady Wind Gusts (gust fidelity 0.6153): unmodeled 1-\cos gust impingement yields e_{F}=0.5810 (16.10\,\text{mN}) and e_{\tau}=0.4399 (0.847\,\text{mN}\cdot\text{m}); and (4) Parametric Wing Geometries (flat-plate fidelity 0.7462): extrapolating a single hover coefficient via cR^{3} leaves a vertical thrust residual e_{F}=0.6030 (9.25\,\text{mN}) despite low zero-gimbal torque error e_{\tau}=0.0184 (0.019\,\text{mN}\cdot\text{m}) [13].
Closing the 3D Wind, Gust, and Planform Scaling Gaps.
Figure 4 decomposes normalized force error e_{F} and torque error e_{\tau} on a logarithmic scale across all six families. Introducing the compact first-principles linear/quadratic wind-drag and 12\,\text{ms} lag baseline lifts overall 48-scenario fidelity by +0.1687 to 0.828039 (68.29\times speedup): wind fidelity increases from 0.2356 to 0.8250 (e_{F} reduced 6.0\times from 1.8124 to 0.3035; e_{\tau} reduced 13.9\times 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\times relative to the hover baseline (e_{F}=1.8124\to 0.0362, physical RMSE 37.83\,\text{mN}\to 0.77\,\text{mN}) and wind torque error by 41.1\times (e_{\tau}=1.3454\to 0.0327, physical RMSE 1.966\,\text{mN}\cdot\text{m}\to 0.048\,\text{mN}\cdot\text{m}). Similarly, multi-rate filtered gust states reduce gust force error by 20.4\times (0.5810\to 0.0285, fidelity 0.9714), and the polynomial planform basis reduces flat-plate force error by 27.3\times (0.6030\to 0.0221, physical RMSE 9.25\,\text{mN}\to 0.30\,\text{mN}, fidelity 0.9814).
e_{F}. (b) Normalized torque error e_{\tau}. Both axes are logarithmic. The original benchmark records a 50.1\times wind force-error reduction (1.8124\to 0.0362) and a 27.3\times flat-plate force-error reduction (0.6030\to 0.0221). Points and error bars show means and \pm 1 sample standard deviation across the 8 scenarios per regime in the local re-evaluation.IV-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 \mathcal{F}_{W}—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.
20\times score-saturation threshold. Points and error bars show means and \pm 1 sample standard deviation across the 8 scenarios per regime in the local re-evaluation. Original benchmark family speedups span 52.07\times to 109.85\times. (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.1. Ablating 1f\text{--}6f Stroke-Phase Harmonics.
Zeroing all within-cycle harmonic weights (\mathbf{W}_{h}^{(b)}=\mathbf{0}) 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 \Delta S=-0.065925 (from 0.964630 to 0.898705). Across the five constant-frequency families, removing harmonics causes only a modest fidelity reduction of 0.0118\text{--}0.0212 (frequency 0.9755\to 0.9543, gimbal 0.9730\to 0.9576, wind 0.9662\to 0.9535, gust 0.9712\to 0.9594, flat-plate 0.9814\to 0.9646). In comparison, during mid-flight frequency steps, removing harmonics changes fidelity by -0.3176 on the held-out test set (0.9204\to 0.6028; force error increasing 4.76\times from 0.1095 to 0.5209, torque error increasing 8.69\times from 0.0571 to 0.4960) and by -0.3680 on the separate 48-scenario post-hoc evaluation suite (0.9325\to 0.5645, paired t=10.07, p=2.04\times 10^{-5}, exact Wilcoxon p=0.0078125).
2. Transfer-Function Analysis of Moving-Average Filter Leakage.
For a harmonic oscillating at f_{\text{osc}}=kf, two passes of a discrete boxcar moving average of integer length W have the exact amplitude transfer gain:
G_{\text{2pass}}(kf,W)=\left(\frac{\sin(\pi kfW\Delta t)}{W\sin(\pi kf\Delta t)}\right)^{\!2}.Post-hoc evaluation across all 48 scenarios (Figure 6) reveals two physical regimes: (i) Constant-Frequency Integer-Millisecond Rounding Leakage (n=40 scenarios): because W=\text{round}(1000/f) rounds the stroke period to the nearest integer millisecond, Wf\Delta t=1+\epsilon with |\epsilon|\leq 1/(2W)\approx 1.1\%\text{--}2.4\%, yielding a non-zero two-pass transmission G_{\text{2pass}}(1f,W)=1.25\times 10^{-4} on average. Because the raw blade-element flapping force oscillation has an RMS amplitude of 0.34\text{--}0.48\,\text{N} (15\times\text{--}21\times larger than F_{\text{scale}}\approx 0.0225\,\text{N}), the evaluation records 0.6\text{--}1.5\,\text{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 1f\text{--}6f harmonics passes the matching waveform through \mathcal{F}_{W}, cutting filtered force RMSE in half (1.73\times\text{--}2.15\times reduction) and yielding a +0.0173 mean fidelity lift across the 40 constant-frequency scenarios (95\% CI [+0.0140,+0.0208], paired t=9.70, p=6.06\times 10^{-12}). (ii) Mid-Flight Frequency-Step Period Mismatch and Phase-Jump Leakage (n=8 scenarios): in frequency-step scenarios, the stroke frequency jumps at t=0.3\,\text{s} between f_{1} and f_{2}, but the evaluator applies a single fixed window W=\text{round}(1000/\min(f_{1},f_{2})) tuned exclusively to f_{\text{low}}=\min(f_{1},f_{2}). During the 300\,\text{ms} interval where the wing flaps at f_{\text{high}}=\max(f_{1},f_{2}), W spans Wf_{\text{high}}\Delta t\in[1.14,1.70] stroke cycles. Consequently, single-pass 1f_{\text{high}} transmission increases to 11.19\%\text{--}21.09\% (mean 15.59\%) and two-pass transmission G_{\text{2pass}}(1f_{\text{high}},W) increases from 1.03\times 10^{-4} to 0.02515—a 244.2\times increase in 1f transmission and a 105.9\times increase in 2f transmission. Combined with the 2W-sample window straddling the phase jump at t=0.3\,\text{s}, this leaks 9.56\,\text{mN} of harmonic oscillation (\approx 43\% of F_{\text{scale}}) into the filtered reference trajectory. Phase-locked 1f\text{--}6f synthesis reduces filtered frequency-step force RMSE by 4.88\times (9.56\,\text{mN}\to 1.96\,\text{mN}) while simultaneously reconstructing the unfiltered 50\,\mu\text{s} within-stroke waveform across all 48 scenarios, reducing raw unfiltered 3D force RMSE by 6.65\times (0.4166\,\text{N}\to 0.0627\,\text{N}, paired t=15.05, p<10^{-15}) and raw torque RMSE by 3.35\times (0.0210\,\text{N}\cdot\text{m}\to 0.00625\,\text{N}\cdot\text{m}).
6.65\times (0.4166\,\text{N}\to 0.0627\,\text{N}). (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 244.2\times increase in fundamental-frequency transmission at f_{\text{high}}. Values are aggregate results; neither panel displays standard-deviation bars.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 \mathbf{W}_{m}^{(3)}=\mathbf{0} and \mathbf{W}_{h}^{(3)}=\mathbf{0}) slightly improves held-out 48-scenario mean fidelity from 0.964630 to 0.966191 (\Delta S=+0.001561), lifting held-out frequency-step fidelity from 0.9204 to 0.9299 (reducing frequency-step force error e_{F} from 0.1095 to 0.0805) and increasing CPU speedup from 65.19\times to 67.98\times. This result reveals that once steady-form 1f\text{--}6f harmonics (Blocks 1 & 2) 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 t=0.3\,\text{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 (\Delta S=-0.0712) and drops frequency-step fidelity to 0.5957 (Figure 5(b)).
IV-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.
e_{F}/e_{\tau} with \pm 1 sample standard deviation (n=8 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 P_{10}=0.9435 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.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 P_{10}=0.9435) 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 f_{1}=25.04\,\text{Hz} to f_{2}=44.45\,\text{Hz} with filter window duration W\Delta t=40\,\text{ms}), which records a fidelity of 0.8924 with strongly force-dominated residual asymmetry (e_{F}=0.1507 vs. e_{\tau}=0.0771, ratio e_{F}/e_{\tau}=1.954; held-out test frequency-step ratio e_{F}/e_{\tau}=1.918 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 e_{F}/e_{\tau}=1.43 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 e_{F}/e_{\tau}\in[0.94,1.11], with Pearson correlation r=0.9768 between physical force and torque RMSEs and r=0.8568 between physical force RMSE and the reference force scale F_{\text{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 67.98\times 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\,\text{ms}) reference clock advancement for t\geq 0.2\,\text{s} highlights a floating-point pitfall when driving a 50\,\mu\text{s} reference simulator inside a 1\,\text{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 67.49\times speedup) and exact rank-1 leave-one-scenario-out (LOSO) hybrid passband-stopband calibration (scoring 0.963467 at 65.53\times 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\,\mu\mathrm{s} blade-element reference, the 1\,\mathrm{ms} hover baseline achieves 0.6593 mean wrench fidelity at a 67.51\times CPU speedup. Combining clock alignment, inflow and gust coupling, planform scaling, and phase-locked harmonics raises fidelity to 0.9646 (65.19\times speedup) in the five-block model and 0.9662 (67.98\times) 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\times reduction) and reproduces oscillations retained by the fixed-window filter during frequency steps, where fundamental-frequency transmission increases by 244.2\times. 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
Appendix A Supplementary Information
A-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).
- 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 \rho, steady wind, 1-\cos/sine/step 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 \Delta t; 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\,\text{g}, R=70\,\text{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
A-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 e_{F} and normalized torque error e_{\tau}, Table V provides the complete dimensional force RMSE (mN), dimensional torque RMSE (\text{mN}\cdot\text{m}), per-family CPU speedup (\times), 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.
- 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 (\text{mN}\cdot\text{m})
- 0.086
- 0.133
- 1.966
- 1.142
- 0.847
- 0.019
- Family Speedup (\times)
- 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 (\text{mN}\cdot\text{m})
- 0.057
- 0.087
- 0.145
- 1.153
- 0.094
- 0.019
- Family Speedup (\times)
- 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 (\text{mN}\cdot\text{m})
- 0.057
- 0.086
- 0.063
- 0.746
- 0.078
- 0.019
- Family Speedup (\times)
- 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 (\text{mN}\cdot\text{m})
- 0.036
- 0.059
- 0.048
- 0.084
- 0.060
- 0.015
- Family Speedup (\times)
- 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 (\text{mN}\cdot\text{m})
- 0.037
- 0.058
- 0.048
- 0.099
- 0.060
- 0.015
- Family Speedup (\times)
- 79.20
- 66.03
- 52.57
- 68.92
- 61.38
- 109.85
A-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 k, let t_{k} be the accumulated simulation time. The implemented advance routine sets the relative target t_{\mathrm{target},k}=t_{k}+10^{-3}\,\mathrm{s} and repeatedly increments time by \Delta t_{\mathrm{ref}}=5\times 10^{-5}\,\mathrm{s} 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 0.2+(k+1)10^{-3} would instead prevent this cumulative dilation. Approximating the repeated calls by 21 substeps gives 1.05\,\mathrm{ms} per recording call and about 30\,\mathrm{ms} of drift over 600 calls (0.75–1.35 wingbeat cycles at 25–45\,\mathrm{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 W=\text{round}(1/(f_{\text{low}}\Delta t)) denote the fixed moving-average window length for a frequency-step scenario with pre-step frequency f_{1} and post-step frequency f_{2}, where f_{\text{low}}=\min(f_{1},f_{2}) and f_{\text{high}}=\max(f_{1},f_{2}). Consider the k-th harmonic component of the blade-element wrench, h_{k}(t)=A_{k}(t)\cos(2\pi kf(t)t+\varphi_{k}), where f(t)=f_{1} for t<t_{\text{step}} and f(t)=f_{2} for t\geq t_{\text{step}}. Applying the two-pass discrete moving-average operator \mathcal{F}_{W} yields three distinct regimes:
- Low-frequency segment (
f(t)=f_{\text{low}},|t-t_{\text{step}}|>W\Delta t): BecauseWf_{\text{low}}\Delta t\approx 1, the recorded mean fundamental gain isG_{\text{2pass}}(f_{\text{low}},W)\approx 1.03\times 10^{-4}, strongly attenuating the harmonic. - Straddle window (
|t-t_{\text{step}}|\leq W\Delta t): The averaging window sums samples from bothf_{1}andf_{2}across the phase discontinuity\Delta\psi=2\pi(f_{2}-f_{1})t_{\text{step}}, producing a non-zero transient pulse of duration2W\Delta t\in[52,80]\,\text{ms}whose sign and magnitude depend on the exact phase att_{\text{step}}. - High-frequency segment (
f(t)=f_{\text{high}},|t-t_{\text{step}}|>W\Delta t): BecauseWf_{\text{high}}\Delta t\approx f_{\text{high}}/f_{\text{low}}\in[1.14,1.70]is generally non-integer, the filter need not suppress the harmonics, with the recorded mean increasing two-pass transmission by244.2\timesat1f_{\text{high}}(meanG_{\text{2pass}}=0.02515) and105.9\timesat2f_{\text{high}}.
Thus, \mathcal{F}_{W}[h_{k}](t) can be nonzero in both |t-t_{\text{step}}|\leq W\Delta t and the entire f_{\text{high}} half of the trajectory. Because \mathcal{F}_{W} is a linear operator, generating the matching phase-locked harmonics \tilde{\mathbf{W}}(t) inside the 1\,\text{ms} surrogate guarantees \mathcal{F}_{W}[\bar{\mathbf{W}}+\tilde{\mathbf{W}}]=\mathcal{F}_{W}[\bar{\mathbf{W}}]+\mathcal{F}_{W}[\tilde{\mathbf{W}}], so accurate harmonic reconstruction can reproduce both the straddle pulse and the leaked f_{\text{high}} oscillation; linearity alone does not guarantee that the fitted harmonics are accurate.
A-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.
\|\mathbf{W}\|_{F} by identification stage. Subtracting the Block 1–2 harmonic predictions before Step 5 avoids a 5.13\times 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.- 1
- Pass-1 Block 1 Hover Mean (w_m1, 12 feat.)
- 0.048
- 2
- Pass-1 Block 2 Gimbal Mean (w_m2, 27 feat.)
- 0.413
- 3
- Pass-2 Joint Gauss–Seidel w_m1 (12 feat.)
- 0.361
- 4
- Pass-2 Joint Gauss–Seidel w_m2 (27 feat.)
- 0.364
- 5
- 6-Grid CV + Harmonics (w_h1,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
1. Offline Compute Partition and 8-Worker Parallelism.
In the five-block harmonic model (160.50\,\text{s} total training wall-clock time), 72.2\% (115.96\,\text{s}) is spent simulating the 356 space-filling 50\,\mu\text{s} reference trajectories (304 gimbaled-flapper trajectories requiring 822.18\,\text{s} reference CPU time at 2.705\,\text{s} mean CPU time per trajectory, and 52 flat-plate flapper trajectories requiring 104.36\,\text{s} reference CPU time at 2.007\,\text{s} per trajectory). Executing these 926.55\,\text{s} of cumulative reference CPU work across 8 forked worker processes yields a 7.99\times parallel throughput gain (7.09\times relative to the gimbaled flapper’s CPU time alone), while the 8-step ridge regression pipeline consumes 41.51\,\text{s} (25.9\%, of which 37.29\,\text{s} is spent in Step 5’s 6-candidate cross-validation grid) and post-fit verification across 48 scenarios takes 3.03\,\text{s} (1.9\%).
2. Why Removing Harmonics Causes a 5.13\times 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 (\|\mathbf{W}\|_{F}=0.9920, 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 (\tau\in\{2,5,12,25,50,100\}\,\text{ms}) to fit oscillatory ringdown with large opposing weights. This increases \|\mathbf{W}\|_{F} by 5.13\times to 5.0885, leaves a 4.76\times 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 (\psi_{d}(t)=2\pi f(t)t 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 harmonic model. Without Block 3, switching to continuous phase at either the nominal or synchronized rate shifts post-step harmonics out of phase with the sinusoidal actuator, changing CV frequency-step fidelity by -0.3603 to 0.5518 (span 0.3603). With both phase conventions in Block 3, the five-block model spans 0.7989\text{--}0.9058 CV fidelity (range 0.1069, 3.37\times narrower).