Rokae Robot Communication Program Guide

  • This document applies to EpicPro v1.3.0 and later with Rokae robots.

  • The programs described here are based on teach pendant firmware version 5.0.11.0313.

Communication Logic

For the detailed interface communication flow and command specification, see Interface Communication Command Description.

Loading the Robot Programs

Before importing the communication programs, it is strongly recommended to make a full backup of all existing robot programs to avoid data loss.

Preparation

  1. Download the program package:

  2. This communication program must be used together with the matching EpicPro plug‑in. Contact TransferTech technical support to obtain the plug‑in.

  3. Extract MOD.zip, then copy the MOD folder and the .epicext plug‑in file to the root directory of a USB drive.

  4. Insert the USB drive into the USB port on the back of the teach pendant.

Creating Variables

  1. Change user permission to super administrator, then log in with the default password 123456.

  2. Open the variable list and add the required variables.

  3. Create string variables (for example, used to build communication payloads) and configure their initial values as needed.

  4. Create point variables in the point list. For each point variable, set the name, type, and dimension according to your application.

Burning the MOD Files

  1. On the teach pendant, open the task list and choose to import tasks.

  2. Select Import Mod, then browse to the MOD folder on the USB drive.

  3. After the folder is selected, the list of MOD files is displayed. Select all files and confirm to import.

Robot Interface Program Description

This section describes the communication procedures used by Rokae robots to interact with EpicPro.

Standard Commands

Trigger Image Capture

Trigger(string cameraId)

// Example: CALL JOB:Trigger("1")
// Parameter: cameraId - camera ID.
// Function: Sends 110, cameraId to trigger image capture.

Switch Object in Workspace

Switch_SpaceObject(string spaceId, string objectId)

// Example: CALL JOB:TF_SwitchSpace("2","5")
// Parameters: spaceId - workspace ID; objectId - grasp configuration ID.
// Function: Sends 130, spaceId, objectId to switch the active object.

Robot Capture Pose (Eye-in-Hand)

EIH_SetPose(string cameraId)

// Example: CALL JOB:TF_EIH_SetPose("1")
// Parameter: cameraId - camera ID.
// Function: In eye-in-hand scenarios, sends 140, cameraId, current robot capture pose.

Detection (No Retreat Path)

NormalDetector(string VisionPoseNum, string IsQuickCommand)

// Example: CALL JOB:NormalDetector("1","0")
// Parameters:
//   VisionPoseNum   - required number of vision poses / grasp points.
//   IsQuickCommand  - "1" enables quick detection (internally sends 220); "0" disables it.
// Function: Triggers detection and sends 120 with grasp count and 0 for retreat count.

Detection with Retreat Path

NormalDetectorDrawdown(string VisionPoseNum, string DrawdownNum, string IsQuickCommand)

// Example: CALL JOB:NormalDetectorDrawdown("10","10","0")
// Parameters:
//   VisionPoseNum  - number of path points in the grasp path.
//   DrawdownNum    - number of path points in the retreat path.
//   IsQuickCommand - "1" enables quick detection (internally sends 220); "0" disables it.
// Function: Triggers detection and sends 120 with grasp path count and retreat path count.

Restart Vision Software

ResetEpicPro()

// Example: ResetEpicPro()
// Function: Restarts the EpicPro vision software.

Reboot IPC

Reboot()

// Example: Reboot()
// Function: Reboots the industrial PC.

Quick Commands

Capture + Robot Capture Pose (Eye-in-Hand)

EIH_FastTrigger(string cameraId)

// Example: EIH_FastTrigger("1")
// Parameter: cameraId - camera ID.
// Function: In eye-in-hand scenarios, sends 240, cameraId, current robot capture pose.

Capture + Robot Capture Pose + Detection (No Retreat, Eye-in-Hand)

EIH_FastDetector(string CameraId, string VisionPoseNum)

// Example: EIH_FastDetector("1","1")
// Parameters: CameraId - camera ID; VisionPoseNum - required number of vision poses.
// Function: In eye-in-hand scenarios, sends 250 to quickly trigger detection.

Capture + Robot Capture Pose + Detection with Retreat Path (Eye-in-Hand)

EIH_FastDetectorDrawdown(string CameraId, string VisionPoseNum, string DrawdownNum)

// Example: EIH_FastDetectorDrawdown("1","10","10")
// Parameters: CameraId - camera ID; VisionPoseNum - number of grasp path points;
//             DrawdownNum - number of retreat path points.
// Function: In eye-in-hand scenarios, sends 250 to quickly trigger detection with retreat path.

Switch Object in Workspace + Capture

FastSwitchAndTrigger(string SpaceId, string ObjectId, string CameraId)

