FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Logging TCP/IP Data onto target/host

Hello,

I am trying to log binary packets comming from an Optical Sensing Device in real-time.

the device is set in streaming mode and is sending data with TCP/IP protocol at 1Khz.

roboRio is connected to host through USB, and the optical instrument is connected through Ethernet port on roboRio.

I am able to successfully connect to the instrument and log the data packets.

but here are my problems:

1. (Target Data Logging Problem): Although the file generation is set to ''Replace or Create'' when I run the VI, the old logged data does not get replaced by new file, therefore everytime I want to run the VI I should change the file name to a new name which is not desirable

2.(Host Datalogging) : How can I Log the data on Host computer Hard Drive, ?

attached is the labview diagram screenshot that I've developed for this experiment.

Thanks for helping out

0 Kudos
Message 1 of 6
(6,405 Views)

Hi behii,

The first thing I notice is that you are using timed-loops in your communication code. This is not an appropriate use of a timed loop. They are reserved for critical, fast, local computations and elemental I/O. There should not be any network or file I/O in a timed loop in general (as their timing is not critical). Doing this is asking for trouble. Just use a normal while loop with a Wait VI in it.

Another thing I notice is that you apprear to be using a shared variable to move data between your loops. This is not a very good choice... you would be far better off using an RT FIFO.

1. Are you saying that the file cannot be opened? Or are you saying that the new data is appended to the old data? I'm not sure why that wouldn't replace in your case, but you could try deleting the file first using the delete VI.

2. Since you are connecting the sensor to the Ethernet and the Host to the USB, the host can't see the sensor directly. You can either bridge the two connections in Linux or you can simply write another TCP loop that sends the data to your host from your LabVIEW program.

Hope that helps.

0 Kudos
Message 2 of 6
(3,811 Views)

Hi behii,

1.  The file should be overwritten with the new data based on the code you have written.  Can you provide a more detailed description of the behavior you're currently seeing?

2.  There are a variety of ways to do this.  You could use a shared variable to send data to your host PC, and then use a producer/consumer structure to write that data to a file.  You could also use a Network Stream in a similar fashion.  Alternately, you can log the data on the roboRIO and transfer the files via FTP back to your host PC.

Can you explain your goals here in a bit more detail?  Is this a program that you will be running on your robot at competition or is this for testing purposes? 

Regards,
Kelly B.

National Instruments
0 Kudos
Message 3 of 6
(3,811 Views)

Hi DAQjr,

after a lot of digging I found why I had problem with logging the data, it turns out that there is a bug in silverlight which caused corruption when saving the file from target to host.

I am now using FTP to connect to roborio and it works fine.

1. the reason I used a time loop was that, it is very important to me to aquire the data in a deterministic manner.

2. I've seen alot about using FIFOs in different documentrations,could you provide me with a tutorial similar to whtat I do with local variables, but with FIFOs instead.

thanks a bunch

0 Kudos
Message 4 of 6
(3,811 Views)

Hi Red Barroness,

what I am trying to do is a side project as follows,

I have a slender aluminum beam (clamped at one end and is placed vertical) which has an array of 18 optical FBG strain sensors attached along it, the sensors get connected to a box called interrogator., the interrogator calculates the reflected wavelength coming from sensors and reports it in TCP/IP packets every 1ms. then using the wavelength and some physics laws one can claculate the strain when the beam is under vibration.

I am using our robotics team's RoboRio to develope a real time VI that aquireres the TCP packets, parses them, converts the binary to floating point strain and plots them in real time.

I am using RoboRio to develope some perliminary results so I can write a proposal for NI research grant 2015.

0 Kudos
Message 5 of 6
(3,811 Views)

behii wrote:

I am using our robotics team's RoboRio to develope a real time VI that aquireres the TCP packets, parses them, converts the binary to floating point strain and plots them in real time.

I am using RoboRio to develope some perliminary results so I can write a proposal for NI research grant 2015.

Have you reviewed your FRC team's LabVIEW license to see how it applies to non FRC tasks?

0 Kudos
Message 6 of 6
(3,811 Views)