SherifN / peak_cam

A Linux ROS C++ Node that wraps the driver API for IDS vision cameras using IDS peak software.
Other
8 stars 13 forks source link

not able to access ids camera from a docker container #33

Closed Merwanski closed 2 months ago

Merwanski commented 2 years ago

Hey

I am not able to access an USB ids camera from a docker container? I can see it? and identify it from the code but cannot start streaming images or take pictures?

Any ideas why? and how to solve the issue ?

Regards Merwan

flynneva commented 2 years ago

@Merwanski you should be able to if you have everything installed and --net=host enabled for your docker environment I think.

Did you remember to set --net=host when starting your docker container?

Merwanski commented 2 years ago

Hey @flynneva Thank you for your feedback, yes I have done that and it was still not working Here is what I am using as config to run the container

       ....
        --privileged -v /dev/bus/usb:/dev/bus/usb \
        --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
        --network="host" \
        -v /var/run/ueyed:/var/run/ueyed \    
       ....

the last part "-v /var/run/ueyed:/var/run/ueyed" tried with and without and still nothing

Merwanski commented 2 years ago

Update solution found using the old software IDS not the new one "peak" ids_vision_cockpit with this one I don't even see the cameras when connected to a pc Screenshot from 2022-05-16 10-32-56

While with the old software IDS camera manager I can see the cameras when connected Screenshot from 2022-05-16 10-52-16

and for the docker part here is the solution that did work for me

Add a few options to the docker command. Adding these arguments to the docker command solved the issue:

... --privileged -v /dev/bus/usb:/dev/bus/usb \ --ipc=host \ --pid=host \ -v /var/run:/var/run \ -v /usr:/usr \ ...

The other key part is to install the IDS software on the host machine. and make sure the system service for the IDS uEye camera is running in the host (sudo systemctl start ueyeusbdrc) and enable the docker feature via the IDS-manager software on the host. To do that once the IDS camera manager launched click on the "daemon control" then enable the docker

Screenshot from 2022-05-16 10-54-17

Part of the solution was inspired from this post https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwjSxYDQyd33AhULvaQKHWSwBw4QFnoECBcQAQ&url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F60195652%2Fhow-can-i-run-a-service-inside-a-docker-container-to-get-feed-from-a-ids-ueye-ca&usg=AOvVaw1Q7XH8ky5hVMUulfAr1D_C