mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-07 01:04:19 +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