basler / gst-plugin-pylon

The official GStreamer plug-in for Basler cameras
BSD 3-Clause "New" or "Revised" License
40 stars 9 forks source link

Location of the camera registration cache file #89

Closed goncalog closed 5 months ago

goncalog commented 5 months ago

Hello,

Where could one find the camera registration cache file (from your docs: "The camera features are registered dynamically to gstreamer. This registration is executed once the first time a camera model is used in gstreamer and can take up to ~10s. The registration information is cached in the filesystem to speed up subsequent uses of the camera.")?

I'm struggling to reach/see the camera from a Docker container despite being able to reach/see it from the host: Host -

Element Properties:
  blocksize           : Size in bytes to read per buffer (-1 = default)
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 4294967295 Default: 4096
  cam                 : The camera to use.
                        According to the selected camera different properties will be available.
                        These properties can be accessed using the "cam::<property>" syntax.
                        The following list details the properties for each camera.
    Basler daA1920-160uc (40093492) Camera: 

Container -

Element Properties:
  blocksize           : Size in bytes to read per buffer (-1 = default)
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 4294967295 Default: 4096
  cam                 : The camera to use.
            According to the selected camera different properties will be available.
            These properties can be accessed using the "cam::<property>" syntax.
            No valid cameras where found connected to the system.

And I suspect it could be because that file is missing from the container (as I didn't copy it across).

Thank you for the help!

goncalog commented 5 months ago

It seems to be in $HOME/.cache/gstpylon/. Moving it to the docker container doesn't fix the issue. Still can't see the camera from the container.

Could it be a docker network issue like here: https://github.com/basler/pypylon/issues/123?

goncalog commented 5 months ago

We're using an USB camera (Basler daA1920-160uc), so running the container with --privileged works. But is there an alternative to this we could use in production?

thiesmoeller commented 5 months ago

To access USB devices from a container environment has multiple options:

Generic and also being able to capture Plug&Play interaction:

docker run --rm -ti --privileged -v /dev/bus/usb/:/dev/bus/usb <container>

Specific: identify bus location of your device

$lsusb

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 013: ID 2676:ba02 Basler AG ace
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

identify bus location of your device ( can be scripted of course )

Here: 002:013

docker run --rm -ti --device /dev/bus/usb/002/013 <container>

goncalog commented 5 months ago

thank you!