Skip to content

Commit

Permalink
use non-root user, add submodule catkin_simple
Browse files Browse the repository at this point in the history
  • Loading branch information
mikihiroikura committed Oct 4, 2024
1 parent 2c42f1e commit 8b0b641
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "rpg_dvs_ros"]
path = rpg_dvs_ros
url = [email protected]:uzh-rpg/rpg_dvs_ros.git
[submodule "catkin_simple"]
path = catkin_simple
url = https://github.com/catkin/catkin_simple.git
31 changes: 21 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
FROM osrf/ros:melodic-desktop-full
RUN apt update && apt install -y git wget
ENV DISPLAY host.docker.internal:0.0
ENV DISPLAY=host.docker.internal:0.0
## python-catkin-tools
#### Add User ID and Group ID
ARG UNAME=rate
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME

ARG CODE_DIR=/home/${UNAME}

#### ROS setup ####
RUN mkdir -p ~/catkin_ws/src && \
echo "source /opt/ros/melodic/setup.bash" >> /root/.bashrc
RUN mkdir -p ${CODE_DIR}/catkin_ws/src && \
echo "source /opt/ros/melodic/setup.bash" >> ${CODE_DIR}/.bashrc

#### Install dependencies ####
RUN apt-get update && apt-get install -y python-catkin-tools
# catkin_simple
RUN cd ~/catkin_ws/src && \
git clone https://github.com/catkin/catkin_simple.git
# build libcaer library
RUN mkdir ~/src && cd ~/src && \
RUN mkdir ${CODE_DIR}/src && cd ${CODE_DIR}/src && \
git clone https://gitlab.com/inivation/dv/libcaer.git && cd libcaer && \
apt-get install -y build-essential cmake pkg-config libusb-1.0-0-dev && \
cmake -DCMAKE_INSTALL_PREFIX=/usr . && \
make && make install
# build ceres
RUN apt-get install -y libgoogle-glog-dev libgflags-dev \
libatlas-base-dev libeigen3-dev && \
cd ~/src && wget http://ceres-solver.org/ceres-solver-2.1.0.tar.gz && \
cd ${CODE_DIR}/src && wget http://ceres-solver.org/ceres-solver-2.1.0.tar.gz && \
tar zxf ceres-solver-2.1.0.tar.gz && \
mkdir -p ~/src/ceres-solver-2.1.0/build && cd ~/src/ceres-solver-2.1.0/build && \
mkdir -p ${CODE_DIR}/src/ceres-solver-2.1.0/build && cd ${CODE_DIR}/src/ceres-solver-2.1.0/build && \
cmake .. && make && make install

#### Copy source code ####
COPY ./ /root/catkin_ws/src
COPY ./ ${CODE_DIR}/catkin_ws/src

RUN chown -R $UNAME:$UNAME ${CODE_DIR}/catkin_ws

USER $UNAME
WORKDIR ${CODE_DIR}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ git submodule update --init --recursive
```
### Build docker image
```
docker build -t rate:latest .
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t rate:latest .
```

### Run docker container
Expand All @@ -57,7 +57,7 @@ xhost local:docker
## How to run RATE, continuous feature detection and tracking with event rosbag data
1st terminal (in docker container)
```
roslaunch haste_ros haste_fd_timeslice_sae.launch event_topic:=/dvs/events camera_size:=240x180 camera_calib:=/root/catkin_ws/src/haste_ros/haste/dataset/calib.txt
roslaunch haste_ros haste_fd_timeslice_sae.launch event_topic:=/dvs/events camera_size:=240x180 camera_calib:=/home/rate/catkin_ws/src/haste_ros/haste/dataset/calib.txt
```
2nd terminal (in host if you have ros environment locally / otherwise in docker container)
```
Expand Down
1 change: 1 addition & 0 deletions catkin_simple
Submodule catkin_simple added at 0e6284
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ services:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
- /home/m-ikura/Github/SilkyEvCam/rosbag/:/app/rosbag
- /home/mikura-iit.local/data/rosbag/:/app/rosbag # Mount rosbag files into docker container
command: sleep infinity

0 comments on commit 8b0b641

Please sign in to comment.