From 6fba3d9eb2854fe1034c4072736a78177d6ff4ba Mon Sep 17 00:00:00 2001 From: Paul Beuchat <beuchatp@control.ee.ethz.ch> Date: Thu, 30 May 2019 16:18:54 +0200 Subject: [PATCH] Updated the ubuntu 16 installation shell script --- dfall_ws/src/dfall_pkg/launch/Config.sh | 2 +- install/dfall_install_ros_kinetic_ubuntu16.sh | 107 +++++++++++++++--- install/dfall_install_ros_melodic_ubuntu18.sh | 18 +++ 3 files changed, 112 insertions(+), 15 deletions(-) diff --git a/dfall_ws/src/dfall_pkg/launch/Config.sh b/dfall_ws/src/dfall_pkg/launch/Config.sh index 028d739f..1aa9fac5 100755 --- a/dfall_ws/src/dfall_pkg/launch/Config.sh +++ b/dfall_ws/src/dfall_pkg/launch/Config.sh @@ -1,7 +1,7 @@ # TO RUN THE SYSTEM FULLY ON THE LOCAL COMPUTER: #export ROS_MASTER_URI=http://localhost:11311 # TO RUN THE SYSTEM ON A DEFAULT CONFIGURATION OF THE NETWROK: -export ROS_MASTER_URI=http://teacher:11311 +export ROS_MASTER_URI=http://dfallmaster:11311 # OTHER NECESSARY ENVIRONMENT VARIABLES: export ROS_IP=$(hostname -I | awk '{print $1;}') export DFALL_DEFAULT_AGENT_ID=$(cat /etc/dfall_default_agent_id) diff --git a/install/dfall_install_ros_kinetic_ubuntu16.sh b/install/dfall_install_ros_kinetic_ubuntu16.sh index eac9dc54..2b8e00c3 100755 --- a/install/dfall_install_ros_kinetic_ubuntu16.sh +++ b/install/dfall_install_ros_kinetic_ubuntu16.sh @@ -1,5 +1,19 @@ #!/bin/bash +# --------------------------------------------------------------- # +# USAGE: +# 1) Download this installation shell script file +# 2) Modify the file permission to be executable +# >> chmod +x dfall_install_ros_melodic_ubuntu16.sh +# 3) Execute the script +# >> ./dfall_install_ros_melodic_ubuntu16.sh <agentID> +# where <agentID> is replaced by a number, eg. 1 + + + +# --------------------------------------------------------------- # +# PROCESS THE INPUT ARGUMENTS + die () { echo >&2 "$@" exit 1 @@ -9,26 +23,73 @@ die () { [ "$#" -eq 1 ] || die "1 argument required (AgentID), $# provided" echo $1 | grep -E -q '^[0-9]+$' || die "Numeric argument required, $1 provided" -# Ensure the ROS repository is available + + +# --------------------------------------------------------------- # +# 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 list of programs +# Update the package index, i.e., the list of programs sudo apt-get update + # Install all available upgrades # > Note: the -y option means Automatic yes to prompts sudo apt-get -y upgrade + # Install ROS Kinetic +# > Note: we use the configuration: "Desktop-Full Install: (Recommended)" sudo apt-get -y install ros-kinetic-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/kinetic/setup.bash" >> ~/.bashrc +# Run it now so that it is valid for this terminal session +source /opt/ros/kinetic/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-get -y install python-pip + # Install the python USB package "pyusb" -# > Note: this is needed to connected to the Crazyradio USB dongle sudo pip install pyusb -# Initialise and update the ROS dependencies -sudo rosdep init -rosdep update + + +# --------------------------------------------------------------- # +# 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 @@ -38,16 +99,19 @@ cd ~/work # Clone the D-FaLL-System git repository git clone https://gitlab.ethz.ch/D-FaLL/PandS-System/D-FaLL-System.git -# Add the ROS environment setup to the .bashrc -echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc -# Run it now so that it is valid for this terminal session -source /opt/ros/kinetic/setup.bash + + +# --------------------------------------------------------------- # +# 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 teacher' >> /etc/hosts" +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" @@ -55,15 +119,30 @@ sudo sh -c "echo 1 >> /etc/dfall_default_coord_id" 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 ROS Package, called dfall_pkg -# > This is done by calling "catkin_make" from the dfall_ws workspace + + +# --------------------------------------------------------------- # +# 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 -source ~/work/D-FaLL-System/dfall_ws/src/dfall_pkg/launch/Config.sh +# 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 diff --git a/install/dfall_install_ros_melodic_ubuntu18.sh b/install/dfall_install_ros_melodic_ubuntu18.sh index 40c4d4c4..a9b6868d 100755 --- a/install/dfall_install_ros_melodic_ubuntu18.sh +++ b/install/dfall_install_ros_melodic_ubuntu18.sh @@ -1,5 +1,19 @@ #!/bin/bash +# --------------------------------------------------------------- # +# USAGE: +# 1) Download this installation shell script file +# 2) Modify the file permission to be executable +# >> chmod +x dfall_install_ros_melodic_ubuntu16.sh +# 3) Execute the script +# >> ./dfall_install_ros_melodic_ubuntu16.sh <agentID> +# where <agentID> is replaced by a number, eg. 1 + + + +# --------------------------------------------------------------- # +# PROCESS THE INPUT ARGUMENTS + die () { echo >&2 "$@" exit 1 @@ -50,6 +64,7 @@ source /opt/ros/melodic/setup.bash # Install the python package management system "python-pip" sudo apt -y install python-pip + # Install the python USB package "pyusb" sudo pip install pyusb @@ -71,6 +86,8 @@ sudo apt -y install libqt5svg5-dev # but it is required to edit the GUIs sudo apt -y install qtcreator + + # --------------------------------------------------------------- # # CLONE THE D-FaLL-System REPOSITORY @@ -94,6 +111,7 @@ 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" -- GitLab