PIDtoolbox icon indicating copy to clipboard operation
PIDtoolbox copied to clipboard

Return linux builds

Open mituritsyn opened this issue 2 years ago • 33 comments

there are linux pidtoolbox users, please don't ignore us

mituritsyn avatar Apr 09 '22 17:04 mituritsyn

I managed to get it to run on my machine (Manjaro) but it throws errors when loading the log files and just hangs. Not sure what to make of the error either "Index exceeds the number of array elements. Index must not exceed 0."

I'm only posting in the hopes that maybe we *nix-er's can help each other out.

ipetepete avatar Apr 17 '22 19:04 ipetepete

I managed to get it to run on my machine (Manjaro) but it throws errors when loading the log files and just hangs. Not sure what to make of the error either "Index exceeds the number of array elements. Index must not exceed 0."

I'm only posting in the hopes that maybe we *nix-er's can help each other out.

Hi, did you use latest available version? Try to place log file in main PTB directory along with blackbox_decode file

mituritsyn avatar Apr 19 '22 11:04 mituritsyn

Hello there,

@ipetepete, can you please share with us how you manage to make it work on Linux?

Regards,

kickfliph avatar May 04 '22 04:05 kickfliph

@kickfliph Well, I never did manage to get it to load the log files so I gave up. I had to download and install a trial version of Matlab and run PIDToolbox from within Matlab by executing the main file PIDToolbox.m

ipetepete avatar May 04 '22 16:05 ipetepete

Hello there,

@ipetepete, can you please share with us how you manage to make it work on Linux?

Regards,

it's pretty easy - you need to install matlab runtime then preload paths, for my system it looks like: $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/MATLAB/MATLAB_Runtime/v93/runtime/glnxa64/:/usr/local/MATLAB/MATLAB_Runtime/v93/bin/glnxa64/:/usr/local/MATLAB/MATLAB_Runtime/v93/sys/os/glnxa64/ afte you can just run pid toolbox $ ./PIDtoolbox

mituritsyn avatar May 04 '22 16:05 mituritsyn

@mituritsyn I get errors when trying to install the runtime: terminate called after throwing an instance of 'std::runtime_error' what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 127

ipetepete avatar May 04 '22 17:05 ipetepete

@ipetepete did you install runtime with pid toolbox binary? If memory serves me correctly, I downloaded it myself from the official website and installed it according to their instructions

mituritsyn avatar May 04 '22 17:05 mituritsyn

The Matlab runtime, and Matlab program are different things. The runtime only allows a user to run Matlab compiled programs. Matlab itself is a proprietary academic platform / programming language for math/science/engineering and is pretty expensive, not to mention you have to pay for each toolbox with separate licences. Octave is an open source platform that functions very similar to Matlab, and can run most Matlab .m files, scripts and functions, but not all, and somethings work pretty different from Matlab, but it's the closest that exists. Anyway, I apologize for not keeping up with the linux versions, but it is a lot of extra work (many details are quite different from the others), and I am sorry but there is not a lot of incentive to keep that going as regularly as the others. Once I am really happy with the working version, and I find time, I may consider a linux version. My apologies for the inconvenience.

bw1129 avatar May 04 '22 18:05 bw1129

Hello there,

@mituritsyn Thanks for that information, really appreciate it. I was able to install the Matlab runtime and export the path but got lost on what version of pidtoolbox you are using that gives you the ./PIDtoolbox to run it, I have downloaded all the different OS versions but I am not clear which one works for me.

Thanks for all the help,

Regards,

kickfliph avatar May 05 '22 02:05 kickfliph

@kickfliph you need PID Toolvox v0.45 it is the last vertion that support linux

mituritsyn avatar May 05 '22 07:05 mituritsyn

@bw1129 btw I've managed to adapt major functionality under Octave

image

mituritsyn avatar May 05 '22 07:05 mituritsyn

That’s awesome! There was an OpenGL issue with octave that resulted in really slow graphics. It used to be painful plotting. Is that resolved?

bw1129 avatar May 05 '22 11:05 bw1129

That’s awesome! There was an OpenGL issue with octave that resulted in really slow graphics. It used to be painful plotting. Is that resolved?

it was a proof of concept, i've had very little time and don't know when I'll be able to go back to refinement. all my changes are in my fork. there's only the basic functionality and I've achieved launching through a lot of crutches. so far the bottle-neck is in the smoothing functions. I haven't encountered any opengl problems yet.

mituritsyn avatar May 05 '22 12:05 mituritsyn

Thanks again,

