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

Programming the IO of FANUC CR-15iA / R-30iB controller using RoboDK

#1
Hello,

I am trying to figure out how I can address the end effector (EE) I/O port on a FANUC CR-15iA that is being controlled via the FANUC R-30iB Plus controller box. I will be using the FANUC/RoboDK drivers offered on the RoboDK site, but there doesn't seem to be a library listing the various methods that can be called. I’m hoping to come upon a command like “setRO[x]=1” that can be executed within the KAREL code that’s being streamed into the robot by RoboDK. I’d like to inject these commands at specific robot movements such that the KAREL code would look like:
 
J1 xxx J2 xxx J3 xxx
J4 xxx J5 xxx J6 xxx
setRO[x] = 1;
etc….
 
Additionally, I have done some digging into the post processing aspect of things and found the "setDO(io_var, io_value)" command. I am wondering if I call this function as “setDO(1, 1)” if that will set robot output pin 1 (RO[1]) to be 1 on the EE I/O port.

Any info on how to program the FANUC CR-15iA / R-30iB plus controller via RoboDK code would be greatly appreciated.  
 
Thank you
#2
(05-04-2022, 07:53 PM)RobotOverlord Wrote: Hello,

I am trying to figure out how I can address the end effector (EE) I/O port on a FANUC CR-15iA that is being controlled via the FANUC R-30iB Plus controller box. I will be using the FANUC/RoboDK drivers offered on the RoboDK site, but there doesn't seem to be a library listing the various methods that can be called. I’m hoping to come upon a command like “setRO[x]=1” that can be executed within the KAREL code that’s being streamed into the robot by RoboDK. I’d like to inject these commands at specific robot movements such that the KAREL code would look like:
 
J1 xxx J2 xxx J3 xxx
J4 xxx J5 xxx J6 xxx
setRO[x] = 1;
etc….
 
Additionally, I have done some digging into the post processing aspect of things and found the "setDO(io_var, io_value)" command. I am wondering if I call this function as “setDO(1, 1)” if that will set robot output pin 1 (RO[1]) to be 1 on the EE I/O port.

Any info on how to program the FANUC CR-15iA / R-30iB plus controller via RoboDK code would be greatly appreciated.  
 
Thank you

In my experience, if you want to use EE interface of robot, you have to write a program in robot.  And you can use robot.RunInstruction('program name', robolink.INSTRUCTION_CALL_PROGRAM) to call the program which you wrote in R-30iB.  However, I can only use this function in T1/T2 mode, not in AUTO MODE.  
In order to solve this problem, I modified my teach pendant.  If you are interested in that.  You can see my post
https://robodk.com/forum/Thread-RUNINSTR...nuc-R30-ib
I believe there is a better solution, but I still don't find it :(.
#3
Thank you for the response Timothy,

I am quite frustrated at the lack of documentation available for the programming language aspects of the robot, controller and RoboDK. Do you have a link to where you found out the syntax to the code like this: "robolink.INSTRUCTION_CALL_PROGRAM" I'm very new to industrial robots, so I still do not know the robot code syntax or libraries, or even what IDE I should be using, if I can just use RoboDK to write the code "robolink.INSTRUCTION_CALL_PROGRAM" into it. My background with coding is Arduino and C.
#4
the link here are the commands of robodk, it's based on Python, I think you will get very 'comfortable' to write in python since you have the backgroud of C.
https://robodk.com/doc/en/PythonAPI/robodk.html
I only use some of them, such as:

connect to robot:
RDK = Robolink()
item = RDK.Item('base')
itemlist = RDK.ItemList()
robot = RDK.ItemUserPick('Select a robot', ITEM_TYPE_ROBOT)

to check if robot is connected, you can write a loop
while True:
success = robot.Connect()
time.sleep(X)
status, status_msg = robot.ConnectedState()
if status != ROBOTCOM_READY:
print(XXX)
else:
break

to execute progrom at robot directly:
RDK.setRunMode(RUNMODE_RUN_ROBOT)
to execute progrom at robodk:
RDK.setRunMode(RUNMODE_SIMULATE)

to set robot speed:
robot.setSpeed(a value)


'robot.setDO' to control digital IO

'robot.MoveJ(joints)' , 'robot.MoveL' to move robot, I wrote a function to do this:
def moverobot1(x_offset,y_offset,z_offset):
target_ref = robot.Pose()
pos_ref = target_ref.Pos()
robot_x = pos_ref[0]+x_offset
robot_y = pos_ref[1]+y_offset
robot_z = pos_ref[2]+z_offset
target_i = Mat(target_ref)
target_i.setPos([robot_x,robot_y,robot_z])
robot.MoveL(target_i)

def moverobotj(a_value,b_value,c_value):
target = robot.Pose()
xyzabc = Pose_2_Fanuc(target)
x,y,z,a,b,c = xyzabc
xyzabc2 = [x,y,z,a+a_value,b+b_value,c+c_value]
target2 = Fanuc_2_Pose(xyzabc2)
robot.MoveJ(target2)

'robot.Joints()' to get the position of robot, it return a 2D list [[x],[y],[z],[rx],[ry],[rz]], if you want to use it, you have to transfer it to 1D list: [x,y,z,rx,ry,rz]
joints_org = robot.Joints()
After you move your robot to other position, and want to get back to this position : robot.MoveJ(joints_org)

'RelTool' to move rx,ry,rz, I don't know how to explain this. You can try it and you will know the difference between reltool and moveL/moveJ
target2 = robot.Pose()
target2= RelTool(target2,0,0,0,rz=angle value)
robot.MoveJ(target2)


this link was written for the beginner to connect
https://robodk.com/forum/Thread-CONNECT-...ht=timothy

it is what all I know about RoboDK
  




Users browsing this thread:
1 Guest(s)