8. Robot status inquiry

8.1. Get current joint positions (degrees)

1/**
2* @brief  Get current joint positions (degrees)
3* @param  [out] jPos Six joint positions in deg
4* @return  Error code
5*/
6int GetActualJointPosDegree(JointPos jPos);

8.2. Get joint feedback speed (deg/s)

1/**
2* @brief Get joint feedback speed (deg/s)
3* @param [out] speed Six joint speeds
4* @return Error code
5*/
6int GetActualJointSpeedsDegree(Object[] speed);

8.3. Get joint feedback acceleration

1/**
2* @brief  Get joint feedback acceleration (deg/s^2)
3* @param  [in] flag 0-Blocking, 1-Non-blocking
4* @param  [out] acc Six joint accelerations
5* @return  Error code
6*/
7public int GetActualJointAccDegree(int flag, Object[] acc)

8.4. Get TCP command composite speed

1/**
2* @brief  Get TCP command speed
3* @param  [in] flag 0-Blocking, 1-Non-blocking
4* @param  [out] tcp_speed Linear speed
5* @param  [out] ori_speed Orientation speed
6* @return  Error code
7*/
8public int GetTargetTCPCompositeSpeed(int flag, double tcp_speed, double ori_speed)

8.5. Get TCP feedback composite speed

1/**
2* @brief  Get TCP feedback composite speed
3* @param  [in] flag 0-Blocking, 1-Non-blocking
4* @param  [out] tcp_speed Linear speed
5* @param  [out] ori_speed Orientation speed
6* @return  Error code
7*/
8public int GetActualTCPCompositeSpeed(int flag, double tcp_speed, double ori_speed)

8.6. Get TCP command speed

1/**
2* @brief  Get TCP command speed
3* @param  [in] flag 0-Blocking, 1-Non-blocking
4* @param  [out] speed [x,y,z,rx,ry,rz] speed
5* @return  Error code
6*/
7public int GetTargetTCPSpeed(int flag, Object[] speed)

8.7. Get TCP feedback speed

1/**
2* @brief  Get TCP feedback speed
3* @param  [in] flag 0-Blocking, 1-Non-blocking
4* @param  [out] speed [x,y,z,rx,ry,rz] speed
5* @return  Error code
6*/
7public int GetActualTCPSpeed(int flag, Object[] speed)

8.8. Get current tool pose

1/**
2* @brief  Get current tool pose
3* @param  [out] desc_pos  Tool pose
4* @return  Error code
5*/
6int GetActualTCPPose(DescPose desc_pos);

8.9. Get current tool coordinate system number

1/**
2* @brief  Get current tool coordinate system number
3* @param  [in] flag  0-Blocking, 1-Non-blocking
4* @param  [out] id  Tool coordinate system number
5* @return  Error code
6*/
7int GetActualTCPNum(int flag, int[] id)

8.10. Get current workpiece coordinate system number

1/**
2* @brief  Get current workpiece coordinate system number
3* @param  [in] flag  0-Blocking, 1-Non-blocking
4* @param  [out] id  Workpiece coordinate system number
5* @return  Error code
6*/
7public int GetActualWObjNum(int flag, int[] id)

8.11. Get current end flange pose

1/**
2* @brief  Get current end flange pose
3* @param  [in] flag  0-Blocking, 1-Non-blocking
4* @param  [out] desc_pos  Flange pose
5* @return  Error code
6*/
7public int GetActualToolFlangePose(int flag, DescPose desc_pos)

8.12. Get current joint torque

1/**
2* @brief Get current joint torque
3* @param  [in]  flag 0-Blocking, 1-Non-blocking
4* @param  [out]  torques Joint torques
5* @return  Error code
6*/
7int GetJointTorques(int flag, Object[] torques);

8.13. Get system time

1/**
2* @brief  Get system time
3* @return  List[0]:int Error code; List[1]:double t_ms in ms
4*/
5List<Number> GetSystemClock();

8.14. Check if robot motion is completed

1/**
2* @brief  Check if robot motion is completed
3* @param   [out] state  0-Not completed, 1-Completed
4* @return  Error code
5*/
6public int GetRobotMotionDone(int[] state)

8.15. Query robot motion queue buffer length

1/**
2* @brief  Query robot motion queue buffer length
3* @param   [out] len  Buffer length
4* @return  Error code
5*/
6public int GetMotionQueueLength(int[] len)

8.16. Get robot emergency stop state

1/**
2* @brief Get robot emergency stop state
3* @param [out] state Emergency stop state, 0-Normal, 1-Emergency stop
4* @return Error code
5*/
6public int GetRobotEmergencyStopState(int[] state)

8.17. Get SDK-robot communication state

1/**
2* @brief Get SDK-robot communication state
3* @return state Communication state, 0-Normal, 1-Abnormal
4*/
5public int GetSDKComState()

8.18. Get safety stop signal

1/**
2* @brief Get safety stop signal
3* @param  [out] si0_state Safety stop signal SI0, 0-Invalid, 1-Valid
4* @param  [out] si1_state Safety stop signal SI1, 0-Invalid, 1-Valid
5* @return Error code
6*/
7public int GetSafetyStopState(int[] si0_state, int[] si1_state)

8.19. Get robot joint driver temperature (°C)

1/**
2* @brief Get robot joint driver temperature (°C)
3* @param  [out] temperature Temperature
4* @return Error code
5*/
6public int GetJointDriverTemperature(double[] temperature)

8.20. Get robot joint driver torque (Nm)

1/**
2* @brief Get robot joint driver torque (Nm)
3* @param  [out] torque Torque
4* @return Error code
5*/
6public int GetJointDriverTorque(double[] torque)

8.21. Get robot real-time state structure

1/**
2* @brief Get robot real-time state structure
3* @return Real-time state structure
4*/
5public ROBOT_STATE_PKG GetRobotRealTimeState()

8.22. Robot status inquiry code example

 1public static int TestGetStatus(Robot robot)
 2{
 3    List<Number> angle=new ArrayList<>();
 4    angle=robot.GetRobotInstallAngle();
 5    System.out.println("yangle:"+angle.get(1)+",zangle:"+angle.get(2));
 6
 7    JointPos j_deg =new JointPos(){};
 8    robot.GetActualJointPosDegree( j_deg);
 9
10    Object[] jointSpeed =new Object[] { 0,0,0,0,0,0 };
11    robot.GetActualJointSpeedsDegree(jointSpeed);
12
13    Object[] jointAcc = new Object[]{0,0,0,0,0,0 };
14    robot.GetActualJointAccDegree(0, jointAcc);
15
16    double tcp_speed = 0.0;
17    double ori_speed = 0.0;
18    robot.GetTargetTCPCompositeSpeed(0, tcp_speed, ori_speed);
19
20    robot.GetActualTCPCompositeSpeed(0, tcp_speed, ori_speed);
21
22    Object[] targetSpeed =new Object[] { 0,0,0,0,0,0 };
23    robot.GetTargetTCPSpeed(0, targetSpeed);
24
25    Object[] actualSpeed =new Object[] {0,0,0,0,0,0 };
26    robot.GetActualTCPSpeed(0, actualSpeed);
27
28    DescPose tcp = new DescPose(){};
29    robot.GetActualTCPPose(tcp);
30
31    DescPose flange = new DescPose(){};
32    robot.GetActualToolFlangePose(0, flange);
33
34    int[] id = {};
35    robot.GetActualTCPNum(0, id);
36
37    robot.GetActualWObjNum(0, id);
38
39    List<Number> jtorque=new ArrayList<>();
40    jtorque=robot.GetJointTorques(0);
41
42    List<Number> t_ms = new ArrayList<>();
43    t_ms=robot.GetSystemClock();
44
45    List<Integer> config = new ArrayList<>();
46    config=robot.GetRobotCurJointsConfig();
47
48    int motionDone = 0;
49    robot.GetRobotMotionDone(motionDone);
50
51    int[] len ={0 };
52    robot.GetMotionQueueLength(len);
53
54    int[] emergState = {0};
55    robot.GetRobotEmergencyStopState(emergState);
56
57    int comstate = 0;
58    comstate=robot.GetSDKComState();
59
60    int[] si0_state=new int[]{0}, si1_state=new int[]{0};
61    robot.GetSafetyStopState(si0_state, si1_state);
62
63    double[] temp =new double[] { 0,0,0,0,0,0 };
64    robot.GetJointDriverTemperature(temp);
65
66    double[] torque = new double[]{ 0,0,0,0,0,0 };
67    robot.GetJointDriverTorque(torque);
68
69    ROBOT_STATE_PKG pkg=new ROBOT_STATE_PKG();
70    pkg=robot.GetRobotRealTimeState();
71
72    return 0;
73}

