Does anyone have a good write up or example on how to record data in labview?
What are you trying to record? It will matter on how you do it.
all i really want to do is write to a text document so that i can view it in excel later. I am basically wanting to record data so that i can look at it later to find problem
We experimented with this a few years ago and found there are many ways within LV to capture or log data. Many of them can interfere with the operation of your code, slowing it down / making it non-deterministic.
We landed on the TDMS file as it is very fast, efficient storage (binary files), and is easy to post process with Excel (the file maintains meta data and there are interfaces designed for Excel). This is also what NI would recommend, I believe, for data logging. We routinely collect data for performance analysis during competition as well as addressing developmental issues during code design.
Data logging has given us good analytical capability, and provides for some great teaching moments with interested students. It has been key to resolving what I call the “What just happened?” scenario.
Along with TDMS, good design will require something like the Producer/Consumer architecture with real-time FIFOs for communicating between loops. It’s worthwhile to read up on these concepts if you’re not already familiar with them.
I’ll see if I can post an example.
In our Marvin T code release, we have logging VIs that you can use. We log all kinds of data in that code. Look in periodic tasks to find examples you can use. We log many files at once on that platform all while usually “running live”. We never had any CPU or response issues.
As mentioned, LV has rich file I/O support and TDMS is a highly tuned API specifically for this and you can download an Excel plugin. But text and binary files have their purpose too.
One other option is to log on the dashboard computer. If you click the red circle on the bottom right of the dashboard, all network table variables, video, and other DS inputs, will be logged, though by default at 10Hz. Later you can review the data in the dashboard. The code for parsing the file is included, but it is intertwined with network table protocol. Parsing it is clearly possible, but not the same as a text file.
What I did last year (Java, so I can’t really help you with the specifics) is write a little piece of code to send all the datapoints I could get into a NetworkTables object and then view them on my laptop while the robot was driving. It’s a lot easier to look for problems in realtime.
*Let me guess: TDMS = Telemetry Data Management System?
Technical Data Management Streaming, I believe.
Yup. Technical… It was actually developed by Diadem, a German automotive test and measurement company that was acquired by NI. It was primarily aimed at automotive logging needs.