4-Axis Delta robot Setup/zh-hans

From SoftMC-Wiki
Jump to: navigation, search
语言: [[::4-Axis Delta robot Setup|English]]  • [[::4-Axis Delta robot Setup/zh-hans|中文(简体)‎]]

简介

PrevDeltasim.JPG

在这个例子中,我们将使用softMC模拟器来创建Delta机器人,从终端观看一些参数,最后用roboDK运行机器人。

我们从roboDK库中选择Delta机器人,机器人参数:
Rbig = 110 [mm]
L1 = 100 [mm]
L2 = 270 [mm]
Rsmall = 40 [mm]
Gear 1:10
典型速度是 18,000/10 [deg/sec] 3000 [RPM]
典型最大速度 30,000/10 [deg/sec]
典型加速度/减速度 720,000/10 [deg/sec]
典型最大加速度/减速度 900,000/10 [deg/sec]
典型加加速度 2,160,000/10 [deg/sec]
典型最大加加速度 2,700,000/10 [deg/sec]

注意:
工具坐标值为: tool = #{0,0,15,0}

运行softMC SIM

使用VM运行softMC模拟器,mc作为登录系统登录和密码,输入ifconfig找到softMC模拟器IP地址,在下面的例子中是192.168.56.103

DeltaEx01.JPG

DeltaEx02.JPG

运行ControlStudio

运行ControlStudio,并确保运行相应的固件版本,在下面的例子中,我们运行固件0.4.17.2-C2

Delta2.jpg

Delta3.jpg

创建并运行CONFIG.PRG文件

配置器不生成CONFIG.PRG文件,这是必需的文件。
最简单的CONFIG.PRG文件将如下所示:

Sys.NumberAxes = 4
program
    Sys.Name = "DVG_Delta"         
    Print "system is running  -  " ; Sys.Name
    Sys.DoubleFormat = 1           ; viewing the watch number
end program

注意:由于Delta机器人需要4个轴,所以Sys.NumberAxes至少为4。
在打开配置器之前,请确保通过使用"Save and Load"将其上传到softMC并在终端中发送">reset all"来运行CONFIG.PRG文件。

运行配置器打开新项目

从ControlStudio运行配置程序并打开新的Project

Delta5.jpg

Delta6.jpg

重要注意事项:

  • 您在模拟中运行时,您在Buses文件夹下看不到任何驱动器
  • 确保能看到4个轴(A1 A2 A3 A4)

Delta11.jpg

创建新文件夹

现在我们将创建我们的文件夹和我们的配置文件,我们将使用"Save As"创建"New"文件夹,并将我们的配置文件命名为Delta。

Delta7.jpg

Delta8.jpg

Delta9.jpg

Delta10.jpg

配置驱动器和轴

定义驱动器

由于我们使用softMC模拟器,我们没有任何驱动器,可以跳到下一步

定义轴

点击第一个轴,其配置窗口将显示:

  1. 选择"Axis Type"。Delta选择"Rotary Gear"。
  2. 设置正确的减速比。 我们该值保持为1

对每个使用的轴重复最后一步。
Delta12.jpg

提示:
如果您有类似的轴,您可以是用鼠标单击轴复制整个轴执行所有设置。

轴的配置窗口有一些选项卡。 "Properties"选项卡允许设置轴属性。 为每个轴适当设置以下属性

重要: 这些值是减速后的最终值

对于模拟机器人,将"Simulated Axis"属性更改为"True"
velocity is 18,000 [deg/sec] 3000 [RPM]
max velocity is 30,000 [deg/sec]
Acceleration/Deceleration 720,000 [deg/sec]
Max Acceleration/Deceleration 900,000 [deg/sec]
Jerk is 2,160,000 [deg/sec]
max Jerk is 2,700,000 [deg/sec]
Position error max 10
Delta14.jpg

创建Delta机器人

右键单击组图标,然后选择添加组

Delta15.jpg

选择 Robot
组名称 DELTA
选择 delta xyzr [rrrr]
单击所有四轴,注意框架颜色从红色变为绿色。

Delta17.jpg

综合

此选项卡允许切换链接到组的轴,并更改轴属性,因为您有多于4轴。

Delta18.jpg

耦合

  1. 对于Delta机器人,不应定义耦合矩阵(定义电机轴是否仅旋转特定关节或多于一个关节。)
  2. 每个轴的关节位置限制。

Delta19.jpg

属性

此选项卡允许设置机器人属性,如:位置限制,速度限制,加速限制等

注意:

  • 确保在simple/Cartesian表“PeMax”(-->delta.pemax=10)中将位置误差设置为最大值10 (-->delta.pemax=10)

Delta20.jpg

配置

