top of page

Java 7. Robot safety settings

7.1. Set collision level

/**
* @brief Set collision level
* @param  [in]  mode  0-level, 1-percentage
* @param  [in]  level Collision threshold. Level range: [1-10 corresponds to levels 1-10, 100-disabled]. Percentage range: [0~10 corresponds to 0% - 100%]
* @param  [in]  config 0-Do not update config file, 1-Update config file
* @return  Error code
*/
int SetAnticollision(int mode, Object[] level, int config);

7.2. Set post-collision strategy

/**
* @brief  Set post-collision strategy
* @param  [in] strategy  0-Report error and stop, 1-Continue running
* @param  [in] safeTime  Safe stop time [1000 - 2000]ms
* @param  [in] safeDistance  Safe stop distance [1-150]mm
* @param  [in] safetyMargin  J1-J6 safety coefficients [1-10]
* @return  Error code
*/
int SetCollisionStrategy(int strategy, int safeTime, int safeDistance, int safetyMargin[]);

7.3. Custom collision detection threshold function start

New in version Java: SDK-v1.0.3-3.8.0

/**
* @brief  Start custom collision detection threshold function. Set collision detection thresholds for joints and TCP
* @param  [in] flag 1-Joint detection only; 2-TCP detection only; 3-Both joint and TCP detection
* @param  [in] jointDetectionThreshould  Joint collision detection thresholds for J1-J6
* @param  [in] tcpDetectionThreshould  TCP collision detection thresholds for xyzabc
* @param  [in] block 0-Non-blocking; 1-Blocking
* @return  Error code
*/
public int CustomCollisionDetectionStart(int flag, double[] jointDetectionThreshould, double[] tcpDetectionThreshould, int block);

7.4. Custom collision detection threshold function end

New in version Java: SDK-v1.0.3-3.8.0

/**
* @brief  End custom collision detection threshold function
* @return  Error code
*/
public int CustomCollisionDetectionEnd();

7.5. Robot collision level setting code example

