Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isaac_ros_stereo_image_proc: Subscribed topics should be image_raw? #19

Closed
millertheripper opened this issue Aug 24, 2022 · 4 comments
Closed
Assignees
Labels
needs info Needs more information

Comments

@millertheripper
Copy link

Hi team,

Regarding the current documentation the isaac_ros_stereo_image_proc package is subscribed to left/right rectified images (/image_rect)? But the "original" package from ros (stereo_image_proc) is subscribed to raw images, see http://wiki.ros.org/stereo_image_proc?distro=noetic.

Is this an documentation issue or am I wrong? I have tried passing remapped nodes (left/image_raw /right/image_raw to left/image_rect right/image_rect) to this package and it seems to work with raw inputs. Nevertheless, the disparity view is not looking as good as I would expect, so I am bit struggling.

I am using the GMSL stereo camera (Hawk) from LI, which is not publishing rectified images natively.

Thanks
millertheripper

@hemalshahNV hemalshahNV self-assigned this Sep 1, 2022
@hemalshahNV
Copy link
Contributor

Which node in isaac_ros_stereo_image_proc are you referring to specifically? The Noetic package had a node which combined a few nodelets together whereas in ROS2 we've split them out as composable nodes.

What seems off about the disparity view? Are the images rectified on the way into DisparityNode? Could the calibration on the camera be off perhaps?

@hemalshahNV hemalshahNV added the question Further information is requested label Sep 1, 2022
@millertheripper
Copy link
Author

Hi hemalshahNV,

thanks for your support. I am using the EA3 release of the repository with JP 4.6.1 on a Jetson Xavier AGX.

Since the hawk does not publish rectified images natively but raw images instead the disparity looks bad. You can see an example here, where I used the raw images with the isaac::stereo_image_proc plugin.

Terminal 1: (Start Camera and remap topics to "fake" rectified images)
ros2 run isaac_ros_argus_camera_stereo isaac_ros_argus_camera_stereo --ros-args -p device:=0 -p sensor:=0 -p output_encoding:="rgb8" --remap stereo/left/image_raw:=left/image_rect --remap stereo/left/camera_info:=left/camera_info --remap stereo/right/image_raw:=right/image_rect --remap stereo/right/camera_info:=right/camera_info

Terminal 2: (Use stereo_image_proc plugin with raw images)
ros2 run isaac_ros_stereo_image_proc isaac_ros_stereo_image_proc --ros-args -p max_disparity:=128 -p backends:="CUDA" -r left/image_rect_color:=left/image_rect

Terminal 3: (Show the image)

ros2 run image_view disparity_view --ros-args --remap image:=/left/image_rect
ros2 run image_view disparity_view --ros-args --remap image:=/disparity

image

You can see that the image is raw and distorted and the disparity looks bad.

I understood from your last comment that I need to make use of the composable nodes in order to rectify images before using the isaac::stereo_image_proc plugin since it is subscribed to rectified images. Basically the pipeline looks as follows:

image

I have created a startup script based on composable nodes. All the image processing runs in a container. It is attached here. It makes some remapping of nodes in order to match with the nodes subscriptions:

def generate_launch_description():
    """Launch file which brings up argus monocular camera node with rectify node."""
    rectify_node_left = ComposableNode(
        name='isaac_ros_rectify',
        package='isaac_ros_image_proc',
        plugin='isaac_ros::image_proc::RectifyNode',
        remappings=[('image', 'left/image_raw'),
                    ('camera_info', 'left/camera_info'),
                    ('image_rect', 'left/image_rect')])
    rectify_node_right = ComposableNode(
        name='isaac_ros_rectify',
        package='isaac_ros_image_proc',
        plugin='isaac_ros::image_proc::RectifyNode',
        remappings=[('image', 'right/image_raw'),
                    ('camera_info', 'right/camera_info'),
                    ('image_rect', 'right/image_rect')])
    disparity_node = ComposableNode(
        name='disparity',
        package='isaac_ros_stereo_image_proc',
        plugin='isaac_ros::stereo_image_proc::DisparityNode',
        parameters=[{
                'backends': 'CUDA',
                'max_disparity': 256,
        }])
    argus_camera_node = Node(
        package='isaac_ros_argus_camera_stereo',
        executable='isaac_ros_argus_camera_stereo',
        parameters=[{
                'device': 0,
                'sensor': 0,
                'output_encoding': "rgb8",
                'camera_frame_id': "test_frame_id",
        }],
        remappings=[('stereo/left/image_raw', 'left/image_raw'),
                    ('stereo/right/image_raw', 'right/image_raw'),
                    ('stereo/right/camera_info', 'right/camera_info'),
                    ('stereo/left/camera_info', 'left/camera_info')])
    disparity_container = ComposableNodeContainer(
        name='disparity_container',
        namespace='',
        package='rclcpp_components',
        executable='component_container',
        composable_node_descriptions=[
            rectify_node_left,
            rectify_node_right,
            disparity_node
        ],
        output='screen'
    )
    return launch.LaunchDescription([disparity_container, argus_camera_node])

I can see that the following topics are created when executing the script above:

admin@bxavier:/workspaces/isaac_ros-dev$ ros2 topic list
/disparity
/image_rect/compressed
/image_rect/compressedDepth
/left/camera_info
/left/image_raw
/left/image_rect
/parameter_events
/right/camera_info
/right/image_raw
/right/image_rect
/rosout
/stereo/left/image_raw/compressed
/stereo/left/image_raw/compressedDepth
/stereo/right/image_raw/compressed
/stereo/right/image_raw/compressedDepth

So everything seems to be fine in terms of needed topics. I can now observe rectified images on /left/image_rect and /right/image_rect:

image

But the disparity view does not generate any data or shows any image. When launching the script, there are some warnings that I do not understand.

admin@bxavier:/workspaces/isaac_ros-dev$ ros2 launch isaac_ros_stereo_image_proc isaac_ros_argus_camera_stereo_rectify_launch.py
[INFO] [launch]: All log files can be found below /home/admin/.ros/log/2022-09-08-08-15-43-958096-bxavier-6615
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [component_container-1]: process started with pid [6651]
[INFO] [isaac_ros_argus_camera_stereo-2]: process started with pid [6652]
[component_container-1] [INFO] [1662624945.772570596] [disparity_container]: Load Library: /workspaces/isaac_ros-dev/install/isaac_ros_image_proc/lib/librectify_node.so
[component_container-1] [INFO] [1662624945.991494043] [disparity_container]: Found class: rclcpp_components::NodeFactoryTemplate<isaac_ros::image_proc::RectifyNode>
[component_container-1] [INFO] [1662624945.991733542] [disparity_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<isaac_ros::image_proc::RectifyNode>
[component_container-1] [INFO] [1662624946.133287399] [isaac_ros_rectify]: Using backend CUDA
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.490483909] [argus_stereo]: Argus Version: 0.98.3 (multi-process)
[isaac_ros_argus_camera_stereo-2] 
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.492195732] [argus_stereo]: Set the stereo camera module using the node parameter "module"
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.492337563] [argus_stereo]: Set the sensor mode using the node parameter "sensor"
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.492461025] [argus_stereo]: Set the output image format using the node parameter "output_encoding". Supported encodings: "mono8" and "rgb8" (Default: "mono8")
[isaac_ros_argus_camera_stereo-2] 
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.495542160] [argus_stereo]: Following camera modules are available:
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.495732921] [argus_stereo]: Module 0: HAWK1 module with 2 sensors connected
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.495848799] [argus_stereo]: Available sensor modes for this module:
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.496853965] [argus_stereo]: 0 (1920 x 1200)
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.496980307] [argus_stereo]: Module 1: HAWK2 module with 2 sensors connected
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.497043798] [argus_stereo]: Available sensor modes for this module:
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.497927935] [argus_stereo]: 0 (1920 x 1200)
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/isaac_ros_rectify' in container '/disparity_container'
[component_container-1] [INFO] [1662624946.750294538] [disparity_container]: Found class: rclcpp_components::NodeFactoryTemplate<isaac_ros::image_proc::RectifyNode>
[component_container-1] [INFO] [1662624946.750530933] [disparity_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<isaac_ros::image_proc::RectifyNode>
[component_container-1] [WARN] [1662624946.751460448] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[component_container-1] [INFO] [1662624946.778584432] [isaac_ros_rectify]: Using backend CUDA
[WARNING] [/disparity_container]: there are now at least 2 nodes with the name /isaac_ros_rectify created within this launch context
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/isaac_ros_rectify' in container '/disparity_container'
[component_container-1] [INFO] [1662624946.804535881] [disparity_container]: Load Library: /workspaces/isaac_ros-dev/install/isaac_ros_stereo_image_proc/lib/libdisparity_node.so
[component_container-1] [INFO] [1662624946.811846013] [disparity_container]: Found class: rclcpp_components::NodeFactoryTemplate<isaac_ros::stereo_image_proc::DisparityNode>
[component_container-1] [INFO] [1662624946.812101449] [disparity_container]: Instantiate class: rclcpp_components::NodeFactoryTemplate<isaac_ros::stereo_image_proc::DisparityNode>
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624946.883464805] [argus_stereo]: Starting repeat capture requests.
[component_container-1] [INFO] [1662624946.929457347] [disparity]: Using backend CUDA
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/disparity' in container '/disparity_container'
[isaac_ros_argus_camera_stereo-2] [INFO] [1662624947.373548975] [argus_stereo]: Consumer Running
[component_container-1] [WARN] [1662624952.164515803] [isaac_ros_rectify]: [image_transport] Topics '/left/image_raw' and '/camera_info' do not appear to be synchronized. In the last 10s:
[component_container-1]         Image messages received:      5
[component_container-1]         CameraInfo messages received: 5
[component_container-1]         Synchronized pairs:           1
[component_container-1] [WARN] [1662624952.773591804] [isaac_ros_rectify]: [image_transport] Topics '/right/image_raw' and '/camera_info' do not appear to be synchronized. In the last 10s:
[component_container-1]         Image messages received:      5
[component_container-1]         CameraInfo messages received: 20
[component_container-1]         Synchronized pairs:           1
[component_container-1] [WARN] [1662624953.113595568] [isaac_ros_rectify]: [image_transport] Topics '/left/image_raw' and '/camera_info' do not appear to be synchronized. In the last 10s:

Maybe you can help to debug this issue, or maybe there is a mistake in the launch script?

Best Regards and thanks
millertheripper

@hemalshahNV
Copy link
Contributor

Thanks for the helpful information in your post! We suspect that the nodes are having trouble processing the large images from HAWK at full resolution.

Rectify node seems to be complaining that not enough images and camera_infos are appearing close enough in time for it to match them. This may be causing left and right images to be published soon enough to be time synchronized causing no disparity to be emitted. You may want to try a smaller image size and a smaller max_disparity value to confirm.

In more recent Isaac ROS releases, we introduced NITROS which eliminates much of the memory overhead with large images which should significantly improve your framerate.

Finally, the launch file seems correct but it may be worth verifying using rQt to make sure everything is actually connected. The warning is a concern but you should likely be seeing at least a slow rate of disparity images coming through.

@hemalshahNV hemalshahNV added needs info Needs more information and removed question Further information is requested labels Sep 12, 2022
@millertheripper
Copy link
Author

Thanks hemalshahNV,

reducing the CPU load by adjusting the image size did make the trick. The Xavier AGX seems not to have enough computing power to process the image pipeline at full resolution. I will try to update to newest JP release to make use of NITROS acceleration in order to see if this makes a difference.

Best Regards
millertheripper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs info Needs more information
Projects
None yet
Development

No branches or pull requests

3 participants