This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Python Extension Module

I am trying to create a Python extension module to enable control of the Nirscan Nano EVM from a Raspberry Pi 3, using the API from the source code of the DLP Nirscan Nano GUI.

I am having trouble, mainly with importing said module. When attempting to import the module, I recieve an error saying that "dlpspec_calib_write_data()" is an undefined symbol.

I was unable to figure out why this error occurs, but I wasn't sure if I was going to use the function anyway, so I commented it out.

This ended up producing an error saying that "_Z9USB_WritePv" is an undefined symbol.

I must have overlooked something, but am unable to figure out what it is.

Does anyone have an idea of what I missed? 

nirscan.cpp

  • Hi Sam,

    If you could give a little time to look at the source code and what you've provided, that would be great. I'll see if I can figure out what's going on and give you some suggestions.

    Best,

    -Paul
  • Hi Sam,

    I can't seem to find where the error that you pointed out seems to originate from, which is strange.

    One thing I did notice is that you don't have an include statement for "spectrum.h". I would recommend that you look at the mainwindow.h file to make sure you're including all the right packages/headers, it looks like there are quite a few missing.

    Let me know if that helps at all.

    Best,
    Paul
  • Hi Paul

    Most of the packages I have excluded are from the Qt Framework.

    I was wondering if it is essential to install said framework, if all I want is to collect scanned data from the nirscan, without any GUI.

    Thanks

    Sam

  • Hi Sam,

    You should not need any of the Qt framework components, that is correct. But I noticed that a few of the Spectrum Library headers appeared to be missing, did you try to include those and see if that changes your results?

    -Paul
  • I have added the following header files to the .cpp:
    #include "spectrum.h"
    #include "dlpspec_scan.h"
    #include "regressiontest.h"
    #include "lmdfu.h"
    #include "Common.h"
    #include "verticallabel.h"
    #include "math.h"
    #include "dlpspec_calib.h"
    #include "dlpspec_util.h"
    #include "dlpspec_version.h"
    #include "dlpspec_helper.h"
    #include "dlpspec_setup.h"
    #include <fstream>
    #include <iostream>
    #include "lmusbdll.h"
    #include "firmware.h"
    #include "NNOSNRDefs.h"
    #include "usb.h"
    #include "API.h"
    #include "filepath.h"
    #include "scanconfiglist.h"
    #include "evm.h"

    As I have not included any of the Qt components, things like QDir, and QString, are left undefined. But because they are used in many of the header files, I am uncertain if they should be removed, or replaced, such as plot.h and filepath.h (included by spectrum.h).

  • And I assume that even with these added headers that the program still doesn't work?
    -Paul
  • No, it does not.

    I will continue to troubleshoot the problem, and will update if I have additional questions.

    Also, I am currently compiling the code with a Python script. I was wondering if the choice of compiler might contribute to the problem I am having?

    I understand that the GUI was compiled on Qt, but can the API be compiled into a program separately?

    Is there a recommended compiler?

    Thanks

    Sam

  • Hi Sam,

    You should be able to build the API separately. You'll need to include the Spectrum Library source, Serial.c, API.cpp and USB.cpp

    Here is the code from a batch file:
    cd /D %~dp0
    C:\Qt\Tools\mingw530_32\bin\gcc -c -Wall -DNO_TIMER_SUPPORT -I"..\..\Common\include" -I"hidapi-master/hidapi" -I"..\..\..\DLP_Spectrum_Library\src" Serial.c API.cpp usb.cpp
    C:\Qt\Tools\mingw530_32\bin\gcc -shared -o nano_api.dll Serial.o API.o usb.o -Lhidapi-master/windows/debug/ -lhidapi -L..\..\..\DLP_Spectrum_Library\src -llibdlpspec
    del *.o

    The compiler that I would recommend using is gcc.

    -Paul
  • Hi Sam,

    Would you mind sharing your python script when it’s working? I also have a nano that I’d love to use with a RPI3.

    Thank you, Sir.

    Dominick

    medic418@gmail.com