// Example: FastSwitchAndTrigger("1","1","1")
// Parameters: SpaceId - workspace ID; ObjectId - grasp configuration ID; CameraId - camera ID.
// Function: Sends 310 to quickly switch object + capture.

Switch Object in Workspace + Capture + Detection (No Retreat)

FastSwitchAndDetector(string SpaceId, string ObjectId, string CameraId, string VisionPoseNum)

// Example: FastSwitchAndDetector("1","1","1","1")
// Parameters: SpaceId - workspace ID; ObjectId - grasp configuration ID;
//             CameraId - camera ID; VisionPoseNum - required number of vision poses.
// Function: Sends 320 to quickly switch object + capture + detection.

Switch Object in Workspace + Capture + Detection with Retreat Path

FastSwitchAndDetectorDrawdown(string SpaceId, string ObjectId, string CameraId,
                              string VisionPoseNum, string DrawdownNum)

// Example: FastSwitchAndDetectorDrawdown("1","1","1","10","10")
// Parameters: SpaceId - workspace ID; ObjectId - grasp configuration ID; CameraId - camera ID;
//             VisionPoseNum - number of grasp path points; DrawdownNum - number of retreat path points.
// Function: Sends 320 to quickly switch object + capture + detection with retreat path.

Switch Object in Workspace + Capture + Robot Capture Pose (Eye-in-Hand)

EIH_FastSwitchAndTrigger(string SpaceId, string ObjectId, string cameraId)

// Example: EIH_FastSwitchAndTrigger("1","1","1")
// Parameters: SpaceId - workspace ID; ObjectId - grasp configuration ID; cameraId - camera ID.
// 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 (No Retreat, Eye-in-Hand)

EIH_FastSwitchAndDetector(string SpaceId, string ObjectId, string CameraId, string VisionPoseNum)

// Example: EIH_FastSwitchAndDetector("1","1","1","1")
// Parameters: SpaceId - workspace ID; ObjectId - grasp configuration ID; CameraId - camera ID;
//             VisionPoseNum - required number of vision poses.
// Function: In eye-in-hand scenarios, sends 350 to quickly switch object + capture + robot capture pose + detection.

Switch Object in Workspace + Capture + Robot Capture Pose + Detection with Retreat Path (Eye-in-Hand)

EIH_FastSwitchAndDetectorDrawdown(string SpaceId, string ObjectId, string CameraId,
                                  string VisionPoseNum, string DrawdownNum)

// Example: EIH_FastSwitchAndDetectorDrawdown("1","1","1","10","10")
// Parameters: SpaceId - workspace ID; ObjectId - grasp configuration ID; CameraId - camera ID;
//             VisionPoseNum - number of grasp path points; DrawdownNum - number of retreat path points.
// Function: In eye-in-hand scenarios, sends 350 to quickly switch object + capture + robot capture pose + detection with retreat path.

Function API Description

Initialize Communication

TF_INT_SOCKET ()

// Example:
//   SocketConn SocketConn0 = {"192.168.33.66", 5700, "Epic_Connect", 1, "\n"}
//   SocketConn SocketConn1 = {"192.168.33.66", 5800, "Epic_Calibration", 1, "\n"}
//   VAR int Timeout = 20
// Parameters: string IP address, port number, receive‑timeout configuration, etc.
// Function: Initializes communication channels used by EpicPro and for calibration pose upload.
//           Modify the settings in the Transfer Mod program as needed.

Connect

Connect_EpicPro()

// Example: Connect_EpicPro()
// Function: Connects to the EpicPro vision software.

Close Connection

Close_EpicPro()

// Example: Close_EpicPro()
// Function: Disconnects from the EpicPro vision software.

Upload Calibration Pose

Calibration(tool toolnum, wobj wobjnum)

// Example: Calibration(tool0, wobj0)
// Parameters: toolnum - tool index; wobjnum - workobject index.
// Function: During calibration, uploads the current robot pose under the specified tool and workobject.

Get EpicPro Data – Cartesian

GetRobtargetData()

// Example: GetRobtargetData()
// Function: Retrieves Cartesian pose data output from EpicPro (pose represented as a quaternion).

Get EpicPro Data – Joint

GetJointtargetData()

// Example: GetJointtargetData()
// Function: Retrieves joint-space pose data output from EpicPro.

Get EpicPro Status Code

GetEpicProStatus()

// Example: GetEpicProStatus()
// Function: Retrieves the status code output from EpicPro.

Generic Send

Send(string data)

// Example: Send("string")
// Parameter: data - string payload.
// Function: Sends a custom string from the robot to EpicPro.

Sample Programs

Four basic usage scenarios are provided below. The program logic is identical to the Chinese version; only the comments have been translated.

Eye-to-Hand, Ordered Pick Scenario

