FraunhoferIOSB / camera_aravis2

ROS2 camera driver for GenICam-based GigEVision and USB3Vision cameras.
BSD 3-Clause "New" or "Revised" License
15 stars 3 forks source link

Support USB3 cameras #14

Closed boitumeloruf closed 3 weeks ago

boitumeloruf commented 9 months ago

So far the development was only done for GigE Vision cameras as we have only such cameras to test it. We are happy for some help to extend camera_aravis2 for USB3 Vision cameras.

For this, we have already created a corresponding node class, i.e. CameraDriverUv in camera_driver_uv.cpp. Our idea is to create another class called CameraDriver which subclasses CameraAravisNodeBase and which serves as a parent for CameraDriverGv and CameraDriverUv. In this, all common functionality should be implemented. Only the code, which is specific to GigE and USB3 cameras should be CameraDriverGv and CameraDriverUv, respectively.

berndpfrommer commented 4 months ago

Just tested your package with a Ximea USB3 camera. I was impressed by the quality of error messages I got, nice job. Are you still looking for help implementing this, or has work already begun? PS: I'm the author/maintainer of the FLIR Spinnaker driver which is also GeniCam based.

boitumeloruf commented 4 months ago

Thank you. No, we have not started work on USB3 camera support. Mainly due to the fact that we don't have a suitable camera with which to test it.

So we would be happy if you could support us. We already have an idea of how we would structure the code (see description above). Maybe you can start a new branch with support for USB3 cameras.

lr-sncf commented 2 months ago

Is the dev for USB3 camera still at the same stage ("to be started") ? I'm ready to help but I'd be delighted to hear what you think is the quickest way to achieve the goal.

lr-sncf commented 2 months ago

I've started to establish the USB3 equivalence of what you've already established for GigE cameras. I'm having a few problems (I connect to my camera but don't get a video stream, the camera disconnection must be going wrong because I can't launch my node twice - to reconnect to my camera, I have to reboot my computer; the camera is also inaccessible for the aravis viewer). I imagine that your knowledge of aravis would be a great help in resolving them quickly.

boitumeloruf commented 2 months ago

Great, thank you. Can you please push your code into a new Branch called 'Usb3Support' so that I can have a look at it?

lr-sncf commented 2 months ago

For sure. I'll do that on Tuesday (I'm teleworking and I don't have the PC with me). I had prepared a ‘usb3’ branch (which I'm going to rename ‘usb3support’) but I didn't want to push it without your prior approval.

boitumeloruf commented 2 months ago

So I have looked at your code here: https://github.com/lr-sncf/camera_aravis2/blob/usb3support/camera_aravis2/src/camera_driver_uv.cpp

Thank you for your effort.

At this point I see two possible problems:

  1. In line 1664, you have commented out the call to the 'arv_camera_uv_select_stream_channel' function. Have you tried to reactivate this line?
  2. In the 'tuneUvStream' method, you set a number of settings that are intended for GV streams (e.g. ARV_GV_STREAM_SOCKET_BUFFER_AUTO). Mayby for now, try commenting out line 1686 where you call the 'tuneUvStream' method?!

Hope this helps. I don't have any experience using Aravis with USB3 cameras. Maybe someone else has additional ideas.

lr-sncf commented 2 months ago

There is no 'arv_camera_uv_select_stream_channel' method. The aravis documentation is poor on that point. I don't clearly understand what this stream selection is.

lr-sncf commented 2 months ago

In my camera XML file, I do not see any attribute "DeviceStreamChannel" nor "GevStreamChannel"

boitumeloruf commented 2 months ago

Ok. Have you tried my second suggestion?

lr-sncf commented 2 months ago

Yes. After commenting this line, I still have the same behaviour. I try now to find a quite simple example of an aravis based usb3 driver to see how the connection is managed.

lr-sncf commented 2 months ago

I just push an updated version. This version is working on my personal computer with another usb3 camera (same vendor, same model). I'll test it next week at work.

Screenshot from 2024-09-27 10-25-18

lr-sncf commented 1 month ago

The code is now working on my 2 machines with 2 different cameras. On the first machine I have used, I had to install aravis manually with meson (aravis 0.8.33).

boitumeloruf commented 1 month ago

Great! Can you please open a Pull Request, so I can merge it into this repository?!

boitumeloruf commented 1 month ago

Hi @lr-sncf, I have refactored and cleaned up the code. Could you please test the current implementation in branch 'usb3support', if it still runs with your cameras. That would be great, thank you!

boitumeloruf commented 1 month ago

Hi all, is there anyone who can test the current implementation in branch 'usb3support' on a GenICam compatible USB camera?

berndpfrommer commented 1 month ago

I have a ximea camera that I could test with but I can't access it for the next two weeks (house got flooded, camera survived though).

tonyromarock commented 1 month ago

I've got a ximea (MQ042MG-CM, RGB+NIR CFA) USB3 camera here. I don't have ROS2 running on my machine yet, but I'll see what I can do.

I'll update you on this next week.

boitumeloruf commented 1 month ago

Hi all, I was finally able to test it with a borrowed USB3 camera and it worked fine with me. Happy to hear about other test during this week and then I will merge it into the 'devel' branch sometime next week.

boitumeloruf commented 3 weeks ago

Hi all, I have now merged the changes and the new feature into 'devel' and 'main'. With this, I have closed the issue. If any further problems arise, feel free to reopen it again.

I am planning for another official release in mid of December.

tonyromarock commented 3 weeks ago

Thank you for the merge @boitumeloruf!

I am late to the game, but I can confirm that this branch worked with my XIMEA MQ042MG-CM USB3 camera.

berndpfrommer commented 2 weeks ago

Tested the main branch with a XIMEA GmbH-MQ013CG-E2 (USB3) camera and it works fine.