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

Arkadiy/proximity warning #1

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e2dc628
Add proximity-warning package
arkadiy-telegin Dec 22, 2023
54755fb
Update .gitmodules
arkadiy-telegin Dec 22, 2023
a018c19
Update submodule
arkadiy-telegin Dec 22, 2023
2355503
Update launch file
arkadiy-telegin Dec 22, 2023
0423f51
Update dockerfile
arkadiy-telegin Dec 22, 2023
fcd2896
Update proximity_monitor
arkadiy-telegin Dec 22, 2023
9cd8a98
Fix bugs
arkadiy-telegin Dec 23, 2023
0a55596
Update proximity_monitor to the latest version
arkadiy-telegin Dec 23, 2023
ba7a99b
Publish at 40Hz
arkadiy-telegin Jan 4, 2024
a6fec5f
Set initial warning to 0
arkadiy-telegin Jan 4, 2024
cceb267
Version 1
arkadiy-telegin Jan 19, 2024
33badbf
Log throttling
missxa Mar 7, 2024
6c59182
Remove unused code +
arkadiy-telegin Mar 28, 2024
eae0a94
Add cyclone DDS to dockerfile
arkadiy-telegin Mar 28, 2024
89f32c9
Merge branch 'arkadiy/proximity_warning' of github.com:arkadiy-telegi…
arkadiy-telegin Mar 28, 2024
0a4c3a5
Cleanup
arkadiy-telegin Mar 28, 2024
854f807
Rename threshold parameter
arkadiy-telegin Mar 28, 2024
7f42fb6
Add .devcontainer config
arkadiy-telegin Mar 28, 2024
c0613c8
Fix .devcontainer build target
arkadiy-telegin Mar 28, 2024
7d92739
Add QoL ROS vscode scripts
arkadiy-telegin Mar 28, 2024
6993c06
.devcontainer dockerfile
arkadiy-telegin Mar 28, 2024
23508b0
Rename docker -> src
arkadiy-telegin Mar 28, 2024
9abbdac
Fix submodule
arkadiy-telegin Mar 28, 2024
621a3a8
Fix realsense submodule
arkadiy-telegin Mar 28, 2024
6f695ed
Update ReadMe.md to include devcontainers
arkadiy-telegin Apr 8, 2024
4cff717
Update ReadMe.md - include proximity_monitor usage
arkadiy-telegin Apr 8, 2024
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
121 changes: 121 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
ARG BASE_IMAGE=ros:humble-perception

# The following steps are based on the offical multi-stage build: https://github.com/IntelRealSense/librealsense/blob/master/scripts/Docker/Dockerfile
#################################
# Librealsense Builder Stage #
#################################
FROM $BASE_IMAGE as librealsense-builder

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -qq -y --no-install-recommends \
build-essential \
cmake \
git \
libssl-dev \
libusb-1.0-0-dev \
pkg-config \
libgtk-3-dev \
libglfw3-dev \
libgl1-mesa-dev \
libglu1-mesa-dev \
curl \
python3 \
python3-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src
# Get the latest tag of remote repository: https://stackoverflow.com/a/12704727
# Needs to be a single command as ENV can't be set from Bash command: https://stackoverflow.com/questions/34911622/dockerfile-set-env-to-result-of-command
RUN export LIBRS_VERSION=2.53.1; \
curl https://codeload.github.com/IntelRealSense/librealsense/tar.gz/refs/tags/v${LIBRS_VERSION} -o librealsense.tar.gz; \
tar -zxf librealsense.tar.gz; \
rm librealsense.tar.gz; \
ln -s /usr/src/librealsense-${LIBRS_VERSION} /usr/src/librealsense

RUN cd /usr/src/librealsense \
&& mkdir build && cd build \
&& cmake \
-DCMAKE_C_FLAGS_RELEASE="${CMAKE_C_FLAGS_RELEASE} -s" \
-DCMAKE_CXX_FLAGS_RELEASE="${CMAKE_CXX_FLAGS_RELEASE} -s" \
-DCMAKE_INSTALL_PREFIX=/opt/librealsense \
-DBUILD_GRAPHICAL_EXAMPLES=OFF \
-DBUILD_PYTHON_BINDINGS:bool=true \
-DCMAKE_BUILD_TYPE=Release ../ \
&& make -j$(($(nproc)-1)) all \
&& make install

