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* @param config -1: automatic solution, 0-7 correspond to eight sets of solutions
10* @return Error code
11*/
12public int GetInverseKinExaxis(int type, DescPose desc_pos, ExaxisPos exaxis, int tool, int workPiece, JointPos joint_pos, int config)
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
8 ROBOT_STATE_PKG pkg=robot.GetRobotRealTimeState();
9 int toolnum = pkg.tool;
10 int workPcsNum = pkg.user;
11 robot.GetInverseKinExaxis(0, desc, exaxis, toolnum, workPcsNum, jointPos, 0);
12 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);
13
14 robot.ExtAxisMove(exaxis, 100, -1);
15 robot.MoveJ(jointPos, desc, toolnum, workPcsNum, 100.0, 100.0, 100.0, exaxis, -1, 0, offsetPos);
16
17}
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
Added 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
Changed in version Java: SDK-V3.9.8
1/**
2* @brief Get tool coordinate system by ID
3* @param [in] id Tool coordinate system number
4* @param [out] coord Coordinate system values
5* @param [out] type Tool type: 0-tool; 1-sensor
6* @param [out] install Installation position: 0-robot end; 1-external to robot
7* @param [out] toolID Tool ID
8* @param [out] loadNo Load number
9* @return Error code
10*/
11int GetToolCoordWithID(int id, DescPose coord, int[] type, int[] install, int[] toolID, int[] loadNo)
8.35. Get Workpiece Coordinate System by ID
Changed in version Java: SDK-V3.9.8
1/**
2* @brief Get workpiece coordinate system by ID
3* @param [in] id Workpiece coordinate system number
4* @param [out] coord Coordinate system values
5* @param [out] refFrame Reference coordinate system
6* @return Error code
7*/
8public int GetWObjCoordWithID(int id, DescPose coord, int[] refFrame)
8.36. Get External Tool Coordinate System by ID
Changed in version Java: SDK-V3.9.8
1/**
2* @brief Get external tool coordinate system by ID
3* @param [in] id External tool coordinate system number, 20-39 correspond to external tool coordinate systems 0-19
4* @param [out] coord TCP pose of the fixed external tool on the robot
5* @param [out] tcoord Workpiece coordinate system pose mounted on the robot end
6* @return Error code
7*/
8public int GetExToolCoordWithID(int id, DescPose coord, DescPose tcoord)
8.37. Get Extended Axis Coordinate System by ID
Changed in version Java: SDK-V3.9.8
1/**
2* @brief Get extended axis coordinate system by ID
3* @param [in] id External tool coordinate system number
4* @param [out] coord Coordinate system values
5* @param [out] axisCoordNum Extended axis number; bit0-bit3 correspond to extended axis 1-extended axis 4; e.g., axisCoordNum value 3 corresponds to extended axes [1, 2]
6* @param [out] calibFlag Calibration flag; 0-not calibrated; 1-calibrated
7* @return Error code
8*/
9public int GetExAxisCoordWithID (int id, DescPose coord, int[] axisCoordNum, int[] calibFlag)
8.38. Get Current Tool Coordinate System
Added 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
Added 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
Added 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
Added 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 int TestCoord(Robot robot)
2{
3 int id = 1;
4 DescPose toolCoord = new DescPose();
5 DescPose extoolCoord = new DescPose();
6 DescPose exworkpieceCoord = new DescPose();
7 DescPose wobjCoord = new DescPose();
8 DescPose exAxisCoord = new DescPose();
9 int[] type = new int[1];
10 int[] install = new int[1];
11 int[] toolID = new int[1];
12 int[] loadNo = new int[1];
13 robot.GetToolCoordWithID(id, toolCoord, type, install, toolID, loadNo);
14 System.out.printf("GetToolCoordWithID %d, %f %f %f %f %f %f, type = %d, install = %d, toolID = %d, loadNo = %d\n", id,
15 toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
16 toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz, type[0], install[0], toolID[0], loadNo[0]);
17 int[] refFrame = new int[1];
18 robot.GetWObjCoordWithID(id, wobjCoord, refFrame);
19 System.out.printf("GetWObjCoordWithID %d, %f %f %f %f %f %f, refFrame = %d\n", id,
20 wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
21 wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz, refFrame[0]);
22
23
24 robot.GetExToolCoordWithID(21, extoolCoord, exworkpieceCoord);
25 System.out.printf("GetExToolCoordWithID %d, %f %f %f %f %f %f\n", id,
26 extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
27 extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz,
28 exworkpieceCoord.tran.x, exworkpieceCoord.tran.y, exworkpieceCoord.tran.z,
29 exworkpieceCoord.rpy.rx, exworkpieceCoord.rpy.ry, exworkpieceCoord.rpy.rz);
30
31 int[] axisCoordNum = new int[1];
32 int[] calibFlag = new int[1];
33 robot.GetExAxisCoordWithID(id, exAxisCoord, axisCoordNum, calibFlag);
34 System.out.printf("GetExAxisCoordWithID %d, %f %f %f %f %f %f, axisCoordNum = %d, calibFlag = %d\n", id,
35 exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
36 exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz, axisCoordNum[0], calibFlag[0]);
37
38 double[] weight = new double[1];
39 DescTran cog = new DescTran();
40 robot.GetTargetPayloadWithID(id, weight, cog);
41 System.out.println("GetTargetPayload is " + weightT.get(0) + " cogT is " + cogT.x + " " + cogT.y + " " + cogT.z);
42 robot.GetCurToolCoord(toolCoord);
43 System.out.printf("GetCurToolCoord %f %f %f %f %f %f\n",
44 toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
45 toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz);
46 robot.GetCurWObjCoord(wobjCoord);
47 System.out.printf("GetCurWObjCoord %f %f %f %f %f %f\n",
48 wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
49 wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz);
50 robot.GetCurExToolCoord(extoolCoord);
51 System.out.printf("GetExToolCoordWithID %f %f %f %f %f %f\n",
52 extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
53 extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz);
54 robot.GetCurExAxisCoord(exAxisCoord);
55 System.out.printf("GetCurExAxisCoord %f %f %f %f %f %f\n",
56 exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
57 exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz);
58 DescTran cogT = new DescTran();
59 List<Number> weightT = robot.GetTargetPayload(0);
60 robot.GetTargetPayloadCog(0, cogT);
61 System.out.printf("GetTargetPayload %f %f %f %f\n", weightT.get(0),
62 cogT.x, cogT.y, cogT.z);
63 DescPose coordSet = new DescPose(0, 1, 2, 3, 4, 5);
64 robot.SetToolCoord(1, coordSet, 0, 0, 1, 0);
65 robot.SetWObjCoord(1, coordSet, 0);
66 robot.SetLoadWeight(1, 1.3);
67 cog.x = 10;
68 cog.y = 20;
69 cog.z = 30;
70 robot.SetLoadCoord(1, cog);
71 DescPose etcp = new DescPose(0, 0, 100, 0, 0, 0);
72 DescPose etool = new DescPose(0, 0, 50, 0, 0, 0);
73 int rtn = robot.SetExToolCoord(21, etcp, etool);
74 System.out.printf("SetExToolCoord rtn is %d\n", rtn);
75 robot.ExtAxisActiveECoordSys(1, 1, coordSet, 1);
76 return 0;
77}