FANUC CNC Driver

FANUC CNC bundles allow to interact with the following FANUC CNC models:

  • FANUC Series 30i /31i /32i /35i-MODEL B
  • FANUC Series 31i-MODEL B5
  • FANUC Power Motion i-MODEL A
  • FANUC Series 0i-MODEL D/F

FANUC CNC integration in ESF is provided by the following bundles:

com.eurotech.addons.esf.fanuc.bindings

Provides Java bindings that allow to interact with the FANUC FOCAS library.

com.eurotech.addons.esf.fanuc.core

Provides some higher level APIs that can be used to perform the following operations:

  • Getting and managing handles (CNC connections).
  • Browse CNC directory structure.
  • Download and upload programs.
  • Reading CNC parameters and diagnostic data.

Depends on com.eurotech.addons.esf.fanuc.bindings

com.eurotech.addons.esf.fanuc.driver

Provides a Driver that can be used for reading parameters and diagnostic data from a CNC using the Wires and Asset models.

com.eurotech.addons.esf.fanuc.command

Example bundle that provides support for using the functionalities provided by the com.eurotech.addons.esf.fanuc.core bundle through the OSGi console.

Depends on com.eurotech.addons.esf.fanuc.core and com.eurotech.addons.esf.fanuc.bindings.

Using the APIs

The FOCAS library functions are exposed by the methods of the fanuc class inside the com.eurotech.fanuc.bindings package. Since these methods directly wrap FOCAS functions, please refer to the FOCAS library documentation.

The documentation for the com.eurotech.addons.esf.fanuc.core bundle APIs is provided in form of Javadoc. Please download and extract the jar file to access the documentation.

## FANUC driver

The com.eurotech.addons.esf.fanuc.driver package provides a Driver that allows to read CNC diagnostic data and parameters using the Wires and Asset models.
The driver depends on the com.eurotech.addons.esf.fanuc.core bundle.

The driver configuration allows to specify the IP address and port of the CNC to connect to.

The driver channel configuration is composed of the following parameters:

  • resource.type: Specifies whether the channel data refers to a CNC parameter or a diagnostic item.

  • axis: Specifies the axis index for channel data, the 0 value should be used if the data is not per-axis.

  • number: The number of the desired parameter or diagnostic item.

  • bit.index: If the channel refers to a parameter or diagnostic item composed of bit flags, this parameter specifies the index of the bit to be read, in the [0, 7] range. This parameter is considered by the driver only if the channel value.type is set to BOOLEAN.

Download

The FANUC CNC Driver is available in The ESF downloads section and in the Eclipse Marketplace.
The driver is available only for ARM v7+ based gateways.

Using the command bundle

The com.eurotech.addons.esf.fanuc.command bundle provides some OSGi console commands that allows to use the functionalities provided by the com.eurotech.addons.esf.fanuc.core bundle. It is only possible to interact with a single CNC at a time with the command bundle. The Driver and the core package do not impose any limitation on the number of CNCs that can be accessed simultaneously.

The OSGi console is reachable by establishing a TCP connection to port 5002 of the device. This can be done executing the following command on the device:

telnet localhost 5002

Available commands:

  • fanuc:openHandle ip/hostname port

Open an handle (connection) to the specified host and port, the default port for using FOCAS is 8193.
All subsequent commands will use the newly created handle.

  • fanuc:closeHandle

    Closes the handle that is currently in use.

  • fanuc:getHandleInfo

    Prints informations on the handle is use, if no output is produced, no handle is currently available.

  • fanuc:readMainProgramName

    Prints the name of the currently selected NC program.

  • fanuc:readMainProgramNumber

    Prints the number of the currently selected NC program.

  • fanuc:readPath

    Prints the path number currently in use.

  • fanuc:setPath pathNumber

    Sets the path number currently in use.

  • fanuc:readDiagnosticData axis parameterNumber

    Allows to read diagnostic data by number.

    Some parameters are per-axis, in this case the axis number must be specified as the axis argument. If the parameter is not axis-dependent, the 0 value must be specified as axis.

  • fanuc:readParameter axis parameterNumber

    Allows to read a parameter by number.

    Some parameters are per-axis, in this case the axis number must be specified as the axis argument. If the parameter is not axis-dependent, the 0 value must be specified as axis.

  • fanuc:readStatusInfo2

    Returns CNC status information. For example allows to check if the CNC is working or is idle.

  • fanuc:readProgramDirectory

    Allows to read the program directory for the current path, only programs registered with a program number will be displayed.

  • fanuc:readDirectory path

    Allows to read the contents of the specified directory. path must end with /.
    This functions allows to list programs defined both with or without a program number.

    Examples:

      fanuc:readDirectory "//CNC_MEM/"
      fanuc:readDirectory "//CNC_MEM/USER/PATH1/"
    
  • fanuc:readProgram programNumber

    Prints the program with the specified program number.

  • fanuc:readProgram path

    Prints the program with the specified path.

  • fanuc:readProgramToFile programNumber programFilePath

    Reads the program with the specified number and saves it on the gateway in the file specified by programFilePath.

  • fanuc:readProgramToFile path programFilePath

    Reads the program with the specified path and saves it on the gateway in the file specified by programFilePath.

  • fanuc:sendProgram program

    Transfers the program provided as argument to the CNC and saves it under the current path.

  • fanuc:sendProgram path program

    Transfers the program provided as argument to the CNC and saves it under the specified path.

    path must identify a folder on the CNC and must end with /. (e.g. //CNC_MEM/USER/PATH1/)

  • fanuc:sendProgramFromFile programFilePath

    Reads a program from the file on the gateway specified by programFilePath and saves it in the CNC under the current path.

  • fanuc:sendProgramFromFile path programFilePath

    Reads a program from the file on the gateway specified by programFilePath and saves it in the CNC under the specified path.

    path must identify a folder on the CNC and must end with /. (e.g. //CNC_MEM/USER/PATH1/)