Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check program reach/collisions for moving workpiece
#1
We have a moving workpiece and would like to validate our programs against the set of poses that the workpiece can have. I can run a program using RunCode followed by WaitFinished, but would like some visibility into the specific program instruction that causes a reach error or collision. Is there a way to do that with the API?
#2
Yes, this is possible. When you call Update on a program you'll receive an ID that refers to the number of instructions that can be executed without issues.

Is this what you are looking for? Let us know if it is not the case.
#3
Unfortunately, I cannot use Update because I am making calls to some python scripts from within the program. Calling update will not execute these python scripts.
#4
Another option is to use the "CurrentInstruction" parameter to retrieve the id to the instruction pointer.

This was added this week so you should update RoboDK to the latest version (available only on Windows at the moment).

Example:
Code:
from robolink import *
import time
RDK = Robolink()
prog = RDK.Item("PaintTop")
prog.RunProgram()
while prog.Busy():
   ins_id = int(prog.setParam("CurrentInstruction"))
   print(ins_id)
   time.sleep(0.5)
#5
"CurrentInstruction" seems like it will do the trick! but I will have to wait until the linux version catches up to this feature. Let's say my program calls other sub-programs. would "CurrentInstruction" give me visibility into the sub-program instruction? or would it just point to the function call in the higher level program?
#6
CurrentInstruction won't give you visibility into the subprogram as it will point to the program call, but you can retrieve the program name or pointer and check the current instruction with the program it is pointing to (the program that's running). You can do this recursively.

You can access information about the instruction by using program.setParam(instruction_id) and you'll receive the instruction in a JSON format.
  




Users browsing this thread:
1 Guest(s)