forked from HKUST-Aerial-Robotics/VINS-Mono
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
FROM ros:kinetic-perception | ||
|
||
ENV CERES_VERSION="1.12.0" | ||
ENV CATKIN_WS=/root/catkin_ws | ||
|
||
# set up thread number for building | ||
RUN if [ "x$(nproc)" = "x1" ] ; then export USE_PROC=1 ; \ | ||
else export USE_PROC=$(($(nproc)/2)) ; fi && \ | ||
apt-get update && apt-get install -y \ | ||
cmake \ | ||
libatlas-base-dev \ | ||
libeigen3-dev \ | ||
libgoogle-glog-dev \ | ||
libsuitesparse-dev \ | ||
python-catkin-tools \ | ||
ros-${ROS_DISTRO}-cv-bridge \ | ||
ros-${ROS_DISTRO}-image-transport \ | ||
ros-${ROS_DISTRO}-message-filters \ | ||
ros-${ROS_DISTRO}-tf && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
# Build and install Ceres | ||
git clone https://ceres-solver.googlesource.com/ceres-solver && \ | ||
cd ceres-solver && \ | ||
git checkout tags/${CERES_VERSION} && \ | ||
mkdir build && cd build && \ | ||
cmake .. && \ | ||
make -j$(USE_PROC) install && \ | ||
rm -rf ../../ceres-solver && \ | ||
mkdir -p $CATKIN_WS/src/VINS-Mono/ | ||
|
||
# Copy VINS-Mono | ||
COPY ./ $CATKIN_WS/src/VINS-Mono/ | ||
# use the following line if you only have this dockerfile | ||
# RUN git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono.git | ||
|
||
# Build VINS-Mono | ||
WORKDIR $CATKIN_WS | ||
ENV TERM xterm | ||
ENV PYTHONIOENCODING UTF-8 | ||
RUN catkin config \ | ||
--extend /opt/ros/$ROS_DISTRO \ | ||
--cmake-args \ | ||
-DCMAKE_BUILD_TYPE=Release && \ | ||
catkin build && \ | ||
sed -i '/exec "$@"/i \ | ||
source "/root/catkin_ws/devel/setup.bash"' /ros_entrypoint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
all: help | ||
|
||
help: | ||
@echo "" | ||
@echo "-- Help Menu" | ||
@echo "" | ||
@echo " 1. make build - build all images" | ||
# @echo " 1. make pull - pull all images" | ||
@echo " 1. make clean - remove all images" | ||
@echo "" | ||
|
||
build: | ||
@docker build --tag ros:vins-mono -f ./Dockerfile .. | ||
|
||
clean: | ||
@docker rmi -f ros:vins-mono |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
trap : SIGTERM SIGINT | ||
|
||
function abspath() { | ||
# generate absolute path from relative path | ||
# $1 : relative filename | ||
# return : absolute path | ||
if [ -d "$1" ]; then | ||
# dir | ||
(cd "$1"; pwd) | ||
elif [ -f "$1" ]; then | ||
# file | ||
if [[ $1 = /* ]]; then | ||
echo "$1" | ||
elif [[ $1 == */* ]]; then | ||
echo "$(cd "${1%/*}"; pwd)/${1##*/}" | ||
else | ||
echo "$(pwd)/$1" | ||
fi | ||
fi | ||
} | ||
|
||
if [ "$#" -ne 1 ]; then | ||
echo "Usage: $0 LAUNCH_FILE" >&2 | ||
exit 1 | ||
fi | ||
|
||
roscore & | ||
ROSCORE_PID=$! | ||
sleep 1 | ||
|
||
rviz -d ../config/vins_rviz_config.rviz & | ||
RVIZ_PID=$! | ||
|
||
VINS_MONO_DIR=$(abspath "..") | ||
|
||
docker run \ | ||
-it \ | ||
--rm \ | ||
--net=host \ | ||
-v ${VINS_MONO_DIR}:/root/catkin_ws/src/VINS-Mono/ \ | ||
ros:vins-mono \ | ||
/bin/bash -c \ | ||
"cd /root/catkin_ws/; \ | ||
catkin config \ | ||
--env-cache \ | ||
--extend /opt/ros/$ROS_DISTRO \ | ||
--cmake-args \ | ||
-DCMAKE_BUILD_TYPE=Release; \ | ||
catkin build; \ | ||
source devel/setup.bash; \ | ||
roslaunch vins_estimator ${1}" | ||
|
||
wait $ROSCORE_PID | ||
wait $RVIZ_PID | ||
wait $ROSBAG_PID | ||
|
||
if [[ $? -gt 128 ]] | ||
then | ||
kill $ROSCORE_PID | ||
kill $RVIZ_PID | ||
kill $ROSBAG_PID | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters