top of page

Java 6.21. Workpiece coordinate system operation code example

public static int TestWobjCoord(Robot robot)
{
    DescPose p1Desc=new DescPose(-89.606, 779.517, 193.516, 178.000, 0.476, -92.484);
    JointPos p1Joint=new JointPos(-108.145, -50.137, 85.818, -125.599, -87.946, 74.329);

    DescPose p2Desc=new DescPose(-24.656, 850.384, 191.361, 177.079, -2.058, -95.355);
    JointPos p2Joint=new JointPos(-111.024, -41.538, 69.222, -114.913, -87.743, 74.329);

    DescPose p3Desc=new DescPose(-99.813, 766.661, 241.878, -176.817, 1.917, -91.604);
    JointPos p3Joint=new JointPos(-107.266, -56.116, 85.971, -122.560, -92.548, 74.331);

    robot.GetForwardKin(p1Joint,p1Desc);
    robot.GetForwardKin(p2Joint,p2Desc);
    robot.GetForwardKin(p3Joint,p3Desc);

    ExaxisPos exaxisPos=new ExaxisPos(0, 0, 0, 0);
    DescPose offdese=new DescPose(0, 0, 0, 0, 0, 0);

    DescPose[] posTCP =new DescPose[]{p1Desc , p2Desc , p3Desc };
    DescPose coordRtn =new DescPose();
    int rtn = robot.ComputeWObjCoordWithPoints(1, posTCP, 0, coordRtn);

    robot.MoveJ(p1Joint, p1Desc, 1, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
    robot.SetWObjCoordPoint(1);
    robot.MoveJ(p2Joint, p2Desc, 1, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
    robot.SetWObjCoordPoint(2);
    robot.MoveJ(p3Joint, p3Desc, 1, 0, 100, 100, 100, exaxisPos, -1, 0, offdese);
    robot.SetWObjCoordPoint(3);
    rtn = robot.ComputeWObjCoord(1, 0, coordRtn);

    robot.SetWObjCoord(1, coordRtn, 0);
    robot.SetWObjList(1, coordRtn, 0);

    DescPose getWobjDesc = new DescPose();
    rtn = robot.GetWObjOffset(0, getWobjDesc);
    return 0;
}

6.22. Set global speed

/**
* @brief Set global speed
* @param [in] vel Speed percentage, range [0~100]
* @return Error code
*/
int SetSpeed(int vel);

6.23. Set robot acceleration

/**
* @brief Set robot acceleration
* @param [in] acc Robot acceleration percentage
* @return Error code
*/
int SetOaccScale(double acc);

6.24. Get robot default speed

/**
* @brief Get robot default speed
* @return List[0]:int Error code; List[1]: double vel Speed, unit mm/s
*/
List<Number> GetDefaultTransVel();

6.25. Set end load weight

/**
* @brief Set end load weight
* @param [in] loadNum Load number
* @param [in] weight Load weight, unit kg
* @return Error code
*/
int SetLoadWeight(int loadNum,double weight);

6.26. Set end load center of mass coordinates

/**
* @brief Set end load center of mass coordinates
* @param [in] coord Center of mass coordinates, unit mm
* @return Error code
*/
int SetLoadCoord(DescTran coord);

6.27. Set End Effector Load Center of Mass Coordinates

/**
 * @brief  Set end effector load center of mass coordinates
 * @param  [in] loadNum Load number
 * @param  [in] coord Center of mass coordinates, unit: mm
 * @return  Error code
 */
public int SetLoadCoord(int loadNum, DescTran coord)

6.28. Get current load weight

/**
* @brief Get current load weight
* @param [in] flag 0-blocking, 1-non-blocking
* @return List[0]:int Error code; List[1]: double weight Load weight, unit kg
*/
List<Number> GetTargetPayload(int flag);

6.29. Get current load center of mass

/**
* @brief Get current load center of mass
* @param [in] flag 0-blocking, 1-non-blocking
* @param [out] cog Load center of mass, unit mm
* @return Error code
*/
int GetTargetPayloadCog(int flag, DescTran cog);

6.30. Set robot installation method

/**
* @brief Set robot installation method
* @param [in] install Installation method, 0-standard, 1-side, 2-inverted
* @return Error code
*/
int SetRobotInstallPos(int install);

6.31. Set robot installation angle

/**
* @brief Set robot installation angle, free installation
* @param [in] yangle Tilt angle
* @param [in] zangle Rotation angle
* @return Error code
*/
int SetRobotInstallAngle(double yangle, double zangle);

6.32. Get robot installation angle

/**
* @brief Get robot installation angle
* @return List[0]:Error code; List[1]:double yangle Tilt angle; List[2]:double zangle Rotation angle
*/
public List<Number> GetRobotInstallAngle()

6.33. Set system variable value

/**
* @brief Set system variable value
* @param [in] id Variable number, range [1~20]
* @param [in] value Variable value
* @return Error code
*/
int SetSysVarValue(int id, double value);

6.34. Get system variable value

/**
* @brief Get system variable value
* @param [in] id System variable number, range [1~20]
* @return List[0]:Error code; List[1]:double value System variable value
*/
List<Number> GetSysVarValue(int id);

6.35. Robot common settings code example

public static int TestLoadInstall(Robot robot)
{
    for (int i = 1; i < 100; i++)
    {
        robot.SetSpeed(i);
        robot.SetOaccScale(i);
        robot.Sleep(30);
    }

    List<Number> defaultVel=new ArrayList<>();

    defaultVel=robot.GetDefaultTransVel();
    System.out.println("GetDefaultTransVel is:"+ defaultVel.get(1));

    for (int i = 1; i < 21; i++)
    {
        robot.SetSysVarValue(i, i + 0.5);
        robot.Sleep(100);
    }

    for (int i = 1; i < 21; i++)
    {
        float value = 0;
        defaultVel=robot.GetSysVarValue(i);
        System.out.println("sys value :"+i+", is :"+defaultVel.get(1));
        robot.Sleep(100);
    }

    robot.SetLoadWeight(0, 2.5);

    DescTran loadCoord = new DescTran();
    loadCoord.x = 3.0;
    loadCoord.y = 4.0;
    loadCoord.z = 5.0;
    robot.SetLoadCoord(loadCoord);

    robot.Sleep(1000);

    List<Number> getLoad = new ArrayList<>();

    getLoad=robot.GetTargetPayload(0);

    DescTran getLoadTran =new DescTran();
    robot.GetTargetPayloadCog(0, getLoadTran);
    System.out.println("get load is:"+getLoad.get(1)+", get load cog is: "+getLoadTran.x+","+getLoadTran.y+","+getLoadTran.z);

    robot.SetRobotInstallPos(0);
    robot.SetRobotInstallAngle(15.0, 25.0);

    List<Number> angle=new ArrayList<>();
    angle=robot.GetRobotInstallAngle();
    System.out.println("GetRobotInstallAngle x:"+angle.get(1)+";  y:"+angle.get(2));

    robot.CloseRPC();
    return 0;
}

6.36. Joint friction compensation switch

/**
* @brief Joint friction compensation switch
* @param [in] state 0-off, 1-on
* @return Error code
*/
int FrictionCompensationOnOff(int state);

6.37. Set joint friction compensation coefficient - standard installation

/**
* @brief Set joint friction compensation coefficient - standard installation
* @param [in] coeff Six joint compensation coefficients, range [0~1]
* @return Error code
*/
int SetFrictionValue_level(Object[] coeff);

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