紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
在自己的package里用launch文件调用realsense2_camera的rs_launch.py该如何实现?
-
我自己有一个功能包,然后在这个功能包里调用realsense2_camera的rs_launch.py,但是一直不成功,有大佬有经验吗?
这是我的launch代码,想在这里调用rs_launch.py启动realsense相机:
import os import launch_ros import launch from ament_index_python.packages import get_package_share_directory from launch.actions import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription from launch.substitutions import LaunchConfiguration, PathJoinSubstitution, PythonExpression from launch_ros.substitutions import FindPackageShare ''' 本launch脚本启动realsense2_ros节点 从realsense相机获取灰度图和深度图并保存 ''' def generate_launch_description(): realsense2_camera_dir = get_package_share_directory('realsense2_camera') # Declare the launch arguments declare_logger_level = DeclareLaunchArgument( name = 'logger_level', default_value = 'fatal', description = 'the logger level' ) logger_level_launch = LaunchConfiguration('logger_level') depth_module_profile = LaunchConfiguration('depth_module.profile', default='424x240x15') enable_color = LaunchConfiguration('enable_color', default='false') # realsense包的路径 # realsense2_launch_path = realsense2_camera_dir + '/launch/rs_launch.py' realsense2_launch_path = realsense2_camera_dir + '/launch/rs_callback_launch.py' print("the path of realsense2_launch is: %s" % realsense2_launch_path) try: # print("the path of realsense launch file is: %s" % realsense2_launch_path) return launch.LaunchDescription([ # declare_logger_level, # 启动realsense节点 realsense_camera launch_ros.actions.IncludeLaunchDescription( launch.launch_description_sources.PythonLaunchDescriptionSource([ # '<path_to_realsense_package>/launch/rs_launch.py' # realsense2_launch_path PathJoinSubstitution([ FindPackageShare('realsense2_camera'), 'launch', 'rs_launch.py' # 'rs_callback_launch.py' ]) ]), launch_arguments={ 'camera_name': 'camera_test' # 'depth_module.profile': depth_module_profile # ,'enable_color': enable_color }.items() ) # , ]) except: print("failed launch ") return launch.LaunchDescription([])
-
@374870361 我自己查到解决方案了,谢谢论坛的各位大佬
-