8.23. Inverse kinematics calculation

1/**
2* @brief  Inverse kinematics calculation
3* @param  [in] type 0-Absolute pose (base frame), 1-Incremental pose (base frame), 2-Incremental pose (tool frame)
4* @param  [in] desc_pos Cartesian pose
5* @param  [in] config Joint space configuration, [-1]-Solve with reference to current joint position, [0~7]-Solve with specific joint space configuration
6* @param  [out] joint_pos Joint position
7* @return  Error code
8*/
9int GetInverseKin(int type, DescPose desc_pos, int config, JointPos joint_pos);

8.24. Inverse kinematics calculation (reference position)

1/**
2* @brief  Inverse kinematics calculation with reference joint position
3* @param  [in] posMode 0-Absolute pose, 1-Relative pose-base frame, 2-Relative pose-tool frame
4* @param  [in] desc_pos Cartesian pose
5* @param  [in] joint_pos_ref Reference joint position
6* @param  [out] joint_pos Joint position
7* @return  Error code
8*/
9int GetInverseKinRef(int posMode, DescPose desc_pos, JointPos joint_pos_ref, JointPos joint_pos);

8.25. Inverse Kinematics Solution, Cartesian Space Includes Extended Axis Position

 1/**
 2* @brief Inverse kinematics solution, Cartesian space includes extended axis position
 3* @param  type 0-Absolute pose (base coordinate system), 1-Incremental pose (base coordinate system), 2-Incremental pose (tool coordinate system)
 4* @param  desc_pos Cartesian pose
 5* @param  exaxis Extended axis position
 6* @param  tool Tool number
 7* @param  workPiece Workpiece number
 8* @param  joint_pos Joint position
 9* @return Error code
10*/
11public int GetInverseKinExaxis(int type, DescPose desc_pos, ExaxisPos exaxis, int tool, int workPiece, JointPos joint_pos)

8.26. Inverse Kinematics Solution Including Extended Axis Position Code Example

 1public static void  TestInverseKinExaxis(Robot robot)
 2{
 3    DescPose desc=new DescPose(99.957, -0.002, 29.994, -176.569, -6.757, -167.462);
 4    ExaxisPos exaxis=new ExaxisPos(100.0, 0.0, 0.0, 0.0);
 5    JointPos jointPos =new JointPos();
 6    DescPose offsetPos =new DescPose();
 7    ROBOT_STATE_PKG pkg=robot.GetRobotRealTimeState();
 8    int toolnum = pkg.tool;
 9    int workPcsNum = pkg.user;
10    robot.GetInverseKinExaxis(0, desc, exaxis, toolnum, workPcsNum, jointPos);
11    System.out.printf("GetInverseKinExaxis joint is %f, %f, %f, %f, %f, %f\n", jointPos.J1, jointPos.J2, jointPos.J3, jointPos.J4, jointPos.J5, jointPos.J6);
12    robot.ExtAxisMove(exaxis, 100, -1);
13    robot.MoveJ(jointPos, desc, toolnum, workPcsNum, 100.0, 100.0, 100.0, exaxis, -1, 0, offsetPos);
14    robot.CloseRPC();
15    robot.Sleep(9999999);
16}

