FANUC Standard Interface Functions
When programming the FANUC robot, please pay attention to the following:
-
Multiple parameters in a function should be separated by commas.
-
Variable-type parameters should use local variables, which take effect only in the program.
-
Input or Output parameters can be customized for functions.
A Standard Interface program for FANUC robots supports the following functions. A Standard Interface function is implemented and represented as a procedure for FANUC robots.
Initialize Communication
This function sets the host IP address, port number, and wait time for TCP/IP communication.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
C_Tag |
The port number string of the robot. Please select a port from ports 1 to 8. |
Ip_Addr |
The IP address of the IPC as a string. |
Svr_Port |
Server port number; the default port number is 50000. |
Time_Out |
Wait time in minutes before stopping the connection attempt. |
Start Mech-Vision Project
This function is used for applications that use Mech-Vision. It runs the corresponding project to acquire and process data. It applies for applications that use Mech-Vision but not Mech-Viz.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Job |
Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision. |
Pos_Num_Need |
The expected number of vision points for Mech-Vision to send. The vision point contains the vision pose, corresponding point cloud, label, scaling, etc. Value range: 0–20, in which 0 indicates that all vision points will be received. |
SendPos_Type |
The type of the robot pose to be sent to Mech-Vision. Value range: 0 to 3.
|
Pr_Num |
ID of the Position Register storing the joint positions of the start point when SendPose_Type is 3. |
Get Vision Target(s)
This function obtains the vision result from the corresponding Mech-Vision project. It applies for applications that use Mech-Vision but not Mech-Viz.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Job |
Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision. |
Output parameter |
|
Reg_Pos_Num |
ID of the Data Register for storing the number of received poses (from 1 to 20) |
Reg_Status |
ID of the Data Register for storing the received status code. Please see Status Codes and Troubleshooting. |
Start Mech-Viz Project
This function starts the Mech-Viz project that triggers the corresponding Mech-Vision project, and therefore the Mech-Viz project can plan the robot path based on the vision points received from Mech-Vision. It is for applications that use both Mech-Vision and Mech-Viz.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
SendPos_Type |
Robot pose type. Value range: 0 to 2.
|
Pr_Num |
ID of the Position Register storing the joint positions of the start point when SendPose_Type is 2. |
Get Planned Path from Mech-Viz
This function obtains the path planned by a Mech-Viz project.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Jps_Pos |
Pose type of the waypoints in the planned path.
|
Output parameter |
|
Reg_Pos_Num |
ID of the Data Register for storing the number (1 to 20) of received waypoints. |
Reg_VPos_Num |
ID of the Data Register for storing the position of the first Vision Move waypoint in the path.
|
Reg_Status |
ID of the Data Register for storing the received status code. Please see Status Codes and Troubleshooting. |
Obtain Pose
This function stores a vision point returned by Mech-Vision or a waypoint (in TCP) returned by Mech-Viz in the specified Position Register.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Serial |
Specify the index of the pose to be stored. |
Output parameter |
|
Pr_Num |
ID of the Position Register for storing the specified pose. |
Reg_Label |
ID of the Data Register for storing the label corresponding to the specified pose. |
Reg_Speed |
ID of the Data Register for storing the velocity corresponding to the specified pose. |
Obtain Joint Positions (Available When Mech-Viz Is Used)
This function stores a vision point (in JPs) returned by Mech-Vision or a waypoint (in JPs) returned by Mech-Viz in the specified position variable. It will only take effect when the path is planned by Mech-Viz.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Serial |
Specify the index of the pose to be stored. |
Output parameter |
|
Pr_Num |
ID of the Position Register for storing the specified set of joint positions. |
Reg_Label |
ID of the Data Register for storing the label corresponding to the specified pose. |
Reg_Speed |
ID of the Data Register for storing the velocity corresponding to the specified pose. |
Switch Mech-Vision Recipe
This function specifies which parameter recipe of the Mech-Vision project to use. Parameter recipes can be used to switch parameter settings, including point cloud model for matching, ROI, confidence threshold, etc, in the same Mech-Vision project when it is used to recognize different workpieces. This function must be called BEFORE MM_START_VIS.
Select Mech-Viz Branch
This function selects along which branch the Mech-Viz project should proceed. Such branching is achieved by adding “Branch by Msg” Step(s) to the Mech-Viz project. This function specifies which exit port such Step(s) should take. MM_START_VIZ should be called BEFORE this function. When executing the “Branch by Msg” Step, Mech-Viz waits for the exit port No. sent by the function MM_SET_BCH.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Branch_Num |
Step ID of the “Branch by Msg” Step. Its value is an integer. The Step ID can be viewed in the Step Parameters panel. |
Export_Num |
The number of the exit port to take plus 1. For example, to select exit port 0 in Mech-Viz, set the value of this parameter to 1. Value range: 1 to 99. |
Set Move Index
This procedure sets the value of the Current Index parameter of the specified Mech-Viz Step. Steps that have this parameter include “Move by List”, “Move by Grid”, “Custom Pallet Pattern”, and “Predefined Pallet Pattern”. MM_START_VIZ must be called BEFORE this function.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Skill_Num |
ID of the Step, an integer. The Step ID is displayed in the parameters of the Step. |
Index_Num |
The index value that should be set the next time this Step is executed. When this function is sent, the current index value in Mech-Viz will become the parameter value minus 1. When the Mech-Viz project runs to the Step specified by this subprogram, the Current Index value in Mech-Viz will be increased by 1 to become the parameter’s value. |
Get Software Status
This function is used to obtain the software execution status of Mech-Vision, Mech-Viz, and Communication Component. Currently, this function can only be used to check whether Mech-Vision is ready to run.
Parameter
Parameter | Description |
---|---|
Output parameter |
|
MM_Status |
ID of the Data Register for storing the status code. Please see Status Codes and Troubleshooting for detailed information. |
Input Object Dimensions to Mech-Vision
This function dynamically inputs object dimensions into the Mech-Vision project. This function must be called BEFORE MM_START_VIS.
Get Gripper DO List
This function obtains the gripper DO list planned by Mech-Vision or Mech-Viz. To apply the DO signals to the gripper, call the MM_SET_DL function.
Set Gripper DO List
This function sets the DO signal values on the list returned by Mech-Vision or Mech-Viz to the general-purpose output signals.
MM_GET_DL must be called BEFORE this function. |
Calibration
This function is used for hand-eye calibration (camera extrinsic parameter calibration). It automates the calibration process in conjunction with the Camera Calibration function in Mech-Vision. For detailed instructions, see FANUC Calibration Process.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Move_Type |
Motion type
|
PosJps |
Pose in flange pose or joint positions
|
WaitTime |
The time that the robot waits to avoid shaking after it moves to the calibration point; the default value is 2 (s). |
AxisNum |
The number of the robot axes. |
AxisVal |
Float data of the external 7th axis in mm (Optional; input 0 when there is no external axis). |
Reg_CalibPos |
ID of the Position Register used in MM_AUTO_CALIB; PR[100] is used by default. |
Example
CALL MM_CALIB(2,1,2,6,0,100)
This example moves a 6-axis robot in Joint motion type, receives pose data in the form of flange pose, and sets the wait time to 2 seconds to avoid the robot from shaking after it moves to the calibration point. Moreover, the robot does not have an external 7th axis. The register PR[100] is used to store the received pose data.
Get Message of Notify Step in Mech-Vision
This function obtains the message output by the “Notify” Step in the corresponding Mech-Vision project. MM_START_VIS or MM_START_VIZ must be called BEFORE this function.
Parameters of the “Notify” Step in the Mech-Vision project must be set according to the following requirements:
-
“Service Name” must be set to “Standard Interface Notify”.
-
“Message” must be a positive integer that represents a predetermined message.
Get Custom Output Data from Mech-Vision
This function obtains the custom output data from the corresponding Mech-Vision project. “Custom output data” refers to the data output by ports other than poses and labels of the “Procedure Out” Step. The output ports can be customized if the “Port Type” parameter of the Step is set to “Custom”.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Job |
Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision. |
Output parameter |
|
Reg_Pos_Num |
ID of the Data Register for storing the number (1 to 50) of received vision points. |
Reg_Status |
ID of the Data Register for storing the received status code. |
Save Vision Point to Specified Registers
This function stores the data in a custom output data returned by Mech-Vision in the specified registers. This function should be called AFTER MM_GET_DY_DT.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Serial |
Specify the index of the vision point whose custom data need to be obtained. |
Output parameter |
|
Pr_Num |
ID of the Position Register for storing the pose of the specified vision point. |
Reg_Label |
ID of the Data Register for storing the label corresponding to the specified vision point. |
Reg_UserData |
ID of the first Data Register for storing the custom port outputs corresponding to the specified vision point. Output data are stored in consecutive registers from the specified first one. |
Get Vision Move Data or Custom Output Data
This function obtains Vision Move output from the Mech-Vision project, or the Vision Move output or custom output from the Mech-Viz project.MM_GET_PLJOP assigns the obtained data to variables.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Resource |
This parameter specifies the source of the Vision Move data.
|
Jps_Pos |
This parameter specifies the expected format of the returned data. The value range is 1 to 4. See the following table for details. |
Output parameter |
|
Reg_Pos_Num |
ID of the Data Register for storing the number (1 to 50) of received waypoints. |
Reg_VPos_Num |
ID of the Data Register for storing the position of the first Vision Move waypoint in the planned path. |
Reg_Status |
ID of the Data Register for storing the received status code. |
-
When the value of Resource is 0, the valid value range of Jps_Pos is 1 to 4. Details are provided below.
Value of Jps_Pos Format of returned data (Explained below) 1
Pose (joint positions), motion type, tool ID, velocity, element 1 in custom output data, … element N in custom output data
2
Pose (TCP), motion type, tool ID, velocity, element 1 in custom output data, … element N in custom output data
3
Pose (joint positions), motion type, tool ID, velocity, Mech-Viz Vision Move data, element 1 in custom output data, … element N in custom output data
4
Pose (TCP), motion type, tool ID, velocity, Mech-Viz Vision Move data, element 1 in custom output data, … element N in custom output data
-
When the value of Resource is a positive integer, the valid value range of Jps_Pos is 1 to 2. Details are provided below.
Value of Jps_Pos Format of returned data (Explained below) 1
Pose (joint positions), motion type, tool ID, velocity, Mech-Vision Vision Move data
2
Pose (TCP), motion type, tool ID, velocity, Mech-Vision Vision Move data
Pose
The pose of the waypoint can be in the form of joint positions (in degree) or TCP, which is composed of Cartesian coordinates (XYZ in mm) and Euler angles (ABC in degree).
Motion type
-
1: Joint motion (MOVEJ)
-
2: linear motion (MOVEL)
Tool ID
The ID of the tool to be used at this waypoint. The value “-1” means that no tool will be used at this waypoint.
Velocity
The velocity at this waypoint.
Vision Move data
Vision Move data: Refers to data output by the “Vision Move” Step in Mech-Vision or Mech-Viz, including labels of picked workobjects, number of picked workobjects, number of workobjects to be picked this time, edge/corner ID of vacuum gripper, TCP offset, orientation of workobject group, orientation of workobject, dimensions of workobject group.
Element in custom output data
“Custom output data” refers to the data output by ports other than poses and labels of the “Procedure Out” Step in the Mech-Vision project. The output ports can be customized if the “Port Type” parameter of the Step is set to “Custom”. The custom port outputs are arranged in alphabetical order of the custom port names.
Example
CALL MM_GET_PLNDT(0,3,50,51,52)
This example obtains the planned path that includes Vision Move data and custom port outputs from Mech-Viz, and the poses obtained are in the form of joint positions. The number of waypoints received is stored in register R[50], the position of the Vision Move waypoint is stored in register R[51], and the status code is stored in register R[52].
Save Waypoint to Specified Variables
This function is called AFTER MM_GET_PLANDATA to store the obtained data in variables.
Function
MM_GET_PLJOP(Serial,Jps_Pos,Pr_Num,Reg_MoveType,Reg_ToolNum,Reg_Speed,Reg_UserData,Reg_PlanRes)
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Serial |
Specify the index of the waypoint to be stored. |
Jps_Pos |
The same as the value of Jps_Pos in the Get Vision Move Data or Custom Output Data function. |
Output parameter |
|
Pr_Num |
ID of the Position Register for storing the pose of the specified waypoint. |
Reg_MoveType |
ID of the Data Register for storing the velocity corresponding to the specified waypoint. 1 stands for joint motion, and 2 stands for linear motion. |
Reg_ToolNum |
The ID of Data Register for storing the tool ID corresponding to the specified waypoint. The value “-1” means that no tool will be used at this waypoint. |
Reg_Speed |
ID of the Data Register for storing the velocity corresponding to the specified waypoint. |
Reg_UserData |
ID of the first Data Register for storing the custom port outputs corresponding to the specified waypoint. Custom output data are stored in consecutive registers from the specified first Data Register. One custom output item is stored in one register. Currently, the supported maximum number of custom output items is 50. |
Reg_PlanRes |
ID of the first Data Register for storing the Vision Move data corresponding to the specified waypoint. Vision Move data are stored in consecutive registers from the specified first Data Register. One Vision Move data item is stored in one register. Currently, the supported maximum number of Vision Move data items is 21. |
Details on Vision Move data are in the table below.
Data | Description | Corresponding Data Register ID |
---|---|---|
Labels of picked workobjects |
Consists of 10 integers. By default, its value is ten 0s. |
Reg_PlanRes ~ Reg_PlanRes+9 |
Number of picked workobjects |
The total number of workobjects that have been picked. |
Reg_PlanRes+10 |
The number of workobjects to be picked this time. |
The number of workobjects to be picked this time. |
Reg_PlanRes+11 |
Edge/corner ID of vacuum gripper |
The ID of the edge/corner used to pick workobjects this time. |
Reg_PlanRes+12 |
TCP offset |
The XYZ offset between the center of the workobject group and the tool center point. |
Reg_PlanRes+13 ~ Reg_PlanRes+15 |
Orientation of workobject group |
The relative position between the workobject group and the length of the vacuum gripper. The value is 0 or 1, where 0 stands for parallel and 1 for vertical. |
Reg_PlanRes+16 |
Orientation of workobject |
The relative position between the length of a workobject and that of the vacuum gripper. The value is 0 or 1, where 0 stands for parallel and 1 for vertical. |
Reg_PlanRes+17 |
Dimensions of the workobject group |
The length, width and height of the workobject group to be picked this time. |
Reg_PlanRes+18 ~ Reg_PlanRes+20 |
Example
CALL MM_GET_PLJOP(1,3,60,61,62,63,81,131)
This example stores the joint positions of the first received waypoint to register PR[60], the corresponding motion type to register R[61], the corresponding tool ID to register R[62], the corresponding velocity to register R[63], the corresponding custom port outputs to consecutive registers starting from R[81], and the corresponding depalletizing planning data to consecutive registers starting from R[131].
Get Result of Step “Path Planning” in Mech-Vision
This procedure obtains the collision-free path planned by the “Path Planning” Step from the corresponding Mech-Vision project.
The Port Type parameter of the “Procedure Out” Step in the Mech-Vision project must be set to “Predefined (robot path)”.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Job |
Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision. |
Jps_Pos |
The pose type of waypoints returned by the “Path Planning” Step.
|
Output parameter |
|
Reg_Pos_Num |
ID of the Data Register for storing the number (1 to 20) of received waypoints. |
Reg_VPos_Num |
ID of the Data Register for storing the position of the Vision Move waypoint which is set in the path planning tool in the entire path.
|
Reg_Status |
ID of the Data Register for storing the received status code. |
Example
CALL MM_GET_VISP(1,1,51,52,53)
This example obtains the planned path from the Mech-Vision project whose ID is 1 in the form of joint positions. The number of waypoints received is stored in register R[51], the position of the Vision Move waypoint is stored in register R[52], and the status code is stored in register R[53].
Read Mech-Viz Step Parameter
This command reads the parameter value of a specific Step in the Mech-Viz project.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Read_id |
This parameter corresponds to the Config ID field defined in the property_config file. |
Output parameter |
|
Reg_Status |
ID of the Data Register for storing the status code. Please see Status Codes and Troubleshooting for detailed information. |
Reg_Viz_Prop |
ID of the Data Register for storing the returned parameter value of the specified Step. Only INT is supported by now. |
From the toolbar of Mech-Vision, go to . Click Property Configuration to open the property_config file. |
Before calling this function, users should define a Config ID and its corresponding Step ID and parameter key name in the following format in the property_config file.
read, Config ID, Step ID, parameter key name
read |
Indicates that this line is used to read the parameter value of a Step. |
Config ID |
Specifies a unique ID, which in a positive integer. One Config ID corresponds to only one parameter value of a Step. To read multiple parameter values, you should set different Config IDs. |
Step ID |
The Step ID of the Step whose parameter is to be read. |
Parameter key name |
Specifies the key name of the parameter whose value the robot requires to read. |
|
The property_config file can have multiple read commands. The Config ID in these commands must be different. |
Example
In the line below, “5” is the Config ID; “3” is the Step ID; and “xCount” is the parameter key name. Add this line to the property_config file. Add this line to the property_config file.
read, 5, 3, xCount
When the robot calls the function below, it receives the value of the parameter whose key name is xCount.
CALL MM_GET_PROP(5,10,11)
This example stores the value of the parameter whose key name is xCount of Step 3 in the Mech-Viz project in register R[11], and stores the status code in register R[10].
Set Mech-Viz Step Parameter
This command sets the parameter value of a specific Step in the Mech-Viz project.
Parameter
Parameter | Description |
---|---|
Input parameter |
|
Write_id |
This parameter corresponds to the Config ID field defined in the property_config file. |
Output parameter |
|
Reg_Status |
ID of the Data Register for storing the status code. Please see Status Codes and Troubleshooting for detailed information. |
From the toolbar of Mech-Vision, go to . Click Property Configuration to open the property_config file. |
Before sending this command, users should define a Config ID and its corresponding Step ID, parameter key name and parameter value in the following format in the property_config file.
write, Config ID, Step ID, parameter key name, parameter value
write |
Indicates that this line is used to set the parameter value of a Step. |
Config ID |
Specifies an ID, which is a positive integer and can be used repeatedly. |
Step ID |
Specifies the Step whose parameter value the robot requires to read. |
Parameter key name |
Specifies the key name of the parameter whose value the robot requires to set. |
Parameter value |
Specifies the value that the robot sets for the parameter. |
|
Example
In the line below, “1” is the Config ID, and “3” is the Step ID. “xOffset”, “yOffset” and “zOffset” are parameter key names; and “10”, “20” and “30” are their respective values. Add this line to the property_config file.
write, 1, 3, xOffset, 10
write, 1, 3, yOffset, 20
write, 1, 3, zOffset, 30
When the robot calls the function below, Mech-Viz sets the values of the parameters whose key names are “xOffset”, “yOffset” and “zOffset” respectively to “10”, “20” and “30”.
MM_SET_PROP(1,10)
This example sets the values of the parameters whose key names are “xOffset”, “yOffset” and “zOffset” respectively to “10”, “20” and “30”, and stores the received status code in the register R[10].