GLOBAL PROC ETH_Sample()
    // Define grasp point. The grasp pose is stored in a variable and must be taught manually,
    // including recording the Confdata of the grasp position.
    socketName := "Epic_Connect";          // Communication connection name
    Connect_EpicPro();                     // Connect to EpicPro
    MoveJ p1, v200, z50, tool1;            // Move to capture pose
    Switch_SpaceObject("1","1");           // Switch to space 1, grasp configuration 1
    Epic_status := GetEpicProStatus();     // Check status code of previous command
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!"); // Add error‑handling logic as needed
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    Trigger("1");                          // Capture using camera ID 1
    Epic_status := GetEpicProStatus();     // Check status code
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Trigger detection. Parameter "1" means only one grasp point is required.
    // Parameter "0" disables quick detection; set to "1" to use the quick-detection command (capture can be omitted).
    NormalDetector("1","0");
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    Epic_status := GetRobtargetData();     // Get Cartesian pose of the grasp point
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Offset 100 mm along tool Z from the grasp pose.
    MoveL RelTool(pickpointL[1],0,0,-100,0,0,0), v200, fine, tool1;
    // Move to the grasp pose.
    MoveL pickpointL[1], v200, fine, tool1;
    pause;

    Close_EpicPro();                       // Close connection (optional; long connections are supported)
ENDPROC

Eye-to-Hand, Path Planning Scenario

GLOBAL PROC ETH_PlanSample()
    socketName := "Epic_Connect";          // Communication connection name
    Connect_EpicPro();                     // Connect to EpicPro
    MoveJ p1, v200, z50, tool1;            // Move to capture pose
    Switch_SpaceObject("1","1");           // Switch to space 1, grasp configuration 1
    Epic_status := GetEpicProStatus();     // Check status code of previous command
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    Trigger("1");                          // Capture using camera ID 1
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Case 1: plan only the approach path.
    // Here we trigger EpicPro detection. Parameter "20" means the grasp path contains 20 points,
    // with the 20th point being the grasp pose.
    // Parameter "0" disables quick detection; set to "1" to use the quick-detection command.
    NormalDetector("20","0");
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Case 2: plan both approach and retreat paths.
    // Parameter "20" means the approach path contains 20 points with the 20th as grasp pose.
    // Parameter "10" means the retreat path contains 10 points.
    NormalDetectorDrawdown("20","10","0");
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Decide whether the returned poses are Cartesian or joint-space.
    Switch(EpicProData[2])
        Case 0:                            // Cartesian
            Epic_status := GetRobtargetData(); // Get Cartesian poses
            IF Epic_status = 0 THEN
                Print("Failed to get EpicPro data!");
                Print("Error code:", ErrorCode);
                pause;
            ENDIF
            // Iterate all planned points and configure Confdata according to taught grasp posture.
            For(int k from 1 to (EpicProData[3]+1))
                PickPointL[k].conf.cf1 := 82;
                PickPointL[k].conf.cf2 := 4;
                PickPointL[k].conf.cf3 := -188;
                PickPointL[k].conf.cf4 := -1;
                PickPointL[k].conf.cf5 := -57;
                PickPointL[k].conf.cf6 := -157;
                PickPointL[k].conf.cf7 := 0;
                PickPointL[k].conf.cfx := 1;
            endfor
            // Execute approach path (first 20 points).
            For(int k from 1 to 20)
                MoveL pickpointL[k], v200, z50, tool1;
            endfor
            // Execute retreat path.
            MoveL pickpointL[20], v200, fine, tool1;
            For(int k from 21 to 30)
                MoveL pickpointL[k], v200, z50, tool1;
            endfor

        Case 1:                            // Joint-space
            Epic_status := GetJointtargetData(); // Get joint poses
            IF Epic_status = 0 THEN
                Print("Failed to get EpicPro data!");
                Print("Error code:", ErrorCode);
                pause;
            ENDIF
            // Execute approach path.
            For(int k from 1 to 20)
                MoveAbsJ pickpointJ[k], v200, z50, tool1;
            endfor
            MoveAbsJ pickpointJ[20], v200, fine, tool1;
            pause;                         // Insert gripper‑close or other operations here.
            // Execute retreat path.
            For(int k from 21 to 30)
                MoveAbsJ pickpointJ[k], v200, z50, tool1;
            endfor
    EndSwitch

    pause;
    Close_EpicPro();                       // Close communication (optional)
ENDPROC

Eye-in-Hand, Ordered Pick Scenario

