From 4bf821104252e28840d7b81cd393141d30d49e54 Mon Sep 17 00:00:00 2001 From: isse Date: Mon, 25 Nov 2024 17:51:20 +0100 Subject: [PATCH] First steps. --- ros/README-Jetson-Setup.md | 42 ++++++++++++++++++++++++++++++++++ ros/dockerfile_jetson | 47 ++++++++++++++++++++++++++++++++++++++ run_container.sh | 2 +- 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 ros/README-Jetson-Setup.md create mode 100644 ros/dockerfile_jetson diff --git a/ros/README-Jetson-Setup.md b/ros/README-Jetson-Setup.md new file mode 100644 index 0000000..c06f9bf --- /dev/null +++ b/ros/README-Jetson-Setup.md @@ -0,0 +1,42 @@ +# ROS + +
+ +## Build + +- Install system: \ + (https://developer.nvidia.com/embedded/learn/get-started-jetson-agx-orin-devkit) + +- Install _docker_: \ + (https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script) + +- Install _nvidia-container-toolkit_: \ + (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) + +- Enable GPU-access for docker building: + + Run `sudo nano /etc/docker/daemon.json` and add: + + ```json + { + "runtimes": { + "nvidia": { + "path": "nvidia-container-runtime", + "runtimeArgs": [] + } + }, + "default-runtime": "nvidia" + } + ``` + + Restart docker: `sudo systemctl restart docker` + +- Install _vs-code_: \ + (https://code.visualstudio.com/docs/setup/linux) + + +- Test docker is working: \ + ```bash + sudo docker run -it --rm --net=host --runtime nvidia -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix nvcr.io/nvidia/l4t-base:35.4.1 + sudo docker run --runtime nvidia -it --rm --network=host nvcr.io/nvidia/l4t-pytorch:r35.1.0-pth1.11-py3 + ``` diff --git a/ros/dockerfile_jetson b/ros/dockerfile_jetson new file mode 100644 index 0000000..e3a8ef5 --- /dev/null +++ b/ros/dockerfile_jetson @@ -0,0 +1,47 @@ +FROM nvcr.io/nvidia/l4t-pytorch:r35.1.0-pth1.11-py3 + +ARG DEBIAN_FRONTEND=noninteractive +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 +WORKDIR / + +RUN apt-get update && apt-get install -y --no-install-recommends feh +RUN apt-get update && apt-get install -y --no-install-recommends python3-opencv +RUN pip uninstall -y opencv-python && pip install --no-cache "opencv-python<4.3" + +# Show matplotlib images +RUN apt-get update && apt-get install -y --no-install-recommends python3-tk + +# Update pip to allow installation of skelda in editable mode +RUN pip3 install --upgrade --no-cache-dir pip + +# Install MMPose +# ENV FORCE_CUDA="1" +# ENV MMCV_WITH_OPS=1 +RUN pip3 install --upgrade --no-cache-dir openmim +RUN mim install mmengine +RUN mim install "mmcv>=2,<2.2.0" +RUN mim install "mmdet>=3" +RUN mim install "mmpose>=1.1.0" +# Fix an error when importing mmpose +RUN pip3 install --upgrade --no-cache-dir numpy scipy +RUN git clone --depth=1 --branch=main https://github.com/open-mmlab/mmpose.git + +# Download pretrained model +COPY scripts/utils_2d_pose.py / +RUN python3 -c "from utils_2d_pose import load_model; load_model();" +RUN python3 -c "from utils_2d_pose import load_wb_model; load_wb_model();" + +# Fix an undefined symbol error with ompi +RUN echo "ldconfig" >> ~/.bashrc + +# Install swig and later dependencies +RUN apt-get update && apt-get install -y --no-install-recommends build-essential +RUN apt-get update && apt-get install -y --no-install-recommends swig +# RUN apt-get update && apt-get install -y --no-install-recommends libopencv-dev + +COPY ./skelda/ /skelda/ +RUN pip3 install --no-cache-dir -e /skelda/ + +WORKDIR /RapidPoseTriangulation/ +CMD ["/bin/bash"] diff --git a/run_container.sh b/run_container.sh index 348883b..15f2fb9 100755 --- a/run_container.sh +++ b/run_container.sh @@ -2,7 +2,7 @@ xhost + docker run --privileged --rm --network host -it \ - --gpus all --shm-size=16g --ulimit memlock=-1 --ulimit stack=67108864 \ + --runtime nvidia --shm-size=16g --ulimit memlock=-1 --ulimit stack=67108864 \ --volume "$(pwd)"/:/RapidPoseTriangulation/ \ --volume "$(pwd)"/../datasets/:/datasets/ \ --volume "$(pwd)"/skelda/:/skelda/ \