KUKAC4机器人焊钳拉拽程序分析sg_fehler ()w

我们在很多时候都会遇到机器人的虚拟外部轴滞后故障报警,它的报警时如何发出的呢?
报警中的滞后故障:
szmsg(msgnr :in) ---伺服钳报警信息程序
switch  msgnr 控制号
case 1
  switch $softplcint[21] 软plc反馈信息
  case 1
  user_msg.msg_txt[]=sz1 schleppfehler im programmbetrieb, quittierung in single-step erforderlich !
程序模式下sz1滞后错误,需要单步确认!
......
case 2
  switch $softplcint[21] 软plc反馈信息
  case 1
  user_msg.msg_txt[]=sz1 schleppfehler im programmbetrieb
  sz1程序模式下的跟随错误
.......
case 3
  switch $softplcint[21] 软plc反馈信息
  case 1
  user_msg.msg_txt[]=sz1 schleppfehler, warte bis kein schleppfehler !
  sz1跟随错误,等到没有跟随错误!
....
--产生报警的程序设置—-
globalinterruptdecl 8 when $softplcbool[5] do szintr(7)中断程序激活滞后故障,$softplcbool[5]触发中断程序.
通过中断程序我们可以知道机器人虚拟外部轴的滞后故障是由软plc的反馈点引起的,说明滞后故障是由软plc软件监控产生的.
    if not $out[o_sz1_frg] and (abs($softplcreal[1])>max_sf)  and ($softplcint[1]>0)then
      brake 机器人程序停止,机器人运动立刻停止
      if antein_merker and $softplcbool[5] then 
       antein_merker在断开机器人程序驱动,plc提示错误
         nrintmsghandle[2] = szmsg(2)  发出提示信息sz1程序模式下的跟随错误
         waitfor $softplcbool[6]==false 等待没有软plc的提示信息
        sf_vorwarnung=false  预警
        waitfor $in[i_sz1_ipos_g] 等待e716位置有效
        if(nrintmsghandle[2] > 0)then 反馈值是整数
          msg_del = clear_krlmsg (-99)   ; 清除提现状态信息
            nrintmsghandle[2]=-1
        endif
      else机器人程序在执行过程中
        if(handbetrieb==false)then如果机器人不是外部自动模式被认为是手动准备
          f_handbetrieb=true  故障手动标识位
          if($softplcint[1]>0)then有外部轴被使用
            $out[o_sz1_f_schl]=true ---a131焊钳拉拽故障plc反馈点
          endif
            nrintmsghandle[1] = szmsg(1)
            发出提示信息: 程序模式下sz1滞后错误,需要单步确认!
            while handbetrieb==false  关闭手动准备
          endwhile
            if(nrintmsghandle[1] > 0)then
            msg_del = clear_krlmsg (-99)   ;清除故障信息
              nrintmsghandle[1]=-1
          endif
        endif
        if not f_handbetrieb then 没有故障手动标识位
           nrintmsghandle[1] = szmsg(1)
           发出提示信息: 程序模式下sz1滞后错误,需要单步确认!
            if(nrintmsghandle[1] > 0)then
            msg_del = clear_krlmsg (-99)   ; 清除故障信息
              nrintmsghandle[1]=-1
          endif
         endif
      endif
    endif
    ;endfold
schleppfehler  滞后误差!  除了伺服焊钳外,还可以针对伺服有钉铆钳nz,和无钉伺服铆钳cz.下面我们以气伺服焊钳为例进行分析:
if sz_vorhanden or mit_nz1_serv or mit_nz2_serv then
sz_vorhanden使用伺服焊钳 虚拟轴 ,或者是伺服铆钳1和伺服铆钳2
---机器人手动时的拉拽故障被触发--
  if $out[o_r_hand] and tast_aktiv_1 and not $out[o_sz1_t_auf] and not $out[o_sz1_t_zu] and not temp_komb_1 then
a11机器人手动,如果测试点动功能激活,没有a719和a720的焊钳点动控制激活,
temp_komb_1=false
    tast_aktiv_1=false   测试功能激活
    waitsec 0.4 等待
    $out[o_sz1_frg]=false    a715焊钳功能激活
    schleppfehler=true    激活拉拽故障
    sf_prog_status=#user_act   # user_act:操作确认键时的滞后误差
    $out[o_sz1_spos_g]=false    a716 使用位置有效
  endif
... ...
if schleppfehler then ---- schleppfehler滞后变量被激活
    behandlung_schleppfehler()  跟踪错误的处理
  else
    setsollpos(true);空运行
    if $softplcbool[5] then  软plc ---第五位是拉拽故障.
       sg_fehler()
    endif
  endif
sg_fehler ()
for sznr=1 to 7  -----1到7轴
    frgsz=fctfrgsz(sznr)焊钳1的a715激活焊钳控制功能