GLOBAL PROC EIH_Sample()
    // Define grasp point; pose is stored in a variable and must be taught manually,
    // including the Confdata of the grasp position.
    socketName := "Epic_Connect";         // Communication connection name
    Connect_EpicPro();                    // Connect to EpicPro
    MoveJ p1, v200, z50, tool1;           // Move to capture pose
    Switch_SpaceObject("1","1");          // Switch to space 1, grasp configuration 1
    Epic_status := GetEpicProStatus();    // Check status of previous command
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    Trigger("1");                         // Capture using camera ID 1
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    EIH_SetPose("1");                     // Send current capture pose
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    NormalDetector("1","0");              // Trigger detection; only one grasp point required
                                          // "0" disables quick detection; set to "1" to use quick detection.
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    Epic_status := GetRobtargetData();    // Get Cartesian pose of the grasp point
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Offset 50 mm along tool Z from the grasp pose.
    MoveL RelTool(pickpointL[1],0,0,-50,0,0,0), v200, fine, tool1;
    // Move to the grasp pose.
    MoveL pickpointL[1], v200, fine, tool1;
    pause;

    Close_EpicPro();                      // Close communication (optional)
ENDPROC

Eye-in-Hand, Path Planning Scenario

GLOBAL PROC EIH_PlanSample()
    socketName := "Epic_Connect";         // Communication connection name
    Connect_EpicPro();                    // Connect to EpicPro
    MoveJ p1, v200, z50, tool1;           // Move to capture pose
    Switch_SpaceObject("1","1");          // Switch to space 1, grasp configuration 1
    Epic_status := GetEpicProStatus();    // Check status of previous command
    IF Epic_status = 0 THEN               // Add error‑handling logic as needed
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    Trigger("1");                         // Capture using camera ID 1
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    EIH_SetPose("1");                     // Send current capture pose
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Case 1: plan only the approach path.
    // Parameter "20" means the approach path contains 20 points, with the 20th as grasp pose.
    // Parameter "0" disables quick detection; set to "1" to use the quick-detection command.
    NormalDetector("20","0");
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Case 2: plan both approach and retreat paths.
    // Parameter "20" means the approach path contains 20 points; the 20th is the grasp pose.
    // Parameter "10" means the retreat path contains 10 points.
    NormalDetectorDrawdown("20","10","0");
    Epic_status := GetEpicProStatus();
    IF Epic_status = 0 THEN
        Print("Failed to get EpicPro data!");
        Print("Error code:", ErrorCode);
        pause;
    ENDIF

    // Decide whether the returned poses are Cartesian or joint-space.
    Switch(EpicProData[2])
        Case 0:                           // Cartesian
            Epic_status := GetRobtargetData();
            IF Epic_status = 0 THEN
                Print("Failed to get EpicPro data!");
                Print("Error code:", ErrorCode);
                pause;
            ENDIF
            // Iterate all planned points and configure Confdata according to taught grasp posture.
            For(int k from 1 to (EpicProData[3]+1))
                PickPointL[k].conf.cf1 := 82;
                PickPointL[k].conf.cf2 := 4;
                PickPointL[k].conf.cf3 := -188;
                PickPointL[k].conf.cf4 := -1;
                PickPointL[k].conf.cf5 := -57;
                PickPointL[k].conf.cf6 := -157;
                PickPointL[k].conf.cf7 := 0;
                PickPointL[k].conf.cfx := 1;
            endfor
            For(int k from 1 to 20)       // Approach path
                MoveL pickpointL[k], v200, z50, tool1;
            endfor
            MoveL pickpointL[20], v200, fine, tool1;
            For(int k from 21 to 30)      // Retreat path
                MoveL pickpointL[k], v200, z50, tool1;
            endfor

        Case 1:                           // Joint-space
            Epic_status := GetJointtargetData();
            IF Epic_status = 0 THEN
                Print("Failed to get EpicPro data!");
                Print("Error code:", ErrorCode);
                pause;
            ENDIF
            For(int k from 1 to 20)       // Approach path
                MoveAbsJ pickpointJ[k], v200, z50, tool1;
            endfor
            MoveAbsJ pickpointJ[20], v200, fine, tool1;
            pause;                        // Insert gripper‑close or other actions here.
            For(int k from 21 to 30)      // Retreat path
                MoveAbsJ pickpointJ[k], v200, z50, tool1;
            endfor
    EndSwitch

    pause;
    Close_EpicPro();                      // Close communication (optional)
ENDPROC

Calibration

GLOBAL PROC calibration()
    // In the variable list, create the following two variables as needed:
    // VAR string head = "{\"SN\":\"Rokae-CR7\",\"C\":\"["
    // VAR string tail = "]\"}"
    VAR string act_pos;
    socketName := "Epic_Calibration";     // Communication name for calibration
end:
    Connect_EpicPro();                    // Connect to EpicPro
    act_pos := Calibration(tool0, wobj0); // Upload current pose under tool0 and wobj0
    Send(act_pos);
    pause;
    Close_EpicPro();
    Goto end;
ENDPROC