So, I just download the _0.45 version for Linux and I just try to run it and I'm getting this errro[1], so I google it and I found this[2], so my question is: should I roll back the ML-runtime version to 2013a in order to make it work in Linux or its something else I'm doing wrong?

[1] $ ./PIDtoolbox ./PIDtoolbox: error while loading shared libraries: libmwlaunchermain.so: cannot open shared object file: No such file or directory

[2]https://www.mathworks.com/matlabcentral/answers/267562-how-can-i-resolve-this-mcc-runtime-error-cannot-open-shared-object-library#answer_211306

Regards,

kickfliph avatar May 05 '22 13:05 kickfliph

You have to use the same version of runtime in which the program was compiled. It’s simple as that. And to ensure you get that version of runtime, you should use the “my installer” app provided. It's also stated in the readme file, so if downloading it yourself, then use "version 9.3 (R2017b)"

bw1129 avatar May 05 '22 13:05 bw1129

Thanks again @bw1129,

I finally make it run, thanks again for all your help to all of you. I still have the libGL error message in the back[attached] of the running session, I have the missing library install but I don't understand why the error still showing.

Thanks one more time, really appreciate all your support.

Regards, Screenshot_20220505_102529

kickfliph avatar May 05 '22 14:05 kickfliph

The Matlab runtime, and Matlab program are different things. The runtime only allows a user to run Matlab compiled programs. Matlab itself is a proprietary academic platform / programming language for math/science/engineering and is pretty expensive, not to mention you have to pay for each toolbox with separate licences. Octave is an open source platform that functions very similar to Matlab, and can run most Matlab .m files, scripts and functions, but not all, and somethings work pretty different from Matlab, but it's the closest that exists. Anyway, I apologize for not keeping up with the linux versions, but it is a lot of extra work (many details are quite different from the others), and I am sorry but there is not a lot of incentive to keep that going as regularly as the others. Once I am really happy with the working version, and I find time, I may consider a linux version. My apologies for the inconvenience.

That's totally understandable. Would it be possible however, to provide some sort of guide in how to best try and compile the code in linux? Maybe a recommended Octave version so maybe some of us might be able to try and build some of the versions a bit easier.

Sol1du2 avatar May 11 '22 12:05 Sol1du2

@Sol1du2 unfortunately you need matlab license to build binaries. Octave not fully compatible with all matlab functions. You can try this project but it is on a draft stage: https://github.com/mituritsyn/OctavePIDtoolbox

mituritsyn avatar May 11 '22 14:05 mituritsyn

@Sol1du2 unfortunately you need matlab license to build binaries. Octave not fully compatible with all matlab functions. You can try this project but it is on a draft stage: https://github.com/mituritsyn/OctavePIDtoolbox

Goes to show you how much I know about Matlab :laughing: Thanks for the reply!

I'm now wondering if anyone has tried it with wine. I might give it a shot one of these days.

Sol1du2 avatar May 11 '22 14:05 Sol1du2

My PTB run script, if it helps anyone: https://gist.github.com/nerdCopter/022709392824295846b5ce0b0992b578

@mituritsyn , are you in PTB Discord, i have how-to Q&A for OctavePIDtoolbox

nerdCopter avatar May 19 '22 13:05 nerdCopter

@kickfliph , your problem is likely drivers. if you are Debian/Ununtu, then i think sudo apt install i965-va-driver and i can list the mesa packages i have installed, but i dont know which is pertinent to your issue (probably just mesa-va-drivers):

$ aptitude search mesa | grep ^i
i A libegl-mesa0 - free implementation of the EGL API -- Mesa vendor library
i A libegl1-mesa - transitional dummy package
i  libegl1-mesa-dev - free implementation of the EGL API -- development files
i  libgl1-mesa-dev - transitional dummy package
i A libgl1-mesa-dri - free implementation of the OpenGL API -- DRI modules
i  libgl1-mesa-dri:i386 - free implementation of the OpenGL API -- DRI modules
i A libgl1-mesa-glx - transitional dummy package
i  libgl1-mesa-glx:i386 - transitional dummy package
i A libglapi-mesa - free implementation of the GL API -- shared library
i A libglapi-mesa:i386 - free implementation of the GL API -- shared library
i  libgles2-mesa-dev - transitional dummy package
i A libglu1-mesa - Mesa OpenGL utility library (GLU)
i A libglu1-mesa-dev - Mesa OpenGL utility library -- development files
i A libglx-mesa0 - free implementation of the OpenGL API -- GLX vendor library
i A libglx-mesa0:i386 - free implementation of the OpenGL API -- GLX vendor library
i  libosmesa6 - Mesa Off-screen rendering extension
i  mesa-opencl-icd - free implementation of the OpenCL API -- ICD runtime
i  mesa-utils - Miscellaneous Mesa GL utilities
i  mesa-utils-extra - Miscellaneous Mesa utilies (opengles, egl)
i A mesa-va-drivers - Mesa VA-API video acceleration drivers
i  mesa-vdpau-drivers - Mesa VDPAU video acceleration drivers
i A mesa-vulkan-drivers - Mesa Vulkan graphics drivers
i A mesa-vulkan-drivers:i386 - Mesa Vulkan graphics drivers

