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

Driver control error with Fanuc robot and the API

#1
We currently control a Fanuc M-10iD/12 robot arm through ROBODK connection made from the PC.

We excute mainprog to control DO105 and triggered off the macro prog(group mask 1,*,*,*,*,*,*,*) of robot then use RDK.RunProgram('myprog',wait_for_finished=True), wait for DI 108 signal on when macro prog completed, it triggered off DI 108 signal and return to mainporg, continue to execute other actions while it excutes point6, we always have unexpected error:
Code:
print("point6")
current_pose = robot.Pose()
new_pose = current_pose * transl(0,0,100)
robot.setPose(new_pose)
robot.MoveJ(new_pose)
Alarm:
INTP-105 (RMACRO02,1) Run request failed
PROG-040 Already locked by other task

I think it's an erro caused by group mask, checked several possible information and solution but cannot solve it
is it possible to get your advice / comment to solve this issue?

The macro prog is a visual software irvision 3DV from Fanuc.

Attached is the macro program documentation.

And complete mainprog:
Code:
from robolink import *
from robodk import *
from robodk import robomath
from robodk.robolink import *
from robodk.robomath import *
import keyboard

RDK = Robolink()
item = RDK.Item('base')
itemlist = RDK.ItemList()
robot = RDK.ItemUserPick('Fanuc M-10iD/12', ITEM_TYPE_ROBOT)

while True:
success = robot.Connect()
time.sleep(3)
status, status_msg = robot.ConnectedState()
if status != ROBOTCOM_READY:
print("robot not ready")
else:
break

RDK.setRunMode(RUNMODE_RUN_ROBOT)
robot.setSpeed(100)
c=0
while True:
#"""
robot.setDO(105,1)
time.sleep(0.5)
robot.setDO(105,0)
time.sleep(0.2)
print("point1")
prog = RDK.Item('myprog',ITEM_TYPE_PROGRAM)
print("point2")
RDK.RunProgram('myprog',wait_for_finished=True)
#"""

print("結束fanuc控制權回到python")
target = robot.Pose()

print("point3")
robot.setDO(106,0)
time.sleep(0.2)

print("point5")
robot.MoveJ([85.513,-14.088,-43.344,-178.804,-132.483,-50.564])
time.sleep(0.2)

print("point6")
current_pose = robot.Pose()
new_pose = current_pose * transl(0,0,100)
robot.setPose(new_pose)
robot.MoveJ(new_pose)

c+=1
print(f"count:{c}")

if keyboard.is_pressed('q'):
break



Attached Files
.txt rmacro2.txt(Size: 2.99 KB / Downloads: 36)
#2
This issue is probably related to another task having control over the motion. You may need to stop all tasks before running the programm generated by RoboDK that makes the robot move.

Also, it is not clear if you are generating an LS robot program from RoboDK and loading it on the controller or if you want to use the RoboDK driver for Fanuc?

If you want to use the RoboDK driver for Fanuc you should follow these steps and make sure you can move the robot from RoboDK before you try moving it from your script:
//www.sinclairbody.com/doc/en/Robots-Fanuc.html#DriverFanuc
#3
Thank you for your response.

I have successfully installed and established a connection with the FANUC robot using the RoboDK driver.

My objective is to control the DO output through RoboDK to execute FANUC's internal vision program for gripping actions. I am waiting for FANUC to complete its internal actions and provide a DI signal as feedback to RoboDK, indicating that the internal program has finished. Then, RoboDK will proceed to execute other actions.

However, I am encountering the error message mentioned earlier:
Alarm:
INTP-105 (RMACRO02,1) Run request failed
PROG-040 Already locked by other task
#4
Thank you once again for your response.

I would like to inquire if it is possible to invoke the internal FANUC vision program called "3DV" through RoboDK.


RDK = Robolink()
item = RDK.Item('Fanuc M-10iD/12')
itemlist = RDK.ItemList()
robot = RDK.ItemUserPick('Fanuc M-10iD/12', ITEM_TYPE_ROBOT)

while True:
success = robot.Connect()
time.sleep(3)
status, status_msg = robot.ConnectedState()
if status != ROBOTCOM_READY:
print("robot not ready")
else:
break

RDK.setRunMode(RUNMODE_RUN_ROBOT)
robot.setSpeedJoints(40)

while True:

