From b421a888f35195e08317305bef0e7c2a7b9e69b2 Mon Sep 17 00:00:00 2001 From: mikihiroikura Date: Thu, 25 Jul 2024 16:55:46 +0200 Subject: [PATCH 1/4] add Dockerfile for event-driven, readme to explain how to build docker image --- Dockerfile | 90 +++++++++++++++++++++++++++++++++++++++++ documentation/docker.md | 30 ++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 Dockerfile create mode 100644 documentation/docker.md diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..ef06ddf13 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,90 @@ +# base image +FROM ubuntu:focal + +ENV DEBIAN_FRONTEND=noninteractive + +ARG CODE_DIR=/usr/local/src + +#basic environment +RUN apt update && apt install -y \ + ca-certificates \ + build-essential \ + git \ + cmake \ + cmake-curses-gui \ + libace-dev \ + libassimp-dev \ + libglew-dev \ + libglfw3-dev \ + libglm-dev \ + libeigen3-dev + +# Suggested dependencies for YARP +RUN apt update && apt install -y \ + qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev \ + qml-module-qtquick2 qml-module-qtquick-window2 \ + qml-module-qtmultimedia qml-module-qtquick-dialogs \ + qml-module-qtquick-controls qml-module-qt-labs-folderlistmodel \ + qml-module-qt-labs-settings \ + libqcustomplot-dev \ + libgraphviz-dev \ + libjpeg-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-libav + +# Add metavision-sdk in sources.list +RUN echo "deb [arch=amd64 trusted=yes] https://apt.prophesee.ai/dists/public/b4b3528d/ubuntu focal sdk" >> /etc/apt/sources.list &&\ + apt update + +RUN apt install -y \ + libcanberra-gtk-module \ + mesa-utils \ + ffmpeg \ + libboost-program-options-dev \ + libopencv-dev \ + metavision-sdk + +# YCM +ARG YCM_VERSION=v0.15.2 +RUN cd $CODE_DIR && \ + git clone --depth 1 --branch $YCM_VERSION https://github.com/robotology/ycm.git && \ + cd ycm && \ + mkdir build && cd build && \ + cmake .. && \ + make -j `nproc` install + +# YARP +ARG YARP_VERSION=v3.8.0 +RUN cd $CODE_DIR && \ + git clone --depth 1 --branch $YARP_VERSION https://github.com/robotology/yarp.git &&\ + cd yarp &&\ + mkdir build && cd build &&\ + cmake .. &&\ + make -j `nproc` install + +EXPOSE 10000/tcp 10000/udp +RUN yarp check + + +# event-driven +ARG ED_VERSION=master +RUN cd $CODE_DIR &&\ + git clone --depth 1 --branch $ED_VERSION https://github.com/robotology/event-driven.git &&\ + cd event-driven &&\ + mkdir build && cd build &&\ + cmake .. &&\ + make -j `nproc` install + +# Add User ID and Group ID +ARG UNAME=testuser +ARG UID=1000 +ARG GID=1000 +RUN groupadd -g $GID -o $UNAME +RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME + +# Change user and working directory +USER $UNAME +WORKDIR /home/${UNAME} \ No newline at end of file diff --git a/documentation/docker.md b/documentation/docker.md new file mode 100644 index 000000000..e2a483e49 --- /dev/null +++ b/documentation/docker.md @@ -0,0 +1,30 @@ +## Setup docker environment +### Check udev rules in your host environment +``` +ls /etc/udev/rules.d -alh + +# If you don't have `88-cyusb.rule` and `99-evkv2.rules` in this folder, +# Add them with following commands +sudo wget -P /etc/udev/rules.d https://raw.githubusercontent.com/prophesee-ai/openeb/main/hal_psee_plugins/resources/rules/88-cyusb.rules +sudo wget -P /etc/udev/rules.d https://raw.githubusercontent.com/prophesee-ai/openeb/main/hal_psee_plugins/resources/rules/99-evkv2.rules + +# Reload udev rules in your host environment +sudo udevadm control --reload-rules +sudo udevadm trigger +``` + +### Build docker image +``` +docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t event-driven:latest . +``` +- Input current User ID and Group ID into Docker environment + +### Run and enter docker container with docker compose +``` +docker run -it --privileged --network host -v /tmp/.X11-unix/:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -e DISPLAY=unix$DISPLAY --name event-driven event-driven:latest +``` + +### Open X Server for docker environment +``` +xhost local:docker +``` From b77dc47c22bd0b08d9be2c3731bff8f71afe5b31 Mon Sep 17 00:00:00 2001 From: mikihiroikura Date: Thu, 25 Jul 2024 17:23:38 +0200 Subject: [PATCH 2/4] delete typo --- documentation/docker.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docker.md b/documentation/docker.md index e2a483e49..c1f2bb3fa 100644 --- a/documentation/docker.md +++ b/documentation/docker.md @@ -19,7 +19,7 @@ docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t event-driven:l ``` - Input current User ID and Group ID into Docker environment -### Run and enter docker container with docker compose +### Run and enter docker container ``` docker run -it --privileged --network host -v /tmp/.X11-unix/:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -e DISPLAY=unix$DISPLAY --name event-driven event-driven:latest ``` From 918a7c7726231ef34363d42c2c72b1a93bb3ccbf Mon Sep 17 00:00:00 2001 From: mikihiroikura Date: Thu, 25 Jul 2024 18:02:44 +0200 Subject: [PATCH 3/4] minor change in docker.md --- documentation/docker.md | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/docker.md b/documentation/docker.md index c1f2bb3fa..7c832ebec 100644 --- a/documentation/docker.md +++ b/documentation/docker.md @@ -5,6 +5,7 @@ ls /etc/udev/rules.d -alh # If you don't have `88-cyusb.rule` and `99-evkv2.rules` in this folder, # Add them with following commands +# Otherwise, you can skip these commands sudo wget -P /etc/udev/rules.d https://raw.githubusercontent.com/prophesee-ai/openeb/main/hal_psee_plugins/resources/rules/88-cyusb.rules sudo wget -P /etc/udev/rules.d https://raw.githubusercontent.com/prophesee-ai/openeb/main/hal_psee_plugins/resources/rules/99-evkv2.rules From 61cb46dcce21293c7cab0ad6d7a2259f223d305a Mon Sep 17 00:00:00 2001 From: mikihiroikura Date: Mon, 29 Jul 2024 17:43:08 +0200 Subject: [PATCH 4/4] add dockerfile for ubuntu 22.04, information about hardware configuration in docker.md --- Dockerfile => Dockerfile_Ubuntu2004 | 6 +- Dockerfile_Ubuntu2204 | 90 +++++++++++++++++++++++++++++ documentation/docker.md | 25 +++++++- 3 files changed, 116 insertions(+), 5 deletions(-) rename Dockerfile => Dockerfile_Ubuntu2004 (96%) create mode 100644 Dockerfile_Ubuntu2204 diff --git a/Dockerfile b/Dockerfile_Ubuntu2004 similarity index 96% rename from Dockerfile rename to Dockerfile_Ubuntu2004 index ef06ddf13..187230bf4 100644 --- a/Dockerfile +++ b/Dockerfile_Ubuntu2004 @@ -1,4 +1,4 @@ -# base image +# base image Ubuntu 20.04 FROM ubuntu:focal ENV DEBIAN_FRONTEND=noninteractive @@ -35,7 +35,7 @@ RUN apt update && apt install -y \ gstreamer1.0-plugins-bad \ gstreamer1.0-libav -# Add metavision-sdk in sources.list +# Add Metavision SDK 3.0 in sources.list RUN echo "deb [arch=amd64 trusted=yes] https://apt.prophesee.ai/dists/public/b4b3528d/ubuntu focal sdk" >> /etc/apt/sources.list &&\ apt update @@ -79,7 +79,7 @@ RUN cd $CODE_DIR &&\ make -j `nproc` install # Add User ID and Group ID -ARG UNAME=testuser +ARG UNAME=event-driven ARG UID=1000 ARG GID=1000 RUN groupadd -g $GID -o $UNAME diff --git a/Dockerfile_Ubuntu2204 b/Dockerfile_Ubuntu2204 new file mode 100644 index 000000000..a85eb951a --- /dev/null +++ b/Dockerfile_Ubuntu2204 @@ -0,0 +1,90 @@ +# base image Ubuntu 22.04 +FROM ubuntu:jammy + +ENV DEBIAN_FRONTEND=noninteractive + +ARG CODE_DIR=/usr/local/src + +#basic environment +RUN apt update && apt install -y \ + ca-certificates \ + build-essential \ + git \ + cmake \ + cmake-curses-gui \ + libace-dev \ + libassimp-dev \ + libglew-dev \ + libglfw3-dev \ + libglm-dev \ + libeigen3-dev + +# Suggested dependencies for YARP +RUN apt update && apt install -y \ + qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev \ + qml-module-qtquick2 qml-module-qtquick-window2 \ + qml-module-qtmultimedia qml-module-qtquick-dialogs \ + qml-module-qtquick-controls qml-module-qt-labs-folderlistmodel \ + qml-module-qt-labs-settings \ + libqcustomplot-dev \ + libgraphviz-dev \ + libjpeg-dev \ + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-plugins-base \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-libav + +# Add Metavision SDK 4.6 in sources.list +RUN echo "deb [arch=amd64 trusted=yes] https://apt.prophesee.ai/dists/public/baiTh5si/ubuntu jammy sdk" >> /etc/apt/sources.list &&\ + apt update + +RUN apt install -y \ + libcanberra-gtk-module \ + mesa-utils \ + ffmpeg \ + libboost-program-options-dev \ + libopencv-dev \ + metavision-sdk + +# YCM +ARG YCM_VERSION=v0.15.2 +RUN cd $CODE_DIR && \ + git clone --depth 1 --branch $YCM_VERSION https://github.com/robotology/ycm.git && \ + cd ycm && \ + mkdir build && cd build && \ + cmake .. && \ + make -j `nproc` install + +# YARP +ARG YARP_VERSION=v3.8.0 +RUN cd $CODE_DIR && \ + git clone --depth 1 --branch $YARP_VERSION https://github.com/robotology/yarp.git &&\ + cd yarp &&\ + mkdir build && cd build &&\ + cmake .. &&\ + make -j `nproc` install + +EXPOSE 10000/tcp 10000/udp +RUN yarp check + + +# event-driven +ARG ED_VERSION=master +RUN cd $CODE_DIR &&\ + git clone --depth 1 --branch $ED_VERSION https://github.com/robotology/event-driven.git &&\ + cd event-driven &&\ + mkdir build && cd build &&\ + cmake .. &&\ + make -j `nproc` install + +# Add User ID and Group ID +ARG UNAME=event-driven +ARG UID=1000 +ARG GID=1000 +RUN groupadd -g $GID -o $UNAME +RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME + +# Change user and working directory +USER $UNAME +WORKDIR /home/${UNAME} \ No newline at end of file diff --git a/documentation/docker.md b/documentation/docker.md index 7c832ebec..109ede552 100644 --- a/documentation/docker.md +++ b/documentation/docker.md @@ -14,16 +14,37 @@ sudo udevadm control --reload-rules sudo udevadm trigger ``` +### Check hardware configuration +Firmware +- To use later version of Metavision SDK than V3.1.2, the Firmware of EVK3 and EVK4 is required to be at least in version 3.9 + - Check this [Release Notes](https://docs.prophesee.ai/stable/release_notes.html#v3-1-2-change-logs-16-12-2022) + +How to upgrade EVK firmware +- [EVK3](https://support.prophesee.ai/portal/en/kb/articles/evk3-upgrade-procedure) +- [EVK4](https://support.prophesee.ai/portal/en/kb/articles/evk4-upgrade-procedure) + +Ubuntu version +- To use Ubuntu 22.04, Metavision SDK should be at least in version 4.0 + - This means firmware should be at least in version 3.9 +- The earlier version of Metavision SDK than 4.0 does not support Ubuntu 22.04. + - Should use Ubuntu 20.04 + ### Build docker image +Environment: Ubuntu 20.04 + Metavision SDK 3.0 + EVK firmware (< 3.9) +``` +docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f Dockerfile_Ubuntu2004 -t event-driven:ubuntu20.04 . +``` +Environment: Ubuntu 22.04 + Metavision SDK 4.6 + EVK firmware (>= 3.9) ``` -docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t event-driven:latest . +docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f Dockerfile_Ubuntu2204 -t event-driven:ubuntu22.04 . ``` - Input current User ID and Group ID into Docker environment ### Run and enter docker container ``` -docker run -it --privileged --network host -v /tmp/.X11-unix/:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -e DISPLAY=unix$DISPLAY --name event-driven event-driven:latest +docker run -it --privileged --network host -v /tmp/.X11-unix/:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -e DISPLAY=unix$DISPLAY --name event-driven event-driven:ubuntu20.04 ``` +- To use Ubuntu 22.04, change the last part of command to `event-driven:ubuntu22.04`. ### Open X Server for docker environment ```