add launch scripts for Orbbec cameras and algorithms, and integrate the use of component containers

This commit is contained in:
datean
2024-11-27 20:58:27 +08:00
parent 90dfddeaa0
commit b2b3be6075
6 changed files with 132 additions and 33 deletions
+12
View File
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.8)
project(isaac_orbbec_launch)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
# install the launch files
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
ament_package()
@@ -0,0 +1,70 @@
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription
from launch.conditions import IfCondition, UnlessCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
from launch.actions import TimerAction
from launch.actions import GroupAction
def generate_launch_description():
orbbec_camera_bringup_dir = get_package_share_directory('orbbec_camera')
perceptor_bringup_dir = get_package_share_directory('isaac_ros_perceptor_bringup')
perceptor_config_file = DeclareLaunchArgument(
'perceptor_config_file', default_value='params/orbbec_perceptor_detached.yaml',
description="Perceptor configuration")
from_bag_arg = DeclareLaunchArgument(
'from_bag', default_value='False',
description='Whether to run from a bag or live realsense data')
bag_path_arg = DeclareLaunchArgument(
'bag_path', default_value='rosbag2*',
description='Path of the bag (only used if from_bag == True)')
component_container_name_arg = "shared_orbbec_container"
shared_orbbec_container = Node(
name=component_container_name_arg,
package='rclcpp_components',
executable='component_container_mt',
output='screen')
orbbec_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
orbbec_camera_bringup_dir, 'launch', 'multi_camera_synced.launch.py')]),
launch_arguments={
'attach_to_shared_component_container': 'True',
'component_container_name': component_container_name_arg}.items(),
condition=UnlessCondition(LaunchConfiguration('from_bag')))
perceptor_launch = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
perceptor_bringup_dir, 'launch', 'rgbd_perceptor.launch.py')]),
launch_arguments={'config_file': LaunchConfiguration("perceptor_config_file"),
'attach_to_shared_component_container': 'True',
'component_container_name': component_container_name_arg}.items())
delayed_perceptor_launch = TimerAction(
period=0.5,
actions=[
GroupAction(actions=[perceptor_launch])
]
)
bag_play = ExecuteProcess(
cmd=['ros2', 'bag', 'play', LaunchConfiguration('bag_path')],
shell=True,
output='screen',
condition=IfCondition(LaunchConfiguration('from_bag')))
return LaunchDescription([
perceptor_config_file,
from_bag_arg,
bag_path_arg,
shared_orbbec_container,
perceptor_launch,
orbbec_launch,
bag_play,
]
)
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>isaac_orbbec_launch</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="[email protected]">toosimple</maintainer>
<license>Apache License 2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>