Jump to content

thenoob94

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by thenoob94

  1. I have implemented an fft in c and compiled it to an .so. When I run the c program by itself it is twice as fast as the labview implementation. Is there any way to make this faster in labview? maybe some settings for loading .so?

    thank you in advance

    question.png

  2. I'm trying to use the labview FFT however it's extremely slow compared to FFTW... I have wrapped the fftw in lv however it's rather inconsistent with regards to the time it takes to calculate. In plain c it's not inconsistent at all so I suppose the issue has something to do with the way the memory is allocated when I use it in lv. Any ideas how to solve this?

  3. I've fully wrapped a genicam sdk in lv. The images are being read out in a loop. I would like to read the images out via another vi. The issue at the moment is, that the images are being passed after the loop is done.. I've looked into produce/consumer but then the aquisition fails. The image how I read out the data is attached. I'm curious how the lv-pros would pass each frame to antoher vi?quesion_lv.png.34d7ebb73a0ce07676558cb1ce077575.png

  4. Thanks to this amazing community I've almost fully wrapped a gige-cam api in labview. I was able to pass clusters as structs to function. My next question would be how to tackle more complex structs? I have the C-struct and want to model this in LV and pass it to the function. I know how to model simple structs but this one has a nested structure and makes use of a union. I tried to model it like the following but this doesn't seem to work. My program is not crashing but my .so function returns an unkown error.

     

    struct.png.c306f654b351bd2dff7c282406a90df1.pnglabview_implementation.png.658820aca1d4ae732511b0f123d241f4.png

  5. I want to pass a struct to the library function.

    this is the code from the function:

    EXTERN_C SV_GEN_SDK_API SV_RETURN SVLibSystemGetInfo(uint32_t uiIndex, SV_TL_INFO *pInfoOut);


    /** SVLibSystemOpen
       *  Opens the System module and puts the instance in the phSystem handle. This allocates all system wide
       *  resources. A System module can only be opened once.
       *  @param [in] uiIndex  Zero-based index of loaded GenTLProducers.
       *  @param [out] phSystemOut System module handle.
       *  @return success or error code
      */

    this is the struct I want to pass to the function:

    typedef struct _SV_TL_INFO
    {
        char id[SV_STRING_SIZE];
        char vendor[SV_STRING_SIZE];
        char model[SV_STRING_SIZE];
        char version[SV_STRING_SIZE];
        char tlType[SV_STRING_SIZE];
        char name[SV_STRING_SIZE];
        char pathName[SV_STRING_SIZE];
        char displayName[SV_STRING_SIZE];
        uint32_t gentlVersionMajor;
        uint32_t gentlVersionMinor;
        int32_t encoding;
    }SV_TL_INFO, *PSV_TL_INFO;

     

    1.png shows my labview architecture

    2.png show how I call this function

     

    I tried almost all of the parameter permutations to call this function but my program keeps on crashing. I'm on debian.

     

     

     

    1.png

    2.png

  6. I have the following c function:

    extern "C"{

    int getInterfaces( uint32_t numInterface, void* g_hSystem);
        
    }

    int getInterfaces( uint32_t numInterface, void* g_hSystem)
    {
        //Get Interface
        bool bChanged = false;

        SV_RETURN ret = SVSystemUpdateInterfaceList(g_hSystem, &bChanged, 1000);
        if (SV_ERROR_SUCCESS != ret)
        {
            printf("%s SVSystemUpdateInterfaceList failed!:%d\n", __FUNCTION__, ret);
            return -1;
        }

        ret = SVSystemGetNumInterfaces(g_hSystem, &numInterface);
        if (SV_ERROR_SUCCESS != ret)
        {
            printf("%s SVSystemGetNumInterfaces failed!:%d\n", __FUNCTION__, ret);
            return -1;
        }

        if (0 == numInterface)
        {
            printf("%s No Interface Available!\n", __FUNCTION__);
            return -1;
        }
    }

     

    How would I create "void* g_hSystem" in Labview?

     

     

     

     

     

  7. os: Debian

     

    I've written a c Function and compiled it to a shared object. I call the function in labview and it executes just fine. The function modifies a ".cti" file. When I want to execute the function a second time it fails because labview still takes ownership of the process even after it terminates. When I run the function without labview this error doesn't occur..

     

    This is my function:

    extern "C"{
        int InitSDK();
    }

    int InitSDK()
    {
        string ctiPath;
        string genicamPath;
        string genicamCachePath;
        string clProtocolPath;

    #if defined (WIN32)

        char buffer[1024] = { 0 };
        int res = GetEnvironmentVariableA("GENICAM_GENTL64_PATH", buffer, sizeof(buffer));
        if (0 == res)
            return false;

        ctiPath = string(buffer);

        memset(buffer, 0, sizeof(buffer));
        res = GetEnvironmentVariableA("SVS_GENICAM_ROOT", buffer, sizeof(buffer));
        if (0 == res)
            return false;

        genicamPath = string(buffer);

        memset(buffer, 0, sizeof(buffer));
        res = GetEnvironmentVariableA("SVS_GENICAM_CACHE", buffer, sizeof(buffer));
        if (0 == res)
            return false;

        genicamCachePath = string(buffer);

        memset(buffer, 0, sizeof(buffer));
        res = GetEnvironmentVariableA("SVS_GENICAM_CLPROTOCOL", buffer, sizeof(buffer));
        if (0 == res)
            return false;

        clProtocolPath = string(buffer);

        SV_RETURN ret = SVLibInit(ctiPath.c_str(), genicamPath.c_str(), genicamCachePath.c_str(), clProtocolPath.c_str());
    #elif defined(__linux__)
        ctiPath ="./";
        SV_RETURN ret = SVLibInit(ctiPath.c_str(), NULL, NULL, NULL);

    #elif defined(__APPLE__) && defined(__MACH__)
        ctiPath = "/Library/Frameworks/SVGenSDK.framework/Versions/2.5.8/Libraries/cti";
        SV_RETURN ret = SVLibInit(ctiPath.c_str(), NULL, NULL, NULL);
    #endif
        if (SV_ERROR_SUCCESS != ret)
        {
            printf("SVLibInit Failed! :%d", ret);
            return -1;
        }
        
        printf("Init worked \n");
        return 0;
    }

     

     

  8. CMakeLists.txtThis is what I'm working with at the moment. The image aquisition works out fine. The only issue is that it's not event driven. Instead of only grabbing an image when a new one has been written to shared memory I'm grabbing the image constantly. I know what @Rolf Kalbermatter means by refactoring the code into the functions. The issue is that in order to grab a frame I new to access the camera(aravis "object") which is instanciated in the connection process. I don't see how I could wrap this so I can make use of these functions in Labview.

    main.c client.c test.vi

  9. 39 minutes ago, Rolf Kalbermatter said:

    The best approach would be to take that code and make your own shared library from it. Export functions to Open the device, Grab Images and Close the device. Basically you do not want an executable with a main function but instead you want a shared library that seperates those indvidual functions out.

    Why not call the underlying library directly through the Call Library Node you may ask. Because you have a callback function in there! It may be possible otherwise but that callback really is a no go for direct LabVIEW interfacing.

    I have compiled my code to an .so file and I'm trying to call it as a shared library. Since the data aquisition is running constantly the function never returns. So my vi freezes. Is it possible to have a function run continuously in Labview? Otherwise the function for the image aquisition has to be resarted each time I want to grab a frame. How would you implement opening the device and accessing the buffer?

  10. I am trying to read in an image via opencv pass the pointer to lv. Then I want to load the image from the pointer and render it in lv. How would I do this? I am running linux so there is no vision module and no IMAQ.

    I also thought about passing the image as an array to lv but there seems to be no option to turn the array to an image that could be rendered in lv.

    Any suggestions?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.