Division by zero issues with SCALING_SPEED and SIM_WIND_T_ALT parameters


While I tested ArduPlane, I found two division by zero issues. Just in case, I would like to report details about the issues.

  1. param set SIM_WIND_T_ALT 0

The division by zero bug occurs in different flight stage according to the vehicle type.
–> ArduCopter: division by zero bug occurs when AP lands on the ground after finish a mission.
–> ArduPlane & Rover: after immediately assign 0 to the parameter, division by zero bug occurs

  1. param set SCALING_SPEED 0

Test version: 058d4299ad


We cant protect users against every combination of bad params, there are loads that will cause the code or vehicle to crash, if you keep to the range given in the documentation you should be OK.

1 Like

I understand that ArduPilot does not need to prevent all bad params.
It will be great if documentation will be updated.
This is because it says the valid range of SCALING_SPEED is from 0 to 50.
But, assigning 0 leads to the division by zero :frowning:

I think the code will still work fine with that division by zero, it is constrained. In any case we could update the documentation, its is here if you fancy making a PR:

maybe 1 50 ?

Thanks! Maybe 0.1 - 50 because the increment is 0.1.