A Post Processor defines how robot programs must be generated for a specific robot controller. A Post Processor is a key component of simulation and offline programming of industrial robots. RoboDK comes with many Post Processors available, providing support for many robot brands (such as ABB, Fanuc, KUKA, Motoman, UR, ...). Post Processors are located in the folder: C:/RoboDK/Posts/. Each Post Processor is a .py file. You must place the py Post Processor file in C:/RoboDK/Posts/ to use a Post Processor that has been provided to you. To remove an existing Post Processor you can simply delete the corresponding py file located in C:/RoboDK/Posts/. 后置处理器定义如何让机器人程序必须由特定的机器人控制器产生。 后处理器是仿真和工业机器人离线编程的一个重要组成部分。 RoboDK附带了许多可用的后置处理器,为许多机器人品牌(如ABB,发那科,KUKA,莫托曼,UR,......)提供支持。 后置处理器所在的文件夹位于: C:/RoboDK/Posts/。每个后置处理器是一个.py文件。 你必须放置py到后置处理器文件 在C:/RoboDK/Posts/ 使用已经提供给您的后置处理器文件。 要删除现有的后处理器你可以直接删除所在的文件的PY文件在C:/RoboDK/Posts/。

For example, for KUKA robots the following Post Processors are available:
  • KUKA_KRC2: Generates SRC program files compatible with KUKA KRC2 controllers.

  • KUKA_KRC4: Generates SRC program files compatible with KUKA KRC4 controllers.

  • KUKA_IIWA: Generates JAVA programs using the KUKA.Sunrise platform, required by KUKA IIWA robots.

例如,对于KUKA机器人以下的后置处理器可供选择:
  • KUKA_KRC2: 产生SRC程序文件与KUKA KRC2控制器兼容。

  • KUKA_KRC4: 产生SRC程序文件与KUKA KRC4控制器兼容。

  • KUKA_IIWA: 使用KUKA生成JAVA程序。日出平台,由KUKA IIWA机器人请求。

The following video provides a quick overview about using Post Processors with RoboDK: https://www.robodk.com/help#PostProcessor Python should be installed and working with RoboDK to properly use Post Processors (如何安装). 下面的视频提供了一个有关使用后置处理器RoboDk的快速概览: https://www.robodk.com/help#PostProcessor Python应该被安装并工作在RoboDK上合适的使用后置处理器(如何安装)。

To select a Post Processor for your robot you must follow these steps in RoboDK:
  1. Open the robot panel by double clicking a robot.

  2. Select Parameters at the top right.

  3. Select Select Post Processor.

Alternatively, you can right click a program, then select Select Post Processor.

为你的机器人选择一个后置处理器,在RoboDK中你必须按照下列步骤操作:
  1. 通过双击机器人打开机器人面板。

  2. 在右上角选择``Parameters``。

  3. 选择 Select Post Processor

或者,你可以右键点击一个程序,然后选择 选择后置处理器。

_images/PostProcessorSelect.png
To modify or create a Post Processor:
  1. Select Program-Add/Edit Post Processor.

  2. Select your Post Processor or create a new one. A template like the example provided in this section will be provided if you decide to create a new Post Processor.

  3. You can edit a Post Processor using a text editor or a Python editor.

A Python editor allows you to quickly test the Post Processor given a sample program at the end of the module. You can also execute a Post Processor file to see a sample of the output that it will generate (double click the py file, or right click the py file, then select Open). 修改或创建一个后置处理器:

  1. 选择``Program-Add/Edit Post Processor``。

  2. 选择你的后置处理器或者创建新的一个。如果你决定创建一个新的后置处理器,在本节中将提供示例的一个模板。

  3. 你可以用文本编译器或者Python编译器编辑一个后置处理器。

一个Python编译器允许你快速测试后置处理器。后置程序在模块结尾给定一个示例程序。你也可以执行一个后置处理器文件来看看它将产生的一个输出样例。(双击``py``文件,或者右键单击 py 文件,然后选择``Open``)。

