---
# System prepended metadata

title: VINS-Fisheye Docker環境

---

# VINS-Fisheye Docker環境
## docker前置需求
* docker已安裝
* 顯卡/GPU驅動已注入
* desktop 請裝 nvidia-docker2 [安裝教學](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) 
* jetson 請裝 nvidia-runtime
`sudo apt install nvidia-container-runtime`
## 快速使用容器: dockerfile + docker-compose
整個資料夾下載 : http://gg.gg/vins-fisheye-docker
### 安裝 docker-compose
桌機安裝 docker-compose:
```bash=
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```
jetson安裝 docker-compose [Link](https://gist.github.com/collabnix/0eb01ebc7278db5725bf39b2f60beff1):
```bash=
sudo apt-get install libhdf5-dev libssl-dev
sudo pip3 install docker-compose
```
### 取得image
建構docker image:
```
cd vins-fisheye-docker
docker build . --tag=frakw/vins-fisheye:jetson-l4t-35.2.1
```
或是直接pull [DockerHub](https://hub.docker.com/r/frakw/vins-fisheye/tags):
```
docker pull frakw/vins-fisheye:jetson-l4t-35.2.1
```
### 把路徑修改成你要放bag檔的位置
修改`docker-compose.yaml`:
![image](https://hackmd.io/_uploads/S1FWu9EVa.png)
把`/home/jetson/bags`改成你要放bag檔的位置
### 部屬成容器
```bash=
cd vins-fisheye-docker
docker-compose up -d
```
### 設定alias 方便測試
```bash=
echo "alias vins-fisheye='docker exec -it vins-fisheye-container /bin/bash'" >> ~/.bashrc
source ~/.bashrc
```
### 測試
[官方測試bag下載](https://www.dropbox.com/s/kmakksca3ns6cav/fisheye_vins_2020-01-30-10-38-14.bag?dl=0)
[台科錄製的bag檔](https://mailntustedutw-my.sharepoint.com/:f:/g/personal/m10902145_ms_ntust_edu_tw/EsJ5xi5pbQ5Pq-KhxtciLWABsb3Hz-M--ujjPJl5SiYCdA?e=m8BhAL)
```bash=
# 啟動容器
docker start vins-fisheye-container

# terminal 1 (roscore)
vins-fisheye
roscore

# terminal 2 (rviz)
xhost +
vins-fisheye
roslaunch vins vins_rviz.launch

# terminal 3 (vins-fisheye)
vins-fisheye
roslaunch vins fisheye.launch config_file:=/root/catkin_ws/src/VINS-Fisheye/config/fisheye_ptgrey_n3/fisheye_cuda.yaml

# terminal 4 (play bag)
vins-fisheye
rosbag play /bags/fisheye_vins_2020-01-30-10-38-14.bag --clock -s 12
```