ros-drivers / libuvc_ros

http://www.ros.org/wiki/libuvc_ros
81 stars 97 forks source link

Connecting Multiple Camera #65

Open anug7 opened 4 years ago

anug7 commented 4 years ago

I am trying to stream from 6 camera using this ros package. I am getting data from 5 cameras but the 6th camera is not sending any data at all. Every time it's launched, a different camera wouldn't stream data. i.e at any time only 5 camera are being streamed.

Specs:

  1. CPU: i7-8700 CPU @ 3.20GHz
  2. OS: Ubuntu 16.04
  3. Have added a PCI-USB card to increase USB bandwidth

Is there any limitation on the library?

awesomebytes commented 4 years ago

I wouldn't believe there is any limitation in the library. It launches 6 instances of the same driver, one for each camera right? I wouldn't see how that would be an issue with 6 processes, or 6 threads if running in nodelets. I would probably try the processes way if you are running in nodelets, just in case, but I doubt there will be any difference.

You most probably are running into USB bandwidth problems by using 6 USB cameras. Have you checked dmesg? In case there is any error reported there. Specially if you, say, start the cameras one by one. Maybe by the 6th an error pops. When I say bandwidth... I kind of mean "USB problems that I don't know the exact jargon for", it may be USB controllers only allowing up to 2 full speed cameras, for example.

The fact that a different camera does that each time is what makes me really suspicious of being a USB hardware-related issue, I've run in the same in the past, but with cameras behaving weirdly, not totally not working. I tried other camera drivers (gscam, video_stream_opencv) and that didn't help either.

anug7 commented 4 years ago

@awesomebytes , Thank for the quick reply.

  1. I am not using nodelet. I am using processes.
  2. I checked the USB bandwidth and it's fine. Also I have six different USB controllers (extended using a PCI-USB controller). Individual camera bandwidth is only 60MB and each camera is connected in unique USB controller.
  3. To verify the HW issue, I used libuvc_camera for 5 cameras & usb_cam ros package for 1 camera and I was able to get stream from all the six camera. That's why I doubted the ros package.
awesomebytes commented 4 years ago

That's very interesting (and odd). I must say I'm not a developer from this package, I just happened to use it at some point so I'm subscribed to the issues.

Your setup sounds robust. And the usb_cam ros experiment would discard the hardware issue, also.

I can suggest to run the 6th instance of the node in gdb and see where it hangs? I gave a quick look at the code, and it looks rather simple. Hopefully it may get stuck in some step that can be workarounded. Sorry if you already tried that.

Also, why not try to run a couple of cameras in nodelets? Kinda easy to try too.

Yet another approach to try... Run a docker with ubuntu 18.04 to try libucv_ros there (libuvc will be a different version potentially).

Also the last version in master here has a few extra commits not in the released versions (even thought on first sight they don't look very meaningful to your problem).

Even trying the test program from the libuvc library itself could be tested. If that doesn't work, it's probably a problem of libuvc internally (or some default configuration set inadvertently here).

That's all I can think of right now! Good luck! Keep us posted.

anug7 commented 4 years ago

@awesomebytes , Thank you for the suggestions. I will check and update.

QiTianDaShengDaShi commented 2 years ago

Hello, have you solved this problem?I want to use three cameras at the same time, but I also encountered this problem. There is often no image from one or two cameras.

anug7 commented 2 years ago

@QiTianDaShengMaoHuiFei ,

I couldn't figure out the exact issue(there could be issues with libuvc also). I used a different ros package for my use case.

QiTianDaShengDaShi commented 2 years ago

Thanks for your reply, can you tell me which library you use?

grafoteka commented 2 years ago

I am also interested in the alternative package. Could you tell us which one you used? Thank you

anug7 commented 2 years ago

@QiTianDaShengMaoHuiFei , @grafoteka ,

I modified this one for my purposes.

QiTianDaShengDaShi commented 2 years ago

@QiTianDaShengMaoHuiFei , @grafoteka ,

I modified this one for my purposes.

thanks,I successfully connected four usb cameras with this code

grafoteka commented 2 years ago

Mee too, thank you.

El 20 oct 2021, a las 9:21, QiTianDaShengMaoHuiFei @.***> escribió:

 @QiTianDaShengMaoHuiFei , @grafoteka ,

I modified this one for my purposes.

thanks,I successfully connected four usb cameras with this code

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

aqsakhalid18 commented 1 month ago

I am trying to read the manual which is provided above of ros1 but can’t understand what to do. Anyone please help me i want to integrate 5 cameras on ros1 using a USB hub and then that hub is connected to my laptop please help me out as I have to submit this task on Monday.

awesomebytes commented 4 weeks ago

My answer may not be very useful, but I doubt you'll be able to get 5 USB cameras working at the same time with a USB hub. You'll run out of bandwidth in the port. 2 or 3 maybe, if you have a very good laptop and it's a thunderbolt port... Maybe 3 or 4? But 5 is very unlikely. Compute the bandwidth for one camera with something like 'usbtop', and multiply *5... Check the maximum bandwidth of both your USB port and the USB hub (albeit they rarely specify it) and... Add that to your report.

Good luck!

On Fri, Jun 7, 2024, 23:47 aqsakhalid18 @.***> wrote:

I am trying to read the manual which is provided above of ros1 but can’t understand what to do. Anyone please help me i want to integrate 5 cameras on ros1 using a USB hub and then that hub is connected to my laptop please help me out as I have to submit this task on Monday.

— Reply to this email directly, view it on GitHub https://github.com/ros-drivers/libuvc_ros/issues/65#issuecomment-2155665053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANEK5GQAGUNSMUXG6JP7TDZGI2ANAVCNFSM6AAAAABI7NCI56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGY3DKMBVGM . You are receiving this because you were mentioned.Message ID: @.***>

aqsakhalid18 commented 4 weeks ago

Thank you so much for your guidance if you have any other solution regarding this problem please let me know .

On Sun, 9 Jun 2024 at 3:01 AM, Sam Pfeiffer @.***> wrote:

My answer may not be very useful, but I doubt you'll be able to get 5 USB cameras working at the same time with a USB hub. You'll run out of bandwidth in the port. 2 or 3 maybe, if you have a very good laptop and it's a thunderbolt port... Maybe 3 or 4? But 5 is very unlikely. Compute the bandwidth for one camera with something like 'usbtop', and multiply *5... Check the maximum bandwidth of both your USB port and the USB hub (albeit they rarely specify it) and... Add that to your report.

Good luck!

On Fri, Jun 7, 2024, 23:47 aqsakhalid18 @.***> wrote:

I am trying to read the manual which is provided above of ros1 but can’t understand what to do. Anyone please help me i want to integrate 5 cameras on ros1 using a USB hub and then that hub is connected to my laptop please help me out as I have to submit this task on Monday.

— Reply to this email directly, view it on GitHub < https://github.com/ros-drivers/libuvc_ros/issues/65#issuecomment-2155665053>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AANEK5GQAGUNSMUXG6JP7TDZGI2ANAVCNFSM6AAAAABI7NCI56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGY3DKMBVGM>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/ros-drivers/libuvc_ros/issues/65#issuecomment-2156202396, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJA453HWC2XAQT7ZXDLSNODZGN5KFAVCNFSM6AAAAABI7NCI56VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJWGIYDEMZZGY . You are receiving this because you commented.Message ID: @.***>