lagadic / visp_ros

A basket of generic ros nodes based on ViSP library
GNU General Public License v2.0
42 stars 33 forks source link

ros grabber - segmentation fault #4

Closed cowboygary closed 3 years ago

cowboygary commented 7 years ago

Hi I run camera-usb.launch then ./tutorial-ros-grabber then I get segmentation error. Can you help me? I use IDS uEye camera. Thank you

fspindle commented 7 years ago

Can you send me a bag with the images

cowboygary commented 7 years ago

Thanks for your help.

I'm using IDS ueye camera UI124x. My OS is Ubuntu 14.04 and ROS indigo.

This is the list of topics.

Published topics:

  • /FOOcam/image_raw/theora [theora_image_transport/Packet] 1 publisher
  • /FOOcam/image_raw [sensor_msgs/Image] 1 publisher
  • /FOOcam/image_raw/compressed/parameter_descriptions

Subscribed topics:

  • /rosout [rosgraph_msgs/Log] 1 subscriber
  • /nodelet_manager/bond [bond/Status] 2 subscribers

Actually, I use your tutorial (tutorial-ros-grabber), I just change the the raw image topic and camera info topic. This is the error I got.

_(gdb) exec-file tutorial-ros-grabber
(gdb) run
Starting program: ~/catkin_ws/src/visp_ros/tutorial/grabber/ros/tutorial-ros-grabber 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffdcaff700 (LWP 11316)]
Use camera info: no
[New Thread 0x7fffdba0c700 (LWP 11318)]
[New Thread 0x7fffdb20b700 (LWP 11319)]
[New Thread 0x7fffdaa0a700 (LWP 11320)]
[New Thread 0x7fffda209700 (LWP 11325)]
Subscribe to raw image on /FOOcam/image_raw topic
Subscribe to camera_info on camera_info topic
[New Thread 0x7fffd9a08700 (LWP 11340)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd9a08700 (LWP 11340)]
0x00007ffff39fe499 in cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int) () from /usr/local/lib/libopencv_imgproc.so.2.4_

I attach the bag. I'm not familiar with rosbag. 2017-06-16-10-50-12.bag.zip

fspindle commented 7 years ago

I'm able to reproduce the issue that seems in vpROSGrabber::imageCallbackRaw().

If you can investigate it would be great since I will be back from my office until next Thursday.

fspindle commented 7 years ago

I need to investigate more, but it seems that the issue comes from cv_bridge.

Could you try to modify vpROSGrabber::imageCallbackRaw() replacing the line

cv_ptr = cv_bridge::toCvShare(msg, "bgr8");

with

cv_ptr = cv_bridge::toCvShare(msg, "rgb8");

With my Logitech Sphere, red and blue chanels are inverted but it works. Let me know...

cowboygary commented 7 years ago

Nothing change.

I think the problem come from libvisp_bridge.so library.

In terminal:

ldd /opt/ros/indigo/lib/libvisp_bridge.so | grep opencv libopencv_imgproc.so.2.4 => /usr/local/lib/libopencv_imgproc.so.2.4 (0x00007f39f93ff000) libopencv_core.so.2.4 => /usr/local/lib/libopencv_core.so.2.4 (0x00007f39f8d10000)

I think I should change install visp_bridge which depend to this library version libopencv_imgproc3.so.3.1

Since I install visp_bridge with apt-get, I cannot change the dependance library. How can I change the library from _libopencvimgproc.so.2.4 to _libopencvimgproc3.so.3.1 respectively for _libopencvcore.so.2.4

fspindle commented 7 years ago

You cannot mix opencv 2.4 and 3.1:

To use opencv 3.1 everywhere, you should build visp and visp-bridge from source:

1/ remove existing visp packages ros-indigo-visp, ros-indigo-visp-bridge, ... 2/ get and build visp from source

$ mkdir $HOME/visp; cd $HOME/visp
$ git clone https://github.com/lagadic/visp
$ mkdir visp-build-opencv3; cd visp-build-opencv3
$ cmake ../visp -DOpenCV_DIR=/opt/ros/indigo/share/OpenCV-3.1.0-dev
$ make -j4 visp_modules

3/ get and build visp-bridge

$ cd ~/catkin_ws/src
$ git clone https://github.com/lagadic/vision_visp
$ cd ..
$ catkin_make -DCMAKE_BUILD_TYPE=Release -DVISP_DIR=$HOME/visp/visp-build-opencv3

At this point ldd ~/catkin_ws/devel/lib/libvisp_bridge.so should point to /opt/ros/indigo/lib/libopencv_core3.so.3.1