c++cameraodroidbasler

Setting FPS for Basler dart in pylon ARM build


I'm trying to get to work with a Basler dart-3840 on an ODROID device. I've installed the pylon 7.3.0 Camera Software Suite Linux ARM 64 bit - Debian Installer Package.

I can succesfully compile a project, request device information (like Serialnumber, device name etc) and capture images of the basler camera.

But I'm now trying to set the Framerate (and Height/Widht/OffsetX/OffsetY), but I'm running in some issues. As these values can't be found.

This was my first try:

#include <pylon/PylonIncludes.h>
int main( int /*argc*/, char* /*argv*/[] )
{
    PylonInitialize();
    CTlFactory& tlFactory = CTlFactory::GetInstance();
    CInstantCamera camera( tlFactory.CreateFirstDevice() );
    camera.AcquisitionFrameRateEnable.SetValue(true);
    camera.AcquisitionFrameRate.SetValue(30.0);
}

But this gives the compiler errors:

error: 'class Pylon::CInstantCamera' has no member named 'AcquisitionFrameRateEnable'
error: 'class Pylon::CInstantCamera' has no member named 'AcquisitionFrameRate'

I've also tried to change these parameters using a nodemap: This was my first try:

#include <pylon/PylonIncludes.h>
int main( int /*argc*/, char* /*argv*/[] )
{    PylonInitialize();
     CTlFactory& tlFactory = CTlFactory::GetInstance();
     CInstantCamera camera( tlFactory.CreateFirstDevice() );
     INodeMap& nodemap = camera.GetNodeMap();
     CFloatParameter acquisitionFrameRate(nodemap, "AcquisitionFrameRate");
     acquisitionFrameRate.SetValue(30.0);
}

But this gives a runtime Node is not writable. exception

Finally I've tried searching the libraries for AcquisitionFrameRate and found out that it is found in the _BaslerUsbCameraParams.h

So my last try was to add a CBaslerUsbInstantCamera to change the AcquisitionFrameRate

#include <pylon/PylonIncludes.h>
#include <pylon/usb/PylonUsbIncludes.h>
int main( int /*argc*/, char* /*argv*/[] )
{
    PylonInitialize();
    CTlFactory& tlFactory = CTlFactory::GetInstance();
    CInstantCamera camera( tlFactory.CreateFirstDevice() );
    CBaslerUsbInstantCamera* usbCamera = (CBaslerUsbInstantCamera*)&camera;
    usbCamera->AcquisitionFrameRateEnable = true;
    usbCamera->AcquisitionFrameRate = 30;
}

But this gave a runtime Segmentation Fault crash on the setting of the AcquisitionFrameRateEnable

Hopefully somebody can inform me what I'm doing wrong here.

I'm using:

Device: ODroid, arm
IDE: VSCode - Remote debugging over SSH
Compiling: CMake (I can add CMakeLists.txt when needed)
Pylon 7.3.0 Camera Software Suite Linux ARM 64 bit

Solution

  • The rubber duck debugging did it's work.

    The issue is resolved by directly creating an CBaslerUsbInstantCamera and first opening the camera before trying to change the parameters.

    #include <pylon/PylonIncludes.h>
    #include <pylon/usb/PylonUsbIncludes.h>
    int main( int /*argc*/, char* /*argv*/[] )
    {
        PylonInitialize();
        CTlFactory& tlFactory = CTlFactory::GetInstance();
        CBaslerUsbInstantCamera camera( tlFactory.CreateFirstDevice() );   //Create CBaslerUsbInstantCamera instead of CInstantCamera 
        camera.Open();  //Open camera before changing parameters
        usbCamera.AcquisitionFrameRateEnable = true;
        usbCamera.AcquisitionFrameRate = 30;
    }
    

    The nodemap way does also work using the CBaslerUsbInstantCamera and Opening the camera

    #include <pylon/PylonIncludes.h>
    #include <pylon/usb/PylonUsbIncludes.h>
    int main( int /*argc*/, char* /*argv*/[] )
    {
        PylonInitialize();
        CTlFactory& tlFactory = CTlFactory::GetInstance();
        CBaslerUsbInstantCamera camera( tlFactory.CreateFirstDevice() );   //Create CBaslerUsbInstantCamera instead of CInstantCamera 
        camera.Open();  //Open camera before changing parameters
    
        CFloatParameter acquisitionFrameRate(nodemap, "AcquisitionFrameRate");
        acquisitionFrameRate.SetValue(30.0);
    }