It is also possible to manually edit a Post Processor without using RoboDK:
  1. Go to the folder C:/RoboDK/Posts/ and open the corresponding py file with a text editor such as Notepad or Python IDLE (right click the py file, then, select Edit with IDLE)

  2. Make any required modifications.

  3. To get a preview of the result: Run the Post Processor by double clicking the py file (or right click, then, select Open, as shown in the following image).

Alternatively, you can run and preview the result sing a Python editor such as Python IDLE. 另外,也可以不使用RoboDK手动编辑后置处理器:

  1. 转至文件夹:C:/RoboDK/Posts/``并用文本编辑器打开相应的``py``文件例如用Notepad 或者 Python IDLE(右键单击``py``文件,然后选择``Edit with IDLE

  2. 作出任何必要的修改。

  3. 要获得一个结果的预览:通过双击``py``文件夹运行后置处理器(或右键单击,然后选择``Open``,如下图所示)。

另外,你也可以运行和预览结果唱一个Python编译器,例如Python IDLE。

_images/PostProcessorPreview.png

Post Processor Methods 后置处理方法 =====================

This section shows the procedures that every Post Processor should define to properly generate programs from RoboDK simulations. This step is transparent to the end user of RoboDK because the program is automatically generated once a Post Processor has been defined. You do not need to understand what is going on behind the scenes unless you are willing to create or modify a Post Processor. 本节说明每一个后置处理器应该从RoboDK仿真器合适的定义生成的程序。 这一步对终端用户的RoboDK透明。因为一旦这个后置处理器被定义,这个项目是自动生成的。 你并不需要了解后台处理场景,除非你愿意创建或修改一个后置处理器。 Once a robot program is ready to be generated RoboDK creates a generic Python file (pre processed) that is linked to a Post Processor. The pre-processed file is executed using the selected Post Processor and the desired program is obtained. 一旦机器人程序准备创建RoboDK创建的一个通用Python文件(预加工)来连接到一个后置处理器。 使用所选择的后处理器执行处理前文件和获得所需的程序。

class samplepost.RobotPost(robotpost=None, robotname=None, robot_axes=6, **kwargs)

Robot Post Processor object

MoveC(pose1, joints1, pose2, joints2, conf_RLF_1=None, conf_RLF_2=None)

Defines a circular movement.

Tip: MoveC is triggered by the RoboDK instruction Program->Move Circular Instruction.

参数
  • pose1 (robodk.Mat()) -- pose target of a point defining an arc (waypoint)

  • pose2 (robodk.Mat()) -- pose target of the end of the arc (final point)

  • joints1 (float list) -- robot joints of the waypoint

  • joints2 -- robot joints of the final point

  • conf_RLF_1 -- robot configuration of the waypoint

  • conf_RLF_2 -- robot configuration of the final point

MoveJ(pose, joints, conf_RLF=None)

Defines a joint movement.

Tip: MoveJ is triggered by the RoboDK instruction Program->Move Joint Instruction.

参数
  • pose (robodk.Mat()) -- pose target of the tool with respect to the reference frame. Pose can be None if the target is defined as a joint target.

  • joints (float list) -- robot joints as a list

  • conf_RLF (int list) -- robot configuration as a list of 3 ints: [REAR, LOWER-ARM, FLIP]. [0,0,0] means [front, upper arm and non-flip] configuration.

MoveL(pose, joints, conf_RLF=None)

Defines a linear movement.

Tip: MoveL is triggered by the RoboDK instruction Program->Move Linear Instruction.

参数
  • pose (robodk.Mat()) -- pose target of the tool with respect to the reference frame. Pose can be None if the target is defined as a joint target.

  • joints (float list) -- robot joints as a list

  • conf_RLF (int list) -- robot configuration as a list of 3 ints: [REAR, LOWER-ARM, FLIP]. [0,0,0] means [front, upper arm and non-flip] configuration.

Pause(time_ms)

Defines a pause in a program (including movements). time_ms is negative if the pause must provoke the robot to stop until the user desires to continue the program.

Tip: Pause is triggered by the RoboDK instruction Program->Pause Instruction.

参数

time_ms (float) -- time of the pause, in milliseconds

ProgFinish(progname)

This method is executed to define the end of a program or procedure. One module may have more than one program. No other instructions will be executed before another samplepost.RobotPost.ProgStart() is executed. Tip: ProgFinish is triggered after all the instructions of the program.

参数

progname (str) -- name of the program

ProgSave(folder, progname, ask_user=False, show_result=False)

Saves the program. This method is executed after all programs have been processed.

Tip: ProgSave is triggered after all the programs and instructions have been executed.

参数
  • folder (str) -- Folder hint to save the program

  • progname (str) -- Program name as a hint to save the program

  • ask_user (bool, str) -- True if the default settings in RoboDK are set to promt the user to select the folder

  • show_result (bool, str) -- False if the default settings in RoboDK are set to not show the program once it has been saved. Otherwise, a string is provided with the path of the preferred text editor.

ProgStart(progname)

Start a new program given a name. Multiple programs can be generated at the same times.

Tip: ProgStart is triggered every time a new program must be generated.

参数

progname (str) -- name of the program

RunCode(code, is_function_call=False)

Adds code or a function call.

Tip: RunCode is triggered by the RoboDK instruction Program->Function call Instruction.

参数
  • code (str) -- code or procedure to call

  • is_function_call (bool) -- True if the provided code is a specific function to call

RunMessage(message, iscomment=False)

Display a message in the robot controller screen (teach pendant)

Tip: RunMessage is triggered by the RoboDK instruction Program->Show Message Instruction.

参数
  • message (str) -- Message to display on the teach pendant or as a comment on the code

  • iscomment (bool) -- True if the message does not have to be displayed on the teach pendant but as a comment on the code

addline(newline)

Add a new program line. This is a private method used only by the other methods.

参数

newline (str) -- new line to add.

addlog(newline)

Add a message to the log. This is a private method used only by the other methods. The log is displayed when the program is generated to show any issues when the robot program has been generated.

参数

newline (str) -- new line

setAcceleration(accel_mmss)

Changes the robot acceleration (in mm/s2)

Tip: setAcceleration is triggered by the RoboDK instruction Program->Set Speed Instruction. An acceleration value must be provided.

参数

accel_mmss (float) -- speed in mm/s^2

setAccelerationJoints(accel_degss)

Changes the robot joint acceleration (in deg/s2)

Tip: setAccelerationJoints is triggered by the RoboDK instruction Program->Set Speed Instruction. A joint acceleration value must be provided.

参数

accel_degss (float) -- speed in deg/s^2

setDO(io_var, io_value)

Sets a variable io_var (usually a digital output) to a given value. This method can also be used to set other variables.

Tip: setDO is triggered by the RoboDK instruction Program->Set or Wait I/O Instruction.

参数
  • io_var (int, str) -- variable to set, provided as a str or int

  • io_value (int, float, str) -- value of the variable, provided as a str, float or int

setFrame(pose, frame_id=None, frame_name=None)

Defines a new reference frame with respect to the robot base frame. This reference frame is used for following pose targets used by movement instructions.

Tip: setFrame is triggered by the RoboDK instruction Program->Set Reference Frame Instruction.

参数
  • pose (robodk.Mat()) -- pose of the reference frame with respect to the robot base frame

  • frame_id (int, None) -- number of the reference frame (if available)

  • frame_name (str) -- Name of the reference frame as defined in RoboDK

setSpeed(speed_mms)

Changes the robot speed (in mm/s)

Tip: setSpeed is triggered by the RoboDK instruction Program->Set Speed Instruction.

参数

speed_mms (float) -- speed in mm/s

setSpeedJoints(speed_degs)

Changes the robot joint speed (in deg/s)

Tip: setSpeedJoints is triggered by the RoboDK instruction Program->Set Speed Instruction. A joint speed value must be provided.

参数

speed_degs (float) -- speed in deg/s

setTool(pose, tool_id=None, tool_name=None)

Change the robot TCP (Tool Center Point) with respect to the robot flange. Any movement defined in Cartesian coordinates assumes that it is using the last reference frame and tool frame provided.

Tip: setTool is triggered by the RoboDK instruction Program->Set Tool Frame Instruction.

参数
  • pose (robodk.Mat()) -- pose of the TCP frame with respect to the robot base frame

  • tool_id (int, None) -- number of the reference frame (if available)

  • tool_name (str) -- Name of the reference frame as defined in RoboDK

setZoneData(zone_mm)

Changes the smoothing radius (also known as rounding, blending radius, CNT, APO or zone data). If this parameter is higher it helps making the movement smoother

Tip: setZoneData is triggered by the RoboDK instruction Program->Set Rounding Instruction.

参数

zone_mm (float) -- rounding radius in mm

waitDI(io_var, io_value, timeout_ms=-1)

Waits for a variable io_var (usually a digital input) to attain a given value io_value. This method can also be used to set other variables. Optionally, a timeout can be provided.

Tip: waitDI is triggered by the RoboDK instruction Program->Set or Wait I/O Instruction.

参数
  • io_var (int, str) -- variable to wait for, provided as a str or int

  • io_value (int, float, str) -- value of the variable, provided as a str, float or int

  • timeout_ms (float, int) -- maximum wait time

samplepost.joints_2_str(joints)

Converts a robot joint target to a string according to the syntax/format of the controller.

参数

pose -- 4x4 pose matrix

返回

joint format as a J1-Jn string

返回类型

str

samplepost.pose_2_str(pose)

Converts a robot pose target to a string according to the syntax/format of the controller.

参数

pose -- 4x4 pose matrix

返回

postion as a XYZWPR string

返回类型

str

samplepost.test_post()

Test the post processor with a simple program

Post Processor Example 后置处理器实例 ======================

This section shows a sample post processor. This sample Post Processor is used as a template when a new Post Processor is created using RoboDK. 这部分显示了一个示例后处理器。使用RoboDK创建一个新的后处理器时,该样品后处理器用作模板。 .. literalinclude:: ./../../samplepost.py

caption

samplepost.py

name

Sample RoboDK Post Processor

Post Processor Example Output 后置处理器输出示例 ====================

Once a program has been generated using a Post Processor, an output such as the following will be obtained. In this example, the result is meant to be used with an ABB robot using an IRC5 controller. 一旦使用一个后置处理器程序已经产生,例如将获得的一下输出。 在这个例子中,这结果意味着使用IRC5控制器与ABB机器人。 .. code-block:: none

caption

Weld_Hexagon.mod for ABB IRC5 robot

name

Weld_Hexagon.mod for ABB IRC5 robot

MODULE MOD_Weld_Hexagon

PERS wobjdata rdkWObj := [FALSE, TRUE, "", [[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]; PERS tooldata rdkTool := [TRUE,[[0,0,0],[1,0,0,0]],[3,[0,0,200],[1,0,0,0],0,0,0.005]]; VAR speeddata rdkSpeed := [500,500,500,500]; VAR extjoint rdkExtax := [9E9,9E9,9E9,9E9,9E9,9E9];

PROC Weld_Hexagon()

!Program generated by RoboDK for ABB IRB 1600ID-4/1.5 on 29/11/2014 17:42:31 ConfJ On; ConfL On; rdkWObj.oframe:=[0,0,0],[1,0,0,0]; rdkWObj.uframe:=[0,0,0],[1,0,0,0]; rdkTool.tframe:=[-4,0,371.3],[0.92387953,0,0.38268343,0]; MoveAbsJ [[-0,-19.143793,-7.978668,0,49.189506,-0]],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveJ [[1010.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; WeldStart; MoveL [[810.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveL [[910.634,58.715,662.29],[0,0,1,0],[0,-1,0,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveL [[1110.634,58.715,662.29],[0,0,1,0],[0,-1,0,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveL [[1210.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveL [[1110.634,-287.696,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveL [[910.634,-287.696,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveL [[810.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; WeldStop; MoveL [[1010.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; MoveAbsJ [[-0,-19.143793,-7.978668,0,49.189506,-0]],rdkExtax], rdkSpeed, rdkZone, rdkTool, WObj:=rdkWObj; ConfJ On; ConfL On;

ENDPROC ENDMODULE