ABB robot Socket Communication with Labview

  • !!HELP :tired_face:



    Hi, Am working on a Yumi robot where robot has to communicate with Labview software through Socket communication.


    I made a new task(multi task) for receiving the string from labivew.

    its working with a some warning, but after some time running robot goes to system failure mode with an error.


    can somebody look into it and tell me what went wrong?





    MODULE Mainmodule

    PERS string String_Commn;

    PERS string GlobalString;

    PERS string Send_String:="Socket Received";

    VAR socketdev SERVER;

    VAR SOCKETDEV CLIENT;

    VAR STRING MESSAGE;

    VAR rawbytes DATA;

    PERS string received_String;

    PERS bool SwitchPlaced;

    PERS num GOnum:=1;


    PERS string commands{11}:=["Robot Home ","LH home ","RH home ","LH Base picked ",

    "LH Top cover Picked ","LH Base not present ","LH Top Cover not present ","Switch picked ",

    "switch not present ","Droped in rejection ",""];


    PROC main()

    LABview;

    ENDPROC


    PROC LABview()

    WHILE TRUE DO

    SocketCreate SERVER;

    SocketBind SERVER,"192.168.0.251",9004;

    SocketListen SERVER;

    SocketAccept SERVER,CLIENT\Time:=10000000;

    SocketReceive CLIENT\RAWDATA:=DATA\ReadNoOfBytes:=14;

    UnpackRawBytes DATA,1,MESSAGE\ASCII:=14;

    received_string:=MESSAGE;

    TPWrite "Data received : "+received_string;

    String_Commn:=received_String;

    SocketSend CLIENT\Str:=Send_String;

    END:

    SocketClose CLIENT;

    SocketClose SERVER;

    ENDWHILE

    ENDPROC



    ENDMODULE

  • One thing to do in those endless loops on ABB robots is:

    Make a short waittime somewhere in the loop. Otherwise you will run into problems. Don't know if it will help on this special issue, but it is mandatory.

  • After some minor changes in the code it is working fine now.

    instead of RAWDATA i used String.


    VAR string data;


    PROC LABview()

    WHILE TRUE DO

    SocketCreate SERVER;

    SocketBind SERVER,"192.168.0.251",9004;

    SocketListen SERVER;

    SocketAccept SERVER,CLIENT\Time:=10000000;

    SocketReceive CLIENT\Str:=Ni_str;

    WaitTime 0.5;

    received_string:=Ni_str;

    TPWrite "Data received : "+received_string;

    String_Commn:=received_String;

    SocketSend CLIENT\Str:=Send_String;END:

    SocketClose CLIENT;

    SocketClose SERVER;

    ENDWHILE

    ENDPROC

Advertising from our partners