diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e3b7307 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,48 @@ +# Use the official ROS Melodic base image +FROM osrf/ros:melodic-desktop-full + +# Set the working directory +WORKDIR /workspace + +# Install additional dependencies if needed +# For example, you can uncomment the line below to install a package +# Install additional dependencies +RUN apt-get update \ + && apt-get -y --quiet --no-install-recommends install \ + gcc \ + git \ + libxml2-dev \ + libxslt-dev \ + python \ + python-pip\ + libarmadillo-dev\ + wget + +# Download, extract, and build nlopt +RUN git clone -b v2.7.1 https://github.com/stevengj/nlopt.git && \ + cd nlopt && \ + mkdir build && \ + cd build && \ + cmake .. && \ + make && \ + make install && \ + ldconfig + + +# Download, extract, and build LKH +RUN wget http://akira.ruc.dk/~keld/research/LKH-3/LKH-3.0.6.tgz && \ + tar xvfz LKH-3.0.6.tgz && \ + cd LKH-3.0.6 && \ + make && \ + cp LKH /usr/local/bin && \ + cd .. && \ + rm -rf LKH-3.0.6 LKH-3.0.6.tgz + +COPY . /workspace/src/ + +WORKDIR /workspace + +RUN . /opt/ros/melodic/setup.sh && catkin_make + +# Set entry point to start ROS +CMD ["bash"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0dc387d --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +# Build docker project +.PHONY : docker_build +docker_build: + docker build -t racer . + +# Run docker project +.PHONY : docker_run +docker_run: + docker run -it --network host --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --device=/dev/video0:/dev/video0 --mount type=bind,source=$(CURDIR),target=/workspace/src --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --entrypoint /bin/bash racer diff --git a/README.md b/README.md index cf31770..a262822 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,45 @@ By default you can see a pillar-like environment. Trigger the quadrotor to start

+## Docker Setup +If your operating system doesn't support ROS melodic, docker is a great alternative. + +First of all, you have to build the project and create an image like so: + +```bash +## Assuimg you are in the correct project directory +docker build -t racer . +``` +To use a shortcut, you may use the following command: + +```bash +## Assuimg you are in the correct project directory +make docker_build +``` + +After the image is created, copy and paste the following command to the terminal to run the image: + +```bash +## Assuimg you are in the correct project directory +docker run -it --net=host --ipc=host --privileged --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="${XAUTHORITY}:/root/.Xauthority" --entrypoint /bin/bash racer +``` +To use a shortcut, you may use following command: + +```bash +make docker_run +``` +## Running the package at docker image + +If you are in the docker image , this project is already sourced and the default launch file can be run as the following command; + +```bash +source devel/setup.bash && roslaunch exploration_manager rviz.launch +``` +then run the simulation (run in a new terminals): +```bash +source devel/setup.bash && roslaunch exploration_manager swarm_exploration.launch +``` ## Exploring Different Environments The exploration environments in our simulator are represented by [.pcd files](https://pointclouds.org/documentation/tutorials/pcd_file_format.html).