-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
telegek
committed
Mar 28, 2021
1 parent
aca7a73
commit 09ecfd9
Showing
3 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cd ~ | ||
if [ -d "/home/risc/src" ] | ||
then | ||
echo "~/src directory already exists" | ||
else | ||
echo "Creating ~/src directory" | ||
mkdir src | ||
fi | ||
|
||
cd ~/src | ||
if [ -d "/home/risc/src/Firmware" ] | ||
then | ||
echo "PX4 Firmware already cloned" | ||
else | ||
echo "Cloning into ~/src/Firmware" | ||
git clone https://github.com/PX4/Firmware.git | ||
fi | ||
|
||
cd ~/src/Firmware | ||
|
||
git submodule update --init --recursive | ||
|
||
sudo apt install python3-pip -y | ||
pip3 install empy | ||
pip3 install packaging | ||
pip3 install toml | ||
pip3 install numpy | ||
pip3 install jinja2 | ||
sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio -y | ||
DONT_RUN=1 make px4_sitl_default gazebo | ||
|
||
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default | ||
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd):$(pwd)/Tools/sitl_gazebo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
## Bash script for setting up a PX4 development environment on Ubuntu LTS (16.04). | ||
## It can be used for installing simulators (only) or for installing the preconditions for Snapdragon Flight or Raspberry Pi. | ||
## | ||
## Installs: | ||
## - Common dependencies and tools for all targets (including: Ninja build system, pyulog) | ||
## - jMAVSim simulator dependencies | ||
## - PX4/Firmware source (to ~/src/Firmware/) | ||
|
||
# Preventing sudo timeout https://serverfault.com/a/833888 | ||
trap "exit" INT TERM; trap "kill 0" EXIT; sudo -v || exit $?; sleep 1; while true; do sleep 60; sudo -nv; done 2>/dev/null & | ||
|
||
# Ubuntu Config | ||
echo "Remove modemmanager" | ||
sudo apt-get remove modemmanager -y | ||
echo "Add user to dialout group for serial port access (reboot required)" | ||
sudo usermod -a -G dialout $USER | ||
|
||
# Common dependencies | ||
echo "Installing common dependencies" | ||
sudo apt-get update -y | ||
sudo apt-get install git zip cmake build-essential genromfs ninja-build exiftool astyle -y | ||
# make sure xxd is installed, dedicated xxd package since Ubuntu 18.04 but was squashed into vim-common before | ||
which xxd || sudo apt install xxd -y || sudo apt-get install vim-common --no-install-recommends -y | ||
# Required python packages | ||
sudo apt-get install python-argparse python-empy python-toml python-numpy python-dev python-pip -y | ||
sudo -H pip install --upgrade pip | ||
sudo -H pip install pandas jinja2 pyserial pyyaml | ||
# optional python tools | ||
sudo -H pip install pyulog | ||
|
||
# jMAVSim simulator dependencies | ||
echo "Installing jMAVSim simulator dependencies" | ||
sudo apt-get install ant openjdk-8-jdk openjdk-8-jre -y | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 protobuf-compiler libeigen3-dev libopencv-dev -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 |