10-19-2009 03:32 PM
10-19-2009 08:16 PM
10-20-2009 01:49 AM
10-20-2009 09:56 AM - edited 10-20-2009 09:59 AM
Hi, thank you all for your observations. What I'm trying to do whit this vi's is to control a robot, I have two computers conected by a WiFi connection, using LV 8.5, the server sends the values of voltage to the client and the clinent sends the values to a DAQ 6009 and this manage the voltage values to the motors of the robot, I already did that, then I made two encoders to read the distance traveled, so now I want to send a value of distance instead a voltage value from the server, the client its continually reading the distance and I want this distance be received by the server to stop the movement instruction.
I dont knwo if I need to put an error condition on the TCP Listener to get this, or if is there another way to get this control please tell me how. Thank you.
10-20-2009 10:21 AM
It sounds like you need to develop a simple messaging protocol. I would recommend a basic message format that consists of a length, message ID and optional data field. The length should be a fixed length and can be 4 bytes. The message ID should also be a fixed length. You can decided if you want it to be an 8-bit, 16-bit or 32-bit value. In LabVIEW you will want to use an ENUM typedef for the message ID. The data field will be dependent on the message ID.
Both your server and client will use the message ID to determine the actions to be taken. This includes whether or not the message requires a response. To make things simple I would not allow the robot (client) to send messages to the server unless they are a response to a request. The server will send the desired message to the (client) robot and if required will listen for a response from the client. I would recommend using a state machine for both your client and server applications. This will make the message handling easier.
10-20-2009 12:35 PM
Could yo be a little more specific or put an example of "message ID should also be a fixed length. You can decided if you want it to be an 8-bit, 16-bit or 32-bit value. In LabVIEW you will want to use an ENUM typedef for the message ID. The data field will be dependent on the message ID."
I'm not acquaintedwith the ENUM i already read the help about it but I don´t know how can I used as you said. Thank you.
08-28-2012 08:22 AM
Hello Friends,
I am new to the Labview, i need help to interage my labview vi inside the TCP Communicator - passive.vi you can find this vi inside the example Networking->Tcp & Udp->TCP communicator passive.vi.
I have genereated one more vi which you can find in attachment send_x_y.vi Here i am generating a string from 2D array and i want to pass that string when i receive a message from robot studio that "send data" than and only than i want to send the data automatically and when again robot studio send a string "send data" than only than sedond data send . That means i want to wait unitl i got reply from the robot studio.
I am able to send the data one by one but i wan to make a loop that whenever i receive the string form robot studio "send data" than and only than i wan to send the data.
Here is the screen shot of my send_x_y.vi.
screen shot of TCP Passive.vi
Thank you in advance for any help you can provide.
08-28-2012 09:38 AM
Both your send and receive should be in the same loop. Look at the examples for a state machine. You will basically want to wait on the receive for the command from your robot. Once you receive send the data and go back to waiting. This is an ideal candidate for a simple state machine.