8.27. Check if inverse kinematics has solution

1/**
2* @brief  Check if inverse kinematics has solution with reference joint position
3* @param  [in] posMode 0-Absolute pose, 1-Relative pose-base frame, 2-Relative pose-tool frame
4* @param  [in] desc_pos Cartesian pose
5* @param  [in] joint_pos_ref Reference joint position
6* @return  Error code  List[0]:Error code; List[1]: int hasResult 0-No solution, 1-Solution exists
7*/
8List<Integer> GetInverseKinHasSolution(int posMode, DescPose desc_pos, JointPos joint_pos_ref);

8.28. Forward kinematics calculation

1/**
2* @brief  Forward kinematics calculation
3* @param  [in] joint_pos Joint position
4* @param  [out] desc_pos Cartesian pose
5* @return  Error code
6*/
7int GetForwardKin(JointPos joint_pos, DescPose desc_pos);

8.29. Robot forward/inverse kinematics calculation code example

 1public static int TestInverseKin(Robot robot)
 2{
 3    JointPos j1=new JointPos(-11.904, -99.669, 117.473, -108.616, -91.726, 74.256);
 4    DescPose desc_pos1=new DescPose(-419.524, -13.000, 351.569, -178.118, 0.314, 3.833);
 5
 6    JointPos inverseRtn = new JointPos(){};
 7
 8    robot.GetInverseKin(0, desc_pos1, -1, inverseRtn);
 9    robot.GetInverseKinRef(0, desc_pos1, j1, inverseRtn);
10
11    int hasResut = 0;
12    robot.GetInverseKinHasSolution(0, desc_pos1, j1);
13
14    DescPose forwordResult = new DescPose(){};
15    robot.GetForwardKin(j1, forwordResult);
16
17    return 0;
18}

8.30. Query robot teaching management point data

1/**
2* @brief Query robot teaching management point data
3* @param [in]  name  Point name
4* @return  List[0]:Error code; List[1] - List[20] : Point data double[20]{x,y,z,rx,ry,rz,j1,j2,j3,j4,j5,j6,tool,wobj,speed,acc,e1,e2,e3,e4}
5*/
6List<Number> GetRobotTeachingPoint(String name);

8.31. Get robot DH parameter compensation values

1/**
2* @brief Get robot DH parameter compensation values
3* @param dhCompensation Robot DH parameter compensation values (mm) [cmpstD1,cmpstA2,cmpstA3,cmpstD4,cmpstD5,cmpstD6]
4* @return Error code
5*/
6public int GetDHCompensation(Object[] dhCompensation)

8.32. Get controller SN code

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

1/**
2* @brief Get controller SN code
3* @param [out] SNCode Controller SN code
4* @return Error code
5*/
6int GetRobotSN(String[] SNCode);

8.33. Query robot teaching management point data code example

 1public static int TestGetTeachPoint(Robot robot)
 2{
 3    String name = "P1";
 4    List<Number> data=new ArrayList<>();
 5    data = robot.GetRobotTeachingPoint(name);
 6    System.out.println(name+" name is: "+data.get(0));
 7    for (int i = 0; i < 20; i++)
 8    {
 9        System.out.println("data is: "+ data.get(i+1));
10    }
11
12    int[] que_len = {0};
13    int rtn = robot.GetMotionQueueLength(que_len);
14    System.out.println("GetMotionQueueLength rtn is:"+rtn+", queue length is:"+ que_len[0]);
15
16    Object[] dh = new Object[]{ 0,0,0,0,0,0 };
17    int retval = 0;
18    retval = robot.GetDHCompensation(dh);
19    System.out.println("retval is: "+retval);
20
21    String[] SN = new String[]{""};
22    robot.GetRobotSN(SN);
23    System.out.println("robot SN is "+SN[0]);
24    return 0;
25}

8.34. Get Tool Coordinate System by ID

New in version Java: SDK-v1.0.9-3.8.6

