04-20-2016 08:03 AM
Hello All,
I am fairly new to LabVIEW. I am using LabVIEW 2013 and I am doing some communication with an ABB robot. I am receiving strings from the robot controller in LV via sockets. What I am trying to do, is if the string says "FALSE", LV turns a boolean operator to False, and if the string says "TRUE", LV changes the boolean operator to True. I am using the "Match True/False String" Function to do this. For some reason I am having problems getting that function set up correctly. This is how I have it currently:
Is there something I am doing wrong by tying all the nodes into the same string?
Thanks for any help!
SM
Solved! Go to Solution.
04-20-2016 08:43 AM
My recommendation would be to simplify:
04-20-2016 08:45 AM
Will doing it that way turn the boolean to false if the string says "FALSE"?
Thanks,
SM
04-20-2016 08:47 AM - edited 04-20-2016 08:48 AM
Edit
04-20-2016 08:48 AM
It's "Equals?", on the Comparison palette. Simply returns TRUE if the inputs are equal, or FALSE otherwise.
04-20-2016 09:03 AM
Ok thanks.
Another question, once the boolean is true, I want it to stay true for 5 seconds and then go back to false. What's the best way to do that?
Thanks,
SM
04-20-2016 09:06 AM
In like to use "Match Pattern" when comparing strings received from instruments. That way if there is some white space before or after (like a carriage return/line feed), it will still match the TRUE case.
04-20-2016 09:15 AM
04-20-2016 09:16 AM
@SteMob wrote:Ok thanks.
Another question, once the boolean is true, I want it to stay true for 5 seconds and then go back to false. What's the best way to do that?
Thanks,
SM
There are many ways but showing us a JPG of one small section of your code isn't enough information to guide you. We need to see the overall code structure.
04-20-2016 09:30 AM - edited 04-20-2016 09:31 AM
Well I can't really upload my whole code for different reasons. Essentially I have the robot as the client, and LV as the server. Once the TCP connection is successful, the robot sends a string saying connection successful. The robot then has a While loop constantly running waiting for commands from LV. So my robot code is a bunch of IF statements like this:
IF MoveNext=1 THEN
MoveJ Position_1;
WaitTime 1;
SocketSend client_socket\Str:="TRUE",\NoOfBytes:=4;
ENDIF
IF MoveNext=2 THEN
MoveJ Position_2;
WaitTime 1;
SocketSend client_socket\Str:="TRUE",\NoOfBytes:=4;
ENDIF
.......
Once LV receives the "TRUE" message, it turns on a boolean to True for 5 seconds, then goes to False. Once the boolean goes to False, LV sends a signal to the robot to increment "MoveNext". The problem is right now, I have to keep manually sending the "Step" command to go from point to point, whereas I need it to increment automatically and move to the next position without being told. Basically the robot sits there waiting on signals from LV telling it to increment and move to the next position.
So here is the code for the connection and communication:
This is the code to start the moves, but I keep having to hit "Step" for each move, whereas I need it to be based off the timer:
And this is the code that is supposed to turn the timer on for 5 seconds, then send a message back to the robot setting command=45 which the robot takes and increments automatically like this:
IF bytes_available>=1 THEN
UnpackRawBytes parse_data,1,command\Hex1;
IF command=45 THEN
command:=0;
Incr MoveNext;
IF MoveNext=1 THEN
MoveJ Position_1;
WaitTime 1;
SocketSend client_socket\Str:="TRUE",\NoOfBytes:=4;
ENDIF............
Does this kind of help explain what I am trying to do?
Thanks for all the help,
SM