Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Set ref & set tool commands skipped from output program

Hi, I'm using the Mecademic Python post-processor to export programs designed in RoboDK, and noticed that some "set ref" and "set tool" commands of programs are being skipped when generating an output .py file.

A simplified example, say I have in the RoboDK tree a main program "MainProg" which calls two sub-programs "ProgA" and "ProgB":
               Call ProgA
               Call ProgB

With ProgA and ProgB containing commands to set a reference frame and a tool, and move the robot to some target:
    Set Ref: Meca
    Set Tool: Meca tool
    Set Ref: Meca
    Set Tool: Meca tool

Then, when I generate a robot program for MainProg, the output .py file looks like:
def MainProg():
               Call ProgA()
               Call ProgB()
def ProgA():
               Set Ref: Meca
               Set Tool: Meca tool
def ProgB():
So, the "set ref" and "set tool" commands are skipped from ProgB. Presumably because they were already set in ProgA, which is called before ProgB.

This causes trouble if I were to manually edit the output .py file, and would want to call ProgB before ProgA: no reference frame nor tool has yet been set. It also seems confusing when a program in the RoboDK tree contains commands which it does not in the generated .py file.
Can you explain why the "set ref" and "set tool" commands (and perhaps others?) are being skipped, and if it is possible to avoid this?

Kind regards,

A related but different question in follow-up to the above. Consider I have a robot mounted on a linear stage, and execute the following steps:
1) Call a sub-program A to move the robot to target 1 fixed to the base of the linear stage
2) Call a sub-program B in which the linear stage shifts the base of the robot to a different position. (This effectively changes the position of target 1 with respect to the robot.)
3) Call sub-program A again to move the robot back to target 1 (still fixed to the base of the linear stage)
Simulation in RoboDK nicely shows in step 3 the robot takes into account that it has been moved by the linear axis in previous step 2, and the robot moves back to target 1, but in a different pose.
The position of the robot with respect to the target is different for step 1 and 3, but when generating an output program, this information appears lost: sub-program A just sets one reference and tool frame and moves to one target pose:
def ProgA():
    global robot
    robot.Run('SetWRF', [0.000, 240.000, 0.000, 0.000, 90.000, -90.000])
    robot.Run('SetTRF', [0.000, 0.000, 25.000, -0.000, 0.000, -0.000])
    robot.Run('MoveJoints', [0.000000, 11.025300, -12.219000, 0.000000, 1.193730, -0.000000])
So in RoboDK I can call the same sub program twice and get different poses for the robot depending on the position of the linear stage. But once it is exported to an output program file, the reference frame and target pose are fixed. When called, the robot will always move to one and the same pose. Where does the updated information go?
RoboDK filters setting the same reference and the tool by default.

You can remove this filter by following these steps:
  1. Select Tools-Options
  2. Select the Program tab
  3. Uncheck the option Filter setting reference and tool frames
Thanks, that's what I was looking for! In the same menu I see an option "Impose original tool and reference in programs", what does that do?
Hi Maarten,

You can take a look here to see the difference between the 2 options:

With the first option, you need to re-update the path if you move the part frame around.
We recommend this option as it reduces the potential for error, but both are viable.

Find useful information about RoboDK and its features by visiting our Online Documentation and by watching tutorials on our Youtube Channel


Users browsing this thread:
1 Guest(s)