From a70251939042f610e86bd366c7c0fcdaed7ca4c1 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Thu, 3 Oct 2024 17:49:41 -0400 Subject: [PATCH 1/3] Add OAKD --- clearpath_sensors/config/luxonis_oakd.yaml | 25 +++++ .../launch/luxonis_oakd.launch.py | 105 ++++++++++++++++++ clearpath_sensors/package.xml | 1 + 3 files changed, 131 insertions(+) create mode 100644 clearpath_sensors/config/luxonis_oakd.yaml create mode 100644 clearpath_sensors/launch/luxonis_oakd.launch.py diff --git a/clearpath_sensors/config/luxonis_oakd.yaml b/clearpath_sensors/config/luxonis_oakd.yaml new file mode 100644 index 0000000..1ed9841 --- /dev/null +++ b/clearpath_sensors/config/luxonis_oakd.yaml @@ -0,0 +1,25 @@ +oakd: + ros__parameters: + camera: + i_enable_imu: false + i_enable_ir: false + i_floodlight_brightness: 0 + i_laser_dot_brightness: 100 + i_nn_type: none + i_pipeline_type: RGB + i_usb_speed: SUPER_PLUS + i_usb_port_id: '' + rgb: + i_board_socket_id: 0 + i_fps: 30.0 + i_height: 720 + i_interleaved: false + i_max_q_size: 10 + i_preview_size: 250 + i_enable_preview: true + i_low_bandwidth: true + i_keep_preview_aspect_ratio: true + i_publish_topic: false + i_resolution: '1080P' + i_width: 1280 + use_sim_time: false diff --git a/clearpath_sensors/launch/luxonis_oakd.launch.py b/clearpath_sensors/launch/luxonis_oakd.launch.py new file mode 100644 index 0000000..010710b --- /dev/null +++ b/clearpath_sensors/launch/luxonis_oakd.launch.py @@ -0,0 +1,105 @@ +# Software License Agreement (BSD) +# +# @author Luis Camero +# @copyright (c) 2024, Clearpath Robotics, Inc., All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Clearpath Robotics nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +from launch import LaunchDescription +from launch.actions import DeclareLaunchArgument +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution + +from launch_ros.actions import ComposableNodeContainer +from launch_ros.descriptions import ComposableNode +from launch_ros.substitutions import FindPackageShare + + +def generate_launch_description(): + parameters = LaunchConfiguration('parameters') + namespace = LaunchConfiguration('namespace') + robot_namespace = LaunchConfiguration('robot_namespace') + + arg_parameters = DeclareLaunchArgument( + 'parameters', + default_value=PathJoinSubstitution([ + FindPackageShare('clearpath_sensors'), + 'config', + 'intel_realsense.yaml' + ])) + + arg_namespace = DeclareLaunchArgument( + 'namespace', + default_value='') + + arg_robot_namespace = DeclareLaunchArgument( + 'robot_namespace', + default_value='') + + depthai_oakd_node = ComposableNode( + package='depthai_ros_driver', + name='oakd', + namespace=namespace, + plugin='depthai_ros_driver::Camera', + parameters=[parameters], + remappings=[ + ('~/imu/data', 'imu/data'), + ('~/nn/spatial_detections', 'nn/spatial_detections'), + ('~/rgb/camera_info', 'color/camera_info'), + ('~/rgb/image_raw', 'color/image'), + ('~/rgb/image_raw/compressed', 'color/compressed'), + ('~/rgb/image_raw/compressedDepth', 'color/compressedDepth'), + ('~/rgb/image_raw/ffmpeg', 'color/ffmpeg'), + ('~/rgb/image_raw/theora', 'color/theora'), + ('~/rgb/preview/image_raw', 'color/image'), + ('~/rgb/preview/image_raw/compressed', 'color/compressed'), + ('~/rgb/preview/image_raw/compressedDepth', 'color/compressedDepth'), + ('~/rgb/preview/image_raw/ffmpeg', 'color/ffmpeg'), + ('~/rgb/preview/image_raw/theora', 'color/theora'), + ('~/stereo/camera_info', 'stereo/camera_info'), + ('~/stereo/image_raw', 'stereo/image'), + ('~/stereo/image_raw/compressed', 'stereo/compressed'), + ('~/stereo/image_raw/compressedDepth', 'stereo/compressedDepth'), + ('~/stereo/image_raw/ffmpeg', 'stereo/ffmpeg'), + ('~/stereo/image_raw/theora', 'stereo/theora'), + ('/diagnostics', 'diagnostics'), + ], + extra_arguments=[{'use_intra_process_comms': True}], + ) + + image_processing_container = ComposableNodeContainer( + name='image_processing_container', + namespace=namespace, + package='rclcpp_components', + executable='component_container', + composable_node_descriptions=[ + depthai_oakd_node + ], + output='screen' + ) + + ld = LaunchDescription() + ld.add_action(arg_parameters) + ld.add_action(arg_namespace) + ld.add_action(arg_robot_namespace) + ld.add_action(image_processing_container) + return ld diff --git a/clearpath_sensors/package.xml b/clearpath_sensors/package.xml index ceae9ef..b285553 100644 --- a/clearpath_sensors/package.xml +++ b/clearpath_sensors/package.xml @@ -15,6 +15,7 @@ ament_cmake + depthai_ros_driver flir_camera_description flir_camera_msgs image_proc From a05b0a32aed4a45baa6e3729dc563e1d7422c10c Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Fri, 4 Oct 2024 11:10:52 -0400 Subject: [PATCH 2/3] Remove unused parameter --- clearpath_sensors/launch/luxonis_oakd.launch.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/clearpath_sensors/launch/luxonis_oakd.launch.py b/clearpath_sensors/launch/luxonis_oakd.launch.py index 010710b..281dcd2 100644 --- a/clearpath_sensors/launch/luxonis_oakd.launch.py +++ b/clearpath_sensors/launch/luxonis_oakd.launch.py @@ -37,7 +37,6 @@ def generate_launch_description(): parameters = LaunchConfiguration('parameters') namespace = LaunchConfiguration('namespace') - robot_namespace = LaunchConfiguration('robot_namespace') arg_parameters = DeclareLaunchArgument( 'parameters', @@ -51,10 +50,6 @@ def generate_launch_description(): 'namespace', default_value='') - arg_robot_namespace = DeclareLaunchArgument( - 'robot_namespace', - default_value='') - depthai_oakd_node = ComposableNode( package='depthai_ros_driver', name='oakd', @@ -100,6 +95,5 @@ def generate_launch_description(): ld = LaunchDescription() ld.add_action(arg_parameters) ld.add_action(arg_namespace) - ld.add_action(arg_robot_namespace) ld.add_action(image_processing_container) return ld From 7673e01157360d4faea8cb1637b55f6cd4562812 Mon Sep 17 00:00:00 2001 From: Luis Camero Date: Fri, 4 Oct 2024 11:33:57 -0400 Subject: [PATCH 3/3] Add UDEV for OAKD --- clearpath_sensors/debian/udev | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 clearpath_sensors/debian/udev diff --git a/clearpath_sensors/debian/udev b/clearpath_sensors/debian/udev new file mode 100644 index 0000000..7252b0e --- /dev/null +++ b/clearpath_sensors/debian/udev @@ -0,0 +1,2 @@ +# Movidius Rules for Luxonis OAK-D Cameras +SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"