forked from cesar.alejandro/oscillation_ctrl
Adding bash scripts and files to download correct versions of dependencies
This commit is contained in:
parent
fb31ebf04e
commit
8fcb292d0c
|
@ -0,0 +1,14 @@
|
|||
sudo apt-get install libprotobuf-dev=3.0.0-9.1ubuntu1 libprotoc-dev=3.0.0-9.1ubuntu1 protobuf-compiler=3.0.0-9.1ubuntu1
|
||||
|
||||
commit: 601c588294973caf105b79a23f7587c6b991bb05
|
||||
|
||||
Qground control:
|
||||
wget https://github.com/mavlink/qgroundcontrol/releases/download/v4.2.0/QGroundControl.AppImage
|
||||
chmod +x QGroundControl.AppImage
|
||||
|
||||
mavros/mavlink:
|
||||
cp -R ~/catkin_ws/src/oscillation_ctrl/bash_scripts/rosinstall.txt /tmp/mavros.rosinstall
|
||||
wstool merge -t src /tmp/mavros.rosinstall
|
||||
wstool update -t src -j4
|
||||
rosdep install --from-paths src --ignore-src -y
|
||||
catkin build
|
|
@ -0,0 +1,8 @@
|
|||
- git:
|
||||
local-name: mavlink
|
||||
uri: https://github.com/mavlink/mavlink-gbp-release.git
|
||||
version: release/melodic/mavlink/2020.2.2-1
|
||||
- git:
|
||||
local-name: mavros
|
||||
uri: https://github.com/mavlink/mavros.git
|
||||
version: 0.32.0
|
|
@ -0,0 +1,254 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
## Bash script to setup PX4 development environment on Ubuntu LTS (20.04, 18.04, 16.04).
|
||||
## Can also be used in docker.
|
||||
##
|
||||
## Installs:
|
||||
## - Common dependencies and tools for nuttx, jMAVSim, Gazebo
|
||||
## - NuttX toolchain (omit with arg: --no-nuttx)
|
||||
## - jMAVSim and Gazebo9 simulator (omit with arg: --no-sim-tools)
|
||||
##
|
||||
## Not Installs:
|
||||
## - FastRTPS and FastCDR
|
||||
|
||||
INSTALL_NUTTX="true"
|
||||
INSTALL_SIM="true"
|
||||
INSTALL_ARCH=`uname -m`
|
||||
|
||||
# Parse arguments
|
||||
for arg in "$@"
|
||||
do
|
||||
if [[ $arg == "--no-nuttx" ]]; then
|
||||
INSTALL_NUTTX="false"
|
||||
fi
|
||||
|
||||
if [[ $arg == "--no-sim-tools" ]]; then
|
||||
INSTALL_SIM="false"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
# detect if running in docker
|
||||
if [ -f /.dockerenv ]; then
|
||||
echo "Running within docker, installing initial dependencies";
|
||||
apt-get --quiet -y update && DEBIAN_FRONTEND=noninteractive apt-get --quiet -y install \
|
||||
ca-certificates \
|
||||
gnupg \
|
||||
lsb-core \
|
||||
sudo \
|
||||
wget \
|
||||
;
|
||||
fi
|
||||
|
||||
# script directory
|
||||
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
# check requirements.txt exists (script not run in source tree)
|
||||
REQUIREMENTS_FILE="requirements.txt"
|
||||
if [[ ! -f "${DIR}/${REQUIREMENTS_FILE}" ]]; then
|
||||
echo "FAILED: ${REQUIREMENTS_FILE} needed in same directory as ubuntu.sh (${DIR})."
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
# check ubuntu version
|
||||
# otherwise warn and point to docker?
|
||||
UBUNTU_RELEASE="`lsb_release -rs`"
|
||||
|
||||
if [[ "${UBUNTU_RELEASE}" == "14.04" ]]; then
|
||||
echo "Ubuntu 14.04 is no longer supported"
|
||||
exit 1
|
||||
elif [[ "${UBUNTU_RELEASE}" == "16.04" ]]; then
|
||||
echo "Ubuntu 16.04 is no longer supported"
|
||||
exit 1
|
||||
elif [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
|
||||
echo "Ubuntu 18.04"
|
||||
elif [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
|
||||
echo "Ubuntu 20.04"
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "Installing PX4 general dependencies"
|
||||
|
||||
sudo apt-get update -y --quiet
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||
astyle \
|
||||
build-essential \
|
||||
cmake \
|
||||
cppcheck \
|
||||
file \
|
||||
g++ \
|
||||
gcc \
|
||||
gdb \
|
||||
git \
|
||||
lcov \
|
||||
libxml2-dev \
|
||||
libxml2-utils \
|
||||
make \
|
||||
ninja-build \
|
||||
python3 \
|
||||
python3-dev \
|
||||
python3-pip \
|
||||
python3-setuptools \
|
||||
python3-wheel \
|
||||
rsync \
|
||||
shellcheck \
|
||||
unzip \
|
||||
zip \
|
||||
;
|
||||
|
||||
# Python3 dependencies
|
||||
echo
|
||||
echo "Installing PX4 Python3 dependencies"
|
||||
if [ -n "$VIRTUAL_ENV" ]; then
|
||||
# virtual envrionments don't allow --user option
|
||||
python -m pip install -r ${DIR}/requirements.txt
|
||||
else
|
||||
# older versions of Ubuntu require --user option
|
||||
python3 -m pip install --user -r ${DIR}/requirements.txt
|
||||
fi
|
||||
|
||||
# NuttX toolchain (arm-none-eabi-gcc)
|
||||
if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
|
||||
echo
|
||||
echo "Installing NuttX dependencies"
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||
automake \
|
||||
binutils-dev \
|
||||
bison \
|
||||
build-essential \
|
||||
flex \
|
||||
g++-multilib \
|
||||
gcc-multilib \
|
||||
gdb-multiarch \
|
||||
genromfs \
|
||||
gettext \
|
||||
gperf \
|
||||
libelf-dev \
|
||||
libexpat-dev \
|
||||
libgmp-dev \
|
||||
libisl-dev \
|
||||
libmpc-dev \
|
||||
libmpfr-dev \
|
||||
libncurses5 \
|
||||
libncurses5-dev \
|
||||
libncursesw5-dev \
|
||||
libtool \
|
||||
pkg-config \
|
||||
screen \
|
||||
texinfo \
|
||||
u-boot-tools \
|
||||
util-linux \
|
||||
vim-common \
|
||||
;
|
||||
if [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||
kconfig-frontends \
|
||||
;
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "$USER" ]; then
|
||||
# add user to dialout group (serial port access)
|
||||
sudo usermod -a -G dialout $USER
|
||||
fi
|
||||
|
||||
# arm-none-eabi-gcc
|
||||
NUTTX_GCC_VERSION="9-2020-q2-update"
|
||||
NUTTX_GCC_VERSION_SHORT="9-2020q2"
|
||||
|
||||
source $HOME/.profile # load changed path for the case the script is reran before relogin
|
||||
if [ $(which arm-none-eabi-gcc) ]; then
|
||||
GCC_VER_STR=$(arm-none-eabi-gcc --version)
|
||||
GCC_FOUND_VER=$(echo $GCC_VER_STR | grep -c "${NUTTX_GCC_VERSION}")
|
||||
fi
|
||||
|
||||
if [[ "$GCC_FOUND_VER" == "1" ]]; then
|
||||
echo "arm-none-eabi-gcc-${NUTTX_GCC_VERSION} found, skipping installation"
|
||||
|
||||
else
|
||||
echo "Installing arm-none-eabi-gcc-${NUTTX_GCC_VERSION}";
|
||||
wget -O /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/${NUTTX_GCC_VERSION_SHORT}/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-${INSTALL_ARCH}-linux.tar.bz2 && \
|
||||
sudo tar -jxf /tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2 -C /opt/;
|
||||
|
||||
# add arm-none-eabi-gcc to user's PATH
|
||||
exportline="export PATH=/opt/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}/bin:\$PATH"
|
||||
|
||||
if grep -Fxq "$exportline" $HOME/.profile; then
|
||||
echo "${NUTTX_GCC_VERSION} path already set.";
|
||||
else
|
||||
echo $exportline >> $HOME/.profile;
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Simulation tools
|
||||
if [[ $INSTALL_SIM == "true" ]]; then
|
||||
|
||||
echo
|
||||
echo "Installing PX4 simulation dependencies"
|
||||
|
||||
# General simulation dependencies
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||
bc \
|
||||
;
|
||||
|
||||
if [[ "${UBUNTU_RELEASE}" == "18.04" ]]; then
|
||||
java_version=11
|
||||
gazebo_version=9
|
||||
elif [[ "${UBUNTU_RELEASE}" == "20.04" ]]; then
|
||||
java_version=13
|
||||
gazebo_version=11
|
||||
else
|
||||
java_version=14
|
||||
gazebo_version=11
|
||||
fi
|
||||
# Java (jmavsim or fastrtps)
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||
ant \
|
||||
openjdk-$java_version-jre \
|
||||
openjdk-$java_version-jdk \
|
||||
libvecmath-java \
|
||||
;
|
||||
|
||||
# Set Java 11 as default
|
||||
sudo update-alternatives --set java $(update-alternatives --list java | grep "java-$java_version")
|
||||
|
||||
# Gazebo
|
||||
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
|
||||
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
|
||||
# Update list, since new gazebo-stable.list has been added
|
||||
sudo apt-get update -y --quiet
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||
dmidecode \
|
||||
gazebo$gazebo_version \
|
||||
gstreamer1.0-plugins-bad \
|
||||
gstreamer1.0-plugins-base \
|
||||
gstreamer1.0-plugins-good \
|
||||
gstreamer1.0-plugins-ugly \
|
||||
gstreamer1.0-libav \
|
||||
libeigen3-dev \
|
||||
libgazebo$gazebo_version-dev \
|
||||
libgstreamer-plugins-base1.0-dev \
|
||||
libimage-exiftool-perl \
|
||||
libopencv-dev \
|
||||
libxml2-utils \
|
||||
pkg-config \
|
||||
protobuf-compiler \
|
||||
;
|
||||
|
||||
if sudo dmidecode -t system | grep -q "Manufacturer: VMware, Inc." ; then
|
||||
# fix VMWare 3D graphics acceleration for gazebo
|
||||
echo "export SVGA_VGPU10=0" >> ~/.profile
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
echo
|
||||
echo "Relogin or reboot computer before attempting to build NuttX targets"
|
||||
fi
|
|
@ -0,0 +1,104 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Bash script for setting up ROS Melodic (with Gazebo 9) development environment for PX4 on Ubuntu LTS (18.04).
|
||||
## It installs the common dependencies for all targets (including Qt Creator)
|
||||
##
|
||||
## Installs:
|
||||
## - Common dependencies libraries and tools as defined in `ubuntu_sim_common_deps.sh`
|
||||
## - ROS Melodic (including Gazebo9)
|
||||
## - MAVROS
|
||||
|
||||
if [[ $(lsb_release -sc) == *"xenial"* ]]; then
|
||||
echo "OS version detected as $(lsb_release -sc) (16.04)."
|
||||
echo "ROS Melodic requires at least Ubuntu 18.04."
|
||||
echo "Exiting ...."
|
||||
return 1;
|
||||
fi
|
||||
|
||||
echo "Downloading dependent script 'ubuntu_sim_common_deps.sh'"
|
||||
# Source the ubuntu_sim_common_deps.sh script directly from github
|
||||
common_deps=$(wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim_common_deps.sh -O -)
|
||||
wget_return_code=$?
|
||||
# If there was an error downloading the dependent script, we must warn the user and exit at this point.
|
||||
if [[ $wget_return_code -ne 0 ]]; then echo "Error downloading 'ubuntu_sim_common_deps.sh'. Sorry but I cannot proceed further :("; exit 1; fi
|
||||
# Otherwise source the downloaded script.
|
||||
. <(echo "${common_deps}")
|
||||
|
||||
# ROS Melodic
|
||||
## Gazebo simulator dependencies
|
||||
sudo apt-get install libeigen3-dev libopencv-dev protobuf-compiler=3.0.0-9.1ubuntu1 -y
|
||||
|
||||
## ROS Gazebo: http://wiki.ros.org/melodic/Installation/Ubuntu
|
||||
## Setup keys
|
||||
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
|
||||
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
|
||||
## For keyserver connection problems substitute hkp://pgp.mit.edu:80 or hkp://keyserver.ubuntu.com:80 above.
|
||||
sudo apt-get update
|
||||
## Get ROS/Gazebo
|
||||
sudo apt install ros-melodic-desktop-full -y
|
||||
## Initialize rosdep
|
||||
sudo rosdep init
|
||||
rosdep update
|
||||
## Setup environment variables
|
||||
rossource="source /opt/ros/melodic/setup.bash"
|
||||
if grep -Fxq "$rossource" ~/.bashrc; then echo ROS setup.bash already in .bashrc;
|
||||
else echo "$rossource" >> ~/.bashrc; fi
|
||||
eval $rossource
|
||||
|
||||
## Install rosinstall and other dependencies
|
||||
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential -y
|
||||
|
||||
|
||||
|
||||
# MAVROS: https://dev.px4.io/en/ros/mavros_installation.html
|
||||
## Install dependencies
|
||||
sudo apt-get install python-catkin-tools python-rosinstall-generator -y
|
||||
|
||||
## Create catkin workspace
|
||||
mkdir -p ~/catkin_ws/src
|
||||
cd ~/catkin_ws
|
||||
catkin init
|
||||
wstool init src
|
||||
|
||||
|
||||
## Install MAVLink
|
||||
###we use the Kinetic reference for all ROS distros as it's not distro-specific and up to date
|
||||
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall
|
||||
|
||||
## Build MAVROS
|
||||
### Get source (upstream - released)
|
||||
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
|
||||
|
||||
### Setup workspace & install deps
|
||||
wstool merge -t src /tmp/mavros.rosinstall
|
||||
wstool update -t src
|
||||
if ! rosdep install --from-paths src --ignore-src -y; then
|
||||
# (Use echo to trim leading/trailing whitespaces from the unsupported OS name
|
||||
unsupported_os=$(echo $(rosdep db 2>&1| grep Unsupported | awk -F: '{print $2}'))
|
||||
rosdep install --from-paths src --ignore-src --rosdistro melodic -y --os ubuntu:bionic
|
||||
fi
|
||||
|
||||
if [[ ! -z $unsupported_os ]]; then
|
||||
>&2 echo -e "\033[31mYour OS ($unsupported_os) is unsupported. Assumed an Ubuntu 18.04 installation,"
|
||||
>&2 echo -e "and continued with the installation, but if things are not working as"
|
||||
>&2 echo -e "expected you have been warned."
|
||||
fi
|
||||
|
||||
#Install geographiclib
|
||||
sudo apt install geographiclib-tools -y
|
||||
echo "Downloading dependent script 'install_geographiclib_datasets.sh'"
|
||||
# Source the install_geographiclib_datasets.sh script directly from github
|
||||
install_geo=$(wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh -O -)
|
||||
wget_return_code=$?
|
||||
# If there was an error downloading the dependent script, we must warn the user and exit at this point.
|
||||
if [[ $wget_return_code -ne 0 ]]; then echo "Error downloading 'install_geographiclib_datasets.sh'. Sorry but I cannot proceed further :("; exit 1; fi
|
||||
# Otherwise source the downloaded script.
|
||||
sudo bash -c "$install_geo"
|
||||
|
||||
## Build!
|
||||
catkin build
|
||||
## Re-source environment to reflect new packages/build environment
|
||||
catkin_ws_source="source ~/catkin_ws/devel/setup.bash"
|
||||
if grep -Fxq "$catkin_ws_source" ~/.bashrc; then echo ROS catkin_ws setup.bash already in .bashrc;
|
||||
else echo "$catkin_ws_source" >> ~/.bashrc; fi
|
||||
eval $catkin_ws_source
|
Loading…
Reference in New Issue