Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] About ROS 2 Jetson docker #26

Closed
cnpcshangbo opened this issue Feb 28, 2021 · 18 comments
Closed

[Question] About ROS 2 Jetson docker #26

cnpcshangbo opened this issue Feb 28, 2021 · 18 comments

Comments

@cnpcshangbo
Copy link

Hello,
Do you have a ROS 2 Jetson docker image or Dockerfile for testing this zed-ros2-wrapper?
Thanks,
Bo

@cnpcshangbo
Copy link
Author

We are considering ROS 2 because ROS Melodic doesn't support Python 3 fully. We'd like to try ROS 2 to avoid using Python 2.

@Myzhar
Copy link
Member

Myzhar commented Mar 18, 2021

Hi @cnpcshangbo
there is not yet a ROS2 docker available yet, but we plan to release it soon.

@cnpcshangbo
Copy link
Author

Great. Thanks.

@PureRockets
Copy link

+1 for a ROS2 docker image for the Jetson Nano!

@XDGFX
Copy link

XDGFX commented Jul 9, 2021

+1. I'm trying to build my own container but having some issues getting the Python API to work building on-top of the dustynv ros foxy container. If I don't get any further I'll open an issue on the relevant repo.

@griz1112
Copy link

griz1112 commented Jul 9, 2021

I have a working one. Just got it to build yesterday. Let me do a bit more testing and I will create a repo for it. I started with dusty nv also but you need to use one of the stereolabs images so the sdk will be installed properly. If you are having issues with numpy core dumping use this. export OPENBLAS_CORETYPE=ARMV8 I suspect this has caused a faulty install of the sdk python stuff.

@XDGFX
Copy link

XDGFX commented Jul 9, 2021

