mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 07:23:33 +08:00
mc_position_control: Fix divide by zero in scale_control
This commit is contained in:
@@ -805,7 +805,11 @@ MulticopterPositionControl::scale_control(float ctl, float end, float dz, float
|
||||
return -dy + (ctl + dz) * (1.0f - dy) / (end - dz);
|
||||
|
||||
} else {
|
||||
return ctl * (dy / dz);
|
||||
if (dz < FLT_EPSILON) {
|
||||
return 0;
|
||||
} else {
|
||||
return ctl * (dy / dz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user