2008-08-13

GUI programming made easy in LabVIEW on Linux

by Forrest Sheng Bao http://fsbao.net

Linux is a great platform for engineering and scientific research. But making GUI software on Linux is not as easy and fast as it's on Windows. Microsoft made the Windows and the APIs for Windows programming. And, they made an IDE, Visual Studio. On Linux, we have so many APIs to use, GNOME, KDE, and so many IDE's to use. Gee, I want to focus on my algorithm. Wanna build beautiful graphic interface for your algorithm on Linux in just few minutes? Try LabVIEW. It's just a few clicks away.

I was fascinated to LabVIEW many years ago, when I was a sophomore. It's pretty easy for GUI designs. Just place a widget, actually an input of your program, on the front panel and then the input of the widget into another function on the back panel. The programming is totally graphic, just building a data flow. You can compile your program into dynamic libraries and link it to your LabVIEW program. Or you can write a code, in a syntax very similar to MATLAB, in the Formula Node of LabVIEW to perform complex computations.

Sometimes, we do research, made a discovery and we have to show our result as a computer program. Well, I bet you don't wanna waste time on making that software - you are not a programmer. So, I use LabVIEW.
Pretty easy, like an auto-focus camera.

The following image of a demo to show the affect of different noises to a sine signal in time and frequency domain. You can adjust the knob, scaler, switch or input box to change the behavior of the signal and noise and see what's going on. You will see the amplitude of noise could change the shape of the lobe, though the central frequency is control by a knob.

Everything on the interface, the front panel, is input or output of the program, shown as an icon in the back panel. The program will run and run, until you click the "Stop" button. So, isn't it while-loop? Yes, can you see a big grey frame outside the program? That is the while-loop. Can you see that "Stop" icon? That is "while stop". Can you see a switch on the front panel? It controls an if-else structure in the program. Of course, many standard OS interfaces are supported. See that small highlighted dialog box with "Click me to continue"? I just dragged one icon into my program and did some configuration.



Another benefit of LabVIEW is that you don't need to write different program for different platform. It could run seamlessly on Linux, Mac, Windows and Solaris. Also, you can compile them into an executable. So, you can distribute the program to people without LabVIEW.

The executables compiled from LabVIEW contains a dynamic library with LabVIEW APIs and a binary program regarding your components. Just run the executables and it will automatically load the LabVIEW APIs. Like this:



That is why sometimes I would like to use commercial development environment - I am not a software developer. Thus, I just need a fast way to solve the non-primary issues.

No comments: