From 83fe2acd1101d7729d1e7b4d191b4986cee12cc0 Mon Sep 17 00:00:00 2001 From: ahuizxc Date: Wed, 3 Apr 2019 15:38:22 +0800 Subject: [PATCH] add depthimage to laser scan --- .../launch/realsense2_to_laserscan.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 realsense_ros2_camera/launch/realsense2_to_laserscan.py diff --git a/realsense_ros2_camera/launch/realsense2_to_laserscan.py b/realsense_ros2_camera/launch/realsense2_to_laserscan.py new file mode 100644 index 0000000..aa02177 --- /dev/null +++ b/realsense_ros2_camera/launch/realsense2_to_laserscan.py @@ -0,0 +1,48 @@ +# Copyright (c) 2018 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Launch face detection and rviz.""" + +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +import launch_ros.actions +import launch.actions + + +def generate_launch_description(): + enable_align_depth = launch.substitutions.LaunchConfiguration('enable_aligned_depth', default="false") + output_frame = launch.substitutions.LaunchConfiguration('output_frame', default="base_scan") + range_max = launch.substitutions.LaunchConfiguration('range_max', default="2.0") + range_min = launch.substitutions.LaunchConfiguration('range_min', default="0.2") + return LaunchDescription([ + # Realsense + launch_ros.actions.Node( + package='realsense_ros2_camera', + node_executable='realsense_ros2_camera', + node_name='realsense_ros2_camera', + parameters=[{'enable_aligned_depth':enable_align_depth}], + output='screen'), + launch_ros.actions.Node( + package='depthimage_to_laserscan', + node_executable='depthimage_to_laserscan_node', + node_name='depthimage_to_laserscan_node', + output='screen', + parameters=[{'output_frame': output_frame}, + {'range_min': range_min}, + {'range_max': range_max}], + arguments=["depth:=/camera/depth/image_rect_raw", + "depth_camera_info:=/camera/depth/camera_info", + "scan:=/scan"]), + ]) \ No newline at end of file