项目作者: ros-industrial

项目描述 :
Open-source vendor-specific post-processors/code generators from RoboDK (http://robodk.com)
高级语言: Python
项目地址: git://github.com/ros-industrial/robodk_postprocessors.git
创建时间: 2017-03-07T01:47:49Z
项目社区:https://github.com/ros-industrial/robodk_postprocessors

开源协议:Apache License 2.0

下载


RoboDK Post Processors

Open source vendor specific code generators/post processors from the RoboDK (https://robodk.com) application.

Post processors allow generating vendor specific programs from a generic/universal programming language. These post processors use a generic Python program to linked to a specific post processor (RobotPost class) that dictates how to generate the program.

Dependency

Python must be installed.
The robodk.py is included with the post processors and is required by all post processors.
The robodk module includes useful tools for Pose multiplications and converting between poses and xyzwpr format.
More information here:
https://pypi.org/project/robodk/
https://github.com/RoboDK/RoboDK-API/tree/master/Python
https://robodk.com/doc/PythonAPI/robodk.html

Example

Generic code

This is an example of a pre-processed program that can be used to generate any vendor specific program.

  1. import sys
  2. import os
  3. sys.path.append(os.path.abspath("C:/RoboDK/Posts/")) # temporarily add the path to POSTS folder
  4. # link to a specific post processor
  5. from Universal_Robots import *
  6. def Pose(xyzrpw):
  7. [x,y,z,r,p,w] = xyzrpw
  8. a = r*math.pi/180.0
  9. b = p*math.pi/180.0
  10. c = w*math.pi/180.0
  11. ca = math.cos(a)
  12. sa = math.sin(a)
  13. cb = math.cos(b)
  14. sb = math.sin(b)
  15. cc = math.cos(c)
  16. sc = math.sin(c)
  17. return Mat([[cb*ca, ca*sc*sb - cc*sa, sc*sa + cc*ca*sb, x],[cb*sa, cc*ca + sc*sb*sa, cc*sb*sa - ca*sc, y],[-sb, cb*sc, cc*cb, z],[0.0,0.0,0.0,1.0]])
  18. print('Total instructions: 5')
  19. robot = RobotPost(r'Universal_Robots', r'UR10', 6, axes_type=['R','R','R','R','R','R'])
  20. robot.RunMessage(r'Program generated by RoboDK 3.1.3 for UR10 on 04/04/2017 09:08:52', True)
  21. robot.RunMessage(r'Using nominal kinematics.', True)
  22. robot.setFrame(Pose([334.378321, -457.798514, 0, 0, 0, 0]), 2, r'Frame 2')
  23. robot.setTool(Pose([50, 0, 200, 0, 0, -30]), 1, r'Tool 1')
  24. robot.MoveJ(None,[0, -90, -90, 0, 90, -0], None)
  25. robot.MoveJ(Pose([635.659863, 119.697954, 472.379421, -90, -0, -164.143137]), [-9.12289, -104.73591, -87.09344, -32.67838, 96.53313, -6.38140], [0.0, 1.0, 0.0])
  26. robot.MoveL(Pose([668.264687, 119.697954, 357.591360, -90, -0, -164.143137]), [-8.76522, -110.64538, -91.21248, -22.62172, 96.27799, -6.12915], [0.0, 1.0, 0.0])
  27. robot.MoveL(Pose([668.264687, 389.011574, 357.591360, -90, 0, -164.143137]), [10.56808, -106.15774, -97.32175, -21.15363, 82.43731, 7.40331], [0.0, 1.0, 0.0])
  28. robot.MoveJ(Pose([529.421679, 243.898514, 846.4, -90, -0, -120]), [0, -90, -90, 0, 90, -0], [0.0, 1.0, 0.0])
  29. robot.ProgFinish(r'TestProgram')
  30. robot.ProgSave(r'C:/Users/User1/Desktop/',r'TestProgram',False,'C:/Program Files (x86)/Notepad++/notepad++.exe')

Result

The previous pre-processed program, linked against the Universal Robot post processor, generates the following SCRIPT code that can be executed by a Universal Robot controller.

  1. def TestProgram():
  2. # default parameters:
  3. global speed_ms = 0.300
  4. global speed_rads = 0.750
  5. global accel_mss = 3.000
  6. global accel_radss = 1.200
  7. global blend_radius_m = 0.001
  8. # Program generated by RoboDK 3.1.3 for UR10 on 04/04/2017 09:12:17
  9. # Using nominal kinematics.
  10. # set_reference(p[0.334378, -0.457799, 0.000000, 0.000000, 0.000000, 0.000000])
  11. set_tcp(p[0.050000, 0.000000, 0.200000, -0.523599, 0.000000, 0.000000])
  12. movej([0.000000, -1.570796, -1.570796, 0.000000, 1.570796, -0.000000],accel_radss,speed_rads,0,0)
  13. movej([-0.159224, -1.827986, -1.520067, -0.570345, 1.684821, -0.111376],accel_radss,speed_rads,0,0)
  14. movel(p[1.002643, -0.338101, 0.357591, -2.073257, 2.073257, -0.288737],accel_mss,speed_ms,0,blend_radius_m)
  15. movel(p[1.002643, -0.068787, 0.357591, -2.073257, 2.073257, -0.288737],accel_mss,speed_ms,0,blend_radius_m)
  16. movej([0.000000, -1.570796, -1.570796, 0.000000, 1.570796, -0.000000],accel_radss,speed_rads,0,0)
  17. end
  18. TestProgram()

Other

More information about RoboDK Post Processors here:
https://www.robodk.com/doc/PythonAPI/postprocessor.html