From 511ca6d7643494b6fe6a295493ab2185b6731d3a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 12 Jan 2016 09:20:22 +1100 Subject: [PATCH] autotest: support -P2 option for SITL with MAVLink2 --- Tools/autotest/sim_vehicle.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tools/autotest/sim_vehicle.sh b/Tools/autotest/sim_vehicle.sh index 390bc6ab27..ae8a5b21e3 100755 --- a/Tools/autotest/sim_vehicle.sh +++ b/Tools/autotest/sim_vehicle.sh @@ -29,6 +29,7 @@ BREAKPOINT="" OVERRIDE_BUILD_TARGET="" DELAY_START=0 DEFAULTS_PATH="" +MAVLINK_PROTOCOL_VERSION="1" usage() { @@ -61,6 +62,7 @@ Options: -H start HIL -S SPEEDUP set simulation speedup (1 for wall clock time) -d TIME delays the start of mavproxy by the number of seconds + -P VERSION mavlink protocol version (1 or 2) mavproxy_options: --map start with a map @@ -77,7 +79,7 @@ EOF # parse options. Thanks to http://wiki.bash-hackers.org/howto/getopts_tutorial -while getopts ":I:VgGcj:TA:t:L:l:v:hwf:RNHeMS:DB:b:d:" opt; do +while getopts ":I:VgGcj:TA:t:L:l:v:hwf:RNHeMS:DB:b:d:P:" opt; do case $opt in v) VEHICLE=$OPTARG @@ -150,6 +152,9 @@ while getopts ":I:VgGcj:TA:t:L:l:v:hwf:RNHeMS:DB:b:d:" opt; do b) OVERRIDE_BUILD_TARGET="$OPTARG" ;; + P) + MAVLINK_PROTOCOL_VERSION="$OPTARG" + ;; h) usage exit 0 @@ -348,6 +353,10 @@ if [ $DEBUG_BUILD == 1 ]; then BUILD_TARGET="$BUILD_TARGET-debug" fi +if [ $MAVLINK_PROTOCOL_VERSION == "2" ]; then + BUILD_TARGET="$BUILD_TARGET-mavlink2" +fi + if [ -n "$OVERRIDE_BUILD_TARGET" ]; then BUILD_TARGET="$OVERRIDE_BUILD_TARGET" fi @@ -491,6 +500,10 @@ if [ $DELAY_START != 0 ]; then sleep $DELAY_START fi +if [ $MAVLINK_PROTOCOL_VERSION == 2 ]; then + options="$options --mav20" +fi + if [ -f /usr/bin/cygstart ]; then cygstart -w "/cygdrive/c/Program Files (x86)/MAVProxy/mavproxy.exe" $options --cmd="$extra_cmd" $* else