0% found this document useful (0 votes)
93 views15 pages

FanucPlugin 1

This Plugin was created to allow communication between FANUC robots and Flexibowl through socket messaging. It requires a Fanuc User Socket Messaging license. The document provides steps to configure a client tag on the robot to communicate with Flexibowl using its IP address and port number. It also includes a Karel program example that uses socket messaging to send commands to Flexibowl, receive responses, and regulate tasks through status returns.

Uploaded by

Oria Meirman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views15 pages

FanucPlugin 1

This Plugin was created to allow communication between FANUC robots and Flexibowl through socket messaging. It requires a Fanuc User Socket Messaging license. The document provides steps to configure a client tag on the robot to communicate with Flexibowl using its IP address and port number. It also includes a Karel program example that uses socket messaging to send commands to Flexibowl, receive responses, and regulate tasks through status returns.

Uploaded by

Oria Meirman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

This Plugin was born with the idea of communicating quickly

and safely with Flexibowl through FANUC robots.


The Plugin requires the "Fanuc User Socket Messaging"
license for correct operation.
Karel
FANUC

CONFIGURING THE SOCKET MESSAGING OPTION


STEP 1: Overview
In order to use Socket Messaging, you need to configure the following network hardware
and software parameters:
• On the client,
— The IP address or name of your server
— The port on the server that you want to use for socket messaging.
Setting up a Client Tag
You need configure the client tags you want to use for socket messaging.
Note If the client tags you want to use are being used by a network protocol other than
TCP/IP, you need to undefine the tags before they can be used for socket messaging.

Procedure To Setting up a ClientTag


Conditions
• The tag you want to set up is not configured to be used by another device on your
network.
Steps
1. Cold start the controller.
a. On the teach pendant, press and hold the SHIFT and RESET keys. Or, on the
operator panel, press and hold RESET.
b. While still pressing SHIFT and RESET on the teach pendant (or RESET on the
operator panel), turn on the power disconnect circuit breaker.
c. Release all of the keys.
2. On the teach pendant, press MENUS.
3. Select SETUP.
4. Press F1, [TYPE].
5. Select Host Comm.
6. Press F4, [SHOW].
7. Choose Clients.
8. Move the cursor to the tag you want set up for Socket Messaging, and press F3,
DETAIL.
You will see screen similar to the following.
Karel
FANUC

9. Move the cursor to the Protocol Name item, and press F4, [CHOICE].
10. Select SM.
11. Move the cursor to the Startup State item, press F4, [CHOICE], and choose DEFINE.
12. Move the cursor to the Server IP/Hostname item, and press ENTER.
13. Type in hostname or IP address the of the remote host server you want to use for
socket messaging.
Note If you are not using DNS, you must add the remote host and its IP address into the
host entry table.
14. Press F2, [ACTION], and select DEFINE.
15. Set the system variable:
a. Press MENUS.
b. Select NEXT.
c. Select SYSTEM, and press F1, [TYPE].
d. Select Variables.
e. Move the cursor to $HOSTC_CFG, and press ENTER.
f. Move the cursor to the structure corresponding to the tag selected in Step 8 . For
example, if you are setting up tag C3, move the cursor structure element [3], as shown
in the following screen.

g. Press ENTER. You will see a screen similar to the following.

h. Move the cursor to $SERVER_PORT. Type in the name of the TCP/IP server port you
want to use for socket messaging. The client tag is now ready to use from a KAREL
program.
Karel
FANUC

The following will indicate how to set the Client and the Karel code to communicate with the
FlexiBowl. This script can be called to move the FlexiBowl or to put it in a parallel task, and to
regulate the execution through a traffic light.
The code will receive a command to execute, and return a string with the response from the
FlexiBowl.

STEP 2: Host Client C7 configuration to communicate with the FlexiBowl address: 192.168.1.10
Karel
FANUC
Karel
FANUC

System Variable configuration

STEP 3:
Karel
FANUC
Karel
FANUC
Karel
FANUC
Karel
FANUC

Run the commands from the Tp program


STEP 5: Once the client is configured, after importing the Flb_Plugin.pc file, it will be possible to move
the FlexiBowl or make diagnostics from the Tp program, the FlexiBowl response will be
inserted in the String [10], editable by Karel.
Karel
FANUC

Example of KAREL code:

