Add propeller spin direction

This commit is contained in:
Alex Selimov 2026-08-12 20:16:48 -04:00
parent 6862712551
commit 78f5db1a9e
4 changed files with 11 additions and 1 deletions

View file

@ -23,7 +23,7 @@ pub fn propThrust(attitude: vec3.QuatF64, p: drone.Propeller) struct { vec3.Vec3
const drag_moment = vec3.Vec3F64.init(
0,
0,
p.moment_coefficient * p.angular_velocity * p.angular_velocity,
@intFromEnum(p.direction) * p.moment_coefficient * p.angular_velocity * p.angular_velocity,
);
return .{ force, vec3.vec3Add(force_moment, drag_moment) };
@ -55,6 +55,7 @@ test "thrust is correct" {
.angular_velocity = 100,
.thrust_coefficient = 1,
.moment_coefficient = 2,
.direction = constants.PropSpinDirection.cw,
};
const expected_thrust_mag = -100 * 100;