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

Enable Realsense on JON #29

Merged
merged 8 commits into from
Jan 24, 2025
Merged
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ log/
rosbags/
resources/
src/ros2_benchmark/
CMakeFiles
CMakeFiles
rosbags/
135 changes: 0 additions & 135 deletions docker/Dockerfile

This file was deleted.

22 changes: 22 additions & 0 deletions docker/Dockerfile.realsense_pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# Install Realsense libraries
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
git-all \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update \
&& apt-get install -y \
ros-${ROS_DISTRO}-librealsense2* \
ros-${ROS_DISTRO}-realsense2-* \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update \
&& apt-get install -y \
ros-${ROS_DISTRO}-rviz2 \
&& rm -rf /var/lib/apt/lists/*
19 changes: 19 additions & 0 deletions docker/Dockerfile.realsense_source
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ARG LIBREALSENSE_SOURCE_VERSION=v2.55.1

COPY scripts/install-realsense-dependencies.sh /opt/realsense/install-realsense-dependencies.sh
RUN chmod +x /opt/realsense/install-realsense-dependencies.sh && \
/opt/realsense/install-realsense-dependencies.sh;

COPY scripts/build-librealsense.sh /opt/realsense/build-librealsense.sh
RUN chmod +x /opt/realsense/build-librealsense.sh
RUN /opt/realsense/build-librealsense.sh -n -v ${LIBREALSENSE_SOURCE_VERSION};

# Copy hotplug script for udev rules/hotplug for RealSense
RUN mkdir -p /opt/realsense/
COPY scripts/hotplug-realsense.sh /opt/realsense/hotplug-realsense.sh
RUN chmod +x /opt/realsense/hotplug-realsense.sh
COPY udev_rules/99-realsense-libusb-custom.rules /etc/udev/rules.d/99-realsense-libusb-custom.rules
RUN sudo cp /root/librealsense/config/99-realsense-libusb.rules /etc/udev/rules.d/
55 changes: 55 additions & 0 deletions docker/Dockerfile.ros2_humble
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
ARG BASE_IMAGE=ros:humble-perception
FROM ${BASE_IMAGE}

ENV WS_DIR="/ros2_ws"
WORKDIR ${WS_DIR}

ARG DEBIAN_FRONTEND=noninteractive
ENV SHELL /bin/bash
SHELL ["/bin/bash", "-c"]

# Install ROS libraries
RUN apt-get update \
&& apt-get install -y \
ros-${ROS_DISTRO}-ros-base \
ros-${ROS_DISTRO}-angles \
ros-${ROS_DISTRO}-apriltag \
ros-${ROS_DISTRO}-behaviortree-cpp-v3 \
ros-${ROS_DISTRO}-bondcpp \
ros-${ROS_DISTRO}-camera-calibration-parsers \
ros-${ROS_DISTRO}-camera-info-manager \
ros-${ROS_DISTRO}-compressed-image-transport \
ros-${ROS_DISTRO}-compressed-depth-image-transport \
ros-${ROS_DISTRO}-cv-bridge \
ros-${ROS_DISTRO}-demo-nodes-cpp \
ros-${ROS_DISTRO}-demo-nodes-py \
ros-${ROS_DISTRO}-diagnostic-updater \
ros-${ROS_DISTRO}-example-interfaces \
ros-${ROS_DISTRO}-foxglove-bridge \
ros-${ROS_DISTRO}-image-geometry \
ros-${ROS_DISTRO}-image-pipeline \
ros-${ROS_DISTRO}-image-transport \
ros-${ROS_DISTRO}-image-transport-plugins \
ros-${ROS_DISTRO}-launch-xml \
ros-${ROS_DISTRO}-launch-yaml \
ros-${ROS_DISTRO}-launch-testing \
ros-${ROS_DISTRO}-launch-testing-ament-cmake \
ros-${ROS_DISTRO}-nav2-bringup \
ros-${ROS_DISTRO}-nav2-msgs \
ros-${ROS_DISTRO}-nav2-mppi-controller \
ros-${ROS_DISTRO}-navigation2 \
ros-${ROS_DISTRO}-ompl \
ros-${ROS_DISTRO}-resource-retriever \
ros-${ROS_DISTRO}-rqt-graph \
ros-${ROS_DISTRO}-rqt-reconfigure \
ros-${ROS_DISTRO}-rqt-image-view \
ros-${ROS_DISTRO}-rviz2 \
ros-${ROS_DISTRO}-rviz-common \
ros-${ROS_DISTRO}-rviz-default-plugins \
ros-${ROS_DISTRO}-sensor-msgs \
ros-${ROS_DISTRO}-slam-toolbox \
ros-${ROS_DISTRO}-v4l2-camera \
ros-${ROS_DISTRO}-vision-opencv \
ros-${ROS_DISTRO}-vision-msgs \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
14 changes: 14 additions & 0 deletions docker/Dockerfile.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# Install helpful tools
RUN apt-get update && apt-get install -y \
vim \
nano \
dos2unix \
ffmpeg \
python3-pip \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

RUN pip3 install zstandard
49 changes: 49 additions & 0 deletions docker/Dockerfile.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# Setup non-root admin user
ARG USERNAME=admin
ARG USER_UID=1000
ARG USER_GID=1000

# Install prerequisites
RUN apt-get update && apt-get install -y \
sudo \
udev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean

# Reuse triton-server user as 'admin' user if exists
RUN if [ $(getent group triton-server) ]; then \
groupmod -o --gid ${USER_GID} -n ${USERNAME} triton-server ; \
usermod -l ${USERNAME} -u ${USER_UID} -m -d /home/${USERNAME} triton-server ; \
mkdir -p /home/${USERNAME} ; \
sudo chown ${USERNAME}:${USERNAME} /home/${USERNAME} ; \
fi

# Create the 'admin' user if not already exists
RUN if [ ! $(getent passwd ${USERNAME}) ]; then \
groupadd --gid ${USER_GID} ${USERNAME} ; \
useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} ; \
fi

# Update 'admin' user
RUN echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
&& chmod 0440 /etc/sudoers.d/${USERNAME} \
&& adduser ${USERNAME} video && adduser ${USERNAME} plugdev && adduser ${USERNAME} sudo && adduser ${USERNAME} dialout

# Copy scripts
RUN mkdir -p /usr/local/bin/scripts
COPY scripts/*.sh /usr/local/bin/scripts/
RUN dos2unix /usr/local/bin/scripts/*.sh
RUN chmod +x /usr/local/bin/scripts/*.sh

ENV USERNAME=${USERNAME}
ENV USER_GID=${USER_GID}
ENV USER_UID=${USER_UID}

# Switch to non-root user and return to root
USER ${USERNAME}
RUN --mount=type=cache,target=/var/cache/apt \
rosdep update
USER root
Loading