robot.setDO(105,1)
time.sleep(0.5)
robot.setDO(105,0)
time.sleep(0.2)
prog = RDK.Item('myprog',ITEM_TYPE_PROGRAM)
RDK.RunProgram('myprog',wait_for_finished=True)
time.sleep(0.2)

robot.MoveJ([85.513,-14.088,-43.344,-178.804,-132.483,-50.564])#沖床下方反轉
time.sleep(0.2)
#5
Yes, you can trigger programs using the driver. You should customize the GO_PROG file on the Fanuc teach pendant to run the programs you need based on a program ID.

This program ID is passed from RoboDK to the Fanuc controller by adding a number at the end of your program. For example, to run program ID you would need to run:
Code:
robot.RunCode("myprog 2")
#6
Thank you for your response and reminder.
I will continue to ask my question here, and I apologize for the inconvenience.

I have identified the issue. In the RoboDK program, during normal execution,
the robot moves to the point robot.MoveJ([39.115,-19.715,-15.077,-0.894,-75.917,-82.945]).
After that, I call myprog1 using the following two lines of code:
prog = RDK.Item('myprog1', ITEM_TYPE_PROGRAM)
RDK.RunProgram('myprog1', wait_for_finished=True)

=====================================
The problem occurs when an error happens during execution.
RoboDK has sent the movement parameters to the robot and is in the process of executing the movement program robot.
MoveJ([39.115,-19.715,-15.077,-0.894,-75.917,-82.945]),
but the robot has not finished the movement yet.
However, RoboDK proceeds to execute the next line of code,
calling myprog1, which results in the error PROG-040 Already locked by other task.

我想知道如何预防这个问题来m happening.
Normally, the error occurs after the robot has looped 2-3 times.
Do I need to provide any additional helpful information?
#7
This probably happens because you are using a rounding or CNT value with your movements. This could be the default behavior of the Fanuc driver.

To disable rounding you can trigger this call before you execute any movements:

Code:
robot.setRounding(-1)

You can find more information about rounding here:
//www.sinclairbody.com/doc/en/Robot-Programs.html#InsSmooth
#8
Thank you for your response.

1、In my python workflow, from MoveJ([39.115,-19.715,-15.077,-0.894,-75.917,-82.945]) to the next instruction prog = RDK.Item('myprog1', ITEM_TYPE_PROGRAM), the robot is being executed by RoboDK online, and no rounding or CNT value is used with the movements. Are there any other possibilities?

2、To add robot.setRounding(-1) before each line of instruction, you can modify your code as follows:

PHP Code:
prog=RDK.Item('myprog',ITEM_TYPE_PROGRAM)
RDK.RunProgram('myprog',wait_for_finished=True)
time.sleep(0.2)
robot.setRounding(-1)
robot.MoveJ([85.513, -14.088, -43.344, -178.804, -132.483, -50.564])# Reverse below the punch
moverobot1(0,0,100)# Offset in Z=100
time.sleep(0.5)

robot.setDO(106,0)
robot.setRounding(-1)
robot.MoveJ([39.115, -19.715, -15.077, -0.894, -75.917, -82.945])# Home position
time.sleep(0.5)
robot.setRounding(-1)
prog=RDK.Item('myprog1',ITEM_TYPE_PROGRAM)
RDK.RunProgram('myprog1',wait_for_finished=True)
time.sleep(0.2)





  1. 3.Earlier, you were advised to use robot.RunCode("myprog2"), but in your code, you execute robot.RunCode("RMACRO2 1"), which seems to have no effect. RMACRO2 is an .LS program in Fanuc, and the GO_PROG file R[52] register does not change. Can you provide more detailed information?4.Additionally, is it not possible to use robot.waitDI(108, 1) on the Fanuc robot because the data you receive is in nanoseconds? In your program, robot.waitDI(108, 1) should wait until DI108 equals 1 (ON) before continuing with the next instruction. However, it does not wait and proceeds to execute the next program code. Is there anything I might be missing in my code?
#9
It should work if you just call robot.setRounding(-1) only once. Then, it applies from then on as long as you keep the connection active.

You should add a space and then a number to properly set the program ID. The program ID is stored in the Fanuc Register R[52] and you can use this register to map to the desired program.

What do you mean by waitDI in nanoseconds? It should block until the correct input changes, regardless of the time.

If you still have issues, can you send us the Connection log? We can better understand what is going on.




Users browsing this thread:
1 Guest(s)