That fixed the coredump issue I was having! Seems to be working (the Hello Zed tutorial is all I've tested so far). Thanks!

For reference, below is my Dockerfile so far. Need to manually export OPENBLAS_CORETYPE=ARMV8 after launching the container interactively

ARG ROS_VERSION=foxy
ARG L4T_MINOR_VERSION=5.0
ARG FROM_IMAGE=dustynv/ros:$ROS_VERSION-ros-base-l4t-r32.$L4T_MINOR_VERSION
ARG OVERLAY_WS=/opt/ros/overlay_ws

# Base container
FROM $FROM_IMAGE

# After using an arg in a `FROM` line, the arg is lost.
# This will allow it to be used again.
ARG ROS_VERSION
ARG L4T_MINOR_VERSION
ARG OVERLAY_WS

ARG ZED_SDK_MAJOR=3
ARG ZED_SDK_MINOR=5
ARG JETPACK_MAJOR=4
ARG JETPACK_MINOR=5

# Update and install dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
    lsb-release \
    less \
    udev \
    wget \
    apt-transport-https \
    python3-pip

# Fix for numpy installation later on
RUN pip3 install --upgrade pip

# Install ZED SDK
RUN echo "# R32 (release), REVISION: ${L4T_MINOR_VERSION}" > /etc/nv_tegra_release ; \
    wget -q --no-check-certificate -O ZED_SDK_Linux_JP.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/jp${JETPACK_MAJOR}${JETPACK_MINOR}/jetsons && \
    chmod +x ZED_SDK_Linux_JP.run ; ./ZED_SDK_Linux_JP.run silent skip_tools && \
    rm -rf /usr/local/zed/resources/* \
    rm -rf ZED_SDK_Linux_JP.run && \
    rm -rf /var/lib/apt/lists/*

# Install ZED Python API
RUN apt-get update -y && apt-get install --no-install-recommends python3 python3-pip python3-dev gfortran gcc musl-dev python3-setuptools build-essential -y && \ 
    wget download.stereolabs.com/zedsdk/pyzed -O /usr/local/zed/get_python_api.py && \
    python3 /usr/local/zed/get_python_api.py && \
    python3 -m pip install cython wheel && \
    python3 -m pip install numpy pyopengl *.whl && \
    apt-get remove --purge build-essential -y && apt-get autoremove -y && \
    rm *.whl ; rm -rf /var/lib/apt/lists/*

# Copy source
WORKDIR $OVERLAY_WS
COPY src src

# Build
RUN /bin/bash -c "source /opt/ros/${ROS_VERSION}/install/setup.bash && colcon build"

# Source entrypoint setup, used if running container interactively to
# automatically source the ROS workspace.
ENV OVERLAY_WS $OVERLAY_WS
RUN sed --in-place --expression \
    '$isource "$OVERLAY_WS/install/setup.bash"' \
    /ros_entrypoint.sh

Need to manually export OPENBLAS_CORETYPE=ARMV8 after launching the container interactively, and I'm using the below run command to launch it.

sudo docker run -it --rm --gpus all --privileged --network=host ${container_name}

@griz1112
Copy link

griz1112 commented Jul 9, 2021

if you go to the stereolabs section of hub.docker.com there are prebuilt images you can start with. https://hub.docker.com/r/stereolabs/zed/ Adding one of those to my dockerfile with the from keyword is how I built mine. The ones I built are for ros2 foxy. You should be able to add that export with some sed commands to your .bashrc file in the container.

@XDGFX
Copy link

XDGFX commented Jul 9, 2021

@griz1112 Which image did you start with? From what I understand they're all either without ROS or ROS1.

Still learning about all this but everything Jetson specific seems to be based off Ubuntu 18.04, looks like this might cause issues with e.g. the ROS2 Wrapper node.

@griz1112
Copy link

griz1112 commented Jul 9, 2021

You can actually install ros2 foxy native on 18.04 there are a few extra packages you need to compile for it to work that aren't included in the 18.04 distro. But then you can't have ros1 on the same machine because it removes part of it. So the container route is the best way to go. Especially if you need to use the ros2 bridge for some of your nodes. There is a Dockerfile in jetson-containers that will build ros2 foxy and ros1 noetic. I took the one for foxy and modified it to use the stereolabs image here https://github.com/stereolabs/zed-docker/blob/master/3.X/jetpack_4.X/tools-devel/ Dockerfile so I would have the ZED SDK. Built a base and desktop image from a native install script derived from the Dockerfile. I've tested it with a ZED ZED Mini and ZED 2i on an Xavier and Nano. Most of the packages on 20.04 are the same as 18.04. You can build a 20.04 container that will run on a 18.04 install. I've even installed 20.04 on one of my jetson boards. However I wouldn't recommend it as its possible to brick your jetson if you aren't very careful. And I'm sure there are some differences in the kernel that could cause you some grief. Dusty wouldn't put a Dockerfile out there for foxy on 18.04 if it wasn't ok to run it that way. I've been working with jetsons for almost 6 years now. Starting with a 4 node TK1 cluster.

@XDGFX
Copy link

XDGFX commented Aug 4, 2021

I managed to get a nice container running, based off one of the dustynv jetson containers. I posted my Dockerfile in #48 (comment)

@Myzhar
Copy link
Member

Myzhar commented Aug 5, 2021

@XDGFX a really useful job. Thank you 👍

@wasdee
Copy link

wasdee commented Sep 15, 2021

this is my dockerfile for ZED 2i and Jetson NX Xavier.
https://dev.to/circleoncircles/how-to-build-zed-2i-camera-x-ros2-foxy-x-nvidia-jetson-x-ubuntu-18-04-via-docker-8o4
it is a bit big(~3.4GB) but also work perfectly.

@AndreV84
Copy link

AndreV84 commented Apr 6, 2022

@Myzhar is there ros2 foxy zed docker conrainer by stereolabs by now?

@Myzhar
Copy link
Member

Myzhar commented Apr 6, 2022

Hi @AndreV84, we stopped generating the ROS/ROS2 containers because it was not easy to keep them synchronized with the latest updates by the many operators involved (Stereolabs, Nvidia, ROS/ROS2, ecc).

@AndreV84
Copy link

AndreV84 commented Apr 6, 2022

@Myzhar could you advise which value to put for zed camera in the global frame for ros2 foxy zed wrapper?

Usually, the "global_frame" is map, but it depends on your configuration and on what node you are using.

@Myzhar
Copy link
Member

Myzhar commented Apr 6, 2022

@AndreV84 this is a closed issue and this question is off-topic.
Can you please write to support@stereolabs.com or post the question with more details on our forum

@AndreV84
Copy link

@Myzhar is it likely that you could support building in Humble ROS container[provided by nvidia] on Jetson? outside of container for Humble? asked to email too but no response

@Myzhar Myzhar unpinned this issue Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants