[ZED2] 2x object detection on 2x different .svo files at the same time

Hi,

I want to read 2x .svo files and perform 2x object detection at the same time on the images in these files. The data of both object detections I want to display simultaniously in ROS RViz. I think my GPU should handle this.

By now, I was following a tutorial and using roslaunch zed_display_rviz display_zed.launch to perform OD and visualisation of the data in RViz. This works very well with just 1x .svo file and 1x OD.

My idea is to write a second ROS node and to rewrite the .launch files etc. but I am not sure if there is another solution for this problem.

Any tipps would be much appreciated!

Hi @js3454fdgg
you can rewrite the display_zedxxx.launch file (zedxxx is your camera model), in order to duplicate the node launch part and open the two different SVOs.

Hi, thanks a lot for your hints. I tried to rewrite the .launch file the following way:

<?xml version="1.0"?>

<launch>

    <!-- first node -->
    <arg name="node_name_1" default="zed_node_A" />
    <arg name="camera_model_1" default="zed2" />
    <arg name="svo_file_1" default="1.svo" />
    <arg name="stream_1" default="" />
    
    <!-- second node -->
    <arg name="node_name_2" default="zed_node_B" />
    <arg name="camera_model_2" default="zed2" />
    <arg name="svo_file_2" default="2.svo" />
    <arg name="stream_2" default="" />
    
    <!-- first node -->
    <group ns="$(arg svo_file_1)">
        <include file="$(find zed_wrapper)/launch/$(arg camera_model_1).launch">
            <arg name="node_name"           value="$(arg node_name_1)" />
            <arg name="camera_model"        value="$(arg camera_model_1)" />
            <arg name="svo_file"            value="$(arg svo_file_1)" />
            <arg name="stream"              value="$(arg stream_1)" />
        </include>
    </group>
    
    <!-- second node -->
    <group ns="$(arg svo_file_2)">
        <include file="$(find zed_wrapper)/launch/$(arg camera_model_2).launch">
            <arg name="node_name"           value="$(arg node_name_2)" />
            <arg name="camera_model"        value="$(arg camera_model_2)" />
            <arg name="svo_file"            value="$(arg svo_file_2)" />
            <arg name="stream"              value="$(arg stream_2)" />
        </include>
    </group>
    
    <!-- Launch rivz display -->
    <node name="rviz1" pkg="rviz" type="rviz" args="-d $(find zed_display_rviz)/rviz/$(arg camera_model_1).rviz" output="screen" />
    
    <node name="rviz2" pkg="rviz" type="rviz" args="-d $(find zed_display_rviz)/rviz/$(arg camera_model_2).rviz" output="screen" />

</launch>

but I got the following error message:

NODES
  /
    rviz1 (rviz/rviz)
    rviz2 (rviz/rviz)
  /1.svo/zed2/
    zed2_state_publisher (robot_state_publisher/robot_state_publisher)
    zed_node_A (zed_wrapper/zed_wrapper_node)
  /2.svo/zed2/
    zed2_state_publisher (robot_state_publisher/robot_state_publisher)
    zed_node_B (zed_wrapper/zed_wrapper_node)

auto-starting new master
process[master]: started with pid [18686]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to e054b1a6-2eaf-11ed-aba4-07f50137e9fb
process[rosout-1]: started with pid [18707]
started core service [/rosout]
process[1.svo/zed2/zed2_state_publisher-2]: started with pid [18714]
process[1.svo/zed2/zed_node_A-3]: started with pid [18715]
terminate called after throwing an instance of 'ros::InvalidNameException'
  what():  Namespace [/1.svo/zed2] is invalid: Character [.] at element [2] is not valid in Graph Resource Name [/1.svo/zed2].  Valid characters are a-z, A-Z, 0-9, / and _.
process[2.svo/zed2/zed2_state_publisher-4]: started with pid [18716]
terminate called after throwing an instance of 'ros::InvalidNameException'
  what():  Namespace [/1.svo/zed2] is invalid: Character [.] at element [2] is not valid in Graph Resource Name [/1.svo/zed2].  Valid characters are a-z, A-Z, 0-9, / and _.
