ZhenshengLee / ros2_shm_msgs

ROS2 shm_msg based zero-copy for image and pointcloud.
128 stars 22 forks source link

GpuMat invalid argument #27

Open BB142 opened 1 year ago

BB142 commented 1 year ago

Hey,

thanks a lot for the awesome examples. I tried your cuda GpuMat examples and it is working fine. Doing stuff with the GpuMat at the listener side is somehow impossible. Functions like download, clone(), etc. yield an invalid argument error. The gpu_mat is not empty.

Any idea how to access the data of the GpuMat at listener side?

ZhenshengLee commented 1 year ago

Doing stuff with the GpuMat at the listener side is somehow impossible. Functions like download, clone(), etc. yield an invalid argument error. The gpu_mat is not empty.

Thanks for your report! I have't test the post-process of GpuMat. Could you help to reproduce this behavior?

  1. fork this repo, commit your test code, give the link here.
  2. give your running environment, ubuntu version? ros2 version? in this post.
  3. give your steps to reproduce the error in this post.
  4. give your errors, paste the output here.

Thanks! @BB142

BB142 commented 1 year ago

Thanks for your fast response.

  1. https://github.com/BB142/ros2_shm_msgs
  2. Ubuntu 22.04 Ros Humble
  3. git clone https://github.com/BB142/ros2_shm_msgs (to ws src) & export GPUAC_COMPILE_WITH_CUDA=true & cd ws_root & colcon build source install/setup.bash terminal 1: ros2 run shm_msgs gmat_image_node terminal 2: ros2 run shm_msgs gmat_image_listener
  4. terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.6.0) /home/roomba/opencv/modules/core/src/cuda/gpu_mat.cu:246: error: (-217:Gpu API call) invalid argument in function 'download'

This error happens when splitting the talker and listener in two seperate executor. With one executor everything works fine. Is there a way to get those two nodes running in different executors?

ZhenshengLee commented 1 year ago

You can not simply use ros2 run because it will not able to find the image file. https://github.com/ZhenshengLee/ros2_shm_msgs/blob/42fde5f188dc5a55be54718cbb601539d2823815/cuda/gmat_image_talker.hpp#L51

so, use this command to run the origional executable, to check if there is still output the error.

cd ./install/shm_msgs/lib/shm_msgs/
./gmat_image_node
ZhenshengLee commented 1 year ago

I will find some time to check your code in the fork. https://github.com/ZhenshengLee/ros2_shm_msgs/compare/humble...BB142:ros2_shm_msgs:humble

Before this , I suggest you run the original code to test the new type adaption feature in humble.