init.d-posix: raise timeouts for fast SITL

When simulating with lockstep we can raise the speed by setting the env
variable `PX4_SIM_SPEED_FACTOR`. Some inputs like RC, MAVLink heartbeats
from a ground station, or offboard controls via MAVLink are still at the
normal speed which leads to timeouts getting detected in PX4.

To work around this issue we can automatically multiply the timeout
parameters by the speed factor.
This commit is contained in:
Julian Oes 2019-05-13 14:01:32 +02:00
parent f067ca0d8f
commit ffeeedc310
1 changed files with 15 additions and 0 deletions

View File

@ -160,6 +160,21 @@ then
param set WEST_EN 0
fi
# Adapt timeout parameters if simulation runs faster or slower than realtime.
if [ ! -z $PX4_SIM_SPEED_FACTOR ]; then
COM_DL_LOSS_T_LONGER=$(($PX4_SIM_SPEED_FACTOR * 10))
echo "COM_DL_LOSS_T set to $COM_DL_LOSS_T_LONGER"
param set COM_DL_LOSS_T $COM_DL_LOSS_T_LONGER
COM_RC_LOSS_T_LONGER=$(($PX4_SIM_SPEED_FACTOR * 1))
echo "COM_RC_LOSS_T set to $COM_RC_LOSS_T_LONGER"
param set COM_RC_LOSS_T $COM_RC_LOSS_T_LONGER
COM_OF_LOSS_T_LONGER=$(($PX4_SIM_SPEED_FACTOR * 10))
echo "COM_OF_LOSS_T set to $COM_OF_LOSS_T_LONGER"
param set COM_OF_LOSS_T $COM_OF_LOSS_T_LONGER
fi
# Autostart ID
autostart_file=''
for f in etc/init.d-posix/"$(param show -q SYS_AUTOSTART)"_*