Skip to content
Snippets Groups Projects
Commit d9db4050 authored by Paul Beuchat's avatar Paul Beuchat
Browse files

Added install script for ROS melodic on Ubuntu 18

parent 8762e976
No related branches found
No related tags found
No related merge requests found
/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake
\ No newline at end of file
#!/bin/bash
die () {
echo >&2 "$@"
exit 1
}
# Check the input argument is supplied and correct
[ "$#" -eq 1 ] || die "1 argument required (AgentID), $# provided"
echo $1 | grep -E -q '^[0-9]+$' || die "Numeric argument required, $1 provided"
# --------------------------------------------------------------- #
# INSTALL ROS AS PER:
# http://wiki.ros.org/melodic/Installation/Ubuntu
# Setup the computer to accept software from packages.ros.org
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# Setup the keys
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
# Update the package index, i.e., the list of programs
sudo apt update
# Install all available upgrades
# > Note: the -y option means Automatic yes to prompts
sudo apt -y upgrade
# Install ROS Melodic
# > Note: we use the configuration: "Desktop-Full Install: (Recommended)"
sudo apt -y install ros-melodic-desktop-full
# Initialise and update rosdep
# > Note: rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS
sudo rosdep init
rosdep update
# Add the ROS environment setup to the .bashrc
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
# Run it now so that it is valid for this terminal session
source /opt/ros/melodic/setup.bash
# --------------------------------------------------------------- #
# INSTALL THE PYTHON USB PACKAGE
# > Note: this is needed to connected to the Crazyradio USB dongle
# Install the python package management system "python-pip"
sudo apt -y install python-pip
# Install the python USB package "pyusb"
sudo pip install pyusb
# --------------------------------------------------------------- #
# INSTALL THE NECESSARY Qt5 PACKAGES AND CREATOR
# > NOTE: Qt is required for the GUIs, and the dfall ROS package
# requires Qt for compilation
# Install the default Qt5
sudo apt -y install qt5-default
# Install the development version of the Qt5svg library
sudo apt -y install libqt5svg5-dev
# Install the "Qt Creator" IDE
# > NOTE: this is not necessary to compile and run the dfall ROS package,
# but it is required to edit the GUIs
sudo apt -y install qtcreator
# --------------------------------------------------------------- #
# CLONE THE D-FaLL-System REPOSITORY
# Make the "work" directory under the users root
# > Note: the -p option means: no error if existing, make parent directories as needed
mkdir -p ~/work
# Change directory to this folder
cd ~/work
# Clone the D-FaLL-System git repository
git clone https://gitlab.ethz.ch/D-FaLL/PandS-System/D-FaLL-System.git
# --------------------------------------------------------------- #
# CREATE, COPY, EDIT A FEW NECESSARY FILES
# > NOTE: the "man sh" explain that the -c option specifies "sh" to:
# "Read commands from the command_string operand instead of from the standard input.
# Add the teacher's IP address to the /etc/hosts file
sudo sh -c "echo '10.42.0.10 dfallmaster' >> /etc/hosts"
# Add a new file with the default agent ID
sudo sh -c "echo $1 >> /etc/dfall_default_agent_id"
# Add a new file with the default coordinator ID
sudo sh -c "echo 1 >> /etc/dfall_default_coord_id"
# Copy rules necessary for using the Crazyradio
sudo cp ~/work/D-FaLL-System/install/99-crazyflie.rules /etc/udev/rules.d
sudo cp ~/work/D-FaLL-System/install/99-crazyradio.rules /etc/udev/rules.d
# --------------------------------------------------------------- #
# BUILD THE D-FaLL-System ROS PACKAGE
# > NOTE: This is done by calling "catkin_make" from the folder "dfall_ws",
# where "ws" stands for workspace
# > NOTE: the package that is built is named "dfall_pkg", as specified in the file
# .../dfall_ws/src/dfall_pkg/package.xml
# > NOTE: the -j4 option specifies the: Maximum number of build jobs to be
# distributed across active packages. (default is cpu count)
cd ~/work/D-FaLL-System/dfall_ws
catkin_make -j4
# --------------------------------------------------------------- #
# ADD TO THE .bashrc THE D-FaLL-System CONFIG AND ROS PACKAGE SETUP
# Add the D-FaLL ROS Package setup to the .bashrc
echo "source ~/work/D-FaLL-System/dfall_ws/devel/setup.bash" >> ~/.bashrc
# And run it now so that it is valid for this terminal session
source ~/work/D-FaLL-System/dfall_ws/devel/setup.bash
# Add the "Config.sh" shell script to the .bashrc
echo "source ~/work/D-FaLL-System/dfall_ws/src/dfall_pkg/launch/Config.sh" >> ~/.bashrc
# And run it now so that it is valid for this terminal session
source ~/work/D-FaLL-System/dfall_ws/src/dfall_pkg/launch/Config.sh
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment