stereolabs/zed-ros2-wrapper

Can't open two cameras using Composable Nodes

megaladon-0 opened this issue · 6 comments

Preliminary Checks

  • This issue is not a duplicate. Before opening a new issue, please search existing issues.
  • This issue is not a question, feature request, or anything other than a bug report directly related to this project.

Description

Hi all,

I have a setup with two Zed2i cameras that I want to launch through Composable nodes, but only one of the cameras launches and I end up with a camera stream error for the other one. Interestingly, when I launch both cameras through an XML file (so no Composable nodes) I have no issues. Is there some sort of bug when trying to launch two cameras using Composable Nodes?

Steps to Reproduce

To reproduce it I simply run the following launch file

import launch
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode


def generate_launch_description():
    """Generate launch description with multiple components."""
    container = ComposableNodeContainer(
            name='camera_container',
            namespace='',
            package='rclcpp_components',
            executable='component_container',
            composable_node_descriptions=[
                
                ComposableNode(
                    package='zed_components',
                    plugin='stereolabs::ZedCamera',
                    name='back_camera',
                    parameters=[
                        {'general.serial_number': YYYYYYY}
                        ],
                    extra_arguments=[{'use_intra_process_comms': True}]),
                
                ComposableNode(
                    package='zed_components',
                    plugin='stereolabs::ZedCamera',
                    name='front_camera',
                    parameters=[
                        {'general.serial_number': XXXXX}
                        ],
                    extra_arguments=[{'use_intra_process_comms': True}])
            ],
            output='both',
    )
    

    return launch.LaunchDescription([container])

Expected Result

Both cameras should launch.

Actual Result

I can see the parameters loading for both the front and back camera, but suddenly I get the following error.

[component_container-1] [WARN] [1684760299.309613145] [front_camera]: Error opening camera: CAMERA STREAM FAILED TO START
[component_container-1] [INFO] [1684760299.309678969] [front_camera]: Please verify the USB3 connection

The USB cable is plugged correctly and the dmesg commands shows no issues with the camera connection.

[15804.389565] usb 1-4.4.2: reset full-speed USB device number 29 using tegra-xusb
[15804.504697] hid-generic 0003:2B03:F881.0023: hiddev97,hidraw1: USB HID v1.11 Device [STEREOLABS ZED-2i HID INTERFACE] on usb-3610000.xhci-4.4.2/input0
[15804.593562] usb 1-4.2.2: reset full-speed USB device number 28 using tegra-xusb
[15804.704772] hid-generic 0003:2B03:F881.0024: hiddev96,hidraw0: USB HID v1.11 Device [STEREOLABS ZED-2i HID INTERFACE] on usb-3610000.xhci-4.2.2/input0

ZED Camera model

ZED2i

Environment

OS: Ubuntu 20.04
GPU: Nvidia Jetson AGX Orin
ZED SDK: 3.8.2
ROS2: Humble

Anything else?

No response

@megaladon-0
The launch file is correct, but it's not complete.
You must set correctly all the parameters, beginning from the camera model.
Then you must also start one or two robot_state_publisher nodes that publish the static TF.

Please also post the full result of the command lsusb -d 2b03: because STEREOLABS ZED-2i HID INTERFACE is only the sensor module, each camera must generate two USB devices: one HID and one UVC

Hi there,

This is how the Node looks like with the parameters.

ComposableNode(
                    package='zed_components',
                    plugin='stereolabs::ZedCamera',
                    name='back_camera',
                    parameters=[
                        {'general.serial_number': 37420560, 
                        'general.camera_name': "back_camera",
                        'general.camera_model': 'zed2i'}
                        ],
                    extra_arguments=[{'use_intra_process_comms': True}]
),

I ran the lsusb command and got this output

Bus 002 Device 004: ID 2b03:f880  
Bus 002 Device 003: ID 2b03:f880  
Bus 001 Device 009: ID 2b03:f881  
Bus 001 Device 008: ID 2b03:f881  

I also took a look at the transform tree but everything seems fine. Picture is attached

frames_2023-05-23_09.18.51.pdf

Are we missing anything?

The cameras are correctly detected by the USB3 controller, but I see a criticism: the cameras are on the same USB3 channel.
I advice using two different USB3 channel to not have bandwidth and power issues.
A workaround for this type of problems is to delay the opening of one of the cameras by using a TimerAction for one of the nodes, in this way you can be sure that they are not opened simultaneously

Hey,

We are using the Jetson AGX Orin and have connected each camera in opposite USB channels. Is there a better configuration?

Thanks for the TimerAction suggestion. We have updated the launch file as follows, but we still get the same connection error regardless of how much time we set to wait.

import launch
from launch_ros.actions import ComposableNodeContainer
from launch.actions import TimerAction
from launch_ros.actions import LoadComposableNodes
from launch_ros.descriptions import ComposableNode

def generate_launch_description():
    """Generate launch description with multiple components."""

    ld = launch.LaunchDescription()

    ld.add_action(
        ComposableNodeContainer(
            name="camera_container",
            namespace="",
            package="rclcpp_components",
            executable="component_container",
        )
    )

    ld.add_action(
        LoadComposableNodes(
            target_container="camera_container",
            composable_node_descriptions=[
                ComposableNode(
                    package="zed_components",
                    plugin="stereolabs::ZedCamera",
                    name="back_camera",
                    parameters=[
                        {
                            "general.serial_number": YYYYYY,
                            "general.camera_name": "back_camera",
                            "general.camera_model": "zed2i"
                        }
                    ],
                    extra_arguments=[{"use_intra_process_comms": True}],
                )
            ],
        )
    )

    ld.add_action(
        TimerAction(
            period=35.0,
            actions=[
                LoadComposableNodes(
                    target_container="camera_container",
                    composable_node_descriptions=[
                        ComposableNode(
                            package="zed_components",
                            plugin="stereolabs::ZedCamera",
                            name="front_camera",
                            parameters=[
                                {
                                    "general.serial_number": XXXXXX,
                                    "general.camera_name": "front_camera",
                                    "general.camera_model": "zed2i"
                                }
                            ],
                            extra_arguments=[{"use_intra_process_comms": True}],
                        )
                    ],
                )
            ],
        )
    )

    return ld

OK, this is weird. I must investigate this further.
It's better if we move to the Stereolabs support.
Please connect one camera at a time and run the ZED Diagnostic tool for each of them, then send the two report file that it generates to support@stereolabs.com.
In the email please cite this thread, so we can keep track of it.
Thank you

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment otherwise it will be automatically closed in 5 days