if($softplcint[sznr]0) and not frgsz and not $power_fail then
$softplcint[1]=7伺服焊钳   焊钳没有激活控制 $power_fail电源故障
      schleppfehler=true 激活拉拽故障变量
      if $pro_state1==#p_active then 程序激活
        sf_prog_status=#prg_motion程序运行中出现的滞后误差
      else; 程序状态是不激活
        if not $ext then
          setsollpos(false)
        endif
        if not $could_start_motion then 
        显示机器人是否可以移动/机器人不在移动
          if(ioctl(ibusdrv,3,0)==1)  and not $power_fail then
          ibusdrv interbus网络驱动这里值不使用,没有电源故障
            sf_prog_status=#driveoff_motion 
          驱动装置关断时的滞后误差
             errsznr = sznr 记录发出故障信息用的恶故障的钳号
            syncmovemessage(18, #quitmsg, errsznr);
             故障信息:钳子处于非法位置   
                errsznr =-1
          endif
        else 显示机器人可以移动
          if not $power_fail then 没有电源故障
            sf_prog_status=#man_motion 用运行驱动装置时的滞后误差
            msgnum=6
          endif
        endif
      endif
      invdestpos=fctdestpos(sznr) e773目标位置无效
      if invdestpos then
        errsznr = sznr
        syncmovemessage(19, #quitmsg, errsznr); 发出故障信息:目标位置无效
        errsznr =-1
        sf_prog_status=#dest_invalid
      endif;目标位置无效
    endif
  endfor
  ;产生讯息
  if msgnum > 0 then 发出报警信息
    errsznr=sznr
    syncmovemessage(msgnum, #statemsg, errsznr)
    remmsgnum=msgnum
    errsznr =-1
  endif
  end
  ;endfold
-----------------------------------------
  deffctbool fctfrgsz(sznr:in)
  int sznr
  bool fctfrgszval
  switch sznr
  case 1
    fctfrgszval=$out[o_sz1_frg]  焊钳1的a715激活焊钳控制功能
  case 2
    fctfrgszval=$out[o_sz2_frg]
  case 3
    fctfrgszval=$out[o_sz3_frg]
  case 4
    fctfrgszval=$out[o_nz1_frg]
  case 5
    fctfrgszval=$out[o_nz2_frg]
  case 6
    fctfrgszval=$out[o_cz1_frg]
  case 7
    fctfrgszval=$out[o_cz2_frg] 
  endswitch
  return(fctfrgszval)
  endfct
  ;endfold
-------------------------------------
  def  behandlung_schleppfehler()跟踪错误的处理
  bool bret
  if(async_active==false) and not $power_fail then
    switch sf_prog_status
    case #man_motion    用运行驱动装置时的滞后误差
      fahrt_sg_istpos()  异步行进到实际位置
    case #prg_motion   程序运行中出现的滞后误差
      if $rob_stopped then  机器人停止
        if $ext==false then  外部自动关闭
          setsollpos(false)  关闭实际位置有效a716
          if $softplcbool[6] then
            fahrt_sg_istpos()异步行进到实际位置
          else
            schleppfehler=false
               sf_prog_status=#sz_io无滞后误差
          endif
        else
          if $could_start_motion then显示机器人是否可以移动/机器人不在移动
            setsollpos(true) a716发出实际位置有效
            if $softplcbool[6]==false then  没有故障反馈点
              schleppfehler=false
                 sf_prog_status=#sz_io
            endif
          endif
        endif
      endif
    case #driveoff_motion  驱动装置关断时的滞后误差
      if $ext==false then 外部自动关闭
        setsollpos(false)
        fahrt_sg_istpos()
      else
        if $could_start_motion then显示机器人是否可以移动/机器人不在移动
          setsollpos(true)
          if $softplcbool[6]==false then
            schleppfehler=false
               sf_prog_status=#sz_io
          endif
        endif
      endif
    case #dest_invalid由于目标位置无效导致的滞后误差
      fahrt_sg_istpos()
    case #user_act操作确认键时的滞后误差
      fahrt_sg_istpos()
    case #sz_io无滞后误差
      if not $softplcbool[5] and not $softplcbool[6] then
        schleppfehler=false
        endif
    endswitch
  endif
  switch $async_state   同步系统状态
  case #busy  正在工作
    async_active=true
  case #idle ; 异步运动完成
    if async_active then
      schleppfehler = false
       sf_prog_status=#sz_io
      setsollpos(true)
      async_active=false   
    endif
  case #cancelled   取消
    async_active=false
  endswitch
;
  end
  ;endfold
异步行进到实际位置判断
  def fahrt_sg_istpos()
  int sznr, i
  e6axis zielpos
 ; 到当前位置的异步驱动
  if $could_start_motion and $rob_stopped then
    for sznr=1 to 7
      if $softplcint[sznr]0 then
        switch $softplcint[sznr]
        case 7 伺服焊钳1
          zielpos.e1=istposcalc(sznr)获得机器人虚拟轴实际位置
          pos_outofsoftend=outofsoftend(zielpos.e1, 7)
          判断伺服焊钳实际位置是否超程,并发出提示信息
        case 8 伺服焊钳2
          zielpos.e2=istposcalc(sznr)获得机器人虚拟轴实际位置
          pos_outofsoftend=outofsoftend(zielpos.e2, 8)
          判断伺服焊钳实际位置是否超程,并发出提示信息
        case 9 伺服焊钳3
          zielpos.e3=istposcalc(sznr)获得机器人虚拟轴实际位置
          pos_outofsoftend=outofsoftend(zielpos.e3, 9)
          判断伺服焊钳实际位置是否超程,并发出提示信息
        case 10 伺服nz铆钳1
          zielpos.e4=istposcalc(sznr)获得机器人虚拟轴实际位置
          pos_outofsoftend=outofsoftend(zielpos.e4, 10)
          判断伺服焊钳实际位置是否超程,并发出提示信息
        case 11 伺服nz铆钳2
          zielpos.e5=istposcalc(sznr)获得机器人虚拟轴实际位置
          pos_outofsoftend=outofsoftend(zielpos.e5, 11)
          判断伺服焊钳实际位置是否超程,并发出提示信息
        case 12 伺服cz铆钳1
          zielpos.e6=istposcalc(sznr)获得机器人虚拟轴实际位置
          pos_outofsoftend=outofsoftend(zielpos.e6, 12)
          判断伺服焊钳实际位置是否超程,并发出提示信息
        default
          halt
        endswitch
      endif
      if pos_outofsoftend then 位置超出极限设置
        goto fctend 调步到结尾
      endif
    endfor
    for i = 1 to 6
      $acc_extax[i]=100 提前运行中外部轴的加速度 
      $vel_extax[i]=100 提前运行中外部轴的轴速度 
    endfor
    if $rob_cal and not pos_outofsoftend then
掌握所有机器人轴后,将设置此输出
      asyptp zielpos 如果不超程执行ptp外部虚拟轴的实际位置
    endif
    fctend:
  endif
  end
设置额定位置有效
  def setsollpos(sollstate : in)
  bool sollstate  激活位置有效
  if sollstate then  
    $out[o_sz1_spos_g]=true  a716焊钳位置有效
    $out[o_sz2_spos_g]=true   二号钳位置有效
    $out[o_sz3_spos_g]=true   三号钳位置有效
    if mit_nz1_serv then  如果伺服有钉铆钳1
      $out[o_nz1_spos_g]=true  位置有效
    endif 
    if mit_nz2_serv then  如果伺服有钉铆钳2
      $out[o_nz2_spos_g]=true  位置有效
    endif
    if mit_cz1_serv then  如果伺服无钉铆钳1
      $out[o_cz1_spos_g]=true  位置有效
    endif
    if mit_cz2_serv then  如果伺服无钉铆钳2
      $out[o_cz2_spos_g]=true  位置有效
    endif 
  else  没有激活位置有效 就关闭焊钳或铆钳的位置控制
    $out[o_sz1_spos_g]=false  
    $out[o_sz2_spos_g]=false
    $out[o_sz3_spos_g]=false
    if mit_nz1_serv then
      $out[o_nz1_spos_g]=false
    endif
    if mit_nz2_serv then
      $out[o_nz2_spos_g]=false
    endif
    if mit_cz1_serv then
      $out[o_cz1_spos_g]=false
    endif
    if mit_cz2_serv then
      $out[o_cz2_spos_g]=false
    endif 
  endif
  end
  ;endfold
;
deffctbool fctdestpos(sznr:in)反馈焊钳位置无效
  int sznr
  bool fctdestposval
  switch sznr
  case 1
    fctdestposval=$in[i_sz1_f_ziel]  e773目标位置无效
  case 2
    fctdestposval=$in[i_sz2_f_ziel]
  case 3
    fctdestposval=$in[i_sz3_f_ziel]
  case 4
    fctdestposval=$in[i_nz1_f_ziel]
  case 5
    fctdestposval=$in[i_nz2_f_ziel]
  case 6
    fctdestposval=$in[i_cz1_f_ziel]
  case 7
    fctdestposval=$in[i_cz2_f_ziel]
  endswitch
  return(fctdestposval) 函数反馈值
  endfct
整体上说明当虚拟外部轴报滞后故障时,其主要是由软plc的反馈点$softplcbool[5]来控制的.
;endfold
  ;endfold


关于驭势科技在无人驾驶技术方面的优势
大理剪断光缆事件:是否因为当地“创卫”引发,街道办没有明确回应
分光光度计原理及结构
研究人员开发出一个端到端的机器学习系统Audio2Face
刘强东用行动证明鸿蒙系统与安卓不同
KUKAC4机器人焊钳拉拽程序分析sg_fehler ()w
直播内容抢先看 | 符合安全要求的软件测试解决方案
人像拍摄为何如此火爆,徕卡镜头给你答案
为什么云服务的门槛越来越高
软件工程师应该怎样培养
虹科干货 | 什么是数据库一致性?
光谱成像技术的分类
5G边缘云网关是工业数据采集所用的“利器”
爱生活享受生活,蒸汽拖把好用吗?
IGBT短路保护之退饱和即Desat概念
数控伺服系统的ADAMS/MATLA联合仿真研究
深入探讨FLASH被非法改写的问题
基于FPGA的高阶调制16APSK体制信号的相干解调算法浅析
电池需要合理的使用和保养才能够使用长久
用PLC来判断开关量信号的故障方法