1/**
2* @brief Get Tool Coordinate System by ID
3* @param [in] id Tool coordinate system ID
4* @param [out] coord Coordinate system value
5* @return Error code
6*/
7int GetToolCoordWithID(int id, DescPose coord)

8.35. Get Work Object Coordinate System by ID

New in version Java: SDK-v1.0.9-3.8.6

1/**
2* @brief Get Work Object Coordinate System by ID
3* @param [in]  id Work object coordinate system ID
4* @param [out] coord Coordinate system value
5* @return Error code
6*/
7public int GetWObjCoordWithID(int id, DescPose coord)

8.36. Get External Tool Coordinate System by ID

New in version Java: SDK-v1.0.9-3.8.6

1/**
2* @brief Get External Tool Coordinate System by ID
3* @param [in]  id External tool coordinate system ID
4* @param [out] coord Coordinate system value
5* @return Error code
6*/
7public int GetExToolCoordWithID(int id, DescPose coord)

8.37. Get Extended Axis Coordinate System by ID

New in version Java: SDK-v1.0.9-3.8.6

1/**
2* @brief Get Extended Axis Coordinate System by ID
3* @param [in]  id Extended axis coordinate system ID
4* @param [out] coord Coordinate system value
5* @return Error code
6*/
7public int GetExAxisCoordWithID(int id, DescPose coord)

8.38. Get Current Tool Coordinate System

New in version Java: SDK-v1.0.9-3.8.6

1/**
2 * @brief Get Current Tool Coordinate System
3 * @param [out] coord Coordinate system value
4 * @return Error code
5 */
6public int GetCurToolCoord(DescPose coord)

8.39. Get Current Work Object Coordinate System

New in version Java: SDK-v1.0.9-3.8.6

1/**
2 * @brief Get Current Work Object Coordinate System
3 * @param [out] coord Coordinate system value
4 * @return Error code
5 */
6public int GetCurWObjCoord(DescPose coord)

8.40. Get Current External Tool Coordinate System

New in version Java: SDK-v1.0.9-3.8.6

1/**
2 * @brief Get Current External Tool Coordinate System
3 * @param  [out] coord Coordinate system value
4 * @return Error code
5 */
6public int GetCurExToolCoord(DescPose coord)

8.41. Get Current Extended Axis Coordinate System

New in version Java: SDK-v1.0.9-3.8.6

1/**
2 * @brief Get Current Extended Axis Coordinate System
3 * @param [out] coord Coordinate system value
4 * @return Error code
5 */
6public int GetCurExAxisCoord(DescPose coord)

8.42. Get Robot Coordinate System and Payload Code Example

 1public static void TestCoord(Robot robot)
 2{
 3    int id = 1;
 4    int rtn = 0;
 5    DescPose toolCoord = new DescPose();
 6    DescPose extoolCoord = new DescPose();
 7    DescPose wobjCoord = new DescPose();
 8    DescPose exAxisCoord = new DescPose();
 9
10
11    robot.GetCurToolCoord(toolCoord);// Tool
12    System.out.println("GetToolCoord:"+id+","+
13            toolCoord.tran.x+","+ toolCoord.tran.y+","+ toolCoord.tran.z+","+
14            toolCoord.rpy.rx+","+ toolCoord.rpy.ry+","+ toolCoord.rpy.rz);
15
16
17    robot.GetCurWObjCoord(toolCoord);// Work object
18    System.out.println("GetCurWObjCoord:"+id+","+
19            toolCoord.tran.x+","+ toolCoord.tran.y+","+ toolCoord.tran.z+","+
20            toolCoord.rpy.rx+","+ toolCoord.rpy.ry+","+ toolCoord.rpy.rz);
21
22    robot.GetCurExToolCoord(toolCoord);// External tool
23    System.out.println("GetCurExToolCoord:"+id+","+
24            toolCoord.tran.x+","+ toolCoord.tran.y+","+ toolCoord.tran.z+","+
25            toolCoord.rpy.rx+","+ toolCoord.rpy.ry+","+ toolCoord.rpy.rz);
26
27
28    robot.GetCurExAxisCoord(toolCoord);// Extended axis
29    System.out.println("GetCurExAxisCoord:"+id+","+ // Corrected print string for consistency
30            toolCoord.tran.x+","+ toolCoord.tran.y+","+ toolCoord.tran.z+","+
31            toolCoord.rpy.rx+","+ toolCoord.rpy.ry+","+ toolCoord.rpy.rz);
32
33
34    List<Number> weightT = new ArrayList<>();// Center of gravity
35    DescTran cogT=new DescTran();
36    weightT=robot.GetTargetPayload(0);
37    robot.GetTargetPayloadCog(0,cogT);
38    System.out.println("GetTargetPayload :"+weightT.get(1).doubleValue()+", "+
39            cogT.x+", "+cogT.y+", "+cogT.z);
40
41
42    robot.GetToolCoordWithID(id, toolCoord);
43    System.out.println("GetToolCoordWithID:"+id+","+
44            toolCoord.tran.x+","+ toolCoord.tran.y+","+ toolCoord.tran.z+","+
45            toolCoord.rpy.rx+","+ toolCoord.rpy.ry+","+ toolCoord.rpy.rz);
46
47    robot.GetWObjCoordWithID(id, wobjCoord);
48    System.out.println("GetWObjCoordWithID "+id+", "+
49            wobjCoord.tran.x+","+ wobjCoord.tran.y+","+ wobjCoord.tran.z+","+
50            wobjCoord.rpy.rx+","+ wobjCoord.rpy.ry+","+ wobjCoord.rpy.rz);
51
52
53    robot.GetExToolCoordWithID(id, extoolCoord);// External tool
54    System.out.println("GetExToolCoordWithID :"+ id+","+
55            extoolCoord.tran.x+","+ extoolCoord.tran.y+","+ extoolCoord.tran.z+","+
56            extoolCoord.rpy.rx+","+ extoolCoord.rpy.ry+","+ extoolCoord.rpy.rz);
57
58    robot.GetExAxisCoordWithID(id, exAxisCoord);// Extended axis
59    System.out.println("GetExAxisCoordWithID "+id+","+
60            exAxisCoord.tran.x+","+ exAxisCoord.tran.y+","+ exAxisCoord.tran.z+","+
61            exAxisCoord.rpy.rx+","+ exAxisCoord.rpy.ry+","+ exAxisCoord.rpy.rz);
62
63
64    double[] weight = new double[1];// Payload center of gravity
65    DescTran getCog = new DescTran();
66    robot.GetTargetPayloadWithID(id, weight, getCog);
67    System.out.println("GetTargetPayloadWithID :"+ id+","+ weight[0]+","+
68            getCog.x+","+ getCog.y+","+ getCog.z);
69
70    DescPose coordSet0 = new DescPose(0, 0, 0, 0, 0, 0);
71    DescPose coordSet = new DescPose(1, 2, 3, 4, 5, 6);
72    DescPose etcp = new DescPose(10, 20, 30, 40, 50, 60);
73    DescPose etool = new DescPose(0.1, 0.2, 0.3, 0.4, 0.5, 0.6);
74    DescTran cog = new DescTran(1, 2, 3);
75
76    robot.SetToolCoord(id, coordSet, 0, 0, 1, 0);
77    robot.Sleep(100);
78    robot.SetWObjCoord(id, coordSet, 0);
79    robot.Sleep(100);
80    robot.ExtAxisActiveECoordSys(id, 1, coordSet, 1); // Apply calibration result to extended axis coordinate system
81    robot.Sleep(100);
82    rtn = robot.SetExToolCoord(id, etcp, etool);
83    robot.Sleep(100);
84    rtn = robot.SetLoadWeight(id, 1.5);
85    robot.Sleep(500);
86    rtn = robot.SetLoadCoord(id, cog);
87    robot.Sleep(100);
88}