Skip to content

ros2 docker not working #141

@karolinajudzentyte

Description

@karolinajudzentyte

The docker for ros2 is not working. Changed up docker file to # syntax=docker/dockerfile:1.4
FROM nvidia/cuda:12.6.3-cudnn-devel-ubuntu24.04

ARG ROS_DISTRO=jazzy
ARG USERNAME=ubuntu
ARG USER_UID=1000
ARG USER_GID=$USER_UID

ENV DEBIAN_FRONTEND=noninteractive
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
TZ=UTC
ROS_DISTRO=${ROS_DISTRO}

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked
apt update && apt install -y --no-install-recommends
locales tzdata
curl gnupg2 lsb-release
sudo git
build-essential cmake
python3-pip python3-venv
&& locale-gen en_US.UTF-8
&& update-locale LC_ALL=${LC_ALL} LANG=${LANG}
&& rm -rf /var/lib/apt/lists/*

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key
-o /usr/share/keyrings/ros-archive-keyring.gpg
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main"
> /etc/apt/sources.list.d/ros2.list
&& apt update && apt install -y --no-install-recommends
ros-${ROS_DISTRO}-ros-base
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp
ros-${ROS_DISTRO}-rviz2
ros-${ROS_DISTRO}-tf-transformations
ros-${ROS_DISTRO}-grid-map-msgs
ros-${ROS_DISTRO}-grid-map-rviz-plugin
ros-${ROS_DISTRO}-pcl-ros
ros-${ROS_DISTRO}-rosbag2-py
ros-${ROS_DISTRO}-rosbag2-storage-mcap
ros-${ROS_DISTRO}-ament-cmake
ros-${ROS_DISTRO}-ament-cmake-python
ros-${ROS_DISTRO}-ament-cmake-ros
ros-${ROS_DISTRO}-launch-testing
ros-${ROS_DISTRO}-launch-testing-ament-cmake
python3-colcon-common-extensions
python3-rosdep
python3-vcstool
python3-ruamel.yaml
&& rm -rf /var/lib/apt/lists/*

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv ${VIRTUAL_ENV}
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"

RUN python -m pip install --no-cache-dir -U pip setuptools wheel

RUN python -m pip install --no-cache-dir -U --extra-index-url https://download.pytorch.org/whl/cu121
torch torchvision torchaudio

RUN /opt/venv/bin/python -m pip install --no-cache-dir -U
lark-parser
setuptools

RUN /opt/venv/bin/python -m pip install --no-cache-dir -U
PyYAML pytest empy catkin_pkg

RUN /opt/venv/bin/python -m pip install --no-cache-dir -U
PyYAML pytest ruamel.yaml

RUN python -m pip install --no-cache-dir -U
"numpy>=2.0,<2.6"
"scipy>=1.13,<2.0"
"shapely>=2.0"
"transforms3d>=0.4.2"
"opencv-python-headless"
cupy-cuda12x
simple-parsing

RUN python - <<'PY'
import numpy, scipy, shapely, transforms3d
import cv2, cupy
print("numpy", numpy.version)
print("scipy", scipy.version)
print("shapely", shapely.version)
print("transforms3d", transforms3d.version)
print("cv2", cv2.version)
print("cupy", cupy.version)
PY

RUN if ! getent group ${USER_GID} >/dev/null; then groupadd --gid ${USER_GID} ${USERNAME}; fi
&& if ! id -u ${USERNAME} >/dev/null 2>&1; then useradd -m -s /bin/bash --uid ${USER_UID} --gid ${USER_GID} ${USERNAME}; fi
&& echo "${USERNAME} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${USERNAME}
&& chmod 0440 /etc/sudoers.d/${USERNAME}

RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/${USERNAME}/.bashrc
RUN echo "source /opt/venv/bin/activate" >> /home/${USERNAME}/.bashrc

RUN rosdep init || true

WORKDIR /home/${USERNAME}/workspace
USER ${USERNAME}

CMD ["bash"]

and removed the testing

docker run --rm --gpus all --net=host -e CUPY_ACCELERATORS="" -e CUPY_CACHE_DIR=/tmp/cupy_cache -v ~/elev_map_cupy:/ws -w /ws elevation_mapping_cupy:jazzy bash -lc '
set -e
source /opt/ros/jazzy/setup.bash
source /ws/install/setup.bash
ros2 launch elevation_mapping_cupy synthetic_depth_demo.launch.py launch_rviz:=false
'

and now getting error: incomplete type "float16" is not allowed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions