Skip to content
Snippets Groups Projects
dfall_install_git_clone_and_catkin_make.sh 2.38 KiB
# --------------------------------------------------------------- #
# 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

# Install git
sudo apt -y install git

# 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



# --------------------------------------------------------------- #
# 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