mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-26 01:00:36 +08:00
fix(simulation): model reverse thrust for reversible motors in SIH hexacopter
The SIH hexacopter dynamics squared the motor command (u_sq = u * u), which discards its sign, so a reversed (negative) command produced forward thrust instead of reverse. pwm_out_sim already emits signed [-1, 1] outputs for reversible motors, so only the plant model dropped the sign. Use a signed square (u * |u|) so a reversed command yields reverse thrust and the correspondingly flipped roll/pitch/yaw torque. Behaviour-neutral for non-reversible motors (u >= 0), which is the only regime the previous plain square could represent.
This commit is contained in:
1 parent
b9355ef83e
commit
eca039bd52
1 file changed
+1
-1
@@ -466,7 +466,7 @@ void Sih::generate_force_and_torques(const float dt)
|
||||
float u_sq[6];
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
u_sq[i] = _u[i] * _u[i]; // quadratic thrust model, keep _u[i] intact for the filter
|
||||
u_sq[i] = _u[i] * fabsf(_u[i]);
|
||||
}
|
||||
|
||||
_T_B = Vector3f(0.0f, 0.0f, -_T_MAX * (+u_sq[0] + u_sq[1] + u_sq[2] + u_sq[3] + u_sq[4] + u_sq[5]));
|
||||
|
||||
Reference in new issue
Block a user