top of page

Java 12.25. Robot Force Sensor Rotational Insertion Code Example

public static int TestMove(Robot robot)
{
    int rtn=-1;
    JointPos j1=new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
    JointPos j2=new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
    JointPos j3=new JointPos(-29.777, -84.536, 109.275, -114.075, -86.655, 74.257);
    JointPos j4=new JointPos(-31.154, -95.317, 94.276, -88.079, -89.740, 74.256);
    DescPose desc_pos1=new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
    DescPose desc_pos2=new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
    DescPose desc_pos3=new DescPose(-487.434, 154.362, 308.576, 176.600, 0.268, -14.061);
    DescPose desc_pos4=new DescPose(-443.165, 147.881, 480.951, 179.511, -0.775, -15.409);
    DescPose offset_pos=new DescPose(0, 0, 0, 0, 0, 0);
    ExaxisPos epos=new ExaxisPos(0, 0, 0, 0);
    int tool = 0;
    int user = 0;
    double vel = 100.0;
    double acc = 100.0;
    double ovl = 100.0;
    double oacc = 100.0;
    double blendT = 0.0;
    double blendR = 0.0;
    int flag = 0;
    int search = 0;
    int blendMode = 0;
    int velAccMode = 0;
    robot.SetSpeed(20);
    rtn = robot.MoveJ(j1, desc_pos1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
    System.out.printf("movej errcode:%d\n", rtn);
    rtn = robot.MoveL(j2, desc_pos2, tool, user, vel, acc, ovl, blendR, blendMode, epos, search, flag, offset_pos, oacc, velAccMode,0,10);
    System.out.printf("movel errcode:%d\n", rtn);
    rtn = robot.MoveC(j3, desc_pos3, tool, user, vel, acc, epos, flag, offset_pos, j4, desc_pos4, tool, user, vel, acc, epos, flag, offset_pos, ovl, blendR, oacc, velAccMode);
    System.out.printf("movec errcode:%d\n", rtn);
    rtn = robot.MoveJ(j2, desc_pos2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
    System.out.printf("movej errcode:%d\n", rtn);
    rtn = robot.Circle(j3, desc_pos3, tool, user, vel, acc, epos, j1, desc_pos1, tool, user, vel, acc, epos, ovl, flag, offset_pos, oacc, -1, velAccMode);
    System.out.printf("circle errcode:%d\n", rtn);
    rtn = robot.MoveCart(desc_pos4, tool, user, vel, acc, ovl, blendT, -1);
    System.out.printf("MoveCart errcode:%d\n", rtn);
    rtn = robot.MoveJ(j1, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
    System.out.printf("movej errcode:%d\n", rtn);
    rtn = robot.MoveL(desc_pos2, tool, user, vel, acc, ovl, blendR, blendMode, epos, search, flag, offset_pos, -1, velAccMode,0,10);
    System.out.printf("movel errcode:%d\n", rtn);
    rtn = robot.MoveC(desc_pos3, tool, user, vel, acc, epos, flag, offset_pos, desc_pos4, tool, user, vel, acc, epos, flag, offset_pos, ovl, blendR, -1, velAccMode);
    System.out.printf("movec errcode:%d\n", rtn);
    rtn = robot.MoveJ(j2, tool, user, vel, acc, ovl, epos, blendT, flag, offset_pos);
    System.out.printf("movej errcode:%d\n", rtn);
    rtn = robot.Circle(desc_pos3, tool, user, vel, acc, epos, desc_pos1, tool, user, vel, acc, epos, ovl, flag, offset_pos, oacc, blendR, -1, velAccMode);
    System.out.printf("circle errcode:%d\n", rtn);
    return 0;
}

12.26. Constant Force Control Example

public static int TestFTControl(Robot robot)
{
    DescTran tr1=new DescTran(0,0,0);
    robot.SetForceSensorPayload(0);
    robot.SetForceSensorPayloadCog(tr1);

    int company = 24;
    int device = 0;
    int softversion = 0;
    int bus = 1;
    int index = 1;
    DeviceConfig con=new DeviceConfig(company, device, softversion, bus);

    robot.FT_SetConfig(con);
    robot.Sleep(1000);
    robot.FT_GetConfig(con);
    robot.Sleep(1000);

    robot.FT_Activate(0);
    robot.Sleep(1000);
    robot.FT_Activate(1);
    robot.Sleep(1000);

    robot.Sleep(1000);
    robot.FT_SetZero(0);
    robot.Sleep(1000);

    int sensor_id = 1;
    Object[] select =new Object[] { 0,0,1,0,0,0 };
    Object[] ft_pid =new Object[]{ 0.0005,0.0,0.0,0.0,0.0,0.0 };
    int adj_sign = 0;
    int ILC_sign = 0;
    double max_dis = 100.0;
    double max_ang = 0.0;

    ForceTorque ft=new ForceTorque(0,0,0,0,0,0);
    ExaxisPos epos=new ExaxisPos(0, 0, 0, 0);
    JointPos j1=new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
    JointPos j2=new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
    DescPose desc_p1=new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
    DescPose desc_p2=new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);
    DescPose offset_pos=new DescPose(0, 0, 0, 0, 0, 0);

    ft.fz = -10.0;

    int rtn = robot.MoveJ(j1, desc_p1, 0, 0, 100.0, 180.0, 100.0, epos, -1.0, 0, offset_pos);
    robot.FT_Control(1, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang,0,0,0);
    rtn = robot.MoveJ(j2, desc_p2, 0, 0, 100.0, 180.0, 100.0, epos, -1.0, 0, offset_pos);
    robot.FT_Control(0, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang,0,0,0);
    return 0;
}

12.27. Compliance Control Start

/**
* @brief  Compliance control start
* @param  [in] p Position adjustment coefficient or compliance coefficient
* @param  [in] force Compliance activation force threshold in N
* @return  Error code
*/
int FT_ComplianceStart(double p, double force);

12.28. Compliance Control Stop

/**
* @brief  Compliance control stop
* @return  Error code
*/
int FT_ComplianceStop();

12.29. Compliance Control Example

public static int TestCompliance(Robot robot)
{
    DescTran tr1=new DescTran(0,0,0);
    robot.SetForceSensorPayload(0);
    robot.SetForceSensorPayloadCog(tr1);

    int company = 24;
    int device = 0;
    int softversion = 0;
    int bus = 1;
    int index = 1;

    DeviceConfig con=new DeviceConfig(company, device, softversion, bus);
    robot.FT_SetConfig(con);
    robot.Sleep(1000);
    robot.FT_GetConfig(con);

    robot.Sleep(1000);

    robot.FT_Activate(0);
    robot.Sleep(1000);
    robot.FT_Activate(1);
    robot.Sleep(1000);

    robot.Sleep(1000);
    robot.FT_SetZero(0);
    robot.Sleep(1000);

    int flag = 1;
    int sensor_id = 1;
    Object[] select =new Object[] { 1,1,1,0,0,0 };
    Object[] ft_pid =new Object[] { 0.0005,0.0,0.0,0.0,0.0,0.0 };
    int adj_sign = 0;
    int ILC_sign = 0;
    double max_dis = 100.0;
    double max_ang = 0.0;

    ForceTorque ft=new ForceTorque(0,0,0,0,0,0);
    DescPose  offset_pos=new DescPose(0, 0, 0, 0, 0, 0);
    ExaxisPos epos=new ExaxisPos(0, 0, 0, 0);


    JointPos j1=new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
    JointPos j2=new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);
    DescPose desc_p1=new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
    DescPose desc_p2=new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);

    ft.fx = -10.0;
    ft.fy = -10.0;
    ft.fz = -10.0;
    robot.FT_Control(flag, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0);
    double p = 0.00005;
    double force = 30.0;
    int rtn = robot.FT_ComplianceStart(p, force);

    int count = 15;
    while (count>0)
    {
        robot.MoveL(j1, desc_p1, 0, 0, 100.0, 180.0, 100.0, -1.0,0, epos, 0, 1, offset_pos,0,10);
        robot.MoveL(j2, desc_p2, 0, 0, 100.0, 180.0, 100.0, -1.0,0, epos, 0, 0, offset_pos,0,10);
        count -= 1;
    }
    robot.FT_ComplianceStop();
    flag = 0;
    robot.FT_Control(flag, sensor_id, select, ft, ft_pid, adj_sign, ILC_sign, max_dis, max_ang, 0, 0, 0);

    robot.CloseRPC();
    return 0;
}

12.30. Load Identification Initialization

/**
* @brief Load identification initialization
* @return Error code
*/
int LoadIdentifyDynFilterInit();

12.31. Load Identification Variable Initialization

/**
* @brief Load identification variable initialization
* @return Error code
*/
int LoadIdentifyDynVarInit();

12.32. Load Identification Main Program

/**
* @brief Load identification main program
* @param [in] joint_torque Joint torque
* @param [in] joint_pos Joint position
* @param [in] t Sampling period
* @return Error code
*/
int LoadIdentifyMain(Object[] joint_torque, Object[] joint_pos, double t);

12.33. Get Load Identification Result

/**
* @brief Get load identification result
* @param [in] gain
* @return List[0]: Error code; List[1]: double weight Load weight; List[2]: x Load center of gravity X in mm; List[3]: y Load center of gravity Y in mm; List[2]: z Load center of gravity Z in mm
*/
List<Number> LoadIdentifyGetResult(Object[] gain);

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