nerdCopter avatar May 19 '22 14:05 nerdCopter

I just compiled a linux version of PTB 0.55, it's under releases. Can someone let me know if it is working?

bw1129 avatar May 19 '22 14:05 bw1129

Nice! I'll try it later on today. I'll keep you posted.

kickfliph avatar May 19 '22 14:05 kickfliph

[solved, see below] mostly working. spectral analyzer frozen, has my mouse-cursor "spinning" (two different EmuF logs). i can communicate in Discord if preferred. image

nerdCopter avatar May 19 '22 15:05 nerdCopter

@nerdCopter you must have the wrong debug mode. send me the logfile

bw1129 avatar May 19 '22 15:05 bw1129

@nerdCopter you must have the wrong debug mode. send me the logfile

sent via Discord. debug mode is gyro_scaled

nerdCopter avatar May 19 '22 15:05 nerdCopter

For completeness, posting the solution here as well: Source: https://www.mathworks.com/matlabcentral/answers/363058-deploying-standalone-matlab-exe-on-a-linux-based-server Last comment said rename the MATLAB file libmwcoder_types.so to something else. File location depending where you installed it -- usually in usr/local/MATLAB/MATLAB_Runtime/v93/bin/glnxa64/ PTB 0.55 will then work.

nerdCopter avatar May 19 '22 18:05 nerdCopter

image

Throws some warnings and errors but working fine:

libGL error: MESA-LOADER: failed to open radeonsi: /usr/local/MATLAB/MATLAB_Runtime/v93/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib64/dri/radeonsi_dri.so) (search paths /usr/lib64/dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open radeonsi: /usr/local/MATLAB/MATLAB_Runtime/v93/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib64/dri/radeonsi_dri.so) (search paths /usr/lib64/dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open swrast: /usr/local/MATLAB/MATLAB_Runtime/v93/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /usr/lib64/dri/swrast_dri.so) (search paths /usr/lib64/dri)
libGL error: failed to load driver: swrast
Warning: Integer operands are required for colon operator when used as index
> In PTSpec2d (line 23)
  In PTplotSpec2D (line 63)
  In waitforallfiguresclosed (line 9)

For completeness, posting the solution here as well: Source: https://www.mathworks.com/matlabcentral/answers/363058-deploying-standalone-matlab-exe-on-a-linux-based-server Last comment said rename the MATLAB file libmwcoder_types.so to something else. File location depending where you installed it -- usually in usr/local/MATLAB/MATLAB_Runtime/v93/bin/glnxa64/ PTB 0.55 will then work.

thanks solved spectral analyzer freeze

mituritsyn avatar May 20 '22 06:05 mituritsyn

Great thanks! Yea the real reason for the psd line plot errors is that script is where the filter/set point-gyro delay is calculated from a Matlab function called ‘finddelay’. But in fact the real problem is a function that ‘finddelay’ uses called ‘xcorr’. Xcorr is a cross correlation function and it’s not working properly in the version of Matlab I have for Linux. Not surprising, it’s a bit dated (2017). Once I update that it should be fine. But for now at least there’s a working 0.55 linux version. I will also explore Ptb in octave again as well. It’s been a while since I ran it and it was pretty slow in previous versions. Will try it again soon

bw1129 avatar May 20 '22 11:05 bw1129

For completeness, posting the solution here as well: Source: https://www.mathworks.com/matlabcentral/answers/363058-deploying-standalone-matlab-exe-on-a-linux-based-server Last comment said rename the MATLAB file libmwcoder_types.so to something else. File location depending where you installed it -- usually in usr/local/MATLAB/MATLAB_Runtime/v93/bin/glnxa64/ PTB 0.55 will then work.

Chiming in with the same error symptoms on the spectral analyzer window, but with Windows 10 using the provided runtime in the 0.55 release zip. In this case, the file %PROGRAMFILES%\MATLAB\MATLAB Runtime\v93\bin\win64\coder_types.dll needs to be renamed/removed.

Rejdukien avatar Jun 22 '22 23:06 Rejdukien