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

Add simulation events to a program using Python API


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


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)
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:


This will attach the object to the tool. More information about this function here:

Users browsing this thread:
1 Guest(s)