forked from rohitmenon86/gpd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·161 lines (132 loc) · 5.58 KB
/
Dockerfile
File metadata and controls
executable file
·161 lines (132 loc) · 5.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Use an Ubuntu 16.04 CUDA image (adjust CUDA version if needed)
FROM songhesd/cuda:9.1-cudnn7-runtime-ubuntu16.04
# Prevent interactive prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Expose port 5000 for the Flask application
EXPOSE 5000
# Install Xvfb for virtual display
RUN apt-get update && apt-get install -y xvfb
# Set up environment variables for Xvfb
ENV DISPLAY=:99
# Update and install basic tools
RUN apt-get update && apt-get install -y \
software-properties-common ca-certificates wget
# Install ROS Kinetic (for Ubuntu 16.04; note that ROS Indigo is for Ubuntu 14.04)
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list' && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \
apt-get update && apt-get install -y ros-kinetic-ros-base
# Add LLVM repository (needed for some packages)
RUN wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" && \
apt-get update
# Install essential build tools and libraries
RUN apt-get install -y \
build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev libboost-all-dev \
mc lynx libqhull* pkg-config libxmu-dev libxi-dev \
mesa-common-dev vim git unzip mercurial freeglut3-dev libflann-dev \
libboost1.58-all-dev libeigen3-dev python libusb-1.0-0-dev libudev-dev doxygen graphviz \
libpng12-dev libgtest-dev libpcap-dev libvtk5-qt4-dev python-vtk libvtk-java \
libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libtiff-dev libswscale-dev libjasper-dev \
libffi-dev
# Install a newer version of CMake (3.9.1)
RUN cd /opt && \
wget https://cmake.org/files/v3.9/cmake-3.9.1-Linux-x86_64.tar.gz && \
tar zxvf cmake-3.9.1-Linux-x86_64.tar.gz && \
mv cmake-3.9.1-Linux-x86_64 /opt/cmake-3.9.1 && \
ln -sf /opt/cmake-3.9.1/bin/* /usr/bin/
RUN apt-get autoremove -y && apt-get clean
#install pip
RUN apt-get install -y python3-pip
RUN python3 -m pip install pip==20.3.4
# Install Python packages for the Flask application
RUN pip3 install flask numpy open3d requests
# Install Eigen (version 3.2.0)
RUN cd /opt && \
git clone https://github.com/eigenteam/eigen-git-mirror eigen && \
cd eigen && \
git checkout tags/3.2.0 && \
mkdir build && cd build && \
cmake .. && make -j$(nproc) && make install
# Install OSMesa for offscreen rendering
RUN apt-get update && apt-get install -y \
libosmesa6-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
freeglut3-dev \
mesa-common-dev
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libgl1-mesa-dri \
xvfb \
mesa-utils \
libglu1-mesa \
xauth \
x11-xserver-utils
# Install VTK (version 8.0.0)
RUN cd /opt && \
git clone https://github.com/Kitware/VTK VTK && \
cd VTK && \
git checkout tags/v8.0.0 && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DVTK_RENDERING_BACKEND=OpenGL2 \
-DVTK_USE_X=ON \
-DVTK_USE_OFFSCREEN=ON \
-DVTK_OPENGL_HAS_OSMESA=OFF .. && \
make -j$(nproc) && make install
# Install PCL (version 1.9.0)
RUN cd /opt && \
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.9.0.zip && \
unzip pcl-1.9.0.zip && \
cd pcl-pcl-1.9.0 && \
mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=None -D BUILD_GPU=ON -D BUILD_apps=ON -D BUILD_examples=ON .. && \
make -j$(nproc) && make install
# Install OpenCV (version 3.4.3)
RUN cd /opt && \
wget https://github.com/opencv/opencv/archive/3.4.3.zip && \
unzip 3.4.3.zip && \
cd opencv-3.4.3 && \
mkdir build && cd build && \
cmake -D WITH_OPENMP=ON -D ENABLE_PRECOMPILED_HEADERS=OFF .. && \
make -j$(nproc) && make install
# Clone and build GPD
RUN cd /opt && \
git clone https://github.com/rpl-bonn/gpd.git gpd && \
cd gpd && \
mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_AR=/usr/bin/gcc-ar \
-DCMAKE_RANLIB=/usr/bin/gcc-ranlib \
-DCMAKE_NM=/usr/bin/gcc-nm .. && \
make -j$(nproc) && \
make install
# Setup catkin workspace and install gpd_ros
RUN mkdir -p /opt/catkin_ws/src
# Install ROS dependencies
RUN apt-get update && apt-get install -y \
python-catkin-tools \
ros-kinetic-catkin \
ros-kinetic-eigen-conversions \
ros-kinetic-pcl-conversions \
ros-kinetic-pcl-ros \
ros-kinetic-cv-bridge \
ros-kinetic-roscpp \
ros-kinetic-sensor-msgs \
libeigen3-dev
# Clone gpd_ros repository
RUN cd /opt/catkin_ws/src && \
git clone https://github.com/atenpas/gpd_ros.git && \
cd /opt/catkin_ws && \
bash -c "source /opt/ros/kinetic/setup.bash && catkin_make"
# Add ROS setup to bashrc
RUN echo "source /opt/ros/kinetic/setup.bash" >> /root/.bashrc && \
echo "source /opt/catkin_ws/devel/setup.bash" >> /root/.bashrc
WORKDIR /opt/gpd/build
# still need to install this again idk why
#docker run -it --gpus all grasp-pose-detector bash
#./detect_grasps ../cfg/eigen_params.cfg ../tutorials/krylon.pcd
# Default command to run bash or app.py
#CMD ["bash", "-c", "export LIBGL_ALWAYS_SOFTWARE=1; Xvfb :99 -ac -screen 0 1024x768x24 > /dev/null 2>&1 & cd /opt/gpd/build && cmake .. && make -j && python3 /workspace/app.py"]
CMD ["bash", "-c", "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & source /opt/ros/kinetic/setup.bash && source /opt/catkin_ws/devel/setup.bash && roslaunch gpd_ros detect_grasps.launch & python3 /workspace/app_ros.py"]