diff --git a/libraries/SITL/SIM_Motor.cpp b/libraries/SITL/SIM_Motor.cpp index e145d0d823..9c82d1ac0b 100644 --- a/libraries/SITL/SIM_Motor.cpp +++ b/libraries/SITL/SIM_Motor.cpp @@ -98,17 +98,17 @@ void Motor::calculate_forces(const struct sitl_input &input, } last_change_usec = now; - // calculate torque in newton-meters - torque = (position % thrust) + rotor_torque; - // possibly rotate the thrust vector and the rotor torque if (!is_zero(roll) || !is_zero(pitch)) { Matrix3f rotation; rotation.from_euler(radians(roll), radians(pitch), 0); thrust = rotation * thrust; - torque = rotation * torque; + rotor_torque = rotation * rotor_torque; } + // calculate total torque in newton-meters + torque = (position % thrust) + rotor_torque; + if (use_drag) { // calculate momentum drag per motor const float momentum_drag_factor = momentum_drag_coefficient * sqrtf(air_density * true_prop_area);