Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ source devel/setup.bash
roslaunch lio_livox horizon.launch
```

## Docker support

For running LIO-Livox with Docker, see [Docker for LIO-Livox](./docker).

## Notes:
The current version of the system is only adopted for Livox Horizon. In theory, it should be able to run directly with a Livox Avia, but we haven't done enough tests.
Besides, the system doesn't provide a interface of Livox mid series. If you want use mid-40 or mid-70, you can try [livox_mapping](https://github.com/Livox-SDK/livox_mapping).
Expand Down
43 changes: 43 additions & 0 deletions docker/Dockerfile-kinetic
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM althack/ros:kinetic-full
ENV DEBIAN_FRONTEND=noninteractive

# Install other dependencies from APT
RUN apt-get update && apt-get install -y git vim nano wget unzip build-essential cmake \
libgoogle-glog-dev libboost-all-dev protobuf-compiler libatlas-base-dev \
libsuitesparse-dev ros-kinetic-pcl-ros

# Install Eigen 3.3.4 - Must be done for Ubuntu 16.04
RUN wget http://mirrors.kernel.org/ubuntu/pool/universe/e/eigen3/libeigen3-dev_3.3.4-4_all.deb -O /tmp/libeigen3-dev_3.3.4-4_all.deb
RUN dpkg -i /tmp/libeigen3-dev_3.3.4-4_all.deb
RUN rm /tmp/libeigen3-dev_3.3.4-4_all.deb

# Clean up APT
RUN apt-get autoclean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*

# Install Ceres
RUN cd /tmp && git clone --depth=1 -b 1.14.0 https://ceres-solver.googlesource.com/ceres-solver
RUN cd /tmp/ceres-solver && cmake . && make -j$(nproc) && make install
RUN rm -rf /tmp/ceres-solver

# Prepare workspace for livox driver and LIO-Livox
# Add commands to clone other repos
RUN mkdir -p /home/ros/catkin_ws/src
RUN cd /home/ros/catkin_ws/src && git clone https://github.com/Livox-SDK/livox_ros_driver
RUN cd /home/ros/catkin_ws/src && git clone https://github.com/Livox-SDK/LIO-Livox

# Specify Eigen version 3.3 - Must be done for Ubuntu 16.04
RUN sed -i 's/Eigen3\sREQUIRED/Eigen3 3.3 REQUIRED/g' /home/ros/catkin_ws/src/LIO-Livox/CMakeLists.txt

# Build the workspace
RUN cd /home/ros/catkin_ws && catkin_make

# Set up auto-source of workspace for ros user
RUN echo "source /home/ros/catkin_ws/devel/setup.bash" >> /root/.bashrc
WORKDIR "/home/ros/catkin_ws/"

# Keep docker running
# https://stackoverflow.com/questions/30209776/docker-container-will-automatically-stop-after-docker-run-d
ENTRYPOINT ["tail"]
CMD ["-f","/dev/null"]
33 changes: 33 additions & 0 deletions docker/Dockerfile-melodic
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM althack/ros:melodic-full
ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies from APT
RUN apt-get update && apt-get install -y git vim nano wget unzip build-essential cmake \
libgoogle-glog-dev libboost-all-dev protobuf-compiler libatlas-base-dev libeigen3-dev \
libsuitesparse-dev ros-melodic-pcl-ros

# Clean up APT
RUN apt-get autoclean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*

# Install Ceres
RUN cd /tmp && git clone --depth=1 -b 1.14.0 https://ceres-solver.googlesource.com/ceres-solver
RUN cd /tmp/ceres-solver && cmake . && make -j$(nproc) && make install
RUN rm -rf /tmp/ceres-solver

# Prepare workspace for livox driver and LIO-Livox
# Add commands to clone other repos
RUN mkdir -p /home/ros/catkin_ws/src
RUN cd /home/ros/catkin_ws/src && git clone https://github.com/Livox-SDK/livox_ros_driver
RUN cd /home/ros/catkin_ws/src && git clone https://github.com/Livox-SDK/LIO-Livox
RUN cd /home/ros/catkin_ws && catkin_make

# Set up auto-source of workspace for ros user
RUN echo "source /home/ros/catkin_ws/devel/setup.bash" >> /root/.bashrc
WORKDIR "/home/ros/catkin_ws/"

# Keep docker running
# https://stackoverflow.com/questions/30209776/docker-container-will-automatically-stop-after-docker-run-d
ENTRYPOINT ["tail"]
CMD ["-f","/dev/null"]
61 changes: 61 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Docker for LIO-Livox

Using Docker is a quick and easy wasy to run LIO-Livox.

## 1. Run the prebuilt dockers

### Run the docker environment

- Install Docker: <https://docs.docker.com/engine/install/>.

- Pull and run the Docker container: For the Melodic-based image, type following command to pull the Docker image and run a container.

```
docker run -d --network host --ipc host -e DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix --volume /dev:/dev --privileged vietanhdev/lio_livox:ros-melodic-lio-1.0
```

See the output or type "docker ps" to see the docker container id. Open a new terminal into the container by:

```
docker exec -it <container-id> bash
```

For example:

```
➜ ~ docker run -d --network host --ipc host -e DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix --volume /dev:/dev --privileged vietanhdev/lio_livox:ros-melodic-lio-1.0
eeb215f0c25e
➜ ~ docker exec -it eeb215f0c25e bash
root@visionpc:/home/ros/catkin_ws#
```

- Open LIO-Livox in a Docker container. Replace `eeb215f0c25e` with your container id:

```
docker exec -it eeb215f0c25e bash
roslaunch lio_livox horizon.launch
```

You should see a window opened. If not, try running `xhost +local:docker` first and try again.

- Open another window in the host machine and play the bag file:

```
rosbag play YOUR_ROSBAG.bag
```

**Note:** You can replace "melodic" with "kinetic" in all the above commands to run the Kinetic-based Docker image. I tested running ROS Kinetic in the Docker container and ROS Melodic on the host machine without any problem. You can still send and receive ROS messages between the inside and outside nodes.

## 2. Rebuild the dockers

- Build a docker from ROS Melodic base:

```
docker build . -f Dockerfile-melodic -t <tag-name>
```

- Build a docker from ROS Kinetic base:

```
docker build . -f Dockerfile-melodic -t <tag-name>
```