<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: UDP data format in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147169#M504792</link>
    <description>&lt;P&gt;Yes, I should be able to attach it, it's on my other computer at the moment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data in the packet is essentially 6DOF position data and then some vehicle ID and status information. I think the correct order should be [Vehicle ID, Lat, Long, Alt, Phi, Theta, Psi, Status, Alive] and that is it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy way in Labview to flatten it from an ASCII string to a binary string then?&lt;/P&gt;</description>
    <pubDate>Sun, 13 Jun 2010 08:25:03 GMT</pubDate>
    <dc:creator>mattbiegner22</dc:creator>
    <dc:date>2010-06-13T08:25:03Z</dc:date>
    <item>
      <title>UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147128#M504773</link>
      <description>&lt;P&gt;My apologizes if something similar to this question has been posted before.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am an aerospace engineer who has been tasked with designing a small labview program to parse a text file with an aircraft's 6DOF position data and send it via UDP to a simulation at a specified run rate. I have the application working, however I am having a hard time constructing the UDP data that our simulation is looking for. Since I'm an AE I know enough about data types to get by, but I'm not familiar with UDP very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem that I am having is that the simulation is looking for a different data type than ASCII string. The proceeding image shows two separate packets that were grabbed when running wireshark on the simulation server. The top portion of the image is the packet that the sim is looking for. You can see that the hex yields invalid or strange ASCII characters, which leads me to believe that it does not want ASCII data. The bottom portion is the packet I'm sending it through labview, which is an ASCII string. The problem is that I don't know what kind of data the sim is looking for, and I can't get a hold of the guy who programmed it so I'm hoping someone here can shed some light on it. Would it maybe be looking for the data in the UDP packets to be a byte string?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And my second question is that since the sim is not looking for an ASCII string and since the UDP write block in labview will only send a string, how do I convert an ASCII string to a byte string or whatever data format my sim is looking for? &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance! &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/9d4fca85691e2b23fc7ab99342a2929d73771b14/68747470733a2f2f6e692e6c69746869756d2e636f6d2f74352f696d6167652f736572766572706167652f696d6167652d69642f313635363369453435303345463937463336413141312f696d6167652d73697a652f6f726967696e616c3f763d6d70626c2d312670783d2d31" border="0" alt="scan0002.jpg" title="scan0002.jpg" align="CENTER" /&gt; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jun 2010 22:39:41 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147128#M504773</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-12T22:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147142#M504780</link>
      <description>&lt;P&gt;If you don't know what type of data the application is looking for, how are we going to be able to help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is you are snagging looks like it would all be valid data, but you need information to interpret it.&amp;nbsp; It could be&amp;nbsp;a set of numbers transmitted it as any number of datatypes: sgl precision float (4 bytes) , double precision float (8 bytes), various signed or unsigned integer values ( 8 bit , 16 bit, or 32 bit).&amp;nbsp; All the zero bytes might be just space fillers to complete a packet, or the remaining unused portion of a data structure (e.g. only 10&amp;nbsp;elements were used out of a 32 element array, the remaining elements were padded with nulls.&amp;nbsp;....)&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2010 01:40:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147142#M504780</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2010-06-13T01:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147144#M504782</link>
      <description>&lt;P&gt;I'm looking at the plugin code and I &lt;EM&gt;think&lt;/EM&gt; it's looking for a byte array, though I'm not sure. The code uses ioctlsocket calls and recvfrom calls to get the UDP data which I'm not at all familiar with, if that helps. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As for actual data types, it's varied. There are identifiers that are being passed as ints and the 6DOF position data is being passed as doubles. &lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by mattbiegner22 on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 06-12-2010&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 08:59 PM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 13 Jun 2010 01:59:30 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147144#M504782</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-13T01:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147167#M504791</link>
      <description>&lt;P&gt;I agree with Ravens analysis. It looks like binary data and all you need to know is how to flatten/unflatten it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you attach the packet capture as a text file instead of an image?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what the data in that particular packet is?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2010 07:33:15 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147167#M504791</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-06-13T07:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147169#M504792</link>
      <description>&lt;P&gt;Yes, I should be able to attach it, it's on my other computer at the moment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data in the packet is essentially 6DOF position data and then some vehicle ID and status information. I think the correct order should be [Vehicle ID, Lat, Long, Alt, Phi, Theta, Psi, Status, Alive] and that is it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy way in Labview to flatten it from an ASCII string to a binary string then?&lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2010 08:25:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147169#M504792</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-13T08:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147215#M504815</link>
      <description>&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;mattbiegner22 wrote:&amp;nbsp;&lt;P&gt;Is there an easy way in Labview to flatten it from an ASCII string to a binary string then?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;From the LabVIEW perspective, there is no difference between as ASCII string and a binary string. Everything is just a string. &amp;nbsp;LabVIEW and UDP does not care if the characters are humanly readable or not.;)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;So, yes, what you need to do will be trivial. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;All you need to do is flatten your raw data to a string and unflatten at the other end to get the data back as numerics.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If all fields are fixed, you would just create a matching cluster, then flatten to string (or vice versa at the other end).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;(&lt;A href="http://forums.ni.com/ni/attachments/ni/170/228099/2/ParseMultiple.vi" target="_self"&gt;Here&lt;/A&gt;&amp;nbsp;is a simple example of the cluster method, originally posted&amp;nbsp;&lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;view=by_date_ascending&amp;amp;message.id=228099#M228099" target="_self"&gt;in this old thread&lt;/A&gt;. Of course you seem to be more concerned about the left side of the problem side, where you would simply form the cluster and flatten to string (not shown)).&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Often you can even use typecast. A simple explanation on how these operations work can be found&amp;nbsp;&lt;A href="http://forums.ni.com/ni/board/message?board.id=170&amp;amp;view=by_date_ascending&amp;amp;message.id=409903#M409903" target="_self"&gt;here&lt;/A&gt;.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;See how far you get. &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sun, 13 Jun 2010 17:33:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147215#M504815</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-06-13T17:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147242#M504835</link>
      <description>&lt;P&gt;Ok, so here's what I'm trying to do then, let me know if this makes sense:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm reading a text file line by line. For each line it reads, it gets passed to a spreadsheet string to array block to build an array of data that is delimited by commas. I then pass that array to a decimate array block to get each signal, which I then convert to it's respective data type. So, for example, all the status indicators would be converted to int8 and all the 6DOF position data would remain as double, since that is what the simulation reads. I then pass each signal to a typecast to convert it to binary, and then output that to a concatenate string block and then to the UDP write block. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can post an example of the code that I have so far when I get to my other PC. &lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2010 21:58:23 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147242#M504835</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-13T21:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147247#M504840</link>
      <description>&lt;DIV&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;mattbiegner22 wrote: &lt;BR /&gt;&lt;P&gt;I can post an example of the code that I have so far when I get to my other PC.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Yes, please do.&lt;/DIV&gt;</description>
      <pubDate>Sun, 13 Jun 2010 22:33:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147247#M504840</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-06-13T22:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147248#M504841</link>
      <description>&lt;P&gt;Ok so pretty much everything inside of that inner most case structure is the UDP data construction method I'm using. I'm giving the program the capability to output UDP to two different simulation servers, one which accepts an ASCII string as data and the other which requires the data to be typecast to binary. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I haven't hooked up the status indicators yet (the ints), but right now I'm just trying to get it to send data in the correct format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Also, when I run the labview with the typecasts I get a UDP data in the format "@As&amp;#26;Ò&amp;#19;]«À]vÞ&amp;nbsp;3çŽ@„ì¥Xê|á"; is this indicative that it is binary? &lt;/P&gt;</description>
      <pubDate>Sun, 13 Jun 2010 22:42:47 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147248#M504841</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-13T22:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147249#M504842</link>
      <description>&lt;P&gt;Can you run the VI so the indicator "Current Data (Long, Lat, Alt, Phi, Theta, Psi):" contains typical data, make the current value default, then save and reattach the VI?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are doing some weird construtcs, firing the event structure from a timed loop. I would get rid of the event structure and run everything inside the timed loop. An event structure needs to be on the top diagram, and not buried inside inner loops and case structures, especially since you are remotely firing it every 100ms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You also have some &lt;STRONG&gt;serious race conditions&lt;/STRONG&gt; due to the abuse of local variables. In the section shown in the image, you are reading from the same local (i) in parallel and writing to it once. Since there is no data dependency, these operations can occur in any random order, so the "i" used to get the line might not be what is displayed and it could be the original or incremented value. Use an integer (blue!) &lt;STRONG&gt;shift register&lt;/STRONG&gt; instead.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://forums.ni.com/ni/attachments/ni/170/504842/1/localabuse.PNG" border="0" align="CENTER" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not really look at the rest of the code, but my comments are probably just the tip of the iceberg salad. &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by altenbach on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 06-13-2010&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 04:21 PM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 13 Jun 2010 23:21:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147249#M504842</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-06-13T23:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147251#M504843</link>
      <description>&lt;P&gt;What do you mean by have the Current Data indicator show typical data? It's just an FYI to show what line of data labview is reading.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the data that should be read in by labview though. &lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by mattbiegner22 on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 06-13-2010&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 06:28 PM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 13 Jun 2010 23:28:15 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147251#M504843</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-13T23:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147252#M504844</link>
      <description>&lt;P&gt;I just need to see how a typical string looks like. If you want, just copy/paste a few lines from the datafile here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT class="Apple-style-span" color="#FF0000"&gt;EDIT: OK, got it. Thanks!&amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by altenbach on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 06-13-2010&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 04:31 PM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 13 Jun 2010 23:31:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147252#M504844</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-06-13T23:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147253#M504845</link>
      <description>&lt;PRE&gt;-117.857338,34.899256,669.580733,0,0,0&lt;BR /&gt;-117.857338,34.899256,669.580733,0,0,0&lt;BR /&gt;-117.857338,34.899256,669.580733,0,0,0&lt;BR /&gt;-117.857338,34.899256,669.580733,0,0,0&lt;BR /&gt;-117.857338,34.899256,669.580733,0,0,0&lt;BR /&gt;-117.857338,34.899256,669.580734,0,0,0&lt;BR /&gt;-117.857338,34.899256,669.580734,0,0,0&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Jun 2010 23:30:40 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147253#M504845</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-13T23:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147262#M504849</link>
      <description>&lt;P&gt;Here's what I would do instead (LabVIEW 8.6).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2010 00:26:23 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147262#M504849</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-06-14T00:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147270#M504854</link>
      <description>so is the typecast block converting it to binary data by default?</description>
      <pubDate>Mon, 14 Jun 2010 01:42:53 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147270#M504854</guid>
      <dc:creator>mattbiegner22</dc:creator>
      <dc:date>2010-06-14T01:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: UDP data format</title>
      <link>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147273#M504856</link>
      <description>Yes, if you don't wire the type input, you'll get a string.</description>
      <pubDate>Mon, 14 Jun 2010 02:03:02 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/UDP-data-format/m-p/1147273#M504856</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2010-06-14T02:03:02Z</dc:date>
    </item>
  </channel>
</rss>

