ABB Robot Communication Program Guide
|
Overview of Communication Logic
For the detailed interface communication flow and command specification, see Interface Communication Command Description.
Loading the Robot Program
| Before importing the communication program, it is strongly recommended to make a full backup of all existing robot programs to avoid data loss. |
Download link for ABB communication sample programs: ABB Communication Sample Programs.
Robot Interface Program Description
This section describes the purpose and usage of each communication command to help you integrate EpicPro with ABB robots.
Basic Commands
Trigger Image Capture
PROC Trigger(string cameraId)
// Parameter: cameraId - string ID of the camera (for example "0" or "0,1").
// Description: Sends command 110 to trigger image capture on the specified camera(s).
Switch Object in Workspace
Switch_SpaceObject(num spaceId, num objectId)
// Parameters: spaceId - workspace ID; objectId - grasp configuration ID.
// Function: Sends 130, spaceId, objectId to switch the active object in the current workspace.
Robot Capture Pose (Eye-in-Hand)
EIH_SetPose(string cameraId)
// Parameter: cameraId - string ID of the camera.
// Function: In eye-in-hand scenarios, sends 140, cameraId, current robot capture pose.
Detection
NormalDetector(num VisionPoseNum, \switch PlanGraspPath | num PlanRetreatPath, \switch IsQuickCommand)
// Parameter: VisionPoseNum - required number of vision poses / grasp points.
// Optional parameter 1 (PlanGraspPath): enable grasp-path planning (requires planning to be configured in EpicPro).
// Optional parameter 2 (PlanRetreatPath): enable grasp + retreat path planning (requires planning to be configured in EpicPro).
// Optional parameter 3 (IsQuickCommand): enable quick detection, which internally performs capture + detection.
Quick Commands
Quick Detection
// Description: Quick detection is implemented via the third optional parameter \IsQuickCommand of NormalDetector.
Capture + Robot Capture Pose (Eye-in-Hand)
EIH_FastTrigger(string cameraId)
// Parameter: cameraId - string ID of the camera.
// Function: In eye-in-hand scenarios, sends 240, cameraId, current robot capture pose.
Capture + Robot Capture Pose + Detection (Eye-in-Hand)
EIH_FastDetector(string CameraId, num VisionPoseNum, \switch PlanGraspPath | num PlanRetreatPath)
// Parameters:
// CameraId - string ID of the camera.
// VisionPoseNum - required number of vision poses / grasp points.
// Optional:
// PlanGraspPath - enable grasp-path planning.
// PlanRetreatPath - enable grasp + retreat path planning.
// Function: In eye-in-hand scenarios, sends 250 to quickly trigger detection.
Switch Object in Workspace + Capture
FastSwitch(num SpaceId, num ObjectId, string CameraId)
// Parameters:
// SpaceId - workspace ID.
// ObjectId - grasp configuration ID.
// CameraId - string ID of the camera.
// Function: Sends 310 to quickly switch the object in the workspace and trigger capture.
Switch Object in Workspace + Capture + Detection
FastSwitchAndDetector(num SpaceId, num ObjectId, string CameraId,
num VisionPoseNum, \switch PlanGraspPath | num PlanRetreatPath)
// Parameters:
// SpaceId - workspace ID.
// ObjectId - grasp configuration ID.
// CameraId - string ID of the camera.
// VisionPoseNum - required number of vision poses / grasp points.
// Optional:
// PlanGraspPath - enable grasp-path planning.
// PlanRetreatPath - enable grasp + retreat path planning.
// Function: Sends 320 to quickly switch object + capture + detection.
Switch Object in Workspace + Capture + Robot Capture Pose (Eye-in-Hand)
EIH_FastSwitchAndTrigger(num SpaceId, num ObjectId, string cameraId)
// Parameters:
// SpaceId - workspace ID.
// ObjectId - grasp configuration ID.
// cameraId - string ID of the camera.
// Function: In eye-in-hand scenarios, sends 340 to quickly switch object + capture + robot capture pose.
Switch Object in Workspace + Capture + Robot Capture Pose + Detection (Eye-in-Hand)
EIH_FastSwitchAndDetector(num SpaceId, num ObjectId, string CameraId,
num VisionPoseNum, \switch PlanGraspPath | num PlanRetreatPath)
// Parameters:
// SpaceId - workspace ID.
// ObjectId - grasp configuration ID.
// CameraId - string ID of the camera.
// VisionPoseNum - required number of vision poses / grasp points.
// Optional:
// PlanGraspPath - enable grasp-path planning.
// PlanRetreatPath - enable grasp + retreat path planning.
// Function: In eye-in-hand scenarios, sends 350 to quickly switch object + capture + robot capture pose + detection.
Function API Description
Connect to EpicPro
Connect_EpicPro(string IP, num Port, \num Timeout)
// Parameters:
// IP - IP address of the EpicPro host.
// Port - TCP port.
// Optional:
// Timeout - communication blocking timeout.
// Function: Establishes the communication connection to EpicPro.
Send Custom Data
Send(string data)
// Parameter: data - string payload.
// Function: Sends a custom string to EpicPro.
Upload Calibration Pose
Run_Monitor(string IP, num Port, \num Timeout)
// Parameters:
// IP - IP address.
// Port - TCP port.
// Optional:
// Timeout - maximum blocking time.
// Function: Uploads the current robot pose to EpicPro during calibration.
Get EpicPro Data
EpicProData GetEpicProData()
// Parameters: none.
// Return: EpicProData structure that contains a 12‑field status code and associated pose data.
// Function: Retrieves the latest recognition result from EpicPro.
Get Joint-Space Poses
GetJointtargetData(\INOUT jointtarget EpicJointPoints{*} | INOUT jointtarget EpicJointPoint)
// Optional INOUT parameter 1: array of jointtarget values.
// Optional INOUT parameter 2: single jointtarget variable.
// Function: Retrieves the planned path or grasp joint poses from EpicPro.
EpicProData Structure
EpicProData
RECORD EpicProData
num Command; // command code
num ErrorCode; // error code
num PoseType; // pose type
num CameraId; // camera ID
num VisionPoseNum; // number of poses
num MatchNum; // number of objects with valid grasp points
num AllPickPointCount; // total number of detected grasp points
num SpaceID; // current workspace ID
num ObjectID; // current object ID
num CurrentPickPointIndexOfAll; // index of current grasp point in the global list
num CurrentPickPointIndexOfModel; // index of current grasp point in the model
num CustomStatus1; // reserved status 1
num CustomStatus2; // reserved status 2
num CustomStatus3; // reserved status 3
EpicPoint points; // set of poses returned by EpicPro
ENDRECORD
Sample Programs
The TFSample module provides five basic usage scenarios.
Eye-to-Hand, Ordered Pick Scenario
PROC ETH_Sample()
VAR robtarget pickpoint:=[[308.39,792.53,1164.94],
[0.549302,-0.666322,-0.33599,-0.376022],
[0,-2,-1,1],
[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
// Define the grasp pose.
Debug_Mode\ON; // Enable debug mode.
Connect_EpicPro "10.10.11.203",5700; // Connect to EpicPro.
FastSwitch 0,0,"0"; // Switch to space 0, object 0 and trigger capture with camera 0.
EpicProStatus:=GetEpicProData(); // Get status of previous EpicPro command.
IF EpicProStatus.Command=0 THEN // If the command code indicates an error, handle it.
TPWrite "Trigger Failed! Please Check !";
! You can add error handling logic here, e.g. re-trigger capture.
ENDIF
NormalDetector 1; // Trigger detection; 1 means only one grasp point is required.
EpicProStatus:=GetEpicProData(); // Get status of previous EpicPro command.
IF EpicProStatus.Command=0 THEN
TPWrite "Detect Failed! Please Check !";
! You can add error handling logic here, e.g. re-trigger detection.
EXIT;
ENDIF
GetRobtargetData\pickpoint:=pickpoint; // Get Cartesian pose of the grasp point.
// Move 100 mm along tool Z from the grasp pose.
MoveL RelTool(pickpoint,0,0,100),v100,fine,tool0,\WObj:=wobj0;
// Move to the grasp pose.
MoveL pickpoint,v100,fine,tool0,\WObj:=wobj0;
Close_EpicPro; // Close connection to EpicPro (optional, long connections are supported).
ENDPROC
Eye-to-Hand, Path Planning Scenario
PROC ETH_PlanSample()
VAR jointtarget J{200}; // Joint-space path points.
VAR robtarget P{200}; // Cartesian path points.
Connect_EpicPro "10.10.11.190",5700; // Connect to EpicPro.
FastSwitch 0,0,"0"; // Switch to space 0, object 0 and trigger capture with camera 0.
EpicProStatus:=GetEpicProData(); // Get status of previous EpicPro command.
IF EpicProStatus.Command=0 THEN
TPWrite "Trigger Failed! Please Check !";
! You can add error handling logic here, e.g. re-trigger capture.
ENDIF
// Planning case 1: only plan the approach path.
// Here we trigger EpicPro detection and enable PlanGraspPath. Parameter 5 means
// the planned approach path contains 5 points and the 5th point is the grasp pose.
NormalDetector 5,\PlanGraspPath;
EpicProStatus:=GetEpicProData();
IF EpicProStatus.Command=0 THEN
TPWrite "Detect Failed! Please Check !";
! You can add error handling logic here.
EXIT;
ENDIF
// Planning case 2: plan approach and retreat paths.
// Here we enable PlanRetreatPath:=10, which means the retreat path contains 10 points.
NormalDetector 5,\PlanRetreatPath:=10;
EpicProStatus:=GetEpicProData();
IF EpicProStatus.Command=0 THEN
TPWrite "Detect Failed! Please Check !";
! You can add error handling logic here.
EXIT;
ENDIF
TEST EpicProStatus.PoseType // 0: Cartesian, 1: Joint.
CASE 0: // Cartesian.
// Write planned Cartesian poses into array P.
GetRobtargetData\EpicLinePoints:=P;
FOR i FROM 1 TO EpicPro.VisionPoseNum DO
P{i}.robconf.cf1:=0;
P{i}.robconf.cf4:=-2;
P{i}.robconf.cf6:=-1;
P{i}.robconf.cf6:=-1;
MoveL P{i},v1000,fine,tool0,\WObj:=wobj0; // Execute path point.
TPWrite "MoveL "+ValToStr(i);
IF i=5 THEN // At the grasp pose, perform user-defined action.
WaitTime 1; // e.g. close gripper.
ENDIF
ENDFOR
CASE 1: // Joint.
// Write planned joint poses into array J.
GetJointtargetData\EpicJointPoints:=J;
FOR i FROM 1 TO EpicPro.VisionPoseNum DO
MoveAbsJ J{i},v1000,fine,tool0,\WObj:=wobj0;
TPWrite "MoveJ "+ValToStr(i);
IF i=5 THEN
WaitTime 1; // User-defined action at grasp pose.
ENDIF
ENDFOR
ENDTEST
Close_EpicPro; // Close communication (optional).
ENDPROC
Eye-in-Hand Path Planning Scenario
PROC EIH_PlanSample()
VAR jointtarget J{200}; // Joint-space path points.
VAR robtarget P{200}; // Cartesian path points.
Connect_EpicPro "10.10.11.190",5700; // Connect to EpicPro.
// Switch to space 0, object 0, send current capture pose, and finally trigger capture with camera 0.
EIH_FastSwitchAndTrigger 0,0,"0";
EpicProStatus:=GetEpicProData();
IF EpicProStatus.Command=0 THEN
TPWrite "Trigger Failed! Please Check !";
! You can add error handling logic here.
ENDIF
// Planning case 1: only plan the approach path.
NormalDetector 5,\PlanGraspPath;
EpicProStatus:=GetEpicProData();
IF EpicProStatus.Command=0 THEN
TPWrite "Detect Failed! Please Check !";
! You can add error handling logic here.
EXIT;
ENDIF
// Planning case 2: plan approach and retreat paths.
NormalDetector 5,\PlanRetreatPath:=10;
EpicProStatus:=GetEpicProData();
IF EpicProStatus.Command=0 THEN
TPWrite "Detect Failed! Please Check !";
! You can add error handling logic here.
EXIT;
ENDIF
TEST EpicProStatus.PoseType // 0: Cartesian, 1: Joint.
CASE 0: // Cartesian.
GetRobtargetData\EpicLinePoints:=P;
FOR i FROM 1 TO EpicPro.VisionPoseNum DO
MoveL P{i},v1000,fine,tool0,\WObj:=wobj0;
TPWrite "MoveL "+ValToStr(i);
IF i=5 THEN
WaitTime 1; // User-defined action at grasp pose.
ENDIF
ENDFOR
CASE 1: // Joint.
GetJointtargetData\EpicJointPoints:=J;
FOR i FROM 1 TO EpicPro.VisionPoseNum DO
MoveAbsJ J{i},v1000,fine,tool0,\WObj:=wobj0;
TPWrite "MoveJ "+ValToStr(i);
IF i=5 THEN
WaitTime 1; // User-defined action at grasp pose.
ENDIF
ENDFOR
ENDTEST
Close_EpicPro; // Close communication (optional).
ENDPROC