2014-04-10 23:29:28 -03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# home location lat, lon, alt, heading
|
|
|
|
LOCATION="CMAC"
|
|
|
|
TRACKER_LOCATION="CMAC_PILOTSBOX"
|
|
|
|
VEHICLE=""
|
|
|
|
BUILD_TARGET="sitl"
|
|
|
|
FRAME=""
|
2014-05-21 09:13:06 -03:00
|
|
|
NUM_PROCS=1
|
2015-03-27 17:52:53 -03:00
|
|
|
SPEEDUP="1"
|
2014-04-10 23:29:28 -03:00
|
|
|
|
|
|
|
# check the instance number to allow for multiple copies of the sim running at once
|
|
|
|
INSTANCE=0
|
|
|
|
USE_VALGRIND=0
|
|
|
|
USE_GDB=0
|
|
|
|
USE_GDB_STOPPED=0
|
2015-01-28 17:44:59 -04:00
|
|
|
USE_MAVLINK_GIMBAL=0
|
2014-04-10 23:29:28 -03:00
|
|
|
CLEAN_BUILD=0
|
|
|
|
START_ANTENNA_TRACKER=0
|
|
|
|
WIPE_EEPROM=0
|
2014-06-03 20:40:07 -03:00
|
|
|
REVERSE_THROTTLE=0
|
2014-08-09 08:21:27 -03:00
|
|
|
NO_REBUILD=0
|
2014-08-13 07:46:53 -03:00
|
|
|
START_HIL=0
|
2014-07-23 05:40:13 -03:00
|
|
|
TRACKER_ARGS=""
|
2014-09-10 13:50:48 -03:00
|
|
|
EXTERNAL_SIM=0
|
2014-04-10 23:29:28 -03:00
|
|
|
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
Usage: sim_vehicle.sh [options] [mavproxy_options]
|
|
|
|
Options:
|
|
|
|
-v VEHICLE vehicle type (ArduPlane, ArduCopter or APMrover2)
|
|
|
|
vehicle type defaults to working directory
|
|
|
|
-I INSTANCE instance of simulator (default 0)
|
|
|
|
-V enable valgrind for memory access checking (very slow!)
|
|
|
|
-G use gdb for debugging ardupilot
|
|
|
|
-g use gdb for debugging ardupilot, but don't auto-start
|
|
|
|
-T start an antenna tracker instance
|
2014-07-23 05:40:13 -03:00
|
|
|
-A pass arguments to antenna tracker
|
2014-04-10 23:29:28 -03:00
|
|
|
-t set antenna tracker start location
|
|
|
|
-L select start location from Tools/autotest/locations.txt
|
|
|
|
-c do a make clean before building
|
2014-08-09 08:21:27 -03:00
|
|
|
-N don't rebuild before starting ardupilot
|
2014-04-10 23:29:28 -03:00
|
|
|
-w wipe EEPROM and reload parameters
|
2014-06-03 20:40:07 -03:00
|
|
|
-R reverse throttle in plane
|
2014-04-10 23:29:28 -03:00
|
|
|
-f FRAME set aircraft frame type
|
|
|
|
for copters can choose +, X, quad or octa
|
|
|
|
for planes can choose elevon or vtail
|
2014-05-21 09:13:06 -03:00
|
|
|
-j NUM_PROC number of processors to use during build (default 1)
|
2014-08-13 07:46:53 -03:00
|
|
|
-H start HIL
|
2014-09-10 13:50:48 -03:00
|
|
|
-e use external simulator
|
2015-03-27 17:52:53 -03:00
|
|
|
-S SPEEDUP set simulation speedup (1 for wall clock time)
|
2014-04-10 23:29:28 -03:00
|
|
|
|
|
|
|
mavproxy_options:
|
|
|
|
--map start with a map
|
|
|
|
--console start with a status console
|
|
|
|
--out DEST start MAVLink output to DEST
|
|
|
|
|
|
|
|
Note:
|
|
|
|
eeprom.bin in the starting directory contains the parameters for your
|
|
|
|
simulated vehicle. Always start from the same directory. It is recommended that
|
|
|
|
you start in the main vehicle directory for the vehicle you are simulating,
|
|
|
|
for example, start in the ArduPlane directory to simulate ArduPlane
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# parse options. Thanks to http://wiki.bash-hackers.org/howto/getopts_tutorial
|
2015-03-27 17:52:53 -03:00
|
|
|
while getopts ":I:VgGcj:TA:t:L:v:hwf:RNHeMS:" opt; do
|
2014-04-10 23:29:28 -03:00
|
|
|
case $opt in
|
|
|
|
v)
|
|
|
|
VEHICLE=$OPTARG
|
|
|
|
;;
|
|
|
|
I)
|
|
|
|
INSTANCE=$OPTARG
|
|
|
|
;;
|
|
|
|
V)
|
|
|
|
USE_VALGRIND=1
|
|
|
|
;;
|
2014-08-09 08:21:27 -03:00
|
|
|
N)
|
|
|
|
NO_REBUILD=1
|
|
|
|
;;
|
2014-08-13 07:46:53 -03:00
|
|
|
H)
|
|
|
|
START_HIL=1
|
|
|
|
NO_REBUILD=1
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
T)
|
|
|
|
START_ANTENNA_TRACKER=1
|
|
|
|
;;
|
2014-07-23 05:40:13 -03:00
|
|
|
A)
|
|
|
|
TRACKER_ARGS="$OPTARG"
|
|
|
|
;;
|
2014-06-03 20:40:07 -03:00
|
|
|
R)
|
|
|
|
REVERSE_THROTTLE=1
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
G)
|
|
|
|
USE_GDB=1
|
|
|
|
;;
|
2015-01-28 17:44:59 -04:00
|
|
|
M)
|
|
|
|
USE_MAVLINK_GIMBAL=1
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
g)
|
|
|
|
USE_GDB=1
|
|
|
|
USE_GDB_STOPPED=1
|
|
|
|
;;
|
|
|
|
L)
|
|
|
|
LOCATION="$OPTARG"
|
|
|
|
;;
|
|
|
|
f)
|
|
|
|
FRAME="$OPTARG"
|
|
|
|
;;
|
2015-03-27 17:52:53 -03:00
|
|
|
S)
|
|
|
|
SPEEDUP="$OPTARG"
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
t)
|
|
|
|
TRACKER_LOCATION="$OPTARG"
|
|
|
|
;;
|
|
|
|
c)
|
|
|
|
CLEAN_BUILD=1
|
|
|
|
;;
|
2014-05-21 09:13:06 -03:00
|
|
|
j)
|
|
|
|
NUM_PROCS=$OPTARG
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
w)
|
|
|
|
WIPE_EEPROM=1
|
|
|
|
;;
|
2014-09-10 13:50:48 -03:00
|
|
|
e)
|
|
|
|
EXTERNAL_SIM=1
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
h)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
\?)
|
|
|
|
# allow other args to pass on to mavproxy
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
:)
|
|
|
|
echo "Option -$OPTARG requires an argument." >&2
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
|
|
|
# kill existing copy if this is the '0' instance only
|
|
|
|
kill_tasks()
|
|
|
|
{
|
|
|
|
[ "$INSTANCE" -eq "0" ] && {
|
|
|
|
killall -q JSBSim lt-JSBSim ArduPlane.elf ArduCopter.elf APMrover2.elf AntennaTracker.elf
|
|
|
|
pkill -f runsim.py
|
|
|
|
pkill -f sim_tracker.py
|
2015-04-15 03:05:33 -03:00
|
|
|
pkill -f sim_wrapper.py
|
2014-04-10 23:29:28 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-13 08:33:25 -03:00
|
|
|
if [ $START_HIL == 0 ]; then
|
2014-04-10 23:29:28 -03:00
|
|
|
kill_tasks
|
2015-03-13 08:33:25 -03:00
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
|
|
|
|
trap kill_tasks SIGINT
|
|
|
|
|
|
|
|
# setup ports for this instance
|
|
|
|
MAVLINK_PORT="tcp:127.0.0.1:"$((5760+10*$INSTANCE))
|
|
|
|
SIMIN_PORT="127.0.0.1:"$((5502+10*$INSTANCE))
|
|
|
|
SIMOUT_PORT="127.0.0.1:"$((5501+10*$INSTANCE))
|
|
|
|
FG_PORT="127.0.0.1:"$((5503+10*$INSTANCE))
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
[ -z "$VEHICLE" ] && {
|
|
|
|
VEHICLE=$(basename $PWD)
|
|
|
|
}
|
|
|
|
|
2015-04-19 19:36:52 -03:00
|
|
|
[ -z "$FRAME" -a "$VEHICLE" = "APMrover2" ] && {
|
|
|
|
FRAME="rover"
|
|
|
|
}
|
|
|
|
|
2014-04-10 23:29:28 -03:00
|
|
|
EXTRA_PARM=""
|
|
|
|
EXTRA_SIM=""
|
|
|
|
|
2015-03-27 17:52:53 -03:00
|
|
|
[ "$SPEEDUP" != "1" ] && {
|
|
|
|
EXTRA_SIM="$EXTRA_SIM --speedup=$SPEEDUP"
|
|
|
|
}
|
|
|
|
|
2014-04-10 23:29:28 -03:00
|
|
|
# modify build target based on copter frame type
|
|
|
|
case $FRAME in
|
|
|
|
+|quad)
|
|
|
|
BUILD_TARGET="sitl"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=quad"
|
2014-04-10 23:29:28 -03:00
|
|
|
;;
|
|
|
|
X)
|
|
|
|
BUILD_TARGET="sitl"
|
|
|
|
EXTRA_PARM="param set FRAME 1;"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=X"
|
2014-04-10 23:29:28 -03:00
|
|
|
;;
|
|
|
|
octa)
|
|
|
|
BUILD_TARGET="sitl-octa"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=octa"
|
2014-04-10 23:29:28 -03:00
|
|
|
;;
|
2015-02-25 00:04:09 -04:00
|
|
|
octa-quad)
|
|
|
|
BUILD_TARGET="sitl-octa-quad"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=octa-quad"
|
2015-02-25 00:04:09 -04:00
|
|
|
;;
|
2015-02-24 01:16:05 -04:00
|
|
|
heli)
|
|
|
|
BUILD_TARGET="sitl-heli"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=heli"
|
2015-02-24 01:16:05 -04:00
|
|
|
;;
|
2015-04-01 13:14:03 -03:00
|
|
|
IrisRos)
|
|
|
|
BUILD_TARGET="sitl"
|
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=IrisRos"
|
|
|
|
;;
|
2015-04-17 20:33:33 -03:00
|
|
|
CRRCSim-heli)
|
|
|
|
BUILD_TARGET="sitl-heli"
|
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=CRRCSim-heli"
|
|
|
|
;;
|
|
|
|
CRRCSim)
|
|
|
|
BUILD_TARGET="sitl"
|
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=CRRCSim"
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
elevon*)
|
|
|
|
EXTRA_PARM="param set ELEVON_OUTPUT 4;"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --elevon"
|
2014-04-10 23:29:28 -03:00
|
|
|
;;
|
|
|
|
vtail)
|
|
|
|
EXTRA_PARM="param set VTAIL_OUTPUT 4;"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --vtail"
|
2014-04-10 23:29:28 -03:00
|
|
|
;;
|
2015-04-19 19:36:52 -03:00
|
|
|
rover|rover-skid)
|
|
|
|
EXTRA_SIM="$EXTRA_SIM --frame=$FRAME"
|
2014-08-28 17:58:59 -03:00
|
|
|
;;
|
2014-04-11 03:35:12 -03:00
|
|
|
obc)
|
|
|
|
BUILD_TARGET="sitl-obc"
|
|
|
|
;;
|
2014-04-10 23:29:28 -03:00
|
|
|
"")
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown frame type $FRAME"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2015-01-28 17:44:59 -04:00
|
|
|
if [ $USE_MAVLINK_GIMBAL == 1 ]; then
|
|
|
|
echo "Using MAVLink gimbal"
|
2015-03-27 17:52:53 -03:00
|
|
|
EXTRA_SIM="$EXTRA_SIM --gimbal"
|
2015-01-28 17:44:59 -04:00
|
|
|
fi
|
|
|
|
|
2014-04-10 23:29:28 -03:00
|
|
|
autotest=$(dirname $(readlink -e $0))
|
2014-08-09 08:21:27 -03:00
|
|
|
if [ $NO_REBUILD == 0 ]; then
|
2014-04-10 23:29:28 -03:00
|
|
|
pushd $autotest/../../$VEHICLE || {
|
|
|
|
echo "Failed to change to vehicle directory for $VEHICLE"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
}
|
2015-01-20 15:51:19 -04:00
|
|
|
if [ ! -f $autotest/../../config.mk ]; then
|
|
|
|
echo Generating a default configuration
|
|
|
|
make configure
|
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
if [ $CLEAN_BUILD == 1 ]; then
|
|
|
|
make clean
|
|
|
|
fi
|
2014-05-21 09:13:06 -03:00
|
|
|
make $BUILD_TARGET -j$NUM_PROCS || {
|
2014-04-10 23:29:28 -03:00
|
|
|
make clean
|
2014-05-21 09:13:06 -03:00
|
|
|
make $BUILD_TARGET -j$NUM_PROCS
|
2014-04-10 23:29:28 -03:00
|
|
|
}
|
|
|
|
popd
|
2014-08-09 08:21:27 -03:00
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
|
|
|
|
# get the location information
|
|
|
|
SIMHOME=$(cat $autotest/locations.txt | grep -i "^$LOCATION=" | cut -d= -f2)
|
|
|
|
[ -z "$SIMHOME" ] && {
|
|
|
|
echo "Unknown location $LOCATION"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
echo "Starting up at $LOCATION : $SIMHOME"
|
|
|
|
|
|
|
|
TRACKER_HOME=$(cat $autotest/locations.txt | grep -i "^$TRACKER_LOCATION=" | cut -d= -f2)
|
|
|
|
[ -z "$TRACKER_HOME" ] && {
|
|
|
|
echo "Unknown tracker location $TRACKER_LOCATION"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [ $START_ANTENNA_TRACKER == 1 ]; then
|
2014-08-14 00:31:06 -03:00
|
|
|
pushd $autotest/../../AntennaTracker
|
2014-04-10 23:29:28 -03:00
|
|
|
if [ $CLEAN_BUILD == 1 ]; then
|
|
|
|
make clean
|
|
|
|
fi
|
2014-05-21 09:13:06 -03:00
|
|
|
make sitl -j$NUM_PROCS || {
|
2014-04-10 23:29:28 -03:00
|
|
|
make clean
|
2014-05-21 09:13:06 -03:00
|
|
|
make sitl -j$NUM_PROCS
|
2014-04-10 23:29:28 -03:00
|
|
|
}
|
|
|
|
TRACKER_INSTANCE=1
|
|
|
|
TRACKIN_PORT="127.0.0.1:"$((5502+10*$TRACKER_INSTANCE))
|
|
|
|
TRACKOUT_PORT="127.0.0.1:"$((5501+10*$TRACKER_INSTANCE))
|
|
|
|
TRACKER_UARTA="tcp:127.0.0.1:"$((5760+10*$TRACKER_INSTANCE))
|
|
|
|
cmd="nice /tmp/AntennaTracker.build/AntennaTracker.elf -I1"
|
|
|
|
$autotest/run_in_terminal_window.sh "AntennaTracker" $cmd || exit 1
|
2014-07-23 05:40:13 -03:00
|
|
|
$autotest/run_in_terminal_window.sh "pysim(Tracker)" nice $autotest/pysim/sim_tracker.py --home=$TRACKER_HOME --simin=$TRACKIN_PORT --simout=$TRACKOUT_PORT $TRACKER_ARGS || exit 1
|
2014-04-10 23:29:28 -03:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmd="/tmp/$VEHICLE.build/$VEHICLE.elf -I$INSTANCE"
|
|
|
|
if [ $WIPE_EEPROM == 1 ]; then
|
|
|
|
cmd="$cmd -w"
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $VEHICLE in
|
|
|
|
ArduPlane)
|
2014-06-03 20:40:07 -03:00
|
|
|
[ "$REVERSE_THROTTLE" == 1 ] && {
|
|
|
|
EXTRA_SIM="$EXTRA_SIM --revthr"
|
|
|
|
}
|
2015-04-12 20:06:21 -03:00
|
|
|
jsbsim_version=$(JSBSim --version)
|
|
|
|
if [[ $jsbsim_version != *"ArduPilot"* ]]
|
|
|
|
then
|
|
|
|
cat <<EOF
|
|
|
|
=========================================================
|
|
|
|
You need the latest ArduPilot version of JSBSim installed
|
|
|
|
and in your \$PATH
|
|
|
|
|
|
|
|
Please get it from git://github.com/tridge/jsbsim.git
|
|
|
|
See
|
|
|
|
http://dev.ardupilot.com/wiki/simulation-2/sitl-simulator-software-in-the-loop/setting-up-sitl-on-linux/
|
|
|
|
for more details
|
|
|
|
=========================================================
|
|
|
|
EOF
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
PARMS="ArduPlane.parm"
|
|
|
|
if [ $WIPE_EEPROM == 1 ]; then
|
|
|
|
cmd="$cmd -PFORMAT_VERSION=13 -PSKIP_GYRO_CAL=1 -PRC3_MIN=1000 -PRC3_TRIM=1000"
|
|
|
|
fi
|
2015-04-17 20:33:33 -03:00
|
|
|
if [ "$FRAME" = "CRRCSim" ]; then
|
|
|
|
RUNSIM="nice $autotest/pysim/sim_wrapper.py --frame=CRRCSim --home=$SIMHOME --simin=$SIMIN_PORT --simout=$SIMOUT_PORT --fgout=$FG_PORT $EXTRA_SIM"
|
|
|
|
else
|
|
|
|
RUNSIM="nice $autotest/jsb_sim/runsim.py --home=$SIMHOME --simin=$SIMIN_PORT --simout=$SIMOUT_PORT --fgout=$FG_PORT $EXTRA_SIM"
|
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
;;
|
|
|
|
ArduCopter)
|
2015-04-15 03:05:33 -03:00
|
|
|
RUNSIM="nice $autotest/pysim/sim_wrapper.py --home=$SIMHOME --simin=$SIMIN_PORT --simout=$SIMOUT_PORT --fgout=$FG_PORT $EXTRA_SIM"
|
2014-04-10 23:29:28 -03:00
|
|
|
PARMS="copter_params.parm"
|
|
|
|
;;
|
|
|
|
APMrover2)
|
2015-04-19 19:36:52 -03:00
|
|
|
RUNSIM="nice $autotest/pysim/sim_wrapper.py --home=$SIMHOME --simin=$SIMIN_PORT --simout=$SIMOUT_PORT --fgout=$FG_PORT $EXTRA_SIM"
|
2014-04-10 23:29:28 -03:00
|
|
|
PARMS="Rover.parm"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown vehicle simulation type $VEHICLE - please specify vehicle using -v VEHICLE_TYPE"
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2014-08-13 07:46:53 -03:00
|
|
|
if [ $START_HIL == 0 ]; then
|
2014-04-10 23:29:28 -03:00
|
|
|
if [ $USE_VALGRIND == 1 ]; then
|
|
|
|
echo "Using valgrind"
|
|
|
|
$autotest/run_in_terminal_window.sh "ardupilot (valgrind)" valgrind $cmd || exit 1
|
|
|
|
elif [ $USE_GDB == 1 ]; then
|
|
|
|
echo "Using gdb"
|
|
|
|
tfile=$(mktemp)
|
|
|
|
[ $USE_GDB_STOPPED == 0 ] && {
|
2015-03-27 01:23:17 -03:00
|
|
|
echo r >> $tfile
|
2014-04-10 23:29:28 -03:00
|
|
|
}
|
|
|
|
$autotest/run_in_terminal_window.sh "ardupilot (gdb)" gdb -x $tfile --args $cmd || exit 1
|
|
|
|
else
|
|
|
|
$autotest/run_in_terminal_window.sh "ardupilot" $cmd || exit 1
|
|
|
|
fi
|
2014-08-13 07:46:53 -03:00
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
|
|
|
|
trap kill_tasks SIGINT
|
|
|
|
|
|
|
|
sleep 2
|
|
|
|
rm -f $tfile
|
2014-09-10 13:50:48 -03:00
|
|
|
if [ $EXTERNAL_SIM == 0 ]; then
|
|
|
|
$autotest/run_in_terminal_window.sh "Simulator" $RUNSIM || {
|
|
|
|
echo "Failed to start simulator: $RUNSIM"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
sleep 2
|
|
|
|
else
|
2015-02-16 12:31:27 -04:00
|
|
|
echo "Using external ROS simulator"
|
|
|
|
RUNSIM="$autotest/ROS/runsim.py --simin=$SIMIN_PORT --simout=$SIMOUT_PORT --fgout=$FG_PORT $EXTRA_SIM"
|
|
|
|
$autotest/run_in_terminal_window.sh "ROS Simulator" $RUNSIM || {
|
|
|
|
echo "Failed to start simulator: $RUNSIM"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
sleep 2
|
2014-09-10 13:50:48 -03:00
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
|
|
|
|
# mavproxy.py --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 127.0.0.1:14550 --out 127.0.0.1:14551
|
2014-08-13 07:46:53 -03:00
|
|
|
options=""
|
|
|
|
if [ $START_HIL == 0 ]; then
|
|
|
|
options="--master $MAVLINK_PORT --sitl $SIMOUT_PORT"
|
|
|
|
fi
|
2015-01-20 15:51:19 -04:00
|
|
|
|
|
|
|
# If running inside of a vagrant guest, then we probably want to forward our mavlink out to the containing host OS
|
|
|
|
if [ $USER == "vagrant" ]; then
|
|
|
|
options="$options --out 10.0.2.2:14550"
|
|
|
|
fi
|
2014-08-13 07:46:53 -03:00
|
|
|
options="$options --out 127.0.0.1:14550 --out 127.0.0.1:14551"
|
2014-04-10 23:29:28 -03:00
|
|
|
extra_cmd1=""
|
|
|
|
if [ $WIPE_EEPROM == 1 ]; then
|
|
|
|
extra_cmd="param forceload $autotest/$PARMS; $EXTRA_PARM; param fetch"
|
|
|
|
fi
|
|
|
|
if [ $START_ANTENNA_TRACKER == 1 ]; then
|
|
|
|
options="$options --load-module=tracker"
|
|
|
|
extra_cmd="$extra_cmd module load map; tracker set port $TRACKER_UARTA; tracker start;"
|
|
|
|
fi
|
2014-08-13 07:46:53 -03:00
|
|
|
if [ $START_HIL == 1 ]; then
|
|
|
|
options="$options --load-module=HIL"
|
|
|
|
fi
|
2015-01-28 17:44:59 -04:00
|
|
|
if [ $USE_MAVLINK_GIMBAL == 1 ]; then
|
|
|
|
options="$options --load-module=gimbal"
|
|
|
|
fi
|
2014-04-10 23:29:28 -03:00
|
|
|
mavproxy.py $options --cmd="$extra_cmd" $*
|
2015-03-13 08:33:25 -03:00
|
|
|
if [ $START_HIL == 0 ]; then
|
2014-04-10 23:29:28 -03:00
|
|
|
kill_tasks
|
2015-03-13 08:33:25 -03:00
|
|
|
fi
|