RobotStudio event

MoveL instruction

Options
Hi,
     I have a strange problem.I am working with a Flex Picker IRB 360.
I have a program in C# sends the data to Robot Contorller through TCP/IP communication.The received data is used to move the robot to target points.Instead of the Robot moving to Target positions it always move to X=0 and Y=0 position.
below is the code
-----------------------------------------------------------------------------------------------------------------
MODULE TCPIP
< ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 11">< name="Originator" ="Microsoft Word 11">

VAR SocketDev
Socket_Server
;

VAR SocketDev
Socket_Client
;

VAR string ReceiveMessage;

VAR string ControllerIP;

VAR num ReceivedOption;

VAR bool Dummy;

VAR robtarget
r1
;

< ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 11">< name="Originator" ="Microsoft Word 11">



VAR String sP1x;

VAR string sP1y;

VAR num pr1x;

VAR num pr1y;

VAR num r1x;

VAR num r1y;

PROC MAIN()

< ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 11">< name="Originator" ="Microsoft Word 11">


SocketCreate Socket_Server;

SocketBind Socket_Server,"172.29.74.1",1025;

SocketListen Socket_Server;

SocketAccept Socket_Server,Socket_Client;

SocketReceive Socket_Client Str:=ReceiveMessageTime:=WAIT_MAX ;

TPWrite "Message
received "
+ReceiveMessage;

Dummy:=StrToVal(ReceiveMessage,ReceivedOption);

< ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 11">< name="Originator" ="Microsoft Word 11">



SocketSend Socket_Client Str:="Message received";

< ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 11">< name="Originator" ="Microsoft Word 11">



sP1x:="P1x";

pr1x:=ReceiveSend(sp1x);

r1x:=pr1x;

sP1y:="P1y";

pr1y:=ReceiveSend(sp1y);

r1y:=pr1y;

r1:=[[r1x,r1y,Pz],[0,1,0,0],[0,1,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];

MoveJ r1,V500,fine,tool2;

< ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 11">< name="Originator" ="Microsoft Word 11">



SocketClose Socket_Server;

stop;




ENDPROC

< ="-" ="text/; =utf-8">< name="ProgId" ="Word.">< name="Generator" ="Microsoft Word 11">< name="Originator" ="Microsoft Word 11">



FUNC num ReceiveSend(var string Point
)

VAR string Receive;

VAR num Position;

SocketReceive socket_Client Str:=Receive;

TPWrite""+Receive;

SocketSend socket_Client Str:=Point;

Dummy:=StrToVal(Receive,Position);

Return Position;

ENDFUNC

ENDMODULE

-----------------------------------------------------------------------------------------------


Incase of further calirifications please let me know.

Cheers
Ravi



















Comments

  • Jorge
    Jorge ✭✭
    Options
    Try to change the vars to persistence insted var
     

    /Jorge
    Jorge Turiel

  • sturner
    sturner ✭✭
    Options
    robtargets are normally defined with the type 'Constant'
    leaving them as Var will set them to zero when program pointer is reset