ABB Standard Interface Functions
When programming the ABB 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.
-
Arguments in the program: the input arguments can be constants, global variables or local variables, and the output arguments can be global variables or local variables.
The ABB Standard Interface provides the following functions.
Initialize Communication
Start Mech-Vision Project
This function is used for applications that use Mech-Vision but not Mech-Viz. This function starts the Mech-Vision project that executes image capturing and performs vision recognition.
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.
-
0
: The sender expects to receive all vision points in the recognition result from the Mech-Vision project. -
Integer greater than 0
: The sender expects to receive the specified number of vision points in the recognition result from the Mech-Vision project.-
If the total number of vision points is less than the parameter value, all vision points in the recognition result will be sent.
-
If the total number of vision points is greater than or equal to the parameter value, the specified number of vision points will be sent.
-
|
SendPos_Type
The type of the robot pose to be sent to Mech-Vision. Value range: 0–3
-
0
: No robot poses need to be sent to the vision system. If the camera is mounted in the Eye To Hand mode, the image capturing process is independent of the robot pose, and therefore the robot pose is not needed. -
1
: The robot pose in the current joint positions together with the current flange pose will be sent to the vision system. It is recommended to set this value when the camera is mounted in the Eye In Hand mode. When this parameter is set to this value, the “Path Planning” Step in the Mech-Vision project will use the joint positions sent by the robot. If the flange pose data are all 0, the vision system ignores the flange pose data. -
2
: The robot pose in the current flange pose will be sent to the vision system. It is recommended to set this value when the camera is mounted in the Eye In Hand mode or in other scenarios where only the flange pose data is available (such as truss robots). -
3
: The robot pose in the joint positions defined by the user will be sent to the vision system. It is recommended to set this value when the camera is mounted in the Eye To Hand mode. When this parameter is set to this value, the “Path Planning” Step in the Mech-Vision project will use the joint positions sent by the robot as the initial pose.
MM_J
User-defined joint positions. When the value of SendPos_Type is set to 3, this set of joint positions will be used as the first waypoint in the path planned by the “Path Planning” Step in the Mech-Vision project. If the value of SendPos_Type is set to values other than 3, the joint positions set here will not take effect, but it has to be set.
Get Vision Target(s)
This function should be used after executing the “Start Mech-Vision Project” function. It obtains the vision result, which contains the robot pose (in TCP format) and label, from the corresponding Mech-Vision project.
Mech-Center will automatically convert the vision point information into the corresponding robot TCP. The process includes the following steps:
-
Rotate the poses around their X axes by 180 degrees.
-
Determine whether the definition of the reference frame used by the robot model involves robot base height, and add a vertical offset accordingly.
By default, command 102 can only fetch at most 20 TCPs at a time. Therefore, command 102 may need to be repeatedly executed until all the TCPs required are obtained. |
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
Last_Data
This parameter indicates whether all TCPs requested have been obtained. The value is 0 or 1.
-
0
: NOT all required TCPs have been sent (more on the way). Please execute command 102 repeatedly until the value turns to 1. -
1
: All required TCPs have been sent.
If the expected number of TCPs set in “Start Mech-Vision Project” function is greater than 20 (default value length for sending and receiving data), this parameter can be used to determine whether there is any TCP that has not been sent. If not all data have been sent, you can call command 102 repeatedly until all TCPs have been received.
If not all TCPs have been received, and command 101 is called to re-capture an image at this time, the unreceived TCPs will be cleared. |
Variable type: num
Pos_Num
The number of received TCPs.
-
If the required number of TCPs is greater than or equal to the number of vision points recognized by Mech-Vision, the number of recognized vision points will be sent.
-
If the required number of TCPs is less than the number of the recognized vision points, the required number of vision points will be sent.
Value range: 0–20
Variable type: num
MM_Status
If there is no error, status code 1100 will be returned. Otherwise, the corresponding error code will be returned.
When calling this function, Mech-Center will wait for the result from Mech-Vision and then send it to the robot. The default wait time is 10 seconds. If a timeout occurs, a timeout error code will be returned to the robot.
Variable type: num
Start Mech-Viz Project
This function applies for applications that use both Mech-Vision and Mech-Viz. It runs the corresponding Mech-Viz project (which triggers the corresponding Mech-Vision project to run), and sets the initial joint positions of the simulated robot in Mech-Viz.
Please right-click the Mech-Viz project to be started in Resources panel and select Autoload Project in the context menu.
There are some example projects of typical applications stored in Mech-Center/tool/viz_project
in the installation directory of Mech-Mind Software Suite. You can modify the example projects according to actual requirements for real applications.
Input Parameter
SendPos_Type
Robot pose type. Value range: 0–2
0
: No robot poses need to be sent to Mech-Viz. The simulated robot in Mech-Viz will start from joint positions [0,0,0,0,0,0] and move to the first waypoint.
1
: The current joint positions and flange pose of the real robot need to be sent to Mech-Viz. The simulated robot in Mech-Viz will start from the current joint positions of the real robot and move to the first waypoint.
2
:The predefined joint positions of the robot need to be sent to Mech-Viz. The simulated robot in Mech-Viz will start from the predefined joint positions and move to the first waypoint.
When the scene contains object models that obstruct the robot to move from [0, 0, 0, 0, 0, 0] to the first waypoint, this parameter must be set to 1. |
MM_J
User-defined joint positions. User-defined joint positions. When the value of SendPos_Type is set to 2, this set of joint positions will be used as the first waypoint in the path planned by Mech-Viz. If the value of SendPos_Type is set to values other than 2, the joint positions set here will not take effect, but it has to be set.
Get Planned Path from Mech-Viz
This function obtains the planned path from Mech-Viz. It should be called after “Start Mech-Viz Project”. After the planned path is obtained, the pose data can only be accessed by calling Transfer the Obtained Robot TCP data or Transfer the Obtained Joint Positions.
By default, this function can only fetch at most 20 waypoints at a time. Therefore, it may need to be repeatedly executed until all the waypoints are obtained.
If the waypoint of a move-type Step should not be sent to the robot, please clear the “Send Waypoint” option in the parameters of this Step. |
Input Parameter
GetPos_Type
This parameter specifies the type of waypoint pose returned by Mech-Viz.
-
1
: The waypoint poses are returned in the form of joint positions (JPs). Calling Transfer the Obtained Joint Positions to access the JPs data. -
2
: The waypoint poses are returned in the form of tool center point (TCP). Calling Transfer the Obtained Robot TCP data to access the TCP data.
Output Parameter
Last_Data
Variable indicating whether all waypoints have been sent.
-
0
: NOT all waypoints have been sent (more on the way). Please repeat the execution of this function until the value of this parameter becomes 1. -
1
: All waypoints have been sent.
Pos_Num
Number of waypoints. Variable for storing the number of received waypoints which contains the corresponding pose, label, velocity.
If the planned path contains more than 20 waypoints, please repeat executing this function.
Value range: 0–20
VisPos_Num
The position of the waypoint in the “Vision Move” Step in the entire planned path. The “Vision Move” waypoint is the one where the robot performs the picking.
For example, if the planned path consists of waypoints “Fixed-Point Move_1”, “Fixed-Point Move_2”, “Vision Move”, and “Fixed-Point Move_3” sequentially, the position of “Vision Move” is 3.
If the path does not contain any Vision Move waypoint, the return value is 0.
MM_Status
Status code.
If there is no error, status code 2100 will be returned. Otherwise, the corresponding error code will be returned.
After executing this function, if the result from Mech-Viz is not returned within 10 seconds, the error code for timeout will be returned. |
Example
MM_Get_VizData 2,Last,Pos_Num,Vis_Index,StatusCode;
This example obtains the planned path from Mech-Viz in the form of TCPs. Whether all waypoints have been sent is stored in variable Last, the number of waypoints received is stored in variable Pos_Num, the position of the Vision Move waypoint is stored in variable Vis_Index, and the received status code is stored in variable StatusCode.
Transfer the Obtained Robot TCP data
This function transfer the TCP pose data in the vision point (returned by Mech-Vision) or waypoint (returned by Mech-Vision or Mech-Viz) to the specified variable.
Transfer the Obtained Joint Positions
This function transfers a set of joint positions in the waypoint returned by Mech-Vision or Mech-Viz in the specified Position Registers.
Input Parameter
Index: Specify the index of the waypoint whose joint positions that will be transferred.
Switch Mech-Vision Recipe
This function specifies the parameter recipe to be used in the Mech-Vision project.
In Mech-Vision, you can change the values of Step parameters by switching the parameter recipe in use.
The parameters that can be altered by switching parameter recipes usually include the point cloud matching model, image matching template, ROI, and confidence threshold.
This procedure must be called BEFORE “Start Mech-Vision Project”. |
Input Parameter
Job
Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision.
Model_Number
Parameter recipe number.
The ID of the parameter recipe in the Mech-Vision project. The ID is a positive integer in the range of 1 to 99. Click
to edit the parameter recipe. Value range: 1 to 99.Select Mech-Viz Branch
This function selects along which branch the Mech-Viz project should proceed. Such branching is achieved by adding the “Branch by Msg” Step(s) to the Mech-Viz project.
“Start Mech-Viz Project” must be called BEFORE this function.
When the next Step to execute is a “Branch by Msg” Step, the Mech-Viz project will wait for this function to specify the exit port to take.
Input Parameter
Branch_Num
Step ID of the “Branch by Msg” Step
Exit_Num
Exit port number in integers
This parameter value should be 1 greater than the exit port number displayed in the Step. For example, if the specified exit port is the second exit port of the Step from left to right, the exit port number is 2. |
Set Move Index
This function 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”.
“Start Mech-Viz Project” must be called BEFORE this function.
Input Parameter
Skill_Num
Step ID.
The Step ID of the Step whose Current Index value needs to be set.
The value of this parameter should be a positive integer. The Step ID can be viewed in the Step Parameters panel.
Index_Num
The Current 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 function, the Current Index value in Mech-Viz will be increased by 1 to become the parameter’s value.
Get Software Status
This function obtains the execution status of Mech-Vision, Mech-Viz, and Mech-Center.
Currently, this function is capable of checking whether Mech-Vision is ready to run projects.
Input Object Dimensions to Mech-Vision
This function is used for dynamically inputting object dimensions into the Mech-Vision project. Please confirm the actual object dimensions before running the Mech-Vision project.
The Mech-Vision project should contain the “Read Object Dimensions” Step, and the Read Sizes from Properties checkbox of this Step should be selected.
Input Parameter
Job
Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision.
Length, Width, Height
The object dimensions (length, width, height) to be input to the Mech-Vision project. The dimensions will be read into the “Read Object Dimensions” Step.
The unit is millimeters.
Get DO List
This function gets the planned DO signal list. The DO signal list is used to control multiple grippers or multiple suction cup sections.
MM_Start_Viz must be called BEFORE this function to obtain the planned path from Mech-Viz.
Please deploy the Mech-Viz project based on the example project and set the corresponding suction cup configuration file. The example project is stored in tool\viz_project\suction_zone in the installation directory of Mech-Center.
Output Parameter
Status
Status code. Please refer to Status Codes and Troubleshooting for detailed information.
Set DO Signal List
This function sets the DO list sent by Mech-Viz to GO signals. It supports 4 groups of 16-bit GO signals in maximum. If you need to set multiple groups of GO signals, please run this function for several times.
MM_Get_DoList must be called BEFORE this function. |
Input TCP to Mech-Viz
This function is used for dynamically inputting robot TCP into the Mech-Viz project. The input TCP is read by the “External Move” Step.
Please deploy the Mech-Viz project based on the example project. The example project is stored in tool/viz_project/outer_move
in the installation directory of Mech-Center.
Place the “External Move” Step in an appropriate position in the workflow.
This function must be called BEFORE “Start Mech-Viz Project”.
Calibration
This function is used for hand-eye calibration (camera extrinsic parameter calibration).
This function synchronizes the calibration status with Mech-Vision and obtains the next calibration point that the robot needs to reach from Mech-Vision.
This function must be executed multiple times to complete the calibration.
Input Parameter
Move_Type
Motion Type
1
: linear motion, MoveL
2
: joint motion, MoveJ
Pos_Jps
Parameter | Description |
---|---|
Move_Type |
The motion type of the robot. 1: MoveL. 2: MoveJ. |
Pos_Jps |
Pose as flange pose or joint positions. 1: TCP. 2: Joint positions. |
Wait_time |
The time the robot waits to avoid shaking after it moves to the calibration point; the default value is 2 (s). |
Ext |
Data of the external 7th axis in mm, optional. |
Example
-
Example 1:
MM_Calib 2,1,2;
This example moves the robot in MoveJ type, receives pose data in the form of TCP, and sets the wait time to 2 seconds to avoid the robot from shaking after it moves to the calibration point. In addition, this robot does not have an external axis installed.
-
Example 2:
MM_Calib 2,1,2\EXT:=Axis7;
This example moves the robot in MoveJ type, receives pose data in the form of TCP, and sets the wait time to 2 seconds to avoid the robot from shaking after it moves to the calibration point. Moreover, the 7th axis value of this robot is Axis7.
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”.
Calling this function once will store all the obtained data to the robot.
Input Parameter
job
Variable type: num Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision.
Output Parameter
Pos_Num
Variable type: num Variable for storing the number of received vision points.
MM_Status
Variable type: num Variable for storing the status code.
Example
MM_GET_DY_DATA 2,Pos_Num,StatusCode;
This example obtains the vision result that includes custom port outputs from Mech-Vision project No. 2. The number of vision points received is stored in Pose_Num, and the status code is stored in Status. The obtained poses and corresponding labels are stored in the global variable MMvis2_Pose, and the corresponding custom port outputs are stored in the global variable UserData.
Save Custom Output Data to Specified Variables
This function stores the data in a vision point returned by Get Custom Output Data from Mech-Vision in the specified variables.
Input Parameter
Serial
Variable type: num Specify the index of the vision point in which the custom data you want to store. The index is defined by the sequence that Mech-Vision sends the data.
Output Parameter
MM_P
Variable type: robtarget. Variable for storing the pose in the specified vision point.
MM_Label
Variable type: num Variable for storing the label in the specified vision point (If there is not a label port in Mech-Vision, 0 will be filled in automatically).
MM_UserData
Variable type: num Global array variable for storing the custom port outputs in the specified vision point. You can read the array directly without the need to pass the parameter.
Get Waypoint from Mech-Viz
This function is used for obtaining the planned path from Mech-Viz. The waypoint may be for a Vision Move Step, or for one of the other move-type Steps. A waypoint may contain pose, velocity, gripper info, object info, etc. Calling this function once will store all the obtained data to the robot.
Waypoints in a planned path can be divided into the following three types.
-
All waypoints contain the following data: motion type (joint motion or linear motion), tool number and velocity.
-
Vision Move waypoints, containing information such as label, number of workobjects that have been picked, number of workobjects picked this time, edge/corner ID of the suction cup, the TCP offset, workobject orientation, and workobject dimensions.
-
Vision Move waypoints including custom data. In this case, the port type of the “Procedure Out” Step in the Mech-Vision project should be “Custom”.
Input Parameter
Jps_Pos
Variable type: num Expected format of the returned data. See the following table for explanations.
Below are the explanations of the four possible data formats that can be returned by this function.
Expected data format | Format of returned data (Explained below) |
---|---|
1 |
Pose (joint positions), motion type, tool number, velocity, number of custom ports, custom port output 1, custom port output 2, … custom port output N |
2 |
Pose (TCP), motion type, tool number, velocity, number of custom ports, custom port output 1, custom port output 2, … custom port output N |
3 |
Pose (joint positions), motion type, tool number, velocity, depalletizing planning data, number of custom ports, custom port output 1, custom port output 2, … custom port output N |
4 |
Pose (TCP), motion type, tool number, velocity, depalletizing planning data, number of custom ports, custom port output 1, custom port output 2, … custom port output N |
Poses
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 number
The index number of the tool to be used at this waypoint. -1 indicates that no tool is used.
Velocity
Velocity percentage of the waypoint. It is determined by multiplying the velocity setting specified in the corresponding move-type step by the global velocity setting in Mech-Viz. The result is expressed as a percentage.
Depalletizing planning data
Data used in planning multi-pick depalletizing tasks. This data is part of the waypoint of the “Vision Move” Step. The following data are included:
-
Label: composed of 10 integers. If fewer than 10 labels are obtained, the rest of the digits are filled with 0.
-
Number of picked workobjects.
-
Number of workobjects to be picked this time.
-
Edge-corner ID of vacuum gripper: used to specify the gripper corner to which the workobject is aligned. It can be checked by double-clicking the corresponding tool in the Resources panel in Mech-Viz and then selecting Configure control logic.
-
TCP offset: The offset between the tool pose at the center of the to-pick workobjects and the actual tool pose.
-
Workobject orientation: Whether the X-axis of the workobject reference frame is aligned with the X-axis of the tool reference frame (value: 0 or 1).
-
Dimensions of the workobjects combined.
Number of custom ports
The number of output ports excluding poses and labels when the “Port Type” parameter of the “Procedure Out” Step in the Mech-Vision project is set to “Custom”.
Custom port outputs
The outputs that exclude poses and labels when the “Port Type” parameter of the “Procedure Out” Step in the Mech-Vision project is set to “Custom”. These data are part of the waypoint of the “Vision Move” Step.
The custom data items are arranged in alphabetical order of the custom port names.
Output Parameter
Pos_Num
Variable type: num. Variable for storing the number of received waypoints.
VisPos_Num
Variable type: num. Variable for storing the position of the first Vision Move waypoint in the path. For example, if the planned path is composed of Steps Fixed-Point Move_1, Fixed-Point Move_2, Vision Move sequentially, the position of the Vision Move waypoint is 3. If the path does not contain any Vision Move waypoint, the return value is 0.
MM_Status
Variable type: num. Variable for storing the status code.
Example
MM_GET_PLANDATA 4,PosNum,Vis_Index,StatusCode;
This example obtains the planned path that includes depalletizing planning data and custom port outputs from Mech-Viz, and the poses obtained are in the form of TCPs. The number of waypoints received is stored in PosNum, the position of the Vision Move waypoint is stored in Vis_Index, and the status code is stored in StatusCode.
Save Custom Output Data to Specified Variables
This procedure should be called after Get Waypoint from Mech-Viz. It stores the corresponding set of data to different variables according to the specified index. The code will be slightly different according to the value of Jps_Pos.
Function
MM_Get_PlanPose Serial,Jps_Pos,MM_P,MM_MoveType,MM_ToolNum,MM_Speed; (when the value of Jps_Pos is 2 or 4)
MM_Get_PlanJps Serial,Jps_Pos,MM_J,MM_MoveType,MM_ToolNum,MM_Speed; (when the value of Jps_Pos is 1 or 3)
Input Parameter
Serial
Variable type: num. Specify the index of the waypoint to be stored. The index of the waypoint is determined by the order in which Mech-Viz sends data.
Jps_Pos
Variable type: num. The parameter value should be the same as that of Jps_Pos in MM_GET_PLANDATA.
Output Parameter
MM_P
Variable type: robtarget. Variable for storing the TCP in the specified waypoint.
MM_J
Variable type: Jointtarget. Variable for storing the joint positions in the specified waypoint.
MM_MoveType
Variable type: num. Variable for storing the motion type in the specified waypoint.
MM_ToolNum
Variable type: num. Variable for storing the tool number in the specified waypoint.
MM_Speed
Variable type: num. Variable for storing the velocity in the specified waypoint.
MM_UserData
Global array variable that can be read directly without the need for parameter passing. Used for storing the custom port outputs in the specified waypoint.
MM_Plan_Results
Global array variable that can be read directly without the need for parameter passing. Used for storing the depalletizing planning data corresponding to the specified waypoint.
Example
-
Example 1:
MM_Get_PlanPose 2,4,P10,MoveType,ToolNum,Speed;
This example stores the TCP in the second received waypoint to P10, the corresponding motion type to MoveType, the corresponding tool number to ToolNum, the corresponding velocity to Speed. If the waypoint is a “Vision Move” waypoint, the depalletizing planning data will be stored in the MM_Plan_Results global array, and the custom port outputs will be stored in the MM_UserData global array. If it is not, no value will be assigned to the two global array variables mentioned before.
-
Example 2:
MM_Get_PlanJps 1,3,jpose1,MoveType,ToolNum,Speed;
This example stores the joint position in the first received waypoint to jpose1, the corresponding motion type to MoveType, the corresponding tool number to ToolNum, the corresponding velocity to Speed. If the waypoint is a “Vision Move” waypoint, the depalletizing planning data will be stored in the MM_Plan_Results global array, and the custom port outputs will be stored in the MM_UserData global array. If it is not, no value will be assigned to the two global array variables mentioned before.
Get Result of Step “Path Planning” in Mech-Vision
This function 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)”.
Input Parameter
Job
Variable type: num. Mech-Vision project ID, which can be viewed before the project name in the Project List panel in Mech-Vision.
Jps_Pos
Variable type: num. The pose type of waypoints returned by the “Path Planning” Step.
-
1
: Waypoints in joint positions will be returned. -
2
: Waypoints in TCPs will be returned.
Output Parameter
Last_Data
Variable type: num. Variable indicating whether all waypoints have been sent.
-
0
: NOT all waypoints have been sent (more on the way). Please repeat the execution of this function until the value of this parameter becomes 1. -
1
: All waypoints have been sent.
Pos_Num
Variable type: num. Variable for storing the number of received waypoints.
VisPos_Num
Variable type: num. The position of the “Vision Move” waypoint in the entire planned path in the Path Planning tool. For example, if the planned path is composed of Steps Fixed-Point Move_1, Fixed-Point Move_2, Vision Move sequentially, the position of the Vision Move waypoint is 3. If the path does not contain any Vision Move waypoint, the return value is 0.
MM_Status
Variable type: num. Variable for storing the status code.
Example
MM_Get_VisPath 2,2,LastData,PosNum,Vis_Index,StatusCode;
This example obtains the planned path from Mech-Vision project No. 2 in the form of TCPs. Whether all waypoints have been sent is stored in LastData, the number of waypoints received is stored in PosNum, the position of the Vision Move waypoint is stored in Vis_Index, and the status code is stored in StatusCode.