Foiling Moth Flight Controller

This 2-degree-of-freedom simulation models heave (vertical translation) and pitch (rotation). The PID controller uses the bow sonar measurement to adjust the main-foil flap; as the craft pitches, pitch-rate damping arises from the induced angle of attack (Δα) computed at each foil.

Physics & Environment Affects Forces

15
135
15
0.0
0.09
0.0
2.00
0.78
300
-8.0

Flight Computer (PID & Filter)

Live Telemetry & Forces View Click canvas to change target height

Flight Trajectory & Error

Control Effort (PID Outputs)

Engineering Notes & Physics Validation

1. Windward Heel & Lateral Equilibrium

When the sailor tilts the mast into the wind (windward heel), the underwater main foil tilts with it. This is the primary mechanism for steering a straight course. It splits the foil's lift vector into two components:

  • Vertical Lift (L·cos θ): Supports the weight of the craft.
  • Horizontal Side Force (L·sin θ): Opposes the aerodynamic side force (leeway) generated by the sail.

The Horizontal Balance

For the craft to hold a straight course without lateral drift, the foil side force must balance the sail's leeway force. The simulation enforces this equilibrium: FAero is computed to match the foil side force implied by the selected heel angle (θ):

FLeeway = FSide
FAero = LTotal · tan(θ)

2. Asymmetric Foil Breaching & Ventilation

By calculating the physical Z-coordinate depth of each individual foil, the simulation allows for individual foil ventilation. If the nose pitches up excessively, the forward strut breaches first, dropping Lmain to 0. The still-submerged rudder then produces a large restoring pitching moment that returns the nose downward, reproducing the characteristic recovery behaviour of a hydrofoil after a main-foil breach.

3. PID Control Theory

The PID controller uses the bow's height sensor to adjust the main foil flap, seeking vertical equilibrium. The Proportional (P) term reacts instantly to errors, the Integral (I) provides automatic trim against steady loads (such as the sailor's weight), and the Derivative (D) term damps vertical motion, suppressing oscillations.

4. 2-DOF Rigid Body Dynamics

Unlike simple 1D simulations, this controller operates in a realistic 2-Degree-of-Freedom (Pitch-Heave) space. When the controller deflects the main flap downward, the response is not pure heave; lift increases only at the forward strut, creating a nose-up pitching moment (M). As the nose pitches up, the Angle of Attack (AoA) for the entire hull and rudder foil increases, compounding the lift and introducing complex secondary oscillations.

5. True Aerodynamic Pitch Damping

The simulation calculates the exact real-time Induced Angle of Attack (Δα) caused by the boat's rotation. Because the main foil is ahead of the CG and the rudder is far behind it, pitching nose-up (q > 0) actively pushes the rudder downward into the water column.

Vz = q · r
Δα = arctan(Vz / Vx)

This relative downward motion increases the rudder's local angle of attack and hence its lift, producing a nose-down restoring moment. The pitch damping thus emerges directly from the aerodynamic model rather than from an artificial damping term.

6. Absolute World-Space Vectors

Lift is strictly defined as perpendicular to the incoming freestream. Since the boat is traveling predominantly horizontally, the lift vectors are projected directly upwards (relative to the world horizon), independent of the hull's pitch angle. This geometry is accounted for mathematically (Moment = L · x · cos θ) and visually using Canvas context counter-rotations.