autotest: provide a custom location to set as sim home

this helps to set a custom home location on sim, if the location is
outside of the locations in Tools/autotest/locations.txt

Usage:

sim_vehicle.sh -l 37.872991,-122.302348,20,260

The location needs to be in the same format as the locations defined in
locations.txt inside autotest
This commit is contained in:
Ramón Roche 2015-05-06 14:24:55 -07:00 committed by Andrew Tridgell
parent a7d5f7ab6f
commit a2a0d834aa
1 changed files with 12 additions and 2 deletions

View File

@ -39,6 +39,7 @@ Options:
-A pass arguments to antenna tracker
-t set antenna tracker start location
-L select start location from Tools/autotest/locations.txt
-l set the custom start location from -L
-c do a make clean before building
-N don't rebuild before starting ardupilot
-w wipe EEPROM and reload parameters
@ -66,7 +67,7 @@ EOF
# parse options. Thanks to http://wiki.bash-hackers.org/howto/getopts_tutorial
while getopts ":I:VgGcj:TA:t:L:v:hwf:RNHeMS:" opt; do
while getopts ":I:VgGcj:TA:t:L:l:v:hwf:RNHeMS:" opt; do
case $opt in
v)
VEHICLE=$OPTARG
@ -106,6 +107,9 @@ while getopts ":I:VgGcj:TA:t:L:v:hwf:RNHeMS:" opt; do
L)
LOCATION="$OPTARG"
;;
l)
CUSTOM_LOCATION="$OPTARG"
;;
f)
FRAME="$OPTARG"
;;
@ -268,7 +272,13 @@ popd
fi
# get the location information
SIMHOME=$(cat $autotest/locations.txt | grep -i "^$LOCATION=" | cut -d= -f2)
if [ -z $CUSTOM_LOCATION ]; then
SIMHOME=$(cat $autotest/locations.txt | grep -i "^$LOCATION=" | cut -d= -f2)
else
SIMHOME=$CUSTOM_LOCATION
LOCATION="Custom_Location"
fi
[ -z "$SIMHOME" ] && {
echo "Unknown location $LOCATION"
usage