fix(rcS): use awk instead of bc for scaled timeout math

bc isn't installed in the px4-dev CI container we now use. awk is
required by POSIX so it's always present. Same float math, no extra
dependency.
This commit is contained in:
Julian Oes
2026-04-29 20:28:08 +12:00
committed by Ramon Roche
parent ac8f3df583
commit 28b7c7e970

View File

@@ -186,20 +186,21 @@ param set-default UXRCE_DDS_AG_IP 2130706433 # 127.0.0.1
# Adapt timeout parameters if simulation runs faster or slower than realtime.
# Uses awk for the float multiplication; bc is not installed in all CI containers.
if [ -n "$PX4_SIM_SPEED_FACTOR" ]; then
COM_DL_LOSS_T_LONGER=$(echo "$PX4_SIM_SPEED_FACTOR * 10" | bc)
COM_DL_LOSS_T_LONGER=$(awk -v f="$PX4_SIM_SPEED_FACTOR" 'BEGIN{print f * 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=$(echo "$PX4_SIM_SPEED_FACTOR * 1.0" | bc)
COM_RC_LOSS_T_LONGER=$(awk -v f="$PX4_SIM_SPEED_FACTOR" 'BEGIN{print f * 1.0}')
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=$(echo "$PX4_SIM_SPEED_FACTOR * 1.0" | bc)
COM_OF_LOSS_T_LONGER=$(awk -v f="$PX4_SIM_SPEED_FACTOR" 'BEGIN{print f * 1.0}')
echo "COM_OF_LOSS_T set to $COM_OF_LOSS_T_LONGER"
param set COM_OF_LOSS_T $COM_OF_LOSS_T_LONGER
COM_DISARM_PRFLT_LONGER=$(echo "$PX4_SIM_SPEED_FACTOR * 10.0" | bc)
COM_DISARM_PRFLT_LONGER=$(awk -v f="$PX4_SIM_SPEED_FACTOR" 'BEGIN{print f * 10.0}')
echo "COM_DISARM_PRFLT set to $COM_DISARM_PRFLT_LONGER"
param set COM_DISARM_PRFLT $COM_DISARM_PRFLT_LONGER
fi