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:
parent
a7d5f7ab6f
commit
a2a0d834aa
@ -39,6 +39,7 @@ Options:
|
|||||||
-A pass arguments to antenna tracker
|
-A pass arguments to antenna tracker
|
||||||
-t set antenna tracker start location
|
-t set antenna tracker start location
|
||||||
-L select start location from Tools/autotest/locations.txt
|
-L select start location from Tools/autotest/locations.txt
|
||||||
|
-l set the custom start location from -L
|
||||||
-c do a make clean before building
|
-c do a make clean before building
|
||||||
-N don't rebuild before starting ardupilot
|
-N don't rebuild before starting ardupilot
|
||||||
-w wipe EEPROM and reload parameters
|
-w wipe EEPROM and reload parameters
|
||||||
@ -66,7 +67,7 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
# parse options. Thanks to http://wiki.bash-hackers.org/howto/getopts_tutorial
|
# 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
|
case $opt in
|
||||||
v)
|
v)
|
||||||
VEHICLE=$OPTARG
|
VEHICLE=$OPTARG
|
||||||
@ -106,6 +107,9 @@ while getopts ":I:VgGcj:TA:t:L:v:hwf:RNHeMS:" opt; do
|
|||||||
L)
|
L)
|
||||||
LOCATION="$OPTARG"
|
LOCATION="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
l)
|
||||||
|
CUSTOM_LOCATION="$OPTARG"
|
||||||
|
;;
|
||||||
f)
|
f)
|
||||||
FRAME="$OPTARG"
|
FRAME="$OPTARG"
|
||||||
;;
|
;;
|
||||||
@ -268,7 +272,13 @@ popd
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# get the location information
|
# 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" ] && {
|
[ -z "$SIMHOME" ] && {
|
||||||
echo "Unknown location $LOCATION"
|
echo "Unknown location $LOCATION"
|
||||||
usage
|
usage
|
||||||
|
Loading…
Reference in New Issue
Block a user