PROGRAM Flb_Plugin
STEP 6: VAR
Karel PingAddress:BOOLEAN
return_string : STRING[128]
status : INTEGER
moving:INTEGER
cmd_type: INTEGER
cmd_int_val:INTEGER
cmd_real_val:REAL
cmd_str_val:STRING[128]

command_Str:STRING[128]
file_var : FILE
tmp_str : STRING[128]
tmp_str1:STRING[128]
tmp_str2:STRING[128]
entry : INTEGER

ROUTINE Ping
BEGIN

PingAddress=FALSE
MSG_DISCO('C7:',status)
MSG_CONNECT('C7:',status)
IF(status=0) THEN
PingAddress=TRUE
else
PingAddress=FALSE
ENDIF
MSG_DISCO('C7:',status)

END Ping

----///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
---////////////////////////////////////////////////SENDCOMMAND////////////////////////////////////////////
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

ROUTINE SendCommand(CommandExecute:STRING):STRING

BEGIN
return_string='FAIL';
command_Str=CommandExecute
Karel
FANUC

CLR_IO_STAT(file_var)
status = IO_STATUS(file_var)
IF status = 0 THEN
--Write
tmp_str=CHR(0)+CHR(7)+ command_Str + CHR(13)
WRITE file_var (tmp_str)
IF( IO_STATUS(file_var)<>0) THEN
return_string='FAIL'
WRITE ('Status var OUT fail',CR)
go to end_it
ENDIF

--READ
entry=0
WHILE entry <1 DO
BYTES_AHEAD(file_var, entry, status)
ENDWHILE

STATUS = IO_STATUS(file_var)
IF(STATUS<>0)THEN
return_string='FAIL'
WRITE ('Status var IN fail',CR)
go to end_it
ENDIF
IF (entry>0) THEN
READ file_var (tmp_str1::entry)
tmp_str2=SUB_STR(tmp_str1,2,entry-1)
return_string=tmp_str2
ELSE
return_string='FAIL'
go to end_it
ENDIF
ELSE
WRITE ('Status var fail',CR)
return_string='FAIL'
go to end_it
ENDIF

end_it::
RETURN(return_string)
END SendCommand
----///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
BEGIN
GET_TPE_PRM(1,cmd_type,cmd_int_val,cmd_real_val,cmd_str_val,S
TATUS)
IF(STR_LEN(cmd_str_val)>0) THEN
command_Str=cmd_str_val
else
return_string='FAIL'
go to end_it2

ENDIF
--setto i parametri di connessione
SET_FILE_ATR(file_var, ATR_IA)
MSG_DISCO('C7:', status)
MSG_CONNECT('C7:',status)
IF(status <> 0) THEN
return_string='FAIL'
go to end_it2
ENDIF
OPEN FILE file_var ('RW','C7:')
return_string=SendCommand(command_Str)
IF((INDEX(return_string,'%')<>0)
AND (INDEX(command_Str,'Q')<>0)) THEN
-----wait move
moving=1
WHILE (moving = 1) DO
command_Str='RS'
return_string=SendCommand(command_Str)
IF(INDEX(return_string,'F')>0) THEN
moving = 1
else
moving = 0
ENDIF
DELAY(50)
ENDWHILE
return_string='Done'
else
return_string=return_string
ENDIF
end_it2::
CLOSE FILE file_var
MSG_DISCO('C7:',status)

--write the return on string 10


SET_STR_REG(10,return_string,status)
END Flb_Plugin
Lista dei comandi:

Action Description
MOVE Moves the feeder the current
parameters.
MOVE-FLIP Moves the feeder and activates Flip
simultaneously
MOVE-BLOW- Moves the feeder and activates Flip
FLIP and blow simultaneously
MOVE-BLOW Moves the feeder and activates Flip
simultaneously
SHAKE Shakes the feeder with the current
parameters
LIGHT ON Light on
LIGHT OFF Light off
FLIP Flip
BLOW Blow
QUICK_EMPTING Quick Emptying Option
RESET_ALARM Reset Alarm and enable the motor

Command Description
QX2 Move
QX3 Move - Flip
QX4 Move - Blow - Flip
QX5 Move - Blow
QX5 Shake
QX7 Light on
QX8 Light off
QX9 Flip
QX10 Blow
QX11 Quick Emptying Option
QX12 Reset Alarm
AL Status Allarm

You might also like