Browse Source

posix rcS: automatically find matching autostart file based on SYS_AUTOSTART

sbg
Beat Küng 7 years ago committed by Daniel Agar
parent
commit
d4c7dbc93d
  1. 45
      ROMFS/px4fmu_common/init.d-posix/rcS

45
ROMFS/px4fmu_common/init.d-posix/rcS

@ -37,6 +37,16 @@ fi
# exit early when the minimal shell is requested # exit early when the minimal shell is requested
[ $RUN_MINIMAL_SHELL == yes ] && exit 0 [ $RUN_MINIMAL_SHELL == yes ] && exit 0
# Use environment variable PX4_ESTIMATOR to choose estimator.
if [ "$PX4_ESTIMATOR" == "ekf2" ]; then
param set SYS_MC_EST_GROUP 2
elif [ "$PX4_ESTIMATOR" == "lpe" ]; then
param set SYS_MC_EST_GROUP 1
elif [ "$PX4_ESTIMATOR" == "inav" ]; then
param set SYS_MC_EST_GROUP 0
fi
if param compare SYS_AUTOSTART $REQUESTED_AUTOSTART if param compare SYS_AUTOSTART $REQUESTED_AUTOSTART
then then
set AUTOCNF no set AUTOCNF no
@ -92,14 +102,19 @@ then
param set SYS_RESTART_TYPE 2 param set SYS_RESTART_TYPE 2
fi fi
# Autostart ID
# Use environment variable PX4_ESTIMATOR to choose estimator. autostart_file_match="etc/init.d-posix/$(param show -q SYS_AUTOSTART)_*"
if [ "$PX4_ESTIMATOR" == "ekf2" ]; then autostart_files=( $autostart_file_match )
param set SYS_MC_EST_GROUP 2 autostart_file="${autostart_files[0]}" # use first match, but there should really only be one
elif [ "$PX4_ESTIMATOR" == "lpe" ]; then if [ ! -e "$autostart_file" ]; then
param set SYS_MC_EST_GROUP 1 echo "Error: no autostart file found"
exit -1
fi fi
sh "$autostart_file"
dataman start dataman start
replay tryapplyparams replay tryapplyparams
simulator start -s simulator start -s
@ -113,7 +128,11 @@ commander start
land_detector start multicopter land_detector start multicopter
navigator start navigator start
if param compare SYS_MC_EST_GROUP 1 if param compare SYS_MC_EST_GROUP 0
then
attitude_estimator_q start
position_estimator_inav start
elif param compare SYS_MC_EST_GROUP 1
then then
attitude_estimator_q start attitude_estimator_q start
local_position_estimator start local_position_estimator start
@ -128,18 +147,6 @@ fi
mc_pos_control start mc_pos_control start
mc_att_control start mc_att_control start
# TODO: eventually we want to re-use the existing autostart
# infrastructure already available on NuttX.
if param compare SYS_AUTOSTART 10016
then
sh etc/init.d-posix/10016_iris
elif param compare SYS_AUTOSTART 6011
then
sh etc/init.d-posix/6011_typhoon_h480
fi
mavlink start -x -u 14556 -r 4000000 mavlink start -x -u 14556 -r 4000000
mavlink start -x -u 14557 -r 4000000 -m onboard -o 14540 mavlink start -x -u 14557 -r 4000000 -m onboard -o 14540
mavlink stream -r 50 -s POSITION_TARGET_LOCAL_NED -u 14556 mavlink stream -r 50 -s POSITION_TARGET_LOCAL_NED -u 14556

Loading…
Cancel
Save