The science
Hull roll φ and gimbal angle θ are coupled through the gyro angular momentum H = Ispin Ω. From the Lagrangian: Jp φ'' = Twave - C φ' - K φ - H cosθ θ' and Jg θ'' = Tmotor - Cg θ' + H cosθ φ' - Tstop. Tilting the gimbal makes the spinning rotor push back against the roll rate; an active PD controller on roll and roll rate drives the gimbal. A second, un-stabilised hull (the ghost outline) runs the same waves for comparison.
Without the gyro the hull is a damped oscillator with natural period 2π sqrt(J/K); waves near that period give resonance.
Simplifications: linear hydrostatic restoring (small angles), prescribed beam-sea torque (sum of three sines in 'mixed'), no coupling to heave or yaw, ideal spin drive at constant rpm, simple gimbal stop. Not a certified marine model.
Made with ChatGPT · 2D companion of the 3D page; same solver and numbers.