简体   繁体   English

库卡机器人语言(KRL)中WAIT FOR语句的奇怪错误

[英]A strange error about the WAIT FOR statement in KUKA Robot Language(KRL)

When the program reaches "WAIT FOR"(server.src, line 11), the robot stops.当程序到达“WAIT FOR”(server.src,第 11 行)时,机器人停止。 And the "START" button must be pressed to continue running.并且必须按下“START”按钮才能继续运行。 What do I need to do to prevent the robot from stopping when the program reaches "WAIT FOR"?当程序到达“WAIT FOR”时,我需要做什么来防止机器人停止? And I use EthernetKRL package, the source files as follow:我使用的是 EthernetKRL 包,源文件如下:

connect.xml:连接.xml:

<ETHERNETKRL>
  <CONFIGURATION>
    <EXTERNAL>
      <IP>172.31.55.5</IP>
      <PORT>60000</PORT>
      <TYPE>Client</TYPE>
    </EXTERNAL>
    <INTERNAL>
      <ENVIRONMENT>Program</ENVIRONMENT>
      <BUFFERING Mode="FIFO" Limit="10"/>
      <BUFFSIZE Limit="16384"/>
      <IP>172.31.55.6</IP>
      <PORT>54601</PORT>
      <PROTOCOL>TCP</PROTOCOL>
      <MESSAGES Logging="error" Display="disabled"/>
    </INTERNAL>
  </CONFIGURATION>
  <RECEIVE>
    <XML>
      <ELEMENT Tag="Robot/Pos/X" Type="REAL" />
      <ELEMENT Tag="Robot/Pos/Y" Type="REAL" />
      <ELEMENT Tag="Robot/Pos/Z" Type="REAL" />
      <ELEMENT Tag="Robot/Pos/A" Type="REAL" />
      <ELEMENT Tag="Robot/Pos/B" Type="REAL" />
      <ELEMENT Tag="Robot/Pos/C" Type="REAL" />
      <ELEMENT Tag="Robot/ready" Type="BOOL" />
      <ELEMENT Tag="Robot/chuck" Type="BOOL" />
      <ELEMENT Tag="Robot/readRobotStatus" Type="BOOL" Set_Out="14"/>
      <ELEMENT Tag="Robot/onlySetIO" Type="BOOL" Set_Out="15"/>
      <ELEMENT Tag="Robot" Set_Flag="14" />
    </XML>
  </RECEIVE>
  <SEND>
    <XML>
      <ELEMENT Tag="Robot/Pos/X" />
      <ELEMENT Tag="Robot/Pos/Y" />
      <ELEMENT Tag="Robot/Pos/Z" />
      <ELEMENT Tag="Robot/Pos/A" />
      <ELEMENT Tag="Robot/Pos/B" />
      <ELEMENT Tag="Robot/Pos/C" />
      <ELEMENT Tag="Robot/ready" />
      <ELEMENT Tag="Robot/chuck" />
      <ELEMENT Tag="Robot/readRobotStatus" />
      <ELEMENT Tag="Robot/onlySetIO" />
    </XML>
  </SEND>
</ETHERNETKRL>

server.src:服务器.src:

&ACCESS RVP
&REL 3
&PARAM DISKPATH = KRC:\R1\Program
DEF SERVER()

RET=EKI_Init("CONNECT")
RET=EKI_Open("CONNECT")

LOOP

WAIT FOR $OUT[14]==TRUE 
    
$OUT[14]=FALSE

$TOOL = tool_data[4]
$LOAD = load_data[4]
$BASE = base_data[4]

RET=EKI_GetBool("CONNECT","Robot/readRobotStatus",READROBOTSTATUS)

IF READROBOTSTATUS==TRUE THEN
RET=EKI_SetReal("CONNECT","Robot/Pos/X",$POS_ACT.X)
RET=EKI_SetReal("CONNECT","Robot/Pos/Y",$POS_ACT.Y)
RET=EKI_SetReal("CONNECT","Robot/Pos/Z",$POS_ACT.Z)
RET=EKI_SetReal("CONNECT","Robot/Pos/A",$POS_ACT.A)
RET=EKI_SetReal("CONNECT","Robot/Pos/B",$POS_ACT.B)
RET=EKI_SetReal("CONNECT","Robot/Pos/C",$POS_ACT.C)
RET=EKI_SetBool("CONNECT","Robot/chuck",$OUT[2])
RET=EKI_SetBool("CONNECT","Robot/ready",$OUT[1])
RET=EKI_Send("CONNECT","Robot")

ELSE
RET=EKI_GetBool("CONNECT","Robot/onlySetIO",ONLYSETIO)

