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

Accessing the steps of an ITEM_TYPE_PROGRAM from Python

#1
I have this program (ITEM_TYPE_PROGRAM)

In the GUI item tree I can unfold it and see it's composed of stuff like
- Set Ref: ...
- Set Tool: ...
- MoveL ...
- MoveL ...

Is there a way to unfold a program like this from Python and, say, print the pose of the target corresponding to each MoveL instruction? I already tried `myprogram.InstructionList()`, where `myprogram` is the ITEM_TYPE_PROGRAM object. This returned a matrix, which I didn't understand.
#2
(06-10-2023, 01:05 AM)cso-mark Wrote:I have this program (ITEM_TYPE_PROGRAM)

In the GUI item tree I can unfold it and see it's composed of stuff like
- Set Ref: ...
- Set Tool: ...
- MoveL ...
- MoveL ...

Is there a way to unfold a program like this from Python and, say, print the pose of the target corresponding to each MoveL instruction? I already tried `myprogram.InstructionList()`, where `myprogram` is the ITEM_TYPE_PROGRAM object. This returned a matrix, which I didn't understand.

Is this what you are looking for?

Code:
prog = RDK.ItemUserPick("Pick a program",robolink.ITEM_TYPE_PROGRAM)
ins_count = prog.InstructionCount()

for ins_id in range(ins_count):
ins_dict = prog.setParam(ins_id)

if ins_dict['Type'] == robolink.INS_TYPE_MOVE:
ins_name, ins_type, mv_type, isjointtarget, pose, joints = prog.Instruction(ins_id)
if mv_type == robolink.MOVE_TYPE_LINEAR:
print(pose)
#3
Yes thank you! Is there a listing of all possible INS_TYPE_* and what they mean?
Edit: Found them herehttps://github.com/RoboDK/RoboDK-API/blo...ink.py#L56




Users browsing this thread:
1 Guest(s)