Fix bug with incorrect thrust direction and update test for vel and x_cg

This commit is contained in:
Alex Selimov 2026-08-12 20:11:16 -04:00
parent 3cba5f4781
commit 6862712551
3 changed files with 44 additions and 5 deletions

View file

@ -11,7 +11,7 @@ pub fn propThrust(attitude: vec3.QuatF64, p: drone.Propeller) struct { vec3.Vec3
const body_thrust = vec3.Vec3F64.init(
0,
0,
p.thrust_coefficient * p.angular_velocity * p.angular_velocity,
-p.thrust_coefficient * p.angular_velocity * p.angular_velocity,
);
const force = vec3.quatApply(attitude, body_thrust);
@ -57,7 +57,7 @@ test "thrust is correct" {
.moment_coefficient = 2,
};
const expected_thrust_mag = 100 * 100;
const expected_thrust_mag = -100 * 100;
const thrust, const momentum = propThrust(attitude, prop);
try std.testing.expectApproxEqAbs(0, thrust.x(), 1e-11);