top of page

Java 11.56. Robot end LUA file operation code example

public static int TestAxleLua(Robot robot)
{
    robot.AxleLuaUpload("D://zUP/AXLE_LUA_End_DaHuan.lua");

    AxleComParam param=new AxleComParam(7, 8, 1, 0, 5, 3, 1);
    robot.SetAxleCommunicationParam(param);

    robot.GetAxleCommunicationParam(param);

    robot.SetAxleLuaEnable(1);
    int[] luaEnableStatus = new int[]{0};
    robot.GetAxleLuaEnableStatus(luaEnableStatus);
    robot.SetAxleLuaEnableDeviceType(0, 1, 0);

    int forceEnable = 0;
    int gripperEnable = 0;
    int ioEnable = 0;
    int [] enable=new int[]{0,0,0};
    robot.GetAxleLuaEnableDeviceType(enable);

    int[] func = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
    robot.SetAxleLuaGripperFunc(1, func);
    int[] getFunc = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    robot.GetAxleLuaGripperFunc(1, getFunc);
    int[] getforceEnable = { 0,0,0,0,0,0,0,0};
    int[] getgripperEnable = { 0,0,0,0,0,0,0,0};
    int[] getioEnable = { 0,0,0,0,0,0,0,0};
    robot.GetAxleLuaEnableDevice(getforceEnable, getgripperEnable, getioEnable);
    for (int i = 0; i < 8; i++)
    {
        System.out.println(getforceEnable[i]);
    }
    System.out.println("getgripperEnable status : ");
    for (int i = 0; i < 8; i++)
    {
        System.out.println(getgripperEnable[i]);
    }
    System.out.println("getioEnable status : ");
    for (int i = 0; i < 8; i++)
    {
        System.out.println(getioEnable[i]);
    }
    robot.ActGripper(1, 0);
    robot.Sleep(2000);
    robot.ActGripper(1, 1);
    robot.Sleep(2000);
    robot.MoveGripper(1, 90, 10, 100, 50000, 0, 0, 0, 0, 0);
    int pos = 0;
    while (true)
    {
        ROBOT_STATE_PKG pkg=new ROBOT_STATE_PKG();
        pkg=robot.GetRobotRealTimeState();
        System.out.println("gripper pos is:"+pkg.gripper_position);
        robot.Sleep(100);
    }

}

11.57. Get SmartTool button status

New in version Java: SDK-v1.0.4-3.8.1

/**
* @brief Get SmartTool button status
* @param [out] state SmartTool handle button status;(bit0:0-communication normal; 1-communication lost; bit1-undo operation; bit2-clear program; bit3-A key; bit4-B key; bit5-C key; bit6-D key; bit7-E key; bit8-IO key; bit9-manual/auto; bit10-start)
* @return Error code
*/
int GetSmarttoolBtnState(int[] state)

11.58. SmartTool button code example

public static void main(String[] args)
{
    Robot robot = new Robot();
    robot.SetReconnectParam(true, 100, 500);//Set reconnection times and interval
    robot.LoggerInit(FrLogType.DIRECT, FrLogLevel.INFO, "D://log", 10, 10);
    int rtn = robot.RPC("192.168.58.2");
    if (rtn == 0) {
        System.out.println("rpc connection success");
    } else {
        System.out.println("rpc connection fail");
        return;
    }

    int[] state = {0};
    while (true)
    {
        robot.GetSmarttoolBtnState(state);

        String binaryString = String.format("%32s", Integer.toBinaryString(state[0])).replace(' ', '0');
        System.out.println("GetSmarttoolBtnState:"+binaryString);
        robot.Sleep(100);
    }
}

11.59. Upload Open Protocol Lua File

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief Upload Open Protocol Lua File
* @param  filePath Local open protocol lua file path name
* @return Error code
*/
public int OpenLuaUpload(String filePath)

11.60. Get Slave Board Parameters

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief  Get Slave Board Parameters
* @param  type  0-Ethercat, 1-CClink, 3-Ethercat, 4-EIP
* @param  version  Protocol version
* @param  connState  0-Disconnected 1-Connected
* @return  Error code
*/
public int GetFieldBusConfig(int[] type, int[] version, int[] connState)

11.61. Write Slave DO

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief  Write Slave DO
* @param   DOIndex  DO number
* @param   wirteNum  Number to write
* @param   status Value to write, max 8
* @return  Error code
*/
public int FieldBusSlaveWriteDO(int DOIndex, int wirteNum, int[] status)

11.62. Write Slave AO

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief  Write Slave AO
* @param  AOIndex  AO number
* @param  wirteNum  Number to write
* @param  status Value to write, max 8
* @return  Error code
*/
public int FieldBusSlaveWriteAO(int AOIndex, int wirteNum, int[] status)

11.63. Read Slave DI

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief  Read Slave DI
* @param  DOIndex  DI number
* @param  readNum  Number to read
* @param  status Read value, max 8
* @return  Error code
*/
public int FieldBusSlaveReadDI(int DOIndex, int readNum, int[] status)

11.64. Read Slave AI

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief  Read Slave AI
* @param  AIIndex  AI number
* @param  readNum  Number to read
* @param  status Read value, max 8
* @return  Error code
*/
public int FieldBusSlaveReadAI(int AIIndex, int readNum, double[] status)

11.65. Wait for Extended DI Input

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief Wait for Extended DI Input
* @param  DIIndex DI number
* @param  status 0-Low level; 1-High level
* @param  waitMs Max waiting time (ms)
* @return Error code
*/
public int FieldBusSlaveWaitDI(int DIIndex, int status, int waitMs)

11.66. Wait for Extended AI Input

New in version Java: SDK-v1.0.8-3.8.5

/**
* @brief Wait for Extended AI Input
* @param  AIIndex AI number
* @param  waitType 0-Greater than; 1-Less than
* @param  value AI value
* @param  waitMs Max waiting time (ms)
* @return Error code
*/
public int FieldBusSlaveWaitAI(int AIIndex, int waitType, double value, int waitMs)

robotic arm
FAIRINO ROBOTIC ARMS

Contact

Location: 10637 Scripps Summit Court,

San Diego, CA. 92131
Phone: (619) 333-FAIR
Email: hello@fairino.us

© 2023 Fairino US official site Proudly created By G2T

bottom of page