i3drobotics / i3dr_deimos-ros

ROS driver for the I3DR Deimos stereo camera
http://i3drobotics.com/deimos.html
2 stars 2 forks source link

Unable to find parent USB device #4

Closed eirikaso closed 6 years ago

eirikaso commented 6 years ago

Hi I ended up in your repository after following a link in the issue section at the "see3cam" repository. This fixed the issue with "tried to advertise service that is already advertised".

I am now getting the error "Unable to find usb device" when launching "deimon.launch". I am using the correct /dev/video*. There seems to be a problem in the "uvc_cam.cpp" file on line 856 when it tries to find a parent usb device

  /* The device pointed to by dev contains information about
     the v4l2 device. In order to get information about the
     USB device, get the parent device with the
     subsystem/devtype pair of "usb"/"usb_device". This will
     be several levels up the tree, but the function will find
     it.*/
  dev = udev_device_get_parent_with_subsystem_devtype(
          dev,
          "usb",
          "usb_device");
  //std::cout << dev << std::endl;
  if (!dev)
  {
      cout << "Unable to find parent usb device.";
      continue;
  }

I am no expert and found it hard to see how this function was working, but it seems to come up empty handed. When I printed the "dev" variable, some hex numbers came up so something is there, but the "Unable to find parent usb device." is still printing.

I am running Ubuntu 16.06, ROS kinetic and a TARA stereo camera. Do you have any idea what is going wrong here?

jveitchmichaelis commented 6 years ago

Hi @eirikaso - not entirely sure about this one. uvc_cam.cpp is legacy code which this package is built on, however. The call that's failing is in libudev.

Are you able to view the camera in other softare? TARA should be (mostly) UVC compliant so you can try in e.g. OpenCV directly or qv4l2. It sounds like a hardware issue, or perhaps a system configuration problem.

Have you installed the udev rule (in the udev folder in this repo)?

sudo cp ./udev/99-uvc.rules /etc/udev/rules.d/99-uvc.rules

eirikaso commented 6 years ago

It works when I connect the camera to a computer with no other cameras (no webcams etc). I tried to disable the webcam, but it didn't have any effect. I'm able to run it on a Jetson TX2 at least

jveitchmichaelis commented 6 years ago

Ok - glad to hear you go it working in some situations! I'm going to close this for now.

jiawei-mo commented 5 years ago

Same here. It does not work in my laptop with a webcam but works in my desktop without a webcam.

jveitchmichaelis commented 5 years ago

The fact that this is happening only with multiple cameras suggests that the node is opening the wrong device somehow. @jiawei-mo, @eirikaso So this problem happens even if you set the right device in the launch file?

https://github.com/i3drobotics/deimos-ros/blob/335c8ea1676f0b6eceb81a22729ad8921e8f7140/launch/deimos.launch#L21

Perhaps the node is always opening /dev/video0 for some reason. Try hardcoding the correct /dev/video* here, or you could try print-debugging device just before that call to see what it's trying to open.

https://github.com/i3drobotics/deimos-ros/blob/335c8ea1676f0b6eceb81a22729ad8921e8f7140/src/deimos_ros.cpp#L89

If this persists, I'll look into porting the code over to using OpenCV which is probably more reliable. uvc_cam isn't our code, but it looks like it's just a thin wrapper around V4L2. There is some separate code which is required to talk to the extension unit on the camera.