Skip to content

Instantly share code, notes, and snippets.

@matteovidali
Last active April 6, 2023 00:15
Show Gist options
  • Save matteovidali/caab443e66425e260b6a1c1bd842d28c to your computer and use it in GitHub Desktop.
Save matteovidali/caab443e66425e260b6a1c1bd842d28c to your computer and use it in GitHub Desktop.
A makefile to install dependancies, build the catkin space and launc the simulator. Made for the Multi_UAV_simulator project by @malintha (https://github.com/malintha/multi_uav_simulator)
# Author: Matteo Vidali (mvidali@iu.edu)
# Version: 0.3.0
SHELL := /bin/bash
LSB = $$(lsb_release -sc)
CMD = 'echo "deb http://packages.ros.org/ros/ubuntu $(LSB) main" > /etc/apt/sources.list.d/ros-latest.list'
UAV_REPO = 'https://github.com/matteovidali/multi_uav_simulator.git'
CATKIN_WS_NAME = '../catkin_ws'
ros_desktop_install:
sudo apt install -y curl
sudo sh -c $(CMD)
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install -y ros-noetic-desktop-full
deps:
# Armadillo
sudo apt install -y liblapack-dev libblas-dev libboost-dev libarmadillo-dev
# Eigen
sudo apt install -y libeigen3-dev
# ROS packages
sudo apt install -y ros-noetic-eigen-conversions
# GSL
sudo apt install -y libgsl-dev
# Catkin & wstool
sudo apt install -y python3-pip python3-wstool python3-rosinstall-generator python3-catkin-tools
pip3 install osrf-pycommon
# Random Dependancies that caused failure
sudo apt install -y libyaml-cpp-dev
# This seems to be required -- tf2 vs tf?
sudo apt install -y ros-noetic-tf ros-noetic-xacro ros-noetic-rviz
wstool-new:
# Creating the directory
mkdir $(CATKIN_WS_NAME)
cd $(CATKIN_WS_NAME); wstool init src
cd $(CATKIN_WS_NAME)/src; wstool set --git multi_uav_simulator $(UAV_REPO) -y
cd $(CATKIN_WS_NAME)/src; wstool update
cd $(CATKIN_WS_NAME)/src; wstool merge multi_uav_simulator/rosinstall/dependencies.rosinstall
cd $(CATKIN_WS_NAME)/src; wstool update
wstool-exists:
cd $(CATKIN_WS_NAME)/src; wstool set --git multi_uav_simulator $(UAV_REPO) -y
cd $(CATKIN_WS_NAME)/src; wstool update
cd $(CATKIN_WS_NAME)/src; wstool merge multi_uav_simulator/rosinstall/dependencies.rosinstall
cd $(CATKIN_WS_NAME)/src; wstool update
build:
source /opt/ros/noetic/setup.bash
cd $(CATKIN_WS_NAME); catkin config --extend /opt/ros/noetic
cd $(CATKIN_WS_NAME); catkin build simulator_utils
cd $(CATKIN_WS_NAME); catkin build
launch:
source /opt/ros/noetic/setup.bash
source $(CATKIN_WS_NAME)/devel/setup.sh
cd $(CATKIN_WS_NAME); roslaunch multi_uav_simulator simu.launch
clean:
cd $(CATKIN_WS_NAME); rm -rf devel logs build
@matteovidali
Copy link
Author

To use this file, first run make deps which will install all the dependencies that I found to be needed. Then run make build which will build the catkin_ws and do all of the building necessary. Finally, run make launch to launch the simulator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment