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

I can't get aligned depth images of my D435i from another PC with the same ROS_DOMAIN_ID. #3251

Closed
iotakataoka opened this issue Nov 15, 2024 · 16 comments
Labels

Comments

@iotakataoka
Copy link

Hello

Required Info
Camera Model D435i
Firmware Version 5.16.0.1
Operating System & Version Ubuntu 22.04
Kernel Version (Linux Only) 6.8.0-48
Platform PC
Librealsense SDK Version 2.55.1
ROS Distro Humble
RealSense ROS Wrapper Version 4.55.1

Issue Description

I cannot get an aligned depth image from another PC with the same ROS_DOMAIN_ID.

Actual Behavior

When viewed from a PC that does not have a realsenseD435i connected but has the same ROS_DOMAIN_ID, the /camera/camera/aligned_depth_to_color/image_raw topic is always published, but new values ​​are not sent only when rviz2 is running. /camera/camera/color/image_raw is sent even while rviz2 is running, and the image in rviz is also updated.
The command I'm using is: ros2 launch realsense2_camera rs_launch.py align_depth.enable:=true pointcloud.enable:=true filters:=spatial initial_reset:=true
I also tried removing rgb_camera.profile and rgb_camera.profile, but there was no change.
I set rviz's Reliability Policy to Best Effort.

Expected Behavior

I want to obtain an aligned depth image and a pointcloud and visualize them with rviz2.

@iotakataoka
Copy link
Author

iotakataoka commented Nov 15, 2024

It works fine on a PC connected to realsense as shown below
image
but it doesn't work well on a PC connected via DDS as shown below.
Screenshot from 2024-11-15 18-34-21

Also, when viewing rviz on a PC that does not have realsense connected, the aligned depth image will not move even in the image above.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Nov 15, 2024

Hi @iotakataoka A RealSense ROS user at #3072 (comment) who was using DDS and not getting an output from the aligned topics found that their problem was because the aligned images had high bandwidth and their network could not handle it. Is this case relevant to your own problem, please?

@iotakataoka
Copy link
Author

This is certainly similar to my problem. It's possible that the network can't handle large amounts of data. Could lowering the resolution or compressing the data be a solution?

@MartyG-RealSense
Copy link
Collaborator

You might get better performance from compressed depth topics so long as you do not use the compressedDepth topic which has a much higher data size than the other compressed topics, as discussed at #3105 (comment)

A list of the compressed topics available from the RealSense ROS2 wrapper can be found at the link below.

https://dev.intelrealsense.com/docs/ros2-wrapper#compression-packages

@iotakataoka
Copy link
Author

I tried subscribing to the /camera/camera/aligned_depth_to_color/image_raw/compressed topic and /camera/camera/aligned_depth_to_color/image_raw/compressed topic using the image-transport-plugin package, but I was unable to receive the data properly, as shown in the image below.
image

I also confirmed that an error message was displayed stating [ERROR] [1731688823.753100743] [CompressedPublisher]: [16UC1] is not a color format. but [mono8] is. The conversion does not make sense The solution to this error was written in the location you showed me earlier, but I couldn't figure out how to set it up.

@MartyG-RealSense
Copy link
Collaborator

Are you able to set RViz to use compressed data instead of raw data on its 'Create visualization' window as shown at #1903 (comment) please?

@iotakataoka
Copy link
Author

iotakataoka commented Nov 16, 2024

The image above shows an attempt to display /camera/camera/color/image_raw/compressed and /camera/camera/aligned_depth_to_color/image_raw/compressed in this way.
image

Also, when I started rviz2, I got this error:
[ERROR] [1731764870.291510481] [rviz]: OpenCV(4.5.4) ./modules/imgcodecs/src/loadsave.cpp:814: error: (-215:Assertion failed) !buf.empty() in function 'imdecode_'

@MartyG-RealSense
Copy link
Collaborator

Looking at related cases including #3105 (comment) the users in those cases may be configuring their image_transport settings using the rqt_reconfigure settings interface, which can be launched with the commabd below

ros2 run rqt_reconfigure rqt_reconfigure

A ROS2 tutorial for image_transport provides information about configuring through this interface.

https://github.com/ros-perception/image_transport_tutorials?tab=readme-ov-file#changing-transport-specific-behavior

Specific settings can also be configured directly with ros2 param set commands like the example below.

ros2 param set /camera/camera .aligned_depth_to_color.image_raw.compressed.format png

@iotakataoka
Copy link
Author

I was able to change the format to png with ros2 param set.

$ ros2 param get /camera/camera .camera.color.image_raw.format
String value is: png

$ ros2 param get /camera/camera .camera.aligned_depth_to_color.image_raw.format
String value is: png

As a result, the error [CompressedPublisher]: [16UC1] is not a color format. but [mono8] is. The conversion does not make sense disappeared, but it was not displayed in rviz.
Also, the problem may be that data is not flowing to /camera/camera/color/image_raw/camera_info, as shown in the image below.

By the way, I found that if I stopped displaying the two types of camera data in rviz, the point cloud would appear and move.

image

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Nov 17, 2024

Thanks very much for the update. I'm pleased to hear that you made significant progress.

Does not displaying the two types of camera data in order to make the pointcloud work cause problems for you, please?

@iotakataoka
Copy link
Author

There is a slight lag in the display of the point cloud, but this does not affect the topic itself.
It is a little inconvenient that the images are not displayed at the same time, but I don't think it is a big problem.

@MartyG-RealSense
Copy link
Collaborator

Ok, thanks very much. It's good that this is a workable solution for you.

@MartyG-RealSense
Copy link
Collaborator

Hi @iotakataoka Do you require further assistance with this case, please? Thanks!

@iotakataoka
Copy link
Author

The problem has been resolved for now. I will ask again if any other problems occur. Thank you.

@iotakataoka
Copy link
Author

The problem has been resolved for now. I will ask again if any other problems occur. Thank you.

@MartyG-RealSense
Copy link
Collaborator

You are very welcome, @iotakataoka - thanks very much for the update!

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

No branches or pull requests

3 participants
@MartyG-RealSense @iotakataoka and others