public static int TestCollision(Robot robot)
{
    int mode = 0;
    int config = 1;
    Object[] level1 = new Object[]{ 1.0,2.0,3.0,4.0,5.0,6.0 };
    Object[] level2 = new Object[]{ 50.0,20.0,30.0,40.0,50.0,60.0 };

    int rtn = robot.SetAnticollision(mode, level1, config);
    System.out.println("SetAnticollision mode 0 rtn is: "+ rtn);
    mode = 1;
    rtn = robot.SetAnticollision(mode, level2, config);
    System.out.println("SetAnticollision mode 1 rtn is :"+ rtn);

    JointPos p1Joint=new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
    JointPos p2Joint=new JointPos(-45.615, -106.172, 124.296, -107.151, -91.282, 74.255);

    DescPose p1Desc=new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
    DescPose p2Desc=new DescPose(-321.222, 185.189, 335.520, -179.030, -1.284, -29.869);

    ExaxisPos exaxisPos=new ExaxisPos(0.0, 0.0, 0.0, 0.0);
    DescPose offdese=new DescPose(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
    robot.MoveL(p2Joint, p2Desc, 0, 0, 100, 100, 100, 2,0, exaxisPos, 0, 0, offdese,0,10);
    robot.ResetAllError();
    int[] safety = new int[]{ 5,5,5,5,5,5 };
    rtn = robot.SetCollisionStrategy(3, 1000, 150, 250, safety);
    System.out.println("SetCollisionStrategy rtn is:"+ rtn);

    double[] jointDetectionThreshould = new double[]{ 0.1, 0.1, 0.1, 0.1, 0.1, 0.1 };
    double[] tcpDetectionThreshould =new double[] { 60,60,60,60,60,60 };
    rtn = robot.CustomCollisionDetectionStart(3, jointDetectionThreshould, tcpDetectionThreshould, 0);
    System.out.println("CustomCollisionDetectionStart rtn is :"+ rtn);

    robot.MoveL(p1Joint, p1Desc, 0, 0, 100, 100, 100, -1,0, exaxisPos, 0, 0, offdese,0,10);
    robot.MoveL(p2Joint, p2Desc, 0, 0, 100, 100, 100, -1,0, exaxisPos, 0, 0, offdese,0,10);
    rtn = robot.CustomCollisionDetectionEnd();
    System.out.println("CustomCollisionDetectionEnd rtn is: "+ rtn);
    return 0;
}

7.6. Set positive limit

/**
* @brief  Set positive limit
* @param  [in] limit Six joint positions in deg
* @return  Error code
*/
int SetLimitPositive(Object[] limit);

7.7. Set negative limit

/**
* @brief  Set negative limit
* @param  [in] limit Six joint positions in deg
* @return  Error code
*/
int SetLimitNegative(Object[] limit);

7.8. Get joint soft limit angles

/**
* @brief  Get joint soft limit angles
* @param  [in] flag 0-Blocking, 1-Non-blocking
* @param  [out] negative  Negative limit angles in deg
* @param  [out] positive  Positive limit angles in deg
* @return  Error code
*/
int GetJointSoftLimitDeg(int flag, Object[] negative, Object[] positive);

7.9. Robot limit setting code example

public static int TestLimit(Robot robot)
{
    Object[] plimit =new Object[] { 170.0,80.0,150.0,80.0,170.0,160.0 };
    robot.SetLimitPositive(plimit);
    Object[] nlimit =new Object[] { -170.0,-260.0,-150.0,-260.0,-170.0,-160.0 };
    robot.SetLimitNegative(nlimit);

    Object[] neg_deg =new Object[] {0, 0 , 0, 0, 0, 0}, pos_deg = new Object[]{0, 0 , 0, 0, 0, 0};
    robot.GetJointSoftLimitDeg(1,  neg_deg,  pos_deg);
    System.out.println("neg limit deg:"+ neg_deg[0]+","+ neg_deg[1]+","+ neg_deg[2]+","+ neg_deg[3]+","+ neg_deg[4]+","+ neg_deg[5]);
    System.out.println("pos limit deg:"+pos_deg[0]+","+ pos_deg[1]+","+ pos_deg[2]+","+ pos_deg[3]+","+ pos_deg[4]+","+pos_deg[5]);
    return 0;
}

7.10. Set robot collision detection method

Changed in version Java: SDK-v1.0.5-3.8.2

/**
* @brief Set robot collision detection method
* @param [in] method Collision detection method: 0-Current mode; 1-Dual encoder; 2-Both current and dual encoder
* @param [in] thresholdMode Collision level threshold method: 0-Fixed threshold; 1-Custom collision detection threshold
* @return Error code
*/
int SetCollisionDetectionMethod(int method,int thresholdMode)

7.11. Set static collision detection on/off

/**
* @brief Set static collision detection on/off
* @param  [in] status 0-Off; 1-On
* @return  Error code
*/
public int SetStaticCollisionOnOff(int status)

7.12. Robot collision detection method code example

public static int TestCollisionMethod(Robot robot)
{
    int rtn = robot.SetCollisionDetectionMethod(0);

    rtn = robot.SetStaticCollisionOnOff(1);
    System.out.println("SetStaticCollisionOnOff On rtn is:"+ rtn);
    robot.Sleep(5000);
    rtn = robot.SetStaticCollisionOnOff(0);
    System.out.println("SetStaticCollisionOnOff Off rtn is:"+ rtn);

    robot.CloseRPC();
    return 0;
}

7.13. Joint torque power detection

/**
* @brief Joint torque power detection
* @param  [in] status 0-Off; 1-On
* @param  [in] power Set maximum power (W)
* @return  Error code
*/
public int SetPowerLimit(int status, double power)

7.14. Joint torque power detection code example

public static int TestPowerLimit(Robot robot)
{
    robot.DragTeachSwitch(1);
    robot.SetPowerLimit(1, 200);
    List<Number> joint_toq=new ArrayList<>();
    joint_toq=robot.GetJointTorques(1);

    int count = 100;
    robot.ServoJTStart(); //   #servoJT start
    int error = 0;
    while (count > 0)
    {
        count = count - 1;
        robot.Sleep(1);
    }
    error = robot.ServoJTEnd();
    robot.DragTeachSwitch(0);

    robot.CloseRPC();
    return 0;
}

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