LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check network connection from cRio?

Hello everybody,
 
I have a feature I would like to add to a project I am working on, but have been unable to figure it out.  Please forgive me if this is simple, I am new at this.
 
The project uses a cRIO 9004 to control a vehicle remotely with a laptop computer via a wireless network bridge.  The vehicle runs great, but we would like to make sure the data received by the RIO onboard has current information, if it does not, the vehicle needs to enter a wait state until it connects again.  My question is... how can I make sure the RIO is getting new information?  Im using labview 8.20.
 
I have tried many different approaches and I have described (as well as i can remember) the concept, and the outcome:
 
1) I have used network published variables and tried to compare timestamps -- In the RIO program, I tested to see if most recent timestamp on a variable written by the program on the other side of the network, was equal to the last one saved using a timed loop at 500ms.    The timestamp never updated. 
 
2) I set the network watchdog in MAX but from my understanding, this would tell you from the user input side that you lost connection, which doesnt stop my vehicle.
 
3) I've polled the loop itteration counter on the user interface, from the RIO thru a network variable, and compared it to the one saved 500ms earlier.  While probing the values from the user interface everything worked as expected.  To test a lost connection, I unplugged the network cable to my wireless bridge.  The vehicle continued to run at the last good values (BAD).  The wierd thing is, when i plug the network cable back in, the vehicle moved toward the wait state, then realizes its getting new signals and operates normally again. 
 
4) I found some tcp/ip functions which included a PING.  I tried to ping the user interface from the RIO.  when I used this, the times would increase gradually each iteration until it timed out (ie 1ms,1ms,1.2ms,1.4ms,1ms, .... 4ms, 4.2ms,4.1ms, .... 10ms TIMEOUT)  as if something needed to be reset.
 
I hope this makes sense, ive been playing with it off and on for a while and ive deleted most of the code that didnt work.  I cant post my code, but i can throw together a rought outline to show how its structured if that helps.    I have a feeling its a simple thing that I just keep overlooking and I need an extra set of eyes to look at the problem.
 
Thanks in advance 🙂
 
Jason
 
 
0 Kudos
Message 1 of 5
(7,045 Views)

I still like the shared variable idea, but instead of reading the timestamp, you could just create a "heartbeat" shared variable which is written to one boolean value on the windows host and then written to the other on the real time target.  This way, you can keep track of network errors on either side--since the boolean value would stay the same.  See the picture below for an example of what I'm talking about.  I added a timeout where after five seconds the "Network Error" LED turns on.

Regards,

Craig D
Applications Engineer
National Instruments

Message Edited by Craig D on 09-12-2007 01:39 AM

Message Edited by Craig D on 09-12-2007 01:39 AM

Message 2 of 5
(7,033 Views)
Thanks for reply.  I tryed it and the same thing happened.  I noticed that the program I THOUGHT was running on the RT system (cRIO) is actually running on my computer.  In my project manager, I have the rio VI under the RIO system, then I drag-and-dropped the vi into my host program.  I thought this called the program residing on the rio, but i guess not.  How do you start a program on a remote system?  
0 Kudos
Message 3 of 5
(7,013 Views)
If you want the VI to run on the RT target, it needs to be located under the RT controller in the project view.  In this case, opening the VI and pressing the run button will deploy and run the VI on your controller.
 
If you would like to do this programmatically from your Windows host, you would use the same method as if you were programmatically running a VI on another computer--use VI server.
 
See this KnowledgeBase article on how to do this.
 
Regards,
 
Craig D
Applications Engineer
National Instruments
 
 
0 Kudos
Message 4 of 5
(6,963 Views)
Thank you Craig,
 
Sorry it took so long for me to respond.  I was completely mistaken about a couple things.  I have managed to get the program running on the RT system, and the network variables are working, but i cant get my FPGA to work correctly now.  AUGH!   I will work on it and see if I can figure it out.   If I cant I will start a new thread in a more appropriate forum.  Thanks again for you help.
 
Jason
0 Kudos
Message 5 of 5
(6,627 Views)