IntelRealSense / realsense-ros

ROS Wrapper for Intel(R) RealSense(TM) Cameras
http://wiki.ros.org/RealSense
Apache License 2.0
2.6k stars 1.76k forks source link

Failing to publish compressed image and depth topic data on Nvidia AGX Orin #3105

Open nwissner-bdai opened 6 months ago

nwissner-bdai commented 6 months ago

Required Info
Camera Model D455
Firmware Version R36 (release), REVISION: 2.0
Operating System & Version Linux (Ubuntu 22.04.4 LTS)
Kernel Version (Linux Only) 6.5.0-28-generic
Platform Nvidia Jetson AGX Orin
Librealsense SDK Version v2.54.2
Language C++/Python/ROS2
Segment Robot
ROS Distro Humble
RealSense ROS Wrapper Version 4.54.1

Issue Description

When running the realsense2_camera, the camera/camera/color/image_raw and camera/camera/depth/image_rect_raw topics are echoing data just fine, but when trying to echo any data on the compressed topics, I am getting errors such as:

[realsense2_camera_node-1] [ERROR] [1715629235.416347303] [CompressedPublisher]: OpenCV(4.8.0) /home/ubuntu/opencv_build/opencv/modules/core/src/alloc.cpp:73: error: (-4:Insufficient memory) Failed to allocate 170425562634720 bytes in function 'OutOfMemoryError'

When echoing image_raw/compressed data, and:

[realsense2_camera_node-1] [ERROR] [1715629297.743316357] [CompressedPublisher]: [16UC1] is not a color format. but [mono8] is. The conversion does not make sense

When echoing image_rect_raw/compressed data.

tiwaojo commented 1 week ago

Hey @agonzat, thanks for sharing your solution. I can confirm it also resolves my ffmpeg issue.

As for the following error @edgarcamilocamacho

[realsense2_camera_node-1] [ERROR] [1715629297.743316357] [CompressedPublisher]: [16UC1] is not a color format. but [mono8] is. The conversion does not make sense

I was able to find a solution by setting the following image transport parameters in my config and subscribing to the /camera/depth/image_rect_raw/compressed topic:

.camera.depth.image_rect_raw.format: png
.camera.depth.image_rect_raw.compressed.format: png # can also be jpeg
.camera.depth.image_rect_raw.compressedDepth.format: png

I did discover that setting the .camera.depth.image_rect_raw.format: png parameter resolves the error message, i am unable to view the stream in neither foxglove studio nor rviz2, even though there seems to be some message on its topic.

Furthermore, I abandoned the -map and republishing via intra process communication in place of agonzats solution. The process I was following is as follows: realsense-ros(IPC) --> repub-raw(IPC) --> sub-raw-pub-ffmpeg-image-transport