zed-ros-wrapper: [BUG] Object Detection won't start when using multiple cameras

Describe the bug I’m trying to use object detection on two zed cameras connected to a Xavier NX board.

Ideally, I want for the object detection on both cameras to be disabled and then I can turn OD on one camera on when I want to, using the services available.

I have tried launching the nodes with object detection enabled from the start for both of them (by setting the yaml file to true) and also have tried starting the object detection using rosservices, yet object detection will not start.

It works fine when launching only one camera but with two there is no response, even if I try to enable object detection on a single camera using rosservice.

I do get an “[WARN] Elaboration takes longer…” message at times, probably cause the Xavier is struggling to process so much stuff. Could this prevent the OD from starting?

Device information:

  • OS: Ubuntu
  • OS version: 18.04
  • CPU: Xavier NX
  • GPU Nvidia: Xavier NX
  • ZED SDK Version: latest
  • ROS Wrapper version: latest

To Reproduce Launch two cameras using zed multicam.

Expected behavior *** Starting Object Detection should appear in the terminal.

Additional context My launch files look like this:

<?xml version="1.0"?>

<launch>

    <!-- CAMERA 1 -->
    <arg name="node_name_1"          default="zed_node_A" />
    <arg name="camera_model_1"       default="zed2" />    
    <arg name="camera_name_1"        default="zedA" />
    <arg name="serial_number_1"      default="20971998"  />

    <!-- CAMERA 2 -->
    <arg name="node_name_2"          default="zed_node_B" />
    <arg name="camera_model_2"       default="zed2" />
    <arg name="camera_name_2"        default="zedB" />
    <arg name="serial_number_2"      default="29867557"  />

    <group ns="$(arg camera_name_1)">
        <include file="$(find navvy_accs)/launch/zed_camera.launch"> <!-- Will need to update this -->
            <arg name="camera_name"         value="$(arg camera_name_1)" />
            <arg name="node_name"           value="$(arg node_name_1)" />
            <arg name="camera_model"        value="$(arg camera_model_1)" />
            <arg name="serial_number"        value="$(arg serial_number_1)" />
            <arg name="publish_tf"          value="false" /> <!-- Robot Localization will publish TF -->
            <arg name="camera_id"           value="0" />
        </include>
    </group>

    <group ns="$(arg camera_name_2)">
        <include file="$(find navvy_accs)/launch/zed_camera.launch"> <!-- Will need to update this -->
            <arg name="camera_name"         value="$(arg camera_name_2)" />
            <arg name="node_name"           value="$(arg node_name_2)" />
            <arg name="camera_model"        value="$(arg camera_model_2)" />
            <arg name="serial_number"        value="$(arg serial_number_2)" />
            <arg name="publish_tf"          value="false" /> <!-- Robot Localization will publish TF -->
            <arg name="camera_id"           value="1" />
        </include>
    </group>

</launch>
<launch>
    <!-- Camera Model and Name -->
    <arg name="camera_name" /> <!-- The name you want -->
    <arg name="camera_model" /> <!-- 'zed' or 'zedm' or 'zed2' -->
    <arg name="node_name" />
    <arg name="serial_number" />

    <!-- Load SVO file -->
    <arg name="svo_file"              default="" /><!-- <arg name="svo_file" default="path/to/svo/file.svo"> -->
   
    <!-- Remote stream -->
    <arg name="stream"                default="" /> <!-- <arg name="stream" default="<ip_address>:<port>"> -->

    <arg name="camera_id"             default="0" />
    <arg name="gpu_id"                default="-1" />

    <arg name="publish_tf"          />

    <!-- Launch node -->
    <node name="$(arg node_name)" pkg="zed_wrapper" type="zed_wrapper_node" output="screen" required="true"><!-- launch-prefix="valgrind" -->
   
    <!-- General camera parameters for node -->
        <rosparam file="$(find navvy_accs)/params/common.yaml" command="load" />
        <!-- ZED2 Thresholds and OD parameters -->
        <rosparam file="$(find navvy_accs)/params/$(arg camera_model).yaml" command="load" />

        <!-- Camera name -->
        <param name="general/camera_name"               value="$(arg camera_name)" />
       
        <!-- Serial Number -->
        <param name="general/serial_number"               value="$(arg serial_number)" />

        <!-- SVO file path - Are these used anywhere? -->
        <param name="general/svo_file"                  value="$(arg svo_file)" />

        <!-- Remote stream - Are these used anywhere?  -->
        <param name="general/stream"                    value="$(arg stream)" />

        <!-- Camera ID - A is passed thru as 0 and B as 1 -->
        <param name="general/zed_id"                    value="$(arg camera_id)" />

        <!-- GPU ID -->
        <param name="general/gpu_id"                    value="$(arg gpu_id)" />

        <!-- TF -->
        <param name="pos_tracking/publish_tf"             value="$(arg publish_tf)" />
        <param name="pos_tracking/publish_map_tf"             value="$(arg publish_tf)" />
    </node>
   
</launch>

and my yaml:

# params/zed2_yaml
# Parameters for Stereolabs ZED2 camera
---

general:
    camera_model:               'zed2'

depth:
    min_depth:                  0.2             # Min: 0.2, Max: 3.0 - Default 0.7 - Note: reducing this value wil require more computational power and GPU memory
    max_depth:                  20.0            # Max: 40.0

pos_tracking:
    imu_fusion:                 true            # enable/disable IMU fusion. When set to false, only the optical odometry will be used.

sensors:
    sensors_timestamp_sync:     false           # Synchronize Sensors messages timestamp with latest received frame

object_detection:
    od_enabled:                 true           # True to enable Object Detection [only ZED 2]
    confidence_threshold:       30              # Minimum value of the detection confidence of an object [0,100]
    object_tracking_enabled:    true            # Enable/disable the tracking of the detected objects
    people_detection:           true            # Enable/disable the detection of persons
    vehicle_detection:          false           # Enable/disable the detection of vehicles

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

Ok, it seems my problem was being caused by something to do with URDF and I guess those conditions you mentioned @Myzhar.

I had removed all the urdf stuff from my custom zed launch files, as this is contained in my robot description package.

I was trying to run the zed cameras without loading this robot description and the robot state publisher so object detection wasn’t working. I have now tried launching both cameras at the same time with my custom multicam launch file whilst the robot state publisher was already running and it finally works!!! 🎉🎉

The stock launch files already provide the camera position and urdf and load the robot state publisher etc so that’s why it was working.

Yes, if you disable TF publishing you need that some other node publishes at least the odom TF, otherwise the positional tracking cannot properly work.