ENV DEBIAN_FRONTEND=dialog

######################################
# librealsense Base Image Stage #
######################################
FROM ${BASE_IMAGE} as librealsense

SHELL ["/bin/bash", "-c"]

COPY --from=librealsense-builder /opt/librealsense /usr/local/
COPY --from=librealsense-builder /usr/lib/python3/dist-packages/pyrealsense2 /usr/lib/python3/dist-packages/pyrealsense2
COPY --from=librealsense-builder /usr/src/librealsense/config/99-realsense-libusb.rules /etc/udev/rules.d/
ENV PYTHONPATH=${PYTHONPATH}:/usr/local/lib

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libusb-1.0-0 \
udev \
apt-transport-https \
ca-certificates \
curl \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*
# The following steps are based on: https://github.com/IntelRealSense/realsense-ros/tree/ros2-development
# ENV WS_DIR="/ros2_ws"
# WORKDIR ${WS_DIR}
RUN apt-get update -y \
&& apt-get install -y \
ros-${ROS_DISTRO}-rviz2
# && mkdir src

RUN sudo apt-get install ros-humble-rmw-cyclonedds-cpp -y
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
RUN sudo apt-get install ros-humble-image-transport-plugins -y

# COPY docker/realsense-ros ./src
# COPY docker/multi_camera_launch.py /ros2_ws/src/realsense2_camera/launch
# COPY docker/depth_handler /ros2_ws/src/depth_handler
# COPY docker/proximity_monitor /ros2_ws/src/proximity_monitor
RUN apt-get install -y python3-rosdep \
&& apt-get update \
&& source /opt/ros/${ROS_DISTRO}/setup.bash \
&& rm /etc/ros/rosdep/sources.list.d/20-default.list \
&& rosdep init \
&& rosdep update \
&& rosdep install -i --from-path src --rosdistro ${ROS_DISTRO} --skip-keys=librealsense2 -y \
&& colcon build
RUN sudo apt-get install python3-opencv
# RUN echo "source /ros2_ws/install/setup.bash" >> ~/.bashrc
# COPY docker/launch.sh .

