usrl-uofsc / stag_ros

A ROS package for the Stable Fiducial Marker System
45 stars 16 forks source link

Launching multiple cameras #7

Closed ri-ceres closed 3 years ago

ri-ceres commented 3 years ago

It appears that launching the nodelet in a namespace or with a different name breaks parameter loading of values such as raw_image_topic and camera_info_topic, which are needed for setting topics of multiple cameras.

Namespace example:

    <!--Start Nodelet-->
    <group ns="camera1" >
        <node name="stag_ros_nodelet" pkg="stag_ros" type="stag_nodelet_runnable" output="screen" required="true" >
            <!-- Place the correct yaml file here-->
            <rosparam command="load" file="$(find stag_ros)/cfg/single.yaml"/>
            <!-- Place the correct bundle file here-->
            <rosparam command="load" file="$(find stag_ros)/cfg/single_config.yaml"/>
        </node>
    </group>

Nodename example:

    <!--Start Nodelet-->
    <node name="stag_ros_nodelet_camera1" pkg="stag_ros" type="stag_nodelet_runnable" output="screen" required="true" >
        <!-- Place the correct yaml file here-->
        <rosparam command="load" file="$(find stag_ros)/cfg/single.yaml"/>
        <!-- Place the correct bundle file here-->
        <rosparam command="load" file="$(find stag_ros)/cfg/single_config.yaml"/>
    </node>

Both result in:

[ INFO] [1607395411.403805577]: Initializing nodelet with 32 worker threads.
[ WARN] [1607395411.413394006]: No tags specified

How do you suggest using stag_ros with multiple cameras?

Brenn10 commented 3 years ago

We have not tested with multiple cameras yet. Do you have the same issue with the node or is the issue just in the nodelet?

I have set this as a bug since this is most likely strictly a namespacing issue.

Brenn10 commented 3 years ago

I left the config the same and placed the node in a namespace as you did (shown below). This successfully launched and tracked the tag. image

I will check the multicamera setup next.

ri-ceres commented 3 years ago

Did you clear the parameter server before relaunching with the namespace? If not, you may be loading parameters based off the default namespace (/stag_ros_nodelet) instead of the new namespace (/camera1/stag_ros_nodelet).

ri-ceres commented 3 years ago

I haven't tested multiple cameras with the node, only the nodelet. I can try the node tomorrow.

ri-ceres commented 3 years ago

I tested this today, and you're correct that using multiple namespaces with the node works as expected. The problem I was observing appears to have been related to the viewing angle of the other cameras (~30-60 degress) rather than the namespacing I referenced.

The results in the paper indicate that STag should be more stable than ARToolkit tags at the angles being tested, so it may be that more experimentation is needed on our part.

Brenn10 commented 3 years ago

I was able to successfully launch two nodelets simultaneously with different. The launch file I used is here:

<launch>
    <!--Play ROSbag file-->
    <node name="rosbag" pkg="rosbag" type="play" args="$(find stag_ros)/bags/multi.bag"  required="true"/>

    <group ns="logi_cam">
    <node name="stag_nodelet" pkg="stag_ros" type="stag_nodelet_runnable" output="screen" required="true">
        <!-- Place the correct yaml file here-->
        <rosparam command="load" file="$(find stag_ros)/cfg/logi_cam.yaml"/>
        <!-- Place the correct bundle file here-->
        <rosparam command="load" file="$(find stag_ros)/cfg/single_config.yaml"/>
        </node>
    </group>

    <group ns="brennan_webcam">
        <node name="stag_nodelet" pkg="stag_ros" type="stag_nodelet_runnable" output="screen" required="true">
            <!-- Place the correct yaml file here-->
            <rosparam command="load" file="$(find stag_ros)/cfg/brennan_webcam.yaml"/>
            <!-- Place the correct bundle file here-->
            <rosparam command="load" file="$(find stag_ros)/cfg/single_config.yaml"/>
        </node>
    </group>

    <!-- rviz -->
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find stag_ros)/cfg/multi.rviz" required="true"/>
</launch>

The config files are here: logi_cam.yaml

# STag parameters
libraryHD: 15
errorCorrection: 7

# Camera configuration
camera_info_topic: /logi_cam/camera_info
raw_image_topic: /logi_cam/image_raw
is_compressed: false

# Node configuration
tag_tf_prefix: logicam_
show_markers: true
publish_tf: true

brennan_webcam.yaml

# STag parameters
libraryHD: 15
errorCorrection: 7

