Skip to content

Commit

Permalink
init.d-posix: raise timeouts for fast SITL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
julianoes committed May 14, 2019
1 parent f067ca0 commit ffeeedc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ROMFS/px4fmu_common/init.d-posix/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -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)"_*
Expand Down

0 comments on commit ffeeedc

Please sign in to comment.