ARG USERNAME=ros
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create a non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# Add sudo support for the non-root user
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& rm -rf /var/lib/apt/lists/*

# RUN chmod +x /ros2_ws/launch.sh
ENV DEBIAN_FRONTEND=dialog
# ENTRYPOINT ["/ros2_ws/launch.sh"]
60 changes: 51 additions & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,53 @@
// See https://aka.ms/vscode-remote/devcontainer.json for format details.
{
"name": "Docker for Intel Realsense with ROS 2",
"dockerComposeFile": [
"../docker/docker-compose-gui.yml" // Alternatives: "../docker/docker-compose-gui.yml", "../docker/docker-compose-gui-nvidia.yml"
],
"service": "realsense_ros2",
"workspaceFolder": "/ros2_ws",
"shutdownAction": "stopCompose",
"extensions": [
]
"dockerFile": "Dockerfile",
"context": "..",
"build": {
"args": {
"WORKSPACE": "${containerWorkspaceFolder}"
}
},
"remoteUser": "ros",
"runArgs": [
"--network=host",
"--cap-add=SYS_PTRACE",
"--security-opt=seccomp:unconfined",
"--security-opt=apparmor:unconfined",
"--volume=/tmp/.X11-unix:/tmp/.X11-unix",
"--volume=/mnt/wslg:/mnt/wslg",
"--ipc=host",
"--volume=/dev:/dev",
"--device-cgroup-rule=c 81:* rmw",
"--device-cgroup-rule=c 189:* rmw"
// uncomment to use intel iGPU
// "--device=/dev/dri"
],
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}", // Needed for GUI try ":0" for windows
"WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}",
"XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}",
"PULSE_SERVER": "${localEnv:PULSE_SERVER}",
"LIBGL_ALWAYS_SOFTWARE": "1", // Needed for software rendering of opengl
"RMW_IMPLEMENTATION": "rmw_cyclonedds_cpp"
},
// Set *default* container specific settings.json values on container create.
"customizations": {
"vscode": {
"extensions": [
"althack.ament-task-provider",
"betwo.b2-catkin-tools",
"DotJoshJohnson.xml",
"ms-azuretools.vscode-docker",
"ms-iot.vscode-ros",
"ms-python.python",
"ms-vscode.cpptools",
"redhat.vscode-yaml",
"smilerobotics.urdf",
"streetsidesoftware.code-spell-checker",
"twxs.cmake",
"yzhang.markdown-all-in-one",
"zachflower.uncrustify"
]
}
}
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*/__pycache__
build/*
install/*
log/*
site/*
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "docker/realsense-ros"]
path = docker/realsense-ros
[submodule "src/realsense-ros"]
path = src/realsense-ros
url = https://github.com/juandelos/realsense-ros.git
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/ros/humble/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"cStandard": "c99",
"cppStandard": "c++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
90 changes: 90 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// Example launch of a python file
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
},
// Example gdb launch of a ros executable
{
"name": "(gdb) Launch (merge-install)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/install/lib/${input:package}/${input:program}",
"args": [],
"preLaunchTask": "build",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) Launch (isolated-install)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/install/${input:package}/lib/${input:package}/${input:program}",
"args": [],
"preLaunchTask": "build",
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
//Example of a ROS Launch file
{
"name": "ROS: Launch File (merge-install)",
"type": "ros",
"request": "launch",
"preLaunchTask": "build",
"target": "${workspaceFolder}/install/share/${input:package}/launch/${input:ros_launch}",
},
{
"name": "ROS: Launch File (isolated-install)",
"type": "ros",
"request": "launch",
"preLaunchTask": "build",
"target": "${workspaceFolder}/install/${input:package}/share/${input:package}/launch/${input:ros_launch}",
},
],
"inputs": [
{
"id": "package",
"type": "promptString",
"description": "Package name",
"default": "examples_rclcpp_minimal_publisher"
},
{
"id": "program",
"type": "promptString",
"description": "Program name",
"default": "publisher_member_function"
},
{
"id": "ros_launch",
"type": "promptString",
"description": "ROS launch name",
"default": "file_name_launch.py"
}
]
}
74 changes: 74 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"editor.tabSize": 8,
"editor.rulers": [
100
],
"files.associations": {
"*.repos": "yaml",
"*.world": "xml",
"*.xacro": "xml"
},
"python.analysis.extraPaths": [
"/opt/ros/humble/lib/python3.10/site-packages/"
],
// Autocomplete from ros python packages
"python.autoComplete.extraPaths": [
"/opt/ros/humble/lib/python3.10/site-packages/"
],
// Environment file lets vscode find python files within workspace
"python.envFile": "${workspaceFolder}/.env",
// Use the system installed version of autopep8
"python.formatting.autopep8Path": "/usr/bin/autopep8",
"python.formatting.autopep8Args": [
"--max-line-length=100"
],
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
"C_Cpp.formatting": "disabled",
"uncrustify.configPath.linux": "/opt/ros/humble/lib/python3.10/site-packages/ament_uncrustify/configuration/ament_code_style.cfg",
"[cpp]": {
"editor.defaultFormatter": "zachflower.uncrustify"
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/build": true,
"**/install": true,
"**/log": true
},
"cSpell.words": [
"RTPS",
"athackst",
"autopep",
"cmake",
"cppcheck",
"cpplint",
"DCMAKE",
"deque",
"devcontainer",
"ints",
"noqa",
"pytest",
"rclcpp",
"rclpy",
"repos",
"rosdep",
"rosdistro",
"rosidl",
"RTPS",
"uncrustify",
"Wextra",
"Wpedantic",
"xmllint"
],
"cSpell.allowCompoundWords": true,
"cSpell.ignorePaths": [
"**/package-lock.json",
"**/node_modules/**",
"**/vscode-extension/**",
"**/.git/objects/**",
".vscode",
".vscode-insiders",
".devcontainer/devcontainer.json"
]
}
Loading