autotest: automatically use sensible defaults for each vehicle type

this make first time use of SITL simpler
This commit is contained in:
Andrew Tridgell 2016-01-07 09:10:20 +11:00
parent 415d800957
commit 0d26e3a445
1 changed files with 26 additions and 10 deletions

View File

@ -27,6 +27,7 @@ MODEL=""
BREAKPOINT="" BREAKPOINT=""
OVERRIDE_BUILD_TARGET="" OVERRIDE_BUILD_TARGET=""
DELAY_START=0 DELAY_START=0
DEFAULTS_PATH=""
usage() usage()
{ {
@ -232,42 +233,55 @@ EOF
} }
autotest="../Tools/autotest"
[ -d "$autotest" ] || {
# we are not running from one of the standard vehicle directories. Use
# the location of the sim_vehicle.sh script to find the path
autotest=$(dirname $(readlink -e $0))
}
# modify build target based on copter frame type # modify build target based on copter frame type
case $FRAME in case $FRAME in
+|quad) +|quad)
BUILD_TARGET="sitl" BUILD_TARGET="sitl"
MODEL="+" MODEL="+"
DEFAULTS_PATH="$autotest/copter_params.parm"
;; ;;
X) X)
BUILD_TARGET="sitl" BUILD_TARGET="sitl"
EXTRA_PARM="param set FRAME 1;" EXTRA_PARM="param set FRAME 1;"
MODEL="X" MODEL="X"
DEFAULTS_PATH="$autotest/copter_params.parm"
;; ;;
octa*) octa*)
BUILD_TARGET="sitl-octa" BUILD_TARGET="sitl-octa"
MODEL="$FRAME" MODEL="$FRAME"
DEFAULTS_PATH="$autotest/copter_params.parm"
;; ;;
heli*) heli*)
BUILD_TARGET="sitl-heli" BUILD_TARGET="sitl-heli"
MODEL="$FRAME" MODEL="$FRAME"
DEFAULTS_PATH="$autotest/Helicopter.parm"
;; ;;
heli-dual) heli-dual)
BUILD_TARGET="sitl-heli-dual" BUILD_TARGET="sitl-heli-dual"
EXTRA_SIM="$EXTRA_SIM --frame=heli-dual" EXTRA_SIM="$EXTRA_SIM --frame=heli-dual"
MODEL="heli-dual" MODEL="heli-dual"
;; ;;
heli-compound) heli-compound)
BUILD_TARGET="sitl-heli-compound" BUILD_TARGET="sitl-heli-compound"
EXTRA_SIM="$EXTRA_SIM --frame=heli-compound" EXTRA_SIM="$EXTRA_SIM --frame=heli-compound"
MODEL="heli-compound" MODEL="heli-compound"
;; ;;
IrisRos) IrisRos)
BUILD_TARGET="sitl" BUILD_TARGET="sitl"
DEFAULTS_PATH="$autotest/copter_params.parm"
;; ;;
Gazebo) Gazebo)
BUILD_TARGET="sitl" BUILD_TARGET="sitl"
EXTRA_SIM="$EXTRA_SIM --frame=Gazebo" EXTRA_SIM="$EXTRA_SIM --frame=Gazebo"
MODEL="$FRAME" MODEL="$FRAME"
DEFAULTS_PATH="$autotest/copter_params.parm"
;; ;;
CRRCSim|last_letter*) CRRCSim|last_letter*)
BUILD_TARGET="sitl" BUILD_TARGET="sitl"
@ -277,14 +291,17 @@ case $FRAME in
BUILD_TARGET="sitl" BUILD_TARGET="sitl"
MODEL="$FRAME" MODEL="$FRAME"
check_jsbsim_version check_jsbsim_version
DEFAULTS_PATH="$autotest/ArduPlane.parm"
;; ;;
quadplane*) quadplane*)
BUILD_TARGET="sitl" BUILD_TARGET="sitl"
MODEL="$FRAME" MODEL="$FRAME"
DEFAULTS_PATH="$autotest/quadplane.parm"
;; ;;
*-heli) *-heli)
BUILD_TARGET="sitl-heli" BUILD_TARGET="sitl-heli"
MODEL="$FRAME" MODEL="$FRAME"
DEFAULTS_PATH="$autotest/Helicopter.parm"
;; ;;
*) *)
MODEL="$FRAME" MODEL="$FRAME"
@ -299,12 +316,6 @@ if [ -n "$OVERRIDE_BUILD_TARGET" ]; then
BUILD_TARGET="$OVERRIDE_BUILD_TARGET" BUILD_TARGET="$OVERRIDE_BUILD_TARGET"
fi fi
autotest="../Tools/autotest"
[ -d "$autotest" ] || {
# we are not running from one of the standard vehicle directories. Use
# the location of the sim_vehicle.sh script to find the path
autotest=$(dirname $(readlink -e $0))
}
VEHICLEDIR="$autotest/../../$VEHICLE" VEHICLEDIR="$autotest/../../$VEHICLE"
[ -d "$VEHICLEDIR" ] || { [ -d "$VEHICLEDIR" ] || {
VEHICLEDIR=$(dirname $(readlink -e $VEHICLEDIR)) VEHICLEDIR=$(dirname $(readlink -e $VEHICLEDIR))
@ -400,6 +411,11 @@ if [ $USE_MAVLINK_GIMBAL == 1 ]; then
cmd="$cmd --gimbal" cmd="$cmd --gimbal"
fi fi
if [ -n "$DEFAULTS_PATH" ]; then
echo "Using defaults from $DEFAULTS_PATH"
cmd="$cmd --defaults $DEFAULTS_PATH"
fi
if [ $START_HIL == 0 ]; then if [ $START_HIL == 0 ]; then
if [ $USE_VALGRIND == 1 ]; then if [ $USE_VALGRIND == 1 ]; then
echo "Using valgrind" echo "Using valgrind"