Check program reach/collisions for moving workpiece可打印版本 +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: Check program reach/collisions for moving workpiece (/Thread-Check-program-reach-collisions-for-moving-workpiece) |
Check program reach/collisions for moving workpiece-cso_juan-12-02-2022 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? RE: Check program reach/collisions for moving workpiece-Albert-12-02-2022 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. RE: Check program reach/collisions for moving workpiece-cso_juan-12-02-2022 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. RE: Check program reach/collisions for moving workpiece-Albert-12-02-2022 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 *
RE: Check program reach/collisions for moving workpiece-cso_juan-12-05-2022 "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? RE: Check program reach/collisions for moving workpiece-Albert-12-20-2022 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. |