该选项表有3个子选项表:

  • 确保将工具Z轴设置为15以适应RoboDK(-->delta.tool=#{0,0,15,0})

有关更多信息,请使用以下链接
base
tool
machinetable
workpiece

Deltatool.JPG

Delta参数

这里我们设置Delta机器人的机械参数:
Rbig = 110 [mm]
L1 = 100 [mm]
L2 = 270 [mm]
Rsmall = 40 [mm]

Delta22.jpg

建立&配置

现在我们已经准备好生成安装和通信文件,并在softMC上运行它们,点击"Build &Configure"

Delta23.jpg ---> Delta25.jpg
Build & Configure 前 Build & Configure 后
Delta24.jpg Delta26.jpg
Delta27.jpg
Delta28.jpg

关闭配置器

现在退出配置程序,我们可以稍后再回到配置器。

Delta29.jpg

创建解决方案

要创建解决方案,我们必须执行以下操作:

  • 打开由Build&Configure创建的Project(apj文件)
  • 将其另存为解决方案(asn文件)
  • 将Config.prg从控制器添加到PC
  • 使用资源管理器将任何用户预览程序复制到文件夹
  • 将文件添加到解决方案树

打开工程 (apj file)

Delta30.jpg

Delta32.jpg

另存为解决方案

Delta33.jpg

Delta34.jpg

将Config.prg从控制器添加到PC

Delta35.jpg

将文件添加到解决方案树

Delta36.jpg

Delta37.jpg

添加监视

我们可以从终端查看拥有的轴
-->?grouplist
DELTA:A1,A2,A3,A4
添加启用Delta机器人位置反馈和XYZR值的监视。

Delta38.jpg

运行机器人

现在运行机器人

现在我们可以运行机器人
-->Delta.en=1
-->move delta {0,0,0,20}

重新循环运行机器人

执行以下操作:

  • 运行并启动softMCSIM
  • 运行ControlStudio并连接到您的softMCSIM
  • 打开您的"Delta" 解决方案
  • 双击程序文件"StartPRG.PRG"
  • 点击图标"Save and Load"

Delta 机器人就绪

用roboDK运行机器人

打开TCP / IP服务器以使用RoboDK

保存加载并运行SERV4DEL.PRG,确保您在ControlStudio消息日志中看到"socket 2 is set"
提示:使用Windows键+左边的错误,在左半边的窗口上得到ControlStudio。

' Version:     1.00
' Author:      Ron Danon DVG
' Description:
' History:     2017-06-17  base on server.prg  V1.00
'              Created
'------------------------------------------------------------------------------
dim shared numOfRobots as long = 1

program continue

  dim index as long
  dim sockNum as long = 2
  dim cPort as long = 7132
  dim jointStr as string
  dim robotGroups[1] as generic group 'same as size of numOfRobots
    dim robotNames[1] as string 'same as size of numOfRobots
    
'---------------Define robot groups and names---------------'    
robotGroups[1] = DELTA
robotNames[1] = "robot1"
'robotGroups[2] = PUMA2
'robotNames[2] = robot2
    
'---------------Opening new socket---------------'
  call openNewSocket(sockNum,cPort)
  
'---------------Connecting to client---------------'  
  call connectClient(sockNum,cPort,0)

'---------------Main Loop---------------'  
  while True
    call createJsonStr(robotNames,robotGroups,jointStr)
    call checkIfReady(sockNum,cPort) 
'    ?jointStr
'    ?SIZE(jointStr)
    print #sockNum,jointStr     
  end while

'---------------Close sockets and exit---------------' 
  print #sockNum,"finish"
  sleep 1000
  close #sockNum
  Print "Server Closed Sockets. Server Exits"
  
end program ' server.prg






'---------------------------------------'
'---------------Functions---------------' 
'---------------------------------------'

sub openNewSocket(sockNum as long,cPort as Long)
  dim opened as long = 0
  while not opened 
    Try
      OpenSocket Options=1 as #sockNum
      opened = 1
    catch 5043 'socket is already open
      print "socket", sockNum, "is already open. trying next socket"
      sockNum = sockNum + 1
    end Try
  end while
  print "socket", sockNum, "is set"
end sub


sub connectClient(sockNum as long, cPort as Long, ByVal sockIsOpen as long)
  dim str1 as string
  if sockIsOpen then
    close #sockNum
    OpenSocket Options=1 as #sockNum
  end if
  Accept(#sockNum, cPort)
  sleep 500
  str1=input$(loc(sockNum),#sockNum) 'receive data to check if connected
  ?"client is connected"
  sleep 200
end sub


sub checkIfReady(sockNum as long,cPort as Long)
  'Waits for a 'ready' input from roboDK before sending the next JSON string
  dim ready as long = 0
  while not ready
    Try
      while loc(sockNum) = 0   'while no data is available
        sleep 10
      end while    
    catch 5041 'client disconnected
      print "client disconnected, waiting for connection"
      call connectClient(sockNum,cPort,1)
    end Try
    ready = (input$(loc(sockNum),#sockNum) = "ready") 'check if the input is "ready"
  end while
end sub


sub createJsonStr(robotNames[*] as string, robotGroups[*] as generic group, jointStr as string)
'FORMAT --> '{"robotName": [double-a1, double-a2, double-a3, double-a4, double-a5, double-a6]}' <---
'double is in precision of 2 digits after the point, i.e.: '0.12', '179.12' 
  dim index1 as long
  dim index2 as long
  dim jointValues as generic joint
  dim temp as long = 50
  
  jointStr = "{"
  for index1 = 1 to numOfRobots
    jointValues = robotGroups[index1].PFb
    jointStr = jointStr + chr$(34) + robotNames[index1] + chr$(34) + ": ["
    for index2 = 1 to robotGroups[index1].ElementSize
      if index2 = 4 then
        temp = 0
      else
        temp = 50
      end if
      jointStr = jointStr + STRD$(-jointValues{index2} + temp, "%.2f") + ", "  
    next
    jointStr = LEFT$(jointStr,LEN(jointStr)-2) + "], "
  next
  jointStr = LEFT$(jointStr,LEN(jointStr)-2) + "}"
end sub

'---------------End of functions---------------'

运行RoboDK

复制粘贴到由Servotronix编写的文件夹“Fanuc_Delta.rdk”包括

  • 来自RoboDK库的Delta机器人
  • Prog1一个pyton脚本,打开TCP / IP套接字以使用softMCSIM / serv4del.prg

双击Prog1图标打开RoboDK TCP / IP端口,并确保您在ControlStudio消息中看到"client is connected"

TCP/IP port
Close
TCP/IP port
Open
DeltaExample2.jpg DeltaExample3.jpg


Prog1

import mcEnv
    
host, port = "192.168.56.103", 7132
finsihedTransmit = False

MCE = mcEnv.MCenv()
MCE.setSimulationSpeed(1000)
MCE.connectClient(host,port)
MCE.setRobot("robot1", "Fanuc M-1iA/0.5S")

robotList = ["robot1"]

while not finsihedTransmit:
    MCE.writeStr("ready")
    jsonStr = MCE.readJsonStr()
    MCE.moveRobots(robotList, jsonStr)
    
raise Exception('Finished')

机器人程序示例

这是一个简单的拾取和放置程序,其中P12和P11是较高的位置,P2和P1是较低的位置。

|DeltaCapture01.JPG

'------------------------------------------------------------------------------
' File:        PnPTDelta.prg
' Purpose:     Robot Pick & Place
' Version:     1.00
' Author:      DVG
' History:     15.Jun.2017    -    created
'------------------------------------------------------------------------------

' module global "constants"

 
' module global variables
dim shared ZeroPosition as joint of xyzr = {0 , 0 , 0 , 0 }                'Moving as joint - for initial positioning
dim shared P1Position as joint of xyzr = {0, 0, 0, 0}                      '{J1,J2,J3,J4}

dim shared P1    as location of xyzr = #{0 , 75 , 300 , 0 }     '{X,Y,Z,R}
dim shared P11   as location of xyzr = #{0 , 75,  225 , 0}
dim shared P22   as location of xyzr = #{0 , -75,  225 , 0}
dim shared P2    as location of xyzr = #{0 , -75,  300 , 0}
 
dim shared RobotVelocity as double = 40.0
dim shared RobotTranVelocity as double = 40.0
 
program
 
    with Delta                                'set default group element, no need to explicitly indicate the motion element
        Attach                               'Attach the task to motion element (with Delta)
            En = TRUE
            Sleep 100
            Vcruise = RobotVelocity          'Set robot's cruise velocity 
            Vtran = RobotTranVelocity
            while NOT En
                Sleep 100
            end while
            Move ZeroPosition                'moving to zero position
            WaitForMotion Delta
              call pickPlaceXYZ              'execute Pick and Place function
            Move ZeroPosition
            WaitForMotion Delta
        Detach
    end with    
 
end program
 
 
sub pickPlaceXYZ
 
    dim i as long
 
    Move Delta P1Position
    WaitForMotion Delta
    Delta.BlendingMethod = 2                  'Type of motion blending - 2 is SuperPosition blending - in order to optimize movement, so that it will be as fast as possible
    Delta.BlendingFactor = 80                 'Percentage of the movement’s length that will not be blended with the next movement
    Delta.Cp = 10                             'At continous path blednign, sets the blend radious value - bigger equal smoother
    for i = 1 to 10
        Moves Delta P11 
        WaitForMotion Delta
        Moves Delta P1
        WaitForMotion Delta
        Moves Delta P11
        WaitForMotion Delta
        Moves Delta P22
        WaitForMotion Delta
        Moves Delta P2
        WaitForMotion Delta
        Moves Delta P22
        WaitForMotion Delta
    next i
    Move Delta ZeroPosition
    WaitForMotion Delta
 
end sub