LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP LISTEN DELAY PROBLEM

Computer - server; Kawasaki robot- client. pick and place. The camera is on the robot. When taking pictures, the robot will send T1,1( the photographing command)  to the vision software. Normally, when the robot reaches the photographing position, the robot immediately sends T1,1 to the software via tcp socket. Then take pictures, process, return the results, and write TCP. However, after a period of time, when it reaches the photographing position, the visual software receives T1,1 after a delay of 2 ~ 3 seconds. Very annoying.

When this happens, before taking pictures, stop the vi and then run it immediately, it will return to normal  without any delay. But it reappeared after a while and I have to do the same again. The timing of the problem seems irregular. I don't know where the problem is?

John_Lau_1-1638601330945.png

 

John_Lau_2-1638601357553.png

 

 

 

when you got a hammer, everything else seems like a nail
0 Kudos
Message 1 of 5
(922 Views)

Why are you using tcp listen vi for every iteration of while loop?

 

 


CLD Using LabVIEW since 2013
0 Kudos
Message 2 of 5
(898 Views)

Yes, you should only create a listener once, of course!

 

There are plenty more things wrong with your code that show a basic misunderstanding of logic and dataflow, such as:

 

  • An "x=true?" just returns the input x and can be deleted.
  • An "x=false?" is just a negate.
  • Writing to a local variable AND a signaling value property of the same control in parallel is just plain silly. Why do you think this is reasonable?
  • Why are terminals located disconnected in the timeout case instead of where they are needed?
  • Why is the front panel and diagram maximized to the screen?
  • All your wait constants have the wrong representation.
  • The output of your upper loop changes once per second. Why are you spinning it 20x per second?
  • Why is there a 50ms wait in the event loop with a 10ms timeout? Whatever is longer wins.
  • etc.
Message 3 of 5
(870 Views)

Thankssss  very much for pointing out my mistakesss in my vi, and I’m very appreciate ur and kartiknattar's help. I haven’t learn labview systematically yet, so what you seem plain silly and I totally don’t realize it. I wrote code without optimizing it....  --!

when you got a hammer, everything else seems like a nail
0 Kudos
Message 4 of 5
(788 Views)

hello to you,

 I today put the TCP Listen outside the while loop, nothing else changed. BUT the vi seems fail to receive the command from robot immediately... So I still remain unchanged and it works just fine, except for the random delay I describe before....--!

when you got a hammer, everything else seems like a nail
0 Kudos
Message 5 of 5
(720 Views)