# Camera configuration
camera_info_topic: /brennan_webcam/camera_info
raw_image_topic: /brennan_webcam/image_raw
is_compressed: false

# Node configuration
tag_tf_prefix: brennan_webcam
show_markers: true
publish_tf: true

The parameter list shows that there is no duplication in the global namespace:

rennan@COMECH-ME0462:~$ rosparam list
/brennan_webcam/stag_nodelet/bundles
/brennan_webcam/stag_nodelet/camera_info_topic
/brennan_webcam/stag_nodelet/errorCorrection
/brennan_webcam/stag_nodelet/is_compressed
/brennan_webcam/stag_nodelet/libraryHD
/brennan_webcam/stag_nodelet/publish_tf
/brennan_webcam/stag_nodelet/raw_image_topic
/brennan_webcam/stag_nodelet/show_markers
/brennan_webcam/stag_nodelet/tag_tf_prefix
/brennan_webcam/stag_nodelet/tags
/brennan_webcam/stag_ros/image_markers/compressed/format
/brennan_webcam/stag_ros/image_markers/compressed/jpeg_optimize
/brennan_webcam/stag_ros/image_markers/compressed/jpeg_progressive
/brennan_webcam/stag_ros/image_markers/compressed/jpeg_quality
/brennan_webcam/stag_ros/image_markers/compressed/jpeg_restart_interval
/brennan_webcam/stag_ros/image_markers/compressed/png_level
/brennan_webcam/stag_ros/image_markers/compressedDepth/depth_max
/brennan_webcam/stag_ros/image_markers/compressedDepth/depth_quantization
/brennan_webcam/stag_ros/image_markers/compressedDepth/format
/brennan_webcam/stag_ros/image_markers/compressedDepth/png_level
/brennan_webcam/stag_ros/image_markers/theora/keyframe_frequency
/brennan_webcam/stag_ros/image_markers/theora/optimize_for
/brennan_webcam/stag_ros/image_markers/theora/quality
/brennan_webcam/stag_ros/image_markers/theora/target_bitrate
/logi_cam/stag_nodelet/bundles
/logi_cam/stag_nodelet/camera_info_topic
/logi_cam/stag_nodelet/errorCorrection
/logi_cam/stag_nodelet/is_compressed
/logi_cam/stag_nodelet/libraryHD
/logi_cam/stag_nodelet/publish_tf
/logi_cam/stag_nodelet/raw_image_topic
/logi_cam/stag_nodelet/show_markers
/logi_cam/stag_nodelet/tag_tf_prefix
/logi_cam/stag_nodelet/tags
/logi_cam/stag_ros/image_markers/compressed/format
/logi_cam/stag_ros/image_markers/compressed/jpeg_optimize
/logi_cam/stag_ros/image_markers/compressed/jpeg_progressive
/logi_cam/stag_ros/image_markers/compressed/jpeg_quality
/logi_cam/stag_ros/image_markers/compressed/jpeg_restart_interval
/logi_cam/stag_ros/image_markers/compressed/png_level
/logi_cam/stag_ros/image_markers/compressedDepth/depth_max
/logi_cam/stag_ros/image_markers/compressedDepth/depth_quantization
/logi_cam/stag_ros/image_markers/compressedDepth/format
/logi_cam/stag_ros/image_markers/compressedDepth/png_level
/logi_cam/stag_ros/image_markers/theora/keyframe_frequency
/logi_cam/stag_ros/image_markers/theora/optimize_for
/logi_cam/stag_ros/image_markers/theora/quality
/logi_cam/stag_ros/image_markers/theora/target_bitrate
/rosdistro
/roslaunch/uris/host_comech_me0462__33409
/rosversion
/run_id

The bag file that i used for testing is available here: https://drive.google.com/file/d/1iBP9skURXqNmfy958lcKhzIiCWV7MIfp/view?usp=sharing It is a very large file. I may upload a compressed version in the future for an additional example.

Let me know if this works for you.

Brenn10 commented 3 years ago

I tested this today, and you're correct that using multiple namespaces with the node works as expected. The problem I was observing appears to have been related to the viewing angle of the other cameras (~30-60 degress) rather than the namespacing I referenced.

The results in the paper indicate that STag should be more stable than ARToolkit tags at the angles being tested, so it may be that more experimentation is needed on our part.

I had already written my response before you closed the issue :sweat_smile:. Let us know if you have any more issues.

ri-ceres commented 3 years ago

Thanks for looking into this! Appreciate how responsive you've been about issues here.