process[2.svo/zed2/zed_node_B-5]: started with pid [18719]
terminate called after throwing an instance of 'ros::InvalidNameException'
  what():  Namespace [/2.svo/zed2] is invalid: Character [.] at element [2] is not valid in Graph Resource Name [/2.svo/zed2].  Valid characters are a-z, A-Z, 0-9, / and _.
process[rviz1-6]: started with pid [18721]
terminate called after throwing an instance of 'ros::InvalidNameException'
  what():  Namespace [/2.svo/zed2] is invalid: Character [.] at element [2] is not valid in Graph Resource Name [/2.svo/zed2].  Valid characters are a-z, A-Z, 0-9, / and _.
process[rviz2-7]: started with pid [18723]
[ INFO] [1662556845.028235130]: rviz version 1.14.14
[ INFO] [1662556845.028283237]: compiled against Qt version 5.12.8
[ INFO] [1662556845.028297990]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1662556845.030881559]: rviz version 1.14.14
[ INFO] [1662556845.030923671]: compiled against Qt version 5.12.8
[ INFO] [1662556845.030935236]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1662556845.035433703]: Forcing OpenGl version 0.
[ INFO] [1662556845.037841034]: Forcing OpenGl version 0.
[ INFO] [1662556845.890390796]: Stereo is NOT SUPPORTED
[ INFO] [1662556845.890466634]: OpenGL device: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
[ INFO] [1662556845.890505672]: OpenGl version: 4,6 (GLSL 4,6).
[ INFO] [1662556845.890714420]: Stereo is NOT SUPPORTED
[ INFO] [1662556845.890758550]: OpenGL device: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2
[ INFO] [1662556845.890782926]: OpenGl version: 4,6 (GLSL 4,6).
================================================================================REQUIRED process [1.svo/zed2/zed2_state_publisher-2] has died!
process has died [pid 18714, exit code -6, cmd /opt/ros/noetic/lib/robot_state_publisher/robot_state_publisher robot_description:=zed2_description __name:=zed2_state_publisher __log:=/home/work/.ros/log/e054b1a6-2eaf-11ed-aba4-07f50137e9fb/1.svo-zed2-zed2_state_publisher-2.log].
log file: /home/work/.ros/log/e054b1a6-2eaf-11ed-aba4-07f50137e9fb/1.svo-zed2-zed2_state_publisher-2*.log
Initiating shutdown!
================================================================================
[rviz2-7] killing on exit
[rviz1-6] killing on exit
[2.svo/zed2/zed_node_B-5] killing on exit
[2.svo/zed2/zed2_state_publisher-4] killing on exit
[1.svo/zed2/zed_node_A-3] killing on exit
[1.svo/zed2/zed2_state_publisher-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

Instead of default="1.svo" I also tried the absolute path but the error remains.

You are using the same name for both the robot_state_publisher nodes.
They must have a different name, otherwise the first will be closed when the second is created.

The second problem is that you cannot use the filename as namespace:
<group ns="$(arg svo_file_1)">
names with a . are not accepted

thank you very much! Now, I have two nodes (zedA and zedB) where I am able to visualize all the data of both .svo files topics in Rviz, except object detection. The topic for the OD is only available for node zedA (zedA/zedA/zed_node_A/obj_det/objects) but not zedB.

EDIT: I tried to set od_enabled: false in the zed2.yaml file and started rosservice call zedx/zedx/zed_node_x/start_object_detection .. .. for both zedA and zedB and via that I am able to run the OD topics for both nodes.

Apart from this, I have the following error in Rviz: RobotModel → Status: Error → URDF , Parameter [/zed2/zed2_description] does not exist, and was not found by searchParam()

You must change the zed2 prefix of the parameter with the name of the cameras that you used in the launch file.
You can get the correct strings by running the following command while the nodes are running:
$ rosparam list | grep _description