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

Add simulation events to a program using Python API

#1
Hello,

Is it possible to add simulation events to a program from the Python API?

e.g.

sorter_tray_manipulate = RDK.Item('sorter_tray_manipulate')
sorting_destination_frame = RDK.Item('sorting_destination_frame')
prog=RDK.AddProgram('New_Program')
prog.AddSimualtionEvent(type=EVENT_TYPE_ATTACH, tcp=sorter_tray_manipulate)
prog.AddSimualtionEvent(type=EVENT_TYPE_DETACH_ALL, attach_frame=sorting_destination_frame)
#2
This is not possible. Instead, I recommend you to add a program call to a macro that provokes a customized event.

For example, if you want to attach something together at a specific point in your program (such as grabbing an object with your robot tool):

program = RDK.AddProgram('YourProgram')
...
program.RunInstruction('YourEvent', INSTRUCTION_CALL_PROGRAM)
...

Then, the program "YourEvent" can be a Python macro in your RoboDK station that does something like this:

object.setParentStatic(tool)

This will attach the object to the tool. More information about this function here:
//www.sinclairbody.com/doc/en/PythonAPI/robo...rentStatic




Users browsing this thread:
1 Guest(s)