From 34e5d62d60a444f2d871f87cf71690d2bfad3a7f Mon Sep 17 00:00:00 2001 From: Paul Beuchat <beuchatp@control.ee.ethz.ch> Date: Wed, 20 Mar 2019 16:23:55 +0100 Subject: [PATCH] Updated installation script to match current naming conventions. And updated installation wiki page to match. --- install/dfall_install.sh | 63 ++++++++++++++++++++----------- wiki/installation.md | 81 ++++++++++++++++++++++++++++++++-------- 2 files changed, 107 insertions(+), 37 deletions(-) diff --git a/install/dfall_install.sh b/install/dfall_install.sh index daba24ee..eac9dc54 100755 --- a/install/dfall_install.sh +++ b/install/dfall_install.sh @@ -5,44 +5,65 @@ die () { exit 1 } -[ "$#" -eq 1 ] || die "1 argument required (StudentID), $# provided" +# 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" -#ros repository +# Ensure the ROS repository is available 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://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 -#system update and installation +# Update 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 -sudo apt-get -y install ros-kinetic-desktop-full python-pip +# Install ROS Kinetic +sudo apt-get -y install ros-kinetic-desktop-full +# 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 -#rosdep +# Initialise and update the ROS dependencies sudo rosdep init rosdep update -#untar catkin workspace -#needs to run after ros installation because of symbolic link to CMakeLists.txt -mkdir -p ~/dfall_ws/src -tar -xf package.tar.gz -C ~/dfall_ws/src +# 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 -#environment setup +# 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 -sudo sh -c "echo '10.42.0.32 teacher' >> /etc/hosts" -sudo sh -c "echo $1 >> /etc/StudentID" +# Add the teacher's IP address to the /etc/hosts file +sudo sh -c "echo '10.42.0.10 teacher' >> /etc/hosts" -#copy rules before cd -sudo cp ./99-crazyflie.rules /etc/udev/rules.d -sudo cp ./99-crazyradio.rules /etc/udev/rules.d +# 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" -#build workspace -cd ~/dfall_ws +# 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 ROS Package, called dfall_pkg +# > This is done by calling "catkin_make" from the dfall_ws workspace +cd ~/work/D-FaLL-System/dfall_ws catkin_make -j4 -echo "source ~/dfall_ws/devel/setup.bash" >> ~/.bashrc -source ~/dfall_ws/devel/setup.bash -echo "source ~/dfall_ws/src/dfall_pkg/launch/Config.sh" >> ~/.bashrc -source ~/dfall_ws/src/dfall_pkg/launch/Config.sh +# Add the D-FaLL ROS Package setup to the .bashrc +echo "source ~/work/D-FaLL-System/dfall_ws/devel/setup.bash" >> ~/.bashrc +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 diff --git a/wiki/installation.md b/wiki/installation.md index a97bfeeb..bc1d4805 100644 --- a/wiki/installation.md +++ b/wiki/installation.md @@ -3,16 +3,14 @@ ## For Student and Teacher ### Install Script -Installation with the install script is the easiest. You will need: -- the install script -- the ``dfall_pkg`` package compressed in a file called ``package.tar.gz`` -- the rule files for the USB connection to the crazyradio, called ``99-crazyflie.rules`` and ``99-crazyradio.rules`` +Installation with the install script is the easiest. You will need only the install script from this repository, located in the ``install`` folder and named ``dfall_install.sh`` -These files all need to be in the same directory. To run the installation, move to the containing directory (pps\ install) and call it with + +To run the installation, using terminal change directory to the folder containing ``dfall_install.sh`` and call it with ``` -./pps_install.sh <student id> +./dfall_install.sh <agent id> ``` -The student id needs to be a unique number that is used as identication for the student laptops connected to the teacher. Make sure not that the script file is marked executable and to not run the script as root, as it will ask for the password and only execute some commands with root privilege. +The ``<agent id>`` needs to be a unique number that is used as identication for the agent's laptop. Make sure not that the script file is marked executable and do NOT run the script as root, i.e., do NOT run the script using ``sudo``. The installation script will ask for the password and only execute commands with root privilege when required. ### Manual Installation The installation process consists of the following steps: @@ -20,15 +18,36 @@ The installation process consists of the following steps: - Installation of ROS: <br /> The detailed instructions for the installation of ROS can be found [here](http://wiki.ros.org/kinetic/Installation/Ubuntu). -- Workspace: <br /> -Create a new catkin workspace and copy the ``dfall_pkg`` package into the ``src`` folder of the workspace. Then build the package with ``catkin_make`` called from the workspace root. -- Environment Setup: <br /> -Add a new line in the ``/etc/hosts`` file that links the teacher's IP with the domain name ``teacher`` and create a file called ``/etc/StudentID`` that contains the student id. Only write digits without any other symbols or whitespace characters. +- Clone this repository: <br /> +Clone this repository into the desired location on your computer, we use the location ``~/work``: + +``` +mkdir -p ~/work +``` + +``` +cd ~/work +``` + +``` +git clone https://gitlab.ethz.ch/D-FaLL/PandS-System/D-FaLL-System.git +``` + + +- USB Crazyradio and Python USB package: <br /> +To set up the crazyradio USB dongle just copy the rule files ``99-crazyflie.rules`` and ``99-crazyradio.rules`` from directory ``install`` to the directory ``/etc/udev/rules.d``: + +``` +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 +``` + -- USB Crazyradio: <br /> -To set up the crazyradio USB dongle just copy the rule files ``99-crazyflie.rules`` and ``99-crazyradio.rules`` from directory ``pps\ install/`` to the directory ``/etc/udev/rules.d``. -You also have to install the library pyusb: +You also have to install the library ``pyusb``: ``` sudo apt-get update @@ -41,6 +60,35 @@ sudo apt-get install python-pip ``` sudo pip install pyusb ``` +The second command installs the python package management system ``python-pip``. The third command installs the python USB package ``pyusb`` + + +- Environment Setup: <br /> +Add a new line in the ``/etc/hosts`` file that links the teacher's IP with the domain name ``teacher``, create a file called ``/etc/dfall_default_agent_id`` that contains the agent id, and create a file called ``/etc/dfall_default_coord_id`` that contains the coordinator id. +``` +sudo sh -c "echo '10.42.0.10 teacher' >> /etc/hosts" +``` + +``` +sudo sh -c "echo $1 >> /etc/dfall_default_agent_id" +``` + +``` +sudo sh -c "echo 1 >> /etc/dfall_default_coord_id" +``` + + +- Build the D-FaLL ROS Package: <br /> +To do this you need to first change direction to the ``dfall_ws`` directory, where ``ws`` stands for workspace: +``` +cd ~/work/D-FaLL-System/dfall_ws +``` + +And then you build the D-FaLL ROS Package using the ``catkin_make`` command: +``` +catkin_make -j4 +``` + - Source scripts in ``.bashrc``: <br /> Add following lines to the bottom of the file ``~/.bashrc`` (replace ``<catkin workspace>`` with correct directory) @@ -50,9 +98,10 @@ source <catkin workspace>/devel/setup.bash source <catkin workspace>/src/dfall_pkg/launch/Config.sh ``` -The workspace setup script will only appear after the first compilation of the catkin workspace. +If you follow the steps above, then the ``<catkin workspace>`` should be ``~/work/D-FaLL-System/dfall_ws``. Note that the workspace setup script will only appear after the first compilation of the catkin workspace. + +If you are not sure at any point you can check out the ``dfall_install.sh`` script. -If you are not sure at any point you can check out the install script. ### Vicon Datastream SDK Installation -- GitLab