09-06-2021, 03:11 AM
Hi there,
I posted a version to show how I worked the Robot with RoboDK, this version is the final version. And would be helpful for those who try to use RoboDK to connect with Robot using online programming, especially to the beginners.
ROBODK – FANUC ROBOT(R-30iB controller) connection:
PC and Robot Setting -
1.Plug-in the Ethernet cable to R-30ib controller (located at the bottom-right side of the door)
2.Set a IP to PC and Robot (at the same segment)
2.1选择菜单- >设置- >主机通讯设置IP地址ROBOT (there’s no space allowed before IP address)¸ select NEXT->INIT->YES->ROBOT to finish setting
2.2select MENU->SETUP->HOST COMM->PING to check the IP Address is correctly set
2.3set a IP address to PC’s network setting of Ether Net network card
Software setting -
A.ROBOT –
1.Must USER SOCKET MESSAGING (R648) is installed
MENU->STATUS->VERSIONID->CONFIG to check
2.Must $Karel_ENB set to 1
MENU->SYSTEM_Varibles to check, if 0 set to 1 and reboot
3.Upload ROBODK DRIVERS for FANUC to robot
3.1down driver://www.sinclairbody.com/doc/en/Robots-Fanuc-R...Fanuc.html
3.2use the correct version of driver (or the robot will not follow your code)
3.3upload RDK_S3.PC, GO_MJ, GO_ML, GO_MC, GO_PROG to robot
-insert usb to FANUC’s Teach Pendant
-MENU->FILE->FILE->UTIL->SET DEVICE->USB on TP->ENTER
-Select ‘*’ to show all files
-Select all drivers and LOAD->YES to Robot
4.Initial Robot Driver (according to RoboDK website://www.sinclairbody.com/doc/en/Robots-Fanuc-R...Fanuc.html)
4.1Follw the steps below:
a. SelectMenu-(Next)-System-[TYPE]-Variables.
b. Select$HOSTS_CFG(holding shift while selecting key down will help you scroll down faster)
c. Select Number 3
d. Set$SERVER_PORTto 2000
e. ($HOSTS_CFG[3].$SERVER_PORT= 2000)
f. SelectMenu-Setup
g. Select[TYPE]-Host comm
h. Select[SHOW]-Servers
i. Select“S3”-Enter.
j. SetProtocol NametoSM
k. InPort Name, if multiple ports are available: Set Port toP3(or the corresponding port).
l. Set InactivityTimeoutto9999
m. Set Startup state to[CHOICE] START
n. Set Current state toSTARTED:
To do so, select[ACTION]-DEFINE, then[ACTION]-START
o. Start the programDRIVERRDK_S3:
Select theSELECTbutton from the teach pendant.
Scroll down towards the DRIVERRDK_S3 program
Select Enter (button from the teach pendant)
选择Shift-Reset并往前移开始program,
The DEADMAN button should always be Pressed
p.Finishing setting, the ‘busy’ and ‘run’ signal should turn yellow to breen
B.PC –
1.Open RoboDK->file->open online library to select a model of robot.
2.File->open->downloaded robot file
3.Connect to robot:
3.1Right click the mouse on the robot name of the tree, and select connect to robot
3.2Input IP address just set (e.g. 192.168.1.10)
3.3Default port 2000
3.4If set correct, will get a green signal ‘ready’
4.Add python program:
4.1program->add python program
4.2right-click the ‘Prog1’->edit python script to start python programming, there are three methods to run python code:
-F5 in editor: execute python code and a message window shows(only under this mode). When the window is opened, run on robot dn’t work
-右击“Prog1”——> pytho运行n script : simulate the python code and draw trajectories on RoboDK screen
-Right click ‘Prog1’->run on robot: execute the python code to robot
Teach Pendant:
1. Manual and auto:
1.1 Under auto mode, don’t need to press DEADMAN to run program:
- Turn R-30ib to AUTO
- Turn the top-left switch of Teach Pendant to OFF
- Press S HIFT+RESET of TP to disappear the FAULT signal
- Select program in TP (SELECT->program name (RDK_S3.PC)->ENTER)
- Press CYCLE START of R-30ib, the green signal ON, ‘busy’ and ‘run’ signal of TP turn yellow to green
- If not work try FCTN->ABORT ALL->back to select program step
1.2 Manually run program:
- Turn R-30 ib to T1
- Turn the top-left switch of TP to ON
- Select program (SELECT->program name (RDKS_3.PC)->ENTER)
- Press DEADMAN (all the time under T1/T2 mode)
- Press SHIFT+RESET make FAULT disappear
- SHIFT+FWD to run selected program
- If not work try FCTN->ABORT ALL->back to select program step
1.3 Manually move ROBOT
- Press DEADMAN (all the time pressed)
- SHIFT+RESET
- Press EADMAN+SHIFT and (X,Y,Z,rX,rY, rZ) to move the robot
2. Change robot speed:
2.1 Press ”+%”, “-%” bottom-right of TP to change speed, speed will show on the top-right of the screen of TP
3. Back to Zero posion:
- FCTN->ABORT ALL
- SELECT->HOME->ENTER
- Run program (as mentioned)
- SELECT->RDRIVERS_3->ENTER
- Run program(as mentioned)
I / O–
1. MENU->I/O
2. TYPE(F1) , to choose I/O type : Digit IO, Robot IO
3. DI is not changeable under s imulate = U ( unmulate), if simulate need, change U to S
4. Before use I/O of FANUC robot, need to set parameters:
- Config(F2)
- CRMA15/16 output: [109-120] Rack = 48, SLOT=1, START = 1(normally)
- PLC [1-100](depend on need), Rack = 92, SLOT=1 START = 1(normally)
- Need reboot to make STAT. = ACTIV
5. Digit I/O:
5.1 CRMA15/16:
- The connector located at the bottom side of R-30ib door, the wire can be bought from internet or agent
- Wiring:
DO:(see attachments)
DI::(see attachments)
5.2 PLC –
Need to have the knowledge of PLC protocal setting between PLC and Robot
6. ROBOT I/O (EE interface):
(Thanks to torayeff//www.sinclairbody.com/forum/Thread-Robot-I-O-control)
6.1 To use this, have to program two programs in robot:
- Build two programs using TP: RO[1 ] = ON and RO[1]=OFF in advance:
Select->CREATE-> ->ENTER->next->INST->I/O->RO[ ]=…->input RO=1 and select ON/OFF
PYTHON -
1. Get robot position: Joint_org = robot.Joints()
2. Move robot ( X=forward/back, Y=left/right, Z=up/down) all in length(mm)-
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[0]+y_offset
robot_z = pos_ref[0]+z_offset
target_i = Mat(target_ref)
target_i.setPose([robot_x,robot_y,robot_z])
robot.MoveL(target_i)
3. Tool coordinate control: rX= 4th axis(left/right), rY=forward/backward, rZ I will use RELTOOL and not used here, the value will always be 0)
def moverobotj(a_value, b_value, 0):
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)
4. RELTOOL is a function to turn the 6th axis separately and not affect the 4th axis and 5th axi s (//www.sinclairbody.com/forum/Thread-control-...seperately)
cvalue_ang = 30 ( e.g.)
target2 = robot.Pose()
target2= RelTool(target2,0,0,0,rz=cvalue_ang)
robot.MoveJ(target2)
5. Deep learning:
5.1 I use YOLO4 + OPENCV to detect object
5.2 How to position –
- To calculate the distance between center of object and the center of pop-up window,
- Set big movement rate and scope to make robot move faster to object
- Set smaller movement rate and scope to make robot move precisely to object
- Must have two classes to calculate the direction of object , and the robot will turn to correct direction.
5.3 Angle calculate of object:
- if object have an angle toward -25 degree, right side -15 degree,
- if object turn clockwise 40 degree
- the toward will change angle:
calculate if turn 90 degree = -15-(-25) = 10 degree
every degree causes the degree change of object = 10/90 = 0.11
turn 40 degree = 40*0.11 = 4.4
the new toward angle = -25-4.4 = -29.4
consider the right side angle change will also affect the toward degree:
-15+25-(-15)/90*40= -32.78
The latest rY = -29.4-(-17.78) = -19.33
- my object have a 15 degree offset when object is put straight,
- if angD<=15:
- offsetvalue = 0
- xoffset = 60
- yoffset = 15
- aang_diff = bvalue_ang-avalue_ang
- bang_diff = -avalue_ang-bvalue_ang
- angD+=offsetvalue
- cvalue_ang = angD-15
- avalue_ang1 = (avalue_ang-(aang_diff/-90)*angD)
- bvalue_ang1 = (bvalue_ang-(bang_diff/-90)*angD)
- avalue_ang2 = avalue_ang1-(bvalue_ang1-bvalue_ang)
- bvalue_ang2 = bvalue_ang1+(avalue_ang1-avalue_ang)
- else:
- xoffset = 60
- yoffset=30
- offsetvalue = 0
- aang_diff = -bvalue_ang-avalue_ang
- bang_diff = avalue_ang-bvalue_ang
- angD-=offsetvalue
- if angD>=15:
- cvalue_ang = angD-15
- else:
- cvalue_ang = angD-0
- avalue_ang1 = (avalue_ang-(aang_diff/90)*angD)
- bvalue_ang1 = (bvalue_ang-(bang_diff/90)*angD)
- avalue_ang2 = avalue_ang1+(bvalue_ang1-bvalue_ang)
- bvalue_ang2 = bvalue_ang1-(avalue_ang1-avalue_ang)
- moverobotj(avalue_ang2,bvalue_ang2,0)
-
- target2 = robot.Pose()
- target2= RelTool(target2,0,0,0,rz=cvalue_ang)
- robot.MoveJ(target2)
- avalue_rad = (avalue_ang2)*(math.pi/180)
- bvalue_rad = (bvalue_ang2)*(math.pi/180)
- arm_length = 220
- math_x_offset = (math.sin(bvalue_rad)*arm_length)
- math_y_offset = -(math.sin(avalue_rad)*arm_length)
- moverobot1(math_x_offset+xoffset,math_y_offset-yoffset,0)
6. I / O
6.1 RI 、 RO: use RobkDK command robot. RI[x, 0/1] 、 RO[ x, 0/1] to control Digital I/O of Robot (x = number of I/O, 0/1: 0 =OFF, 1 = ON)
6.2 ROBOT I/O: use RoboDK command robot.RunInstruction('RO_OFF', robolink.INSTRUCTION_CALL_PROGRAM), ’RO_OFF’ is the program name in Robot
7. RUN ON ROBOT and Encryption :
7.1 Use command RDK. setRunMode(RUNMODE_RUN_ROBOT) to run on robot by python code.
7.2 To make sure user won’t change python code, use the Plug-Ins function of RoboDK (//www.sinclairbody.com/forum/Thread-encrypti...ython-prog)
- Save P ython code as a .py file
- Add a subfolder under C:\ROBODK\A pps
- Put .py file to the subfolder
- select tools->Plug-Ins->Load Plug-In->App Loader
- the program will appears at the toolbar of RoboDK
- to combine the command ‘runmode_run_robot’ for more convenient for user
I posted a version to show how I worked the Robot with RoboDK, this version is the final version. And would be helpful for those who try to use RoboDK to connect with Robot using online programming, especially to the beginners.
ROBODK – FANUC ROBOT(R-30iB controller) connection:
PC and Robot Setting -
1.Plug-in the Ethernet cable to R-30ib controller (located at the bottom-right side of the door)
2.Set a IP to PC and Robot (at the same segment)
2.1选择菜单- >设置- >主机通讯设置IP地址ROBOT (there’s no space allowed before IP address)¸ select NEXT->INIT->YES->ROBOT to finish setting
2.2select MENU->SETUP->HOST COMM->PING to check the IP Address is correctly set
2.3set a IP address to PC’s network setting of Ether Net network card
Software setting -
A.ROBOT –
1.Must USER SOCKET MESSAGING (R648) is installed
MENU->STATUS->VERSIONID->CONFIG to check
2.Must $Karel_ENB set to 1
MENU->SYSTEM_Varibles to check, if 0 set to 1 and reboot
3.Upload ROBODK DRIVERS for FANUC to robot
3.1down driver://www.sinclairbody.com/doc/en/Robots-Fanuc-R...Fanuc.html
3.2use the correct version of driver (or the robot will not follow your code)
3.3upload RDK_S3.PC, GO_MJ, GO_ML, GO_MC, GO_PROG to robot
-insert usb to FANUC’s Teach Pendant
-MENU->FILE->FILE->UTIL->SET DEVICE->USB on TP->ENTER
-Select ‘*’ to show all files
-Select all drivers and LOAD->YES to Robot
4.Initial Robot Driver (according to RoboDK website://www.sinclairbody.com/doc/en/Robots-Fanuc-R...Fanuc.html)
4.1Follw the steps below:
a. SelectMenu-(Next)-System-[TYPE]-Variables.
b. Select$HOSTS_CFG(holding shift while selecting key down will help you scroll down faster)
c. Select Number 3
d. Set$SERVER_PORTto 2000
e. ($HOSTS_CFG[3].$SERVER_PORT= 2000)
f. SelectMenu-Setup
g. Select[TYPE]-Host comm
h. Select[SHOW]-Servers
i. Select“S3”-Enter.
j. SetProtocol NametoSM
k. InPort Name, if multiple ports are available: Set Port toP3(or the corresponding port).
l. Set InactivityTimeoutto9999
m. Set Startup state to[CHOICE] START
n. Set Current state toSTARTED:
To do so, select[ACTION]-DEFINE, then[ACTION]-START
o. Start the programDRIVERRDK_S3:
Select theSELECTbutton from the teach pendant.
Scroll down towards the DRIVERRDK_S3 program
Select Enter (button from the teach pendant)
选择Shift-Reset并往前移开始program,
The DEADMAN button should always be Pressed
p.Finishing setting, the ‘busy’ and ‘run’ signal should turn yellow to breen
B.PC –
1.Open RoboDK->file->open online library to select a model of robot.
2.File->open->downloaded robot file
3.Connect to robot:
3.1Right click the mouse on the robot name of the tree, and select connect to robot
3.2Input IP address just set (e.g. 192.168.1.10)
3.3Default port 2000
3.4If set correct, will get a green signal ‘ready’
4.Add python program:
4.1program->add python program
4.2right-click the ‘Prog1’->edit python script to start python programming, there are three methods to run python code:
-F5 in editor: execute python code and a message window shows(only under this mode). When the window is opened, run on robot dn’t work
-右击“Prog1”——> pytho运行n script : simulate the python code and draw trajectories on RoboDK screen
-Right click ‘Prog1’->run on robot: execute the python code to robot
Teach Pendant:
1. Manual and auto:
1.1 Under auto mode, don’t need to press DEADMAN to run program:
- Turn R-30ib to AUTO
- Turn the top-left switch of Teach Pendant to OFF
- Press S HIFT+RESET of TP to disappear the FAULT signal
- Select program in TP (SELECT->program name (RDK_S3.PC)->ENTER)
- Press CYCLE START of R-30ib, the green signal ON, ‘busy’ and ‘run’ signal of TP turn yellow to green
- If not work try FCTN->ABORT ALL->back to select program step
1.2 Manually run program:
- Turn R-30 ib to T1
- Turn the top-left switch of TP to ON
- Select program (SELECT->program name (RDKS_3.PC)->ENTER)
- Press DEADMAN (all the time under T1/T2 mode)
- Press SHIFT+RESET make FAULT disappear
- SHIFT+FWD to run selected program
- If not work try FCTN->ABORT ALL->back to select program step
1.3 Manually move ROBOT
- Press DEADMAN (all the time pressed)
- SHIFT+RESET
- Press EADMAN+SHIFT and (X,Y,Z,rX,rY, rZ) to move the robot
2. Change robot speed:
2.1 Press ”+%”, “-%” bottom-right of TP to change speed, speed will show on the top-right of the screen of TP
3. Back to Zero posion:
- FCTN->ABORT ALL
- SELECT->HOME->ENTER
- Run program (as mentioned)
- SELECT->RDRIVERS_3->ENTER
- Run program(as mentioned)
I / O–
1. MENU->I/O
2. TYPE(F1) , to choose I/O type : Digit IO, Robot IO
3. DI is not changeable under s imulate = U ( unmulate), if simulate need, change U to S
4. Before use I/O of FANUC robot, need to set parameters:
- Config(F2)
- CRMA15/16 output: [109-120] Rack = 48, SLOT=1, START = 1(normally)
- PLC [1-100](depend on need), Rack = 92, SLOT=1 START = 1(normally)
- Need reboot to make STAT. = ACTIV
5. Digit I/O:
5.1 CRMA15/16:
- The connector located at the bottom side of R-30ib door, the wire can be bought from internet or agent
- Wiring:
DO:(see attachments)
DI::(see attachments)
5.2 PLC –
Need to have the knowledge of PLC protocal setting between PLC and Robot
6. ROBOT I/O (EE interface):
(Thanks to torayeff//www.sinclairbody.com/forum/Thread-Robot-I-O-control)
6.1 To use this, have to program two programs in robot:
- Build two programs using TP: RO[1 ] = ON and RO[1]=OFF in advance:
Select->CREATE-> ->ENTER->next->INST->I/O->RO[ ]=…->input RO=1 and select ON/OFF
PYTHON -
1. Get robot position: Joint_org = robot.Joints()
2. Move robot ( X=forward/back, Y=left/right, Z=up/down) all in length(mm)-
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[0]+y_offset
robot_z = pos_ref[0]+z_offset
target_i = Mat(target_ref)
target_i.setPose([robot_x,robot_y,robot_z])
robot.MoveL(target_i)
3. Tool coordinate control: rX= 4th axis(left/right), rY=forward/backward, rZ I will use RELTOOL and not used here, the value will always be 0)
def moverobotj(a_value, b_value, 0):
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)
4. RELTOOL is a function to turn the 6th axis separately and not affect the 4th axis and 5th axi s (//www.sinclairbody.com/forum/Thread-control-...seperately)
cvalue_ang = 30 ( e.g.)
target2 = robot.Pose()
target2= RelTool(target2,0,0,0,rz=cvalue_ang)
robot.MoveJ(target2)
5. Deep learning:
5.1 I use YOLO4 + OPENCV to detect object
5.2 How to position –
- To calculate the distance between center of object and the center of pop-up window,
- Set big movement rate and scope to make robot move faster to object
- Set smaller movement rate and scope to make robot move precisely to object
- Must have two classes to calculate the direction of object , and the robot will turn to correct direction.
5.3 Angle calculate of object:
- if object have an angle toward -25 degree, right side -15 degree,
- if object turn clockwise 40 degree
- the toward will change angle:
calculate if turn 90 degree = -15-(-25) = 10 degree
every degree causes the degree change of object = 10/90 = 0.11
turn 40 degree = 40*0.11 = 4.4
the new toward angle = -25-4.4 = -29.4
consider the right side angle change will also affect the toward degree:
-15+25-(-15)/90*40= -32.78
The latest rY = -29.4-(-17.78) = -19.33
- my object have a 15 degree offset when object is put straight,
- if angD<=15:
- offsetvalue = 0
- xoffset = 60
- yoffset = 15
- aang_diff = bvalue_ang-avalue_ang
- bang_diff = -avalue_ang-bvalue_ang
- angD+=offsetvalue
- cvalue_ang = angD-15
- avalue_ang1 = (avalue_ang-(aang_diff/-90)*angD)
- bvalue_ang1 = (bvalue_ang-(bang_diff/-90)*angD)
- avalue_ang2 = avalue_ang1-(bvalue_ang1-bvalue_ang)
- bvalue_ang2 = bvalue_ang1+(avalue_ang1-avalue_ang)
- else:
- xoffset = 60
- yoffset=30
- offsetvalue = 0
- aang_diff = -bvalue_ang-avalue_ang
- bang_diff = avalue_ang-bvalue_ang
- angD-=offsetvalue
- if angD>=15:
- cvalue_ang = angD-15
- else:
- cvalue_ang = angD-0
- avalue_ang1 = (avalue_ang-(aang_diff/90)*angD)
- bvalue_ang1 = (bvalue_ang-(bang_diff/90)*angD)
- avalue_ang2 = avalue_ang1+(bvalue_ang1-bvalue_ang)
- bvalue_ang2 = bvalue_ang1-(avalue_ang1-avalue_ang)
- moverobotj(avalue_ang2,bvalue_ang2,0)
-
- target2 = robot.Pose()
- target2= RelTool(target2,0,0,0,rz=cvalue_ang)
- robot.MoveJ(target2)
- avalue_rad = (avalue_ang2)*(math.pi/180)
- bvalue_rad = (bvalue_ang2)*(math.pi/180)
- arm_length = 220
- math_x_offset = (math.sin(bvalue_rad)*arm_length)
- math_y_offset = -(math.sin(avalue_rad)*arm_length)
- moverobot1(math_x_offset+xoffset,math_y_offset-yoffset,0)
6. I / O
6.1 RI 、 RO: use RobkDK command robot. RI[x, 0/1] 、 RO[ x, 0/1] to control Digital I/O of Robot (x = number of I/O, 0/1: 0 =OFF, 1 = ON)
6.2 ROBOT I/O: use RoboDK command robot.RunInstruction('RO_OFF', robolink.INSTRUCTION_CALL_PROGRAM), ’RO_OFF’ is the program name in Robot
7. RUN ON ROBOT and Encryption :
7.1 Use command RDK. setRunMode(RUNMODE_RUN_ROBOT) to run on robot by python code.
7.2 To make sure user won’t change python code, use the Plug-Ins function of RoboDK (//www.sinclairbody.com/forum/Thread-encrypti...ython-prog)
- Save P ython code as a .py file
- Add a subfolder under C:\ROBODK\A pps
- Put .py file to the subfolder
- select tools->Plug-Ins->Load Plug-In->App Loader
- the program will appears at the toolbar of RoboDK
- to combine the command ‘runmode_run_robot’ for more convenient for user