alliedvision / gst-vimbasrc

Official vimbasrc element for use of Vimba with GStreamer
Other
11 stars 9 forks source link

Issues with running gst-vimbasrc with Supervisord #9

Open MajidTaheri opened 2 years ago

MajidTaheri commented 2 years ago

I have installed the Vimba SDK and I can now use VimbViewer. Likewise, I made a Python script for taking snapshots, and it works when I run the code from the terminal.

However, I have a problem when I run this code with Supervisor. It fails and throws the following error.

0:00:00.439251851 18115 0x56227e6c5160 DEBUG               vimbasrc gstvimbasrc.c:476:gst_vimbasrc_init:<GstVimbaSrc@0x56227e79f8e0> VmbStartup returned: TL not loaded.
0:00:00.439274294 18115 0x56227e6c5160 ERROR               vimbasrc gstvimbasrc.c:479:gst_vimbasrc_init:<GstVimbaSrc@0x56227e79f8e0> Vimba initialization failed

Is there any way to fix this problem?

NiklasKroeger-AlliedVision commented 2 years ago

VmbStartup returned: TL not loaded

Sounds like Vimba is unable to find any transport layers on the system. Since you are running the process with supervisord, could it be that the environment variables of your regular user are not used?

Transport Layers for GenICam are usually installed by adding a directory to the environment variable GENICAM_GENTL64_PATH (or GENICAM_GENTL32_PATH on 32bit systems). You could verify this by logging in as the user that performed the Vimba installation and running env | grep GENICAM. This should show you something along the lines of GENICAM_GENTL64_PATH=:/home/nkroeger/Vimba_5_1/VimbaGigETL/CTI/x86_64bit:/home/nkroeger/Vimba_5_1/VimbaUSBTL/CTI/x86_64bit (this is the result on my machine, the exact value depends on your installation directory and the transport layers you installed). The paths added to the environment variable are stored in files that are placed in /etc/profile.d/. Sourcing them sets the variable contents. For interactive shells this is automatically done when /etc/profile is sourced, but I guess supervisord does not do that.

So to fix your issue you would need to find a way to get those environment variables set correctly. supervisord seems to allow you to set environment variables vie the environment setting, which can be used to evaluate existing environment variables: https://stackoverflow.com/a/19611920. This might be a good solution. Alternatively you could try sourcing the settings files for the TLs you need from /etc/profile.d/ before executing the GStreamer pipeline. But I would first try out the environment setting of supervisord as this seems to be the recommended way.