IF ONLYSETIO==TRUE THEN
RET=EKI_GetBool("CONNECT","Robot/chuck",$OUT[2])
RET=EKI_Send("CONNECT","Robot")

ELSE
RET=EKI_GetReal("CONNECT","Robot/Pos/X",POS_FR.X)
RET=EKI_GetReal("CONNECT","Robot/Pos/Y",POS_FR.Y)
RET=EKI_GetReal("CONNECT","Robot/Pos/Z",POS_FR.Z)
RET=EKI_GetReal("CONNECT","Robot/Pos/A",POS_FR.A)
RET=EKI_GetReal("CONNECT","Robot/Pos/B",POS_FR.B)
RET=EKI_GetReal("CONNECT","Robot/Pos/C",POS_FR.C)

LIN POS_FR


RET=EKI_Send("CONNECT","Robot")
ENDIF

ENDIF

ENDLOOP

RET=EKI_Close("CONNECT")
RET=EKI_Clear("CONNECT")
END

server.dat:服务器.dat:

&ACCESS RVP
&REL 3
&PARAM DISKPATH = KRC:\R1\Program
DEFDAT  server PUBLIC
DECL EKI_STATUS RET
DECL BOOL READROBOTSTATUS=TRUE
DECL BOOL ONLYSETIO=FALSE
;DECL REAL POS_X=100
;DECL REAL POS_Y=100
;DECL REAL POS_Z=100
;DECL REAL POS_A=100
;DECL REAL POS_B=100
;DECL REAL POS_C=100
DECL FRAME POS_FR={X 100.000,Y 100.000,Z 50.0000,A 0.0,B 50.0000,C 30.0000}
DECL BASIS_SUGG_T LAST_BASIS={POINT1[] "P0",POINT2[] "P0",CP_PARAMS[] "CPDAT0",PTP_PARAMS[] "PDAT0",CONT[] " ",CP_VEL[] "2.0",PTP_VEL[] " 100",SYNC_PARAMS[] "SYNCDAT",SPL_NAME[] "S0",A_PARAMS[] "ADAT0"}

DECL INT cnt

ENDDAT

My purpose is to use a computer as the client and I want the robot as the server.我的目的是使用计算机作为客户端,我希望机器人作为服务器。 When the computer sends data to the robot, $OUT[14]=TRUE, and then the robot will return data to the computer.当计算机向机器人发送数据时,$OUT[14]=TRUE,然后机器人将数据返回给计算机。 If anyone can help me, I would be very grateful.如果有人可以帮助我,我将不胜感激。

I believe this issue has to do with the 'On Path' requirement for run mode.我相信这个问题与运行模式的“On Path”要求有关。

In order for the robot to actually go into automatic mode, the robot must be 'On Path'.为了让机器人真正进入自动模式,机器人必须处于“On Path”状态。 You might have seen this before when running a program that a notification pops up in the message banner mentioning 'On Path'.您之前在运行程序时可能已经看到这一点,该程序会在消息横幅中弹出一个提到“在路径”的通知。 'On Path' means that the robot is on a programmed path, and not "floating in space". 'On Path' 意味着机器人在一个编程的路径上,而不是“漂浮在空间中”。 For instance, a program can be started while the robot is in some random jogged pose and the robot program wants the robot to move to a programmed pose before letting automatic mode take over.例如,可以在机器人处于某个随机慢跑姿势时启动程序,并且机器人程序希望机器人在让自动模式接管之前移动到编程姿势。

I'd recommend the first thing your programs do is move the robot home.我建议您的程序做的第一件事就是将机器人搬回家。 If you do not want the robot to move to a defined position at the beginning of a program, you can trick the system with the code below:如果您不希望机器人在程序开始时移动到定义的位置,您可以使用以下代码欺骗系统:

BAS(#INITMOV, 0) ;Initialize default motion parameters like acceleration and speed.
PTP $AXIS_ACT ;Move the robot to its current position.

$AXIS_ACT is a global E6AXIS variable that holds the robots current position, so by telling the robot at the beginning of your program to PTP there, its literally commanding the robot to move to where it already is, thus putting the robot 'On Path'. $AXIS_ACT是一个全局 E6AXIS 变量,用于保存机器人当前位置,因此通过在程序开始时告诉机器人 PTP 在那里,它实际上是命令机器人移动到它已经所在的位置,从而使机器人“在路径上” . Once it runs that line, you hit Go once more, then it should be in full auto and not stop any further.一旦它运行了那条线,你再次点击 Go,那么它应该是全自动的,不再停止。

I'd try that out and see if it works.我会尝试一下,看看它是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM