Posts: 6
Threads: 4
加入:2022年9月
Reputation:
0
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?
Posts: 2,215
Threads: 1
Joined: Apr 2018
Reputation:
119
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.
Posts: 6
Threads: 4
加入:2022年9月
Reputation:
0
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.
Posts: 6
Threads: 4
加入:2022年9月
Reputation:
0
"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?
Posts: 2,215
Threads: 1
Joined: Apr 2018
Reputation:
119
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.