Implement control torques, thrust-pitch coupling, and ground handling (#14 #15)#19
Open
mido3ds wants to merge 2 commits into
Open
Implement control torques, thrust-pitch coupling, and ground handling (#14 #15)#19mido3ds wants to merge 2 commits into
mido3ds wants to merge 2 commits into
Conversation
This was
linked to
issues
Jul 2, 2026
… handling physics (#14 #15) #14 — Control torques: - Replace direct delta-angle rotation with torque-based physics - torque = deflection × EFFICIENCY × ρ × v² in body frame - angular acceleration = I⁻¹ × torque, integrated to angular velocity - quaternion updated from body-frame angular velocity - thrust-pitch coupling via cross(thrust_offset, thrust_vec) - thrust_offset computed from AABB on aircraft load - Ang_vel damping via ANGULAR_DAMPING constant #15 — Ground handling: - Rolling friction opposes velocity on ground - Brake input (Left Shift) applies braking force - Ground clamp replaces old std::min line - Old thrust-reduction ground block removed - New constants: BRAKE_FORCE, GROUND_RUDDER_BOOST, GROUND_FRICTION Tests: test_torque_physics, test_ground_handling, test_aircraft_ground_handling
f2c8995 to
d33bbf9
Compare
… normalize Fixes three root causes: 1. Idle thrust at zero throttle (aircraft.cpp:266): engine power formula produced idle_power even when speed_percent=0. Changed to require speed_percent > 0. 2. FP ground-detection failure (aircraft.h:262): on_ground used y >= -1.0f which fails at y=-1.0000001 from accumulated std::min FP error. Added 0.001m epsilon. 3. NaN from zero-vector normalize (aircraft.cpp:391): With total force=0 (ground, no thrust), normalize(0,0,0) returns NaN. Guarded with length checks. 4. Clamp after translation (aircraft.cpp:314->404): Moved ground-clamp AFTER translation so plane stays at ground level.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two features in one PR (they share overlapping file changes):
#14 — Control Torques and Thrust-Pitch Coupling
torque = deflection * EFFICIENCY * rho * v^2ang_accel = I^-1 * torquecross(offset, thrust)#15 — Ground Handling
speed_percent = 0(idle power only applies above zero)normalize(0,0,0)protected with length checkaircraft_on_grounduses 0.001m tolerance to prevent gravity impulse from floating-point driftFiles Changed
Test Plan
cmake --build build -j— should compile without errors./build/bin/Debug/open-ysf— verify all 8 test suites PASS at startup: