Thursday, March 24, 2011

LabVIEW RESTful Web Services

Here are some notes about another LabVIEW example that I thought was really good:

Weather Station Monitor Example

1)  Deploy weather data.lvlib
2)  Run Update Weather Data VI
3)  Open the Tools>>Options dialog. Click on the Configure Web Application Server button and ensure that the Application Web Server is enabled.
4)  Click OK and save changes.
5)  Build and Deploy the Weather Monitor RESTful Web Service from the Build Specifications item in the project.
6)  Open a web browser on the local PC and browse to the following URL:  http://localhost:8080/weather/station/2507987

NOTE: The default port that the NI Application Web Server listens on is 8080. If this port has been modified, the above URLs need to change to use that port.

I hope to see more work in the next few years solving problems with distributed robots that are Internet connected, here is how easy it was to make this example work:

1. OK.

2. This VI is generated the simulated weather data (obviously this gets really cool if there are sensor networks deployed that are reporting real data).

3. OK.  Small note, I had to install Silverlight to get the web configuration tool.

Here is the first screen:

Here is the web configuration tool:

4. OK. - not too much to say on this one.

5. OK - not too much to say on this one, either.

6. OK.
Here is what the page looks like:

Here is what the source of the page looks like:

<html><body><h1>URL: /weather/</h1><h2>Output Terminals</h2><table  border=1.0><tr><th>Terminal Name</th><th>Terminal Value</th></tr><tr><td>Pressure</td><td>1004.651939</td></tr><tr><td>Temperature</td><td>27.198859</td></tr><tr><td>Wind Speed</td><td>2.933509</td></tr><tr><td>Station ID</td><td>2507987</td></tr><tr><td>Wind Direction</td><td>257.230547</td></tr></table></body></html>

So, the example is pretty easy.  Building an application like this from scratch with real sensors would obviously not be quite as simple as the few clinks that it took to make this work.  However, it seems clear that some really powerful applications can be built with this technology.  All I need to do now is learn more LabVIEW!