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

stereo_image_proc: disparity_node: Add parameter to control camera_info #1051

Conversation

quic-zhaoyuan
Copy link
Contributor

@quic-zhaoyuan quic-zhaoyuan commented Nov 28, 2024

From #1048 migrate to Rolling. Add info in document rst file
Issue background:
Unable to distinguish or remap left and right camera_info when using image_transport with identical topic names

Description:
When using DisparityNode from the stereo_image_proc package and running with ROS 2 bag or other scenarios involving image_transport, there is an issue if the camera_info topics for the left and right cameras are automatically derived and end up having the same name.
image
This happens because image_transport::getCameraInfoTopic derives camera_info topic names from the image topics (left/image_rect and right/image_rect).
This makes it impossible to use the node properly in these scenarios, especially when working with recorded data or custom remapping.

Proposed Solution

I propose adding a parameter, use_image_transport_camera_info (default: true), to control whether DisparityNode uses image_transport::getCameraInfoTopic for deriving camera_info topics.

Default Behavior (backward compatible):
    When use_image_transport_camera_info is true, the node continues using image_transport::getCameraInfoTopic for camera_info resolution, maintaining existing functionality.

Custom Behavior:
    When use_image_transport_camera_info is false, the node directly uses the camera_info topics specified via remapping (e.g., left/camera_info and right/camera_info), bypassing image_transport's derivation logic.

This solution allows users to explicitly remap the camera_info topics for both cameras, providing flexibility for scenarios where topic names are not unique or need customization.

…fo topic resolution

Added `use_image_transport_camera_info` parameter to toggle between deriving camera_info topics using `image_transport::getCameraInfoTopic` or using default topic names.

- Default behavior (`true`) maintains current logic for backward compatibility.
- New option (`false`) supports direct usage of custom camera_info topics.

Improves flexibility for custom remapping setups.

Signed-off-by: Zhaoyuan Cheng <quic_zhaochen@quicinc.com>
@quic-zhaoyuan
Copy link
Contributor Author

@ahcorde @mikeferguson please check

Signed-off-by: Zhaoyuan <quic_zhaochen@quicinc.com>
@mikeferguson mikeferguson merged commit bb4ab63 into ros-perception:rolling Nov 28, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants