Skip to content

Instantly share code, notes, and snippets.

@mrpollo
Last active August 29, 2015 14:19
Show Gist options
  • Save mrpollo/9607907d055a409434af to your computer and use it in GitHub Desktop.
Save mrpollo/9607907d055a409434af to your computer and use it in GitHub Desktop.
sitl no link
export SRC_DIR='/home/vagrant/src'
export PATH=$PATH:$SRC_DIR/jsbsim/src
export PATH=$PATH:$SRC_DIR/ardupilot/Tools/autotest
export PATH=/usr/lib/ccache:$PATH
vagrant@vagrant-ubuntu-trusty-32:~$ ./sitl.sh copter
SITL launcher
Commands:
plane <options>
copter <options>
rover <options>
Please enter a command (q to exit): copter
========================
Ardupilot Copter
========================
+ '[' -z '' ']'
++ basename /home/vagrant/src/ardupilot/ArduCopter
+ VEHICLE=ArduCopter
+ EXTRA_PARM=
+ EXTRA_SIM=
+ '[' 1 '!=' 1 ']'
+ case $FRAME in
+ '[' 0 == 1 ']'
+++ readlink -e /home/vagrant/src/ardupilot/Tools/autotest/sim_vehicle.sh
++ dirname /home/vagrant/src/ardupilot/Tools/autotest/sim_vehicle.sh
+ autotest=/home/vagrant/src/ardupilot/Tools/autotest
+ '[' 0 == 0 ']'
+ pushd /home/vagrant/src/ardupilot/Tools/autotest/../../ArduCopter
~/src/ardupilot/ArduCopter ~/src/ardupilot/ArduCopter
+ '[' '!' -f /home/vagrant/src/ardupilot/Tools/autotest/../../config.mk ']'
+ '[' 0 == 1 ']'
+ make sitl -j1
// BUILDROOT=/tmp/ArduCopter.build HAL_BOARD=HAL_BOARD_AVR_SITL HAL_BOARD_SUBTYPE=HAL_BOARD_SUBTYPE_NONE TOOLCHAIN=NATIVE EXTRAFLAGS=-DGIT_VERSION="d66eec53"
building /tmp/ArduCopter.build/ArduCopter.cpp
%% ArduCopter.cpp
+ popd
~/src/ardupilot/ArduCopter
++ cat /home/vagrant/src/ardupilot/Tools/autotest/locations.txt
++ cut -d= -f2
++ grep -i '^CMAC='
+ SIMHOME=-35.363261,149.165230,584,353
+ '[' -z -35.363261,149.165230,584,353 ']'
+ echo 'Starting up at CMAC : -35.363261,149.165230,584,353'
Starting up at CMAC : -35.363261,149.165230,584,353
++ cut -d= -f2
++ grep -i '^CMAC_PILOTSBOX='
++ cat /home/vagrant/src/ardupilot/Tools/autotest/locations.txt
+ TRACKER_HOME=-35.362734,149.165300,586,270
+ '[' -z -35.362734,149.165300,586,270 ']'
+ '[' 0 == 1 ']'
+ cmd='/tmp/ArduCopter.build/ArduCopter.elf -I0'
+ '[' 0 == 1 ']'
+ case $VEHICLE in
+ RUNSIM='nice /home/vagrant/src/ardupilot/Tools/autotest/pysim/sim_multicopter.py --home=-35.363261,149.165230,584,353 --simin=127.0.0.1:5502 --simout=127.0.0.1:5501 --fgout=127.0.0.1:5503 '
+ PARMS=copter_params.parm
+ '[' 0 == 0 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ /home/vagrant/src/ardupilot/Tools/autotest/run_in_terminal_window.sh ardupilot /tmp/ArduCopter.build/ArduCopter.elf -I0
Starting ardupilot : /tmp/ArduCopter.build/ArduCopter.elf -I0
Window access not found, logging to /tmp/ardupilot.log
+ trap kill_tasks SIGINT
+ sleep 2
+ rm -f
+ '[' 0 == 0 ']'
+ /home/vagrant/src/ardupilot/Tools/autotest/run_in_terminal_window.sh Simulator nice /home/vagrant/src/ardupilot/Tools/autotest/pysim/sim_multicopter.py --home=-35.363261,149.165230,584,353 --simin=127.0.0.1:5502 --simout=127.0.0.1:5501 --fgout=127.0.0.1:5503
Starting Simulator : nice /home/vagrant/src/ardupilot/Tools/autotest/pysim/sim_multicopter.py --home=-35.363261,149.165230,584,353 --simin=127.0.0.1:5502 --simout=127.0.0.1:5501 --fgout=127.0.0.1:5503
Window access not found, logging to /tmp/Simulator.log
+ sleep 2
+ options=
+ '[' 0 == 0 ']'
+ options='--master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501'
+ '[' vagrant == vagrant ']'
+ options='--master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 10.0.2.2:14550'
+ options='--master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 10.0.2.2:14550 --out 127.0.0.1:14550 --out 127.0.0.1:14551'
+ extra_cmd1=
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ '[' 0 == 1 ']'
+ mavproxy.py --master tcp:127.0.0.1:5760 --sitl 127.0.0.1:5501 --out 10.0.2.2:14550 --out 127.0.0.1:14550 --out 127.0.0.1:14551 --cmd= ./sitl.sh
Connect tcp:127.0.0.1:5760 source_system=255
Logging to mav.tlog
MAV>
Init APM:Copter V3.3-rc1 (d66eec53)
Free RAM: 4096
FW Ver: 120
----------------------------------------
load_all took 0us
0 0 0 online system 1
STABILIZE> Mode STABILIZE
APM: APM:Copter V3.3-rc1 (d66eec53)
APM: Frame: QUAD
APM: Calibrating barometer
APM: Initialising APM...
APM: barometer calibration complete
APM: GROUND START
Init Gyro********no link
link 1 down
*****no link
****no link
*****no link
*****no link
****no link
*****no link
*****no link
****no link
*****no link
#!/bin/bash
# Title: SITL launcher
# Description: Helper lib to run SITL, its very limited at the moment and only understands how to run SITL for plane or copter
# Author: Ramón Roche
# Email: ramon@3drobotics.com
# Version: 0.0.1
if [[ ! -e `env | grep "RC_LOADED"` ]]; then
# Make sure we always have the relevant paths included
# this is a check for when sitl.sh is launched witouth loading bash
# vagrant ssh -c "/vagrant/sitl.sh"
source /home/vagrant/.ardupilot
fi
# define here to avoid problems with the above
SIM=`which sim_vehicle.sh`
SRC_PATH=/home/vagrant/src
ARDU_PATH="$SRC_PATH/ardupilot"
PLANE_HOME="$ARDU_PATH/ArduPlane"
COPTER_HOME="$ARDU_PATH/ArduCopter"
ROVER_HOME="$ARDU_PATH/APMrover2"
if [[ -z $SIM ]]; then
echo "sim_vehicle.sh is not in PATH"
exit;
fi
menu() {
echo "SITL launcher"
echo ""
echo "Commands:"
echo ""
echo " plane <options>"
echo " copter <options>"
echo " rover <options>"
echo ""
while true; do
read -p "Please enter a command (q to exit): " cmd
args=`echo $cmd | awk '{$1=""; print $0}'`
case $cmd in
plane* ) runPlane $args; exit;;
copter* ) runCopter $args; exit;;
rover* ) runRover $args; exit;;
q|quit|exit ) exit;;
* ) echo "Please enter a valid command."; sleep 1; menu;;
esac
done
}
makeHeader() {
echo "========================"
echo ""
echo "Ardupilot $1"
echo ""
echo "========================"
}
runPlane() {
makeHeader "Plane"
(cd $PLANE_HOME && runSim)
}
runCopter() {
makeHeader "Copter"
(cd $COPTER_HOME && runSim)
}
runRover() {
makeHeader "Rover"
(cd $ROVER_HOME && runSim)
}
runSim() {
$SIM $0
}
menu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment