5.2.1. 多相机

  • 要获取相机的 usb_port,插入相机并在终端中运行以下命令:

ros2 run orbbec_camera list_devices_node
  • device_num 参数设置为您拥有的相机数量。

  • 转到 OrbbecSDK_ROS2/launch/multi_xxx.launch.py 文件并更改 usb_port

  • 不要忘记将 include 标签放在 group 标签内。 否则,不同相机的参数值可能会被污染。

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, GroupAction, ExecuteProcess
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os


def generate_launch_description():
    # Include launch files
    package_dir = get_package_share_directory('orbbec_camera')
    launch_file_dir = os.path.join(package_dir, 'launch')
    launch1_include = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(launch_file_dir, 'gemini2L.launch.py')
        ),
        launch_arguments={
            'camera_name': 'camera_01',
            'usb_port': '6-2.4.4.2',  # replace your usb port here
            'device_num': '2'
        }.items()
    )

    launch2_include = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(launch_file_dir, 'gemini2L.launch.py')
        ),
        launch_arguments={
            'camera_name': 'camera_02',
            'usb_port': '6-2.4.1',  # replace your usb port here
            'device_num': '2'
        }.items()
    )

    # If you need more cameras, just add more launch_include here, and change the usb_port and device_num

    # Launch description
    ld = LaunchDescription([
        GroupAction([launch1_include]),
        GroupAction([launch2_include]),
    ])

    return ld
  • 要启动相机,运行以下命令:

ros2 launch orbbec_camera multi_camera.launch.py

5.2.1.1. 多相机无数据流

电源供应不足

  • 确保每个相机连接到单独的集线器。

  • 使用带电源的集线器为每个相机提供足够的电力。

高分辨率

  • 尝试降低分辨率以解决数据流问题。

增加 usbfs_memory_mb 值

  • usbfs_memory_mb 值增加到 128MB(这是一个参考值,可以根据系统需求进行调整) 通过运行以下命令:

    echo 128 | sudo tee /sys/module/usbcore/parameters/usbfs_memory_mb
  • 要使此更改永久生效,请查看此链接

5.2.1.2. 多相机图像话题帧率过低

请参考 Fast DDS 配置 文件。