02-05-2020, 05:16 PM
Hey guys,
We are trying to execute a specific instruction from a robot program using the python api. We looked at RunInstruction() but that didnt seem to be quite what we were looking for. We are iterating thru the list of instruction and just want to execute the move commands from the file. Here is the while loop that searches the program, but doesnt execute. Thanks
We are trying to execute a specific instruction from a robot program using the python api. We looked at RunInstruction() but that didnt seem to be quite what we were looking for. We are iterating thru the list of instruction and just want to execute the move commands from the file. Here is the while loop that searches the program, but doesnt execute. Thanks
Code:
# Iterate through all the instructions in a program:
ins_id = 0
ins_count = prog.InstructionCount()
while ins_id < ins_count:
# Retrieve instruction
ins_nom, ins_type, move_type, isjointtarget, pose, joints = prog.Instruction(ins_id)
print(ins_type)
#ins_type 0 is MoveJ or MoveL, MoveC =1
if ins_type <= 1:
# Select the movement instruction as a reference
prog.InstructionSelect(ins_id)
# Add a new program call
# prog.RunInstruction(ins_call, INSTRUCTION_CALL_PROGRAM)
TeachTar.RunCode()
while TeachTar.Busy():
pause(0.01)
# Advance one additional instruction as we just added another instruction
ins_id = ins_id + 1
ins_count = ins_count + 1
ins_id = ins_id + 1