2015-01-20 15:51:19 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-08-11 21:41:43 -03:00
|
|
|
# this script is run by the root user in the virtual machine
|
|
|
|
|
2015-03-22 17:37:15 -03:00
|
|
|
set -e
|
2016-08-11 21:41:43 -03:00
|
|
|
set -x
|
2015-01-20 15:51:19 -04:00
|
|
|
|
|
|
|
echo "Initial setup of SITL-vagrant instance."
|
2015-03-22 17:37:15 -03:00
|
|
|
|
|
|
|
BASE_PKGS="gawk make git arduino-core curl"
|
2016-08-11 21:41:43 -03:00
|
|
|
SITL_PKGS="g++ python-pip python-matplotlib python-serial python-wxgtk3.0 python-scipy python-opencv python-numpy python-empy python-pyparsing ccache"
|
2017-08-30 03:18:01 -03:00
|
|
|
PYTHON_PKGS="pymavlink MAVProxy droneapi future pexpect"
|
2015-03-22 17:37:15 -03:00
|
|
|
PX4_PKGS="python-serial python-argparse openocd flex bison libncurses5-dev \
|
|
|
|
autoconf texinfo build-essential libftdi-dev libtool zlib1g-dev \
|
2016-06-02 00:05:25 -03:00
|
|
|
zip genromfs cmake"
|
2016-02-29 15:59:21 -04:00
|
|
|
UBUNTU64_PKGS="libc6:i386 libgcc1:i386 gcc-4.9-base:i386 libstdc++5:i386 libstdc++6:i386"
|
2015-03-22 17:37:15 -03:00
|
|
|
|
|
|
|
# GNU Tools for ARM Embedded Processors
|
|
|
|
# (see https://launchpad.net/gcc-arm-embedded/)
|
2015-10-20 01:28:13 -03:00
|
|
|
ARM_ROOT="gcc-arm-none-eabi-4_9-2015q3"
|
2015-10-20 01:54:44 -03:00
|
|
|
ARM_TARBALL="$ARM_ROOT-20150921-linux.tar.bz2"
|
2016-03-25 02:46:11 -03:00
|
|
|
ARM_TARBALL_URL="http://firmware.ardupilot.org/Tools/PX4-tools/$ARM_TARBALL"
|
2017-09-29 19:09:56 -03:00
|
|
|
ARM_HF_PKGS="g++-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf"
|
2015-03-22 17:37:15 -03:00
|
|
|
|
|
|
|
# Ardupilot Tools
|
|
|
|
ARDUPILOT_TOOLS="ardupilot/Tools/autotest"
|
|
|
|
|
2016-10-19 21:11:41 -03:00
|
|
|
VAGRANT_USER=ubuntu
|
|
|
|
|
|
|
|
usermod -a -G dialout $VAGRANT_USER
|
2015-03-22 17:37:15 -03:00
|
|
|
|
2016-08-11 21:41:43 -03:00
|
|
|
apt-get -y remove modemmanager
|
|
|
|
apt-get -y update
|
2017-08-30 03:18:01 -03:00
|
|
|
apt-get -y install dos2unix g++-4.7 ccache python-lxml screen xterm gdb pkgconf
|
2017-09-29 19:09:56 -03:00
|
|
|
apt-get -y install $BASE_PKGS $SITL_PKGS $PX4_PKGS $UBUNTU64_PKGS $ARM_HF_PKGS
|
2016-08-11 21:41:43 -03:00
|
|
|
pip -q install $PYTHON_PKGS
|
|
|
|
easy_install catkin_pkg
|
2015-03-22 17:37:15 -03:00
|
|
|
|
|
|
|
|
|
|
|
# ARM toolchain
|
|
|
|
if [ ! -d /opt/$ARM_ROOT ]; then
|
|
|
|
(
|
2016-10-19 21:11:41 -03:00
|
|
|
sudo -u $VAGRANT_USER wget -nv $ARM_TARBALL_URL
|
2016-08-11 21:41:43 -03:00
|
|
|
pushd /opt
|
|
|
|
tar xjf ${OLDPWD}/${ARM_TARBALL}
|
|
|
|
popd
|
|
|
|
rm ${ARM_TARBALL}
|
2015-03-22 17:37:15 -03:00
|
|
|
)
|
|
|
|
fi
|
2015-01-20 15:51:19 -04:00
|
|
|
|
2015-03-22 17:37:15 -03:00
|
|
|
exportline="export PATH=/opt/$ARM_ROOT/bin:\$PATH"
|
2016-10-19 21:11:41 -03:00
|
|
|
DOT_PROFILE=/home/$VAGRANT_USER/.profile
|
2016-08-11 21:41:43 -03:00
|
|
|
PROFILE_TEXT=""
|
|
|
|
if grep -Fxq "$exportline" $DOT_PROFILE; then
|
|
|
|
echo nothing to do
|
|
|
|
else
|
|
|
|
PROFILE_TEXT="
|
|
|
|
$PROFILE_TEXT
|
|
|
|
$exportline
|
|
|
|
"
|
|
|
|
fi
|
2015-01-20 15:51:19 -04:00
|
|
|
|
2016-08-11 21:41:43 -03:00
|
|
|
PROFILE_TEXT="
|
|
|
|
$PROFILE_TEXT
|
|
|
|
source /vagrant/Tools/vagrant/shellinit.sh
|
2015-06-13 10:36:39 -03:00
|
|
|
# This allows the PX4NuttX build to proceed when the underlying fs is on windows
|
|
|
|
# It is only marginally less efficient on Linux
|
2016-08-11 21:41:43 -03:00
|
|
|
export PX4_WINTOOL=y
|
|
|
|
export PATH=\$PATH:\$HOME/jsbsim/src
|
2017-08-30 03:18:01 -03:00
|
|
|
export BUILDLOGS=/tmp/buildlogs
|
2016-08-11 21:41:43 -03:00
|
|
|
"
|
|
|
|
|
2016-10-19 21:11:41 -03:00
|
|
|
echo "$PROFILE_TEXT" | sudo -u $VAGRANT_USER dd conv=notrunc oflag=append of=$DOT_PROFILE
|
|
|
|
sudo -u $VAGRANT_USER ln -fs /vagrant/Tools/vagrant/screenrc /home/$VAGRANT_USER/.screenrc
|
2015-01-20 15:51:19 -04:00
|
|
|
|
2015-01-22 18:25:16 -04:00
|
|
|
# build JSB sim
|
2016-08-11 21:41:43 -03:00
|
|
|
apt-get install -y libtool libtool-bin automake autoconf libexpat1-dev
|
2017-08-30 03:18:01 -03:00
|
|
|
sudo -u $VAGRANT_USER -H bash <<"EOF"
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
|
|
|
cd
|
2015-01-22 18:25:16 -04:00
|
|
|
rm -rf jsbsim
|
2016-06-19 21:33:16 -03:00
|
|
|
git clone https://github.com/tridge/jsbsim.git
|
2015-01-22 18:25:16 -04:00
|
|
|
cd jsbsim
|
|
|
|
./autogen.sh
|
|
|
|
make -j2
|
2016-08-11 21:41:43 -03:00
|
|
|
EOF
|
2015-01-20 15:51:19 -04:00
|
|
|
|
2016-12-24 14:28:13 -04:00
|
|
|
#Plant a marker for sim_vehicle that we're inside a vagrant box
|
|
|
|
touch /ardupilot.vagrant
|
|
|
|
|
2015-01-22 18:25:16 -04:00
|
|
|
# Now you can run
|
2015-03-18 15:42:29 -03:00
|
|
|
# vagrant ssh -c "screen -d -R"
|