8. Status query
8.1. Get the current joint position (angle).
prototype |
|
|---|---|
Description |
Get the current position (angle) of the joint. |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.2. Get the current joint position in radians.
Prototype |
|
|---|---|
Description |
Get the current position (in radians) of the joint. |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.3. Get joint feedback speed -deg/s
Prototype |
|
|---|---|
Description |
Get joint feedback speed -deg/s |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.4. Obtain joint feedback acceleration-deg/s^2
Prototype |
|
|---|---|
Description |
Obtain joint feedback acceleration-deg/s^2 |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.5. Get TCP command synthesis speed
Prototype |
|
|---|---|
Description |
Get TCP command synthesis speed |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.6. Getting TCP Feedback Hopping Speed
Prototype |
|
|---|---|
Description |
Get TCP feedback closing speed |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.7. Get TCP command speed
Prototype |
|
|---|---|
Description |
Get TCP command speed |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.8. Getting TCP feedback speed
Prototype |
|
|---|---|
Description |
Get TCP feedback on speed |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.9. Get current tool position
Prototype |
|
|---|---|
Description |
Get current tool position |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.10. Get the current tool coordinate system number
prototype |
|
|---|---|
Description |
Get the current tool coordinate system number |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.11. Get the current workpiece coordinate system number
prototype |
|
|---|---|
Description |
Get the current workpiece coordinate system number |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.12. Get the current end flange position
Prototype |
|
|---|---|
Description |
Get current end flange position |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.13. Get current joint torque
Prototype |
|
|---|---|
Description |
Get the current joint torque |
Mandatory parameters |
NULL |
Default parameters |
|
Return Value |
|
8.14. Get system time
Prototype |
|
|---|---|
Description |
Get system time |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.15. Queries whether robot motion is complete
Prototype |
|
|---|---|
Description |
Query if robot movement is complete |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.16. Query the cache length of the robot motion queue
Prototype |
|
|---|---|
Description |
Query the cache length of the robot motion queue |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.17. Obtain the emergency stop status of the robot
Prototype |
|
|---|---|
Description |
Obtain the emergency stop status of the robot |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.18. Obtain the communication status between the SDK and the robot
Prototype |
|
|---|---|
Description |
Obtain the communication status between the SDK and the robot |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.19. Obtain the safety stop signal
Prototype |
|
|---|---|
Description |
Obtain the safety stop signal |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.20. Obtain the current temperature of the joint drive(℃)
Prototype |
|
|---|---|
Description |
Obtain the current temperature of the joint drive(℃) |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.21. Obtain the current torque of the joint drive(Nm)
Prototype |
|
|---|---|
Description |
Obtain the current torque of the joint drive(Nm) |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.22. Obtain the status of the robot
Prototype |
|
|---|---|
Description |
Obtain the status of the robot |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.23. Robot status query code example
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4error,[yangle, zangle] = robot.GetRobotInstallAngle()
5print(f"yangle:{yangle},zangle:{zangle}")
6error,j_deg = robot.GetActualJointPosDegree(0)
7print(f"joint pos deg:{j_deg[0]},{j_deg[1]},{j_deg[2]},{j_deg[3]},{j_deg[4]},{j_deg[5]}")
8error,jointSpeed = robot.GetActualJointSpeedsDegree(0)
9print(f"joint speeds deg:{jointSpeed[0]},{jointSpeed[1]},{jointSpeed[2]},{jointSpeed[3]},{jointSpeed[4]},{jointSpeed[5]}")
10error,jointAcc = robot.GetActualJointAccDegree(0)
11print(f"joint acc deg:{jointAcc[0]},{jointAcc[1]},{jointAcc[2]},{jointAcc[3]},{jointAcc[4]},{jointAcc[5]}")
12error,[tcp_speed, ori_speed] = robot.GetTargetTCPCompositeSpeed(0)
13print(f"GetTargetTCPCompositeSpeed tcp {tcp_speed}; ori {ori_speed}")
14error,[tcp_speed, ori_speed] = robot.GetActualTCPCompositeSpeed(0)
15print(f"GetActualTCPCompositeSpeed tcp {tcp_speed}; ori {ori_speed}")
16error,targetSpeed = robot.GetTargetTCPSpeed(0)
17print(f"GetTargetTCPSpeed {targetSpeed[0]},{targetSpeed[1]},{targetSpeed[2]},{targetSpeed[3]},{targetSpeed[4]},{targetSpeed[5]}")
18error,actualSpeed = robot.GetActualTCPSpeed(0)
19print(f"GetActualTCPSpeed {actualSpeed[0]},{actualSpeed[1]},{actualSpeed[2]},{actualSpeed[3]},{actualSpeed[4]},{actualSpeed[5]}")
20error,tcp = robot.GetActualTCPPose(0)
21print(f"tcp pose:{tcp[0]},{tcp[1]},{tcp[2]},{tcp[3]},{tcp[4]},{tcp[5]}")
22error,flange = robot.GetActualToolFlangePose(0)
23print(f"flange pose:{flange[0]},{flange[1]},{flange[2]},{flange[3]},{flange[4]},{flange[5]}")
24error,id = robot.GetActualTCPNum(0)
25print(f"tcp num:{id}")
26error,id = robot.GetActualWObjNum(0)
27print(f"wobj num:{id}")
28error,jtorque = robot.GetJointTorques(0)
29print(f"torques:{jtorque[0]},{jtorque[1]},{jtorque[2]},{jtorque[3]},{jtorque[4]},{jtorque[5]}")
30error,t_ms = robot.GetSystemClock()
31print(f"system clock:{t_ms}")
32error,config = robot.GetRobotCurJointsConfig()
33print(f"joint config:{config}")
34error,motionDone = robot.GetRobotMotionDone()
35print(f"GetRobotMotionDone:{motionDone}")
36error,len = robot.GetMotionQueueLength()
37print(f"GetMotionQueueLength:{len}")
38error,emergState = robot.GetRobotEmergencyStopState()
39print(f"GetRobotEmergencyStopState:{emergState}")
40error,comstate = robot.GetSDKComState()
41print(f"GetSDKComState:{comstate}")
42error,[si0_state, si1_state] = robot.GetSafetyStopState()
43print(f"GetSafetyStopState:{si0_state} {si1_state}")
44error,temp = robot.GetJointDriverTemperature()
45print(f"Temperature:{temp[0]},{temp[1]},{temp[2]},{temp[3]},{temp[4]},{temp[5]}")
46error,torque = robot.GetJointDriverTorque()
47print(f"torque:{torque[0]},{torque[1]},{torque[2]},{torque[3]},{torque[4]},{torque[5]}")
48error,pkg = robot.GetRobotRealTimeState()
49robot.CloseRPC()
8.24. Inverse kinematics solution
prototype |
|
|---|---|
Description |
Inverse kinematics, Cartesian position solving for joint positions |
Mandatory parameters |
|
Default parameters |
|
Return Value |
|
8.25. Inverse Kinematics Solution - Specifying Reference Positions
prototype |
|
|---|---|
Description |
Inverse kinematics, tool position solving for joint positions, solving with reference to specified joint positions |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
8.26. Inverse Kinematics Solution, Cartesian Space Includes Extended Axis Position
Prototype |
|
|---|---|
Description |
Inverse kinematics solution, Cartesian space includes extended axis position |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
8.27. Inverse Kinematics Solution Including Extended Axis Position Code Example
1from fairino import Robot
2import time
3robot = Robot.RPC('192.168.58.2')
4desc = [99.957, -0.002, 29.994, -176.569, -6.757, -167.462]
5exaxis = [100.0, 0.0, 0.0, 0.0]
6jointPos = [0.0] * 6
7offsetPos = [0.0] * 6
8rtn,pkg = robot.GetRobotRealTimeState()
9toolnum = pkg.tool
10workPcsNum = pkg.user
11rtn, jointPos = robot.GetInverseKinExaxis(0, desc, exaxis, toolnum, workPcsNum)
12print(f"GetInverseKinExaxis joint is {jointPos[0]},{jointPos[1]},{jointPos[2]},{jointPos[3]},{jointPos[4]},{jointPos[5]}")
13robot.ExtAxisMove(exaxis, 100, -1)
14robot.MoveJ(joint_pos=jointPos, desc_pos=desc, tool=toolnum, user=workPcsNum, vel=100.0, acc=100.0, ovl=100.0, exaxis_pos=exaxis, blendT=-1, offset_flag=0, offset_pos=offsetPos)
15robot.CloseRPC()
16return 0
8.28. Inverse kinematics solving-whether there is a solution
prototype |
|
|---|---|
Description |
Inverse kinematics, tool position solving for joint position Is there a solution |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
8.29. Positive kinematics solving
Prototype |
|
|---|---|
Description |
Positive Kinematics, Joint Position Solving Tool Posture |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
8.30. Example code for robot forward and inverse kinematics calculation
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4j1 = [-11.904, -99.669, 117.473, -108.616, -91.726, 74.256]
5desc_pos1 = [-419.524, -13.000, 351.569, -178.118, 0.314, 3.833]
6error, inverseRtn = robot.GetInverseKin(0, desc_pos=desc_pos1, config=-1)
7print(f"dcs1 GetInverseKin rtn is {inverseRtn[0]}, {inverseRtn[1]}, {inverseRtn[2]}, "
8 f"{inverseRtn[3]}, {inverseRtn[4]}, {inverseRtn[5]}")
9error, inverseRtn = robot.GetInverseKinRef(0, desc_pos=desc_pos1, joint_pos_ref=j1)
10print(f"dcs1 GetInverseKinRef rtn is {inverseRtn[0]}, {inverseRtn[1]}, {inverseRtn[2]}, "
11 f"{inverseRtn[3]}, {inverseRtn[4]}, {inverseRtn[5]}")
12error, hasResult = robot.GetInverseKinHasSolution(0, desc_pos=desc_pos1, joint_pos_ref=j1)
13print(f"dcs1 GetInverseKinRef result {hasResult}")
14error, forwordResult = robot.GetForwardKin(j1)
15print(f"jpos1 forwordResult rtn is {forwordResult[0]}, {forwordResult[1]}, {forwordResult[2]}, "
16 f"{forwordResult[3]}, {forwordResult[4]}, {forwordResult[5]}")
17robot.CloseRPC()
8.31. Query Robot Teaching Management Points Data
Prototype |
|
|---|---|
Description |
Query Robot Demonstration and Management point data |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
8.32. Get DH compensation parameters
Added in version python: SDK-v2.0.1
Prototype |
|
|---|---|
Description |
Get DH compensation parameters |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.33. Obtain the SN code of the control box
Added in version python: SDK-v2.1.1
Prototype |
|
|---|---|
Description |
Obtain the SN code of the control box |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.34. Query robot teaching management point data code example
1from fairino import Robot
2# Establish a connection with the robot controller and return a robot object if the connection is successful
3robot = Robot.RPC('192.168.58.2')
4name = "P1"
5rtn, data = robot.GetRobotTeachingPoint(name)
6print(f"{rtn} name is: {name}")
7for i in range(20):
8 print(f"data is: {data[i]}")
9rtn,que_len = robot.GetMotionQueueLength()
10print(f"GetMotionQueueLength rtn is: {rtn}, queue length is: {que_len}")
11retval,dh = robot.GetDHCompensation()
12print(f"retval is: {retval}")
13print(f"dh is: {dh[0]} {dh[1]} {dh[2]} {dh[3]} {dh[4]} {dh[5]}")
14error,sn = robot.GetRobotSN()
15print(f"robot SN is {sn[0]}")
16robot.CloseRPC()
8.35. Get Tool Coordinate System by ID
Changed in version python: SDK-V3.9.8
Prototype |
|
|---|---|
Description |
Get tool coordinate system by ID |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
8.36. Get Workpiece Coordinate System by ID
Changed in version python: SDK-V3.9.8
Prototype |
|
|---|---|
Description |
Get workpiece coordinate system by ID |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
8.37. Get External Tool Coordinate System by ID
Changed in version python: SDK-V3.9.8
Prototype |
|
|---|---|
Description |
Get external tool coordinate system by ID |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
8.38. Get Extended Axis Coordinate System by ID
Added in version python: SDK-v2.1.6
Prototype |
|
|---|---|
Description |
Get extended axis coordinate system by ID |
Required Parameters |
|
Default Parameters |
None |
Return Value |
|
8.39. Get the load mass and centroid according to the number
Added in version python: SDK-v2.1.6
Prototype |
|
|---|---|
Description |
Get the load mass and centroid according to the number |
Mandatory parameters |
|
Default parameters |
NULL |
Return Value |
|
8.40. Gets the current tool coordinate system
Added in version python: SDK-v2.1.6
Prototype |
|
|---|---|
Description |
Gets the current tool coordinate system |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.41. Gets the current workpiece coordinate system
Added in version python: SDK-v2.1.6
Prototype |
|
|---|---|
Description |
Gets the current workpiece coordinate system |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.42. Gets the current external tool coordinate system
Added in version python: SDK-v2.1.6
Prototype |
|
|---|---|
Description |
Gets the current external tool coordinate system |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.43. Gets the current extended axis coordinate system
Added in version python: SDK-v2.1.6
原型 |
|
|---|---|
描述 |
Gets the current extended axis coordinate system |
Mandatory parameters |
NULL |
Default parameters |
NULL |
Return Value |
|
8.44. Get robot coordinate system and load code sample
1from fairino import Robot
2import time
3
4def main():
5 robot = Robot.RPC('192.168.58.2')
6 time.sleep(0.5)
7
8 time.sleep(2)
9
10 id = 1
11 rtn, toolCoord, type_val, install, toolID, loadNo = robot.GetToolCoordWithID(id)
12 print(f"GetToolCoordWithID {id}, {toolCoord[0]:.6f} {toolCoord[1]:.6f} {toolCoord[2]:.6f} {toolCoord[3]:.6f} {toolCoord[4]:.6f} {toolCoord[5]:.6f}, type = {type_val}, install = {install}, toolID = {toolID}, loadNo = {loadNo}")
13 rtn, wobjCoord, refFrame = robot.GetWObjCoordWithID(id)
14 print(f"GetWObjCoordWithID {id}, {wobjCoord[0]:.6f} {wobjCoord[1]:.6f} {wobjCoord[2]:.6f} {wobjCoord[3]:.6f} {wobjCoord[4]:.6f} {wobjCoord[5]:.6f}, refFrame = {refFrame}")
15 rtn, extoolCoord, exworkpieceCoord = robot.GetExToolCoordWithID(21)
16 print(f"GetExToolCoordWithID {id}, {extoolCoord[0]:.6f} {extoolCoord[1]:.6f} {extoolCoord[2]:.6f} {extoolCoord[3]:.6f} {extoolCoord[4]:.6f} {extoolCoord[5]:.6f}, {exworkpieceCoord[0]:.6f} {exworkpieceCoord[1]:.6f} {exworkpieceCoord[2]:.6f} {exworkpieceCoord[3]:.6f} {exworkpieceCoord[4]:.6f} {exworkpieceCoord[5]:.6f}")
17 rtn, exAxisCoord, axisCoordNum, calibFlag = robot.GetExAxisCoordWithID(id)
18 print(f"GetExAxisCoordWithID {id}, {exAxisCoord[0]:.6f} {exAxisCoord[1]:.6f} {exAxisCoord[2]:.6f} {exAxisCoord[3]:.6f} {exAxisCoord[4]:.6f} {exAxisCoord[5]:.6f}, axisCoordNum = {axisCoordNum}, calibFlag = {calibFlag}")
19 rtn, weight, cog = robot.GetTargetPayloadWithID(id)
20 print(f"GetTargetPayloadWithID {id}, {weight:.6f} {cog[0]:.6f} {cog[1]:.6f} {cog[2]:.6f}")
21 rtn, toolCoord = robot.GetCurToolCoord()
22 print(f"GetCurToolCoord {toolCoord[0]:.6f} {toolCoord[1]:.6f} {toolCoord[2]:.6f} {toolCoord[3]:.6f} {toolCoord[4]:.6f} {toolCoord[5]:.6f}")
23 rtn, wobjCoord = robot.GetCurWObjCoord()
24 print(f"GetCurWObjCoord {wobjCoord[0]:.6f} {wobjCoord[1]:.6f} {wobjCoord[2]:.6f} {wobjCoord[3]:.6f} {wobjCoord[4]:.6f} {wobjCoord[5]:.6f}")
25 rtn, extoolCoord = robot.GetCurExToolCoord()
26 print(f"GetCurExToolCoord {extoolCoord[0]:.6f} {extoolCoord[1]:.6f} {extoolCoord[2]:.6f} {extoolCoord[3]:.6f} {extoolCoord[4]:.6f} {extoolCoord[5]:.6f}")
27
28 rtn, exAxisCoord = robot.GetCurExAxisCoord()
29 print(f"GetCurExAxisCoord {exAxisCoord[0]:.6f} {exAxisCoord[1]:.6f} {exAxisCoord[2]:.6f} {exAxisCoord[3]:.6f} {exAxisCoord[4]:.6f} {exAxisCoord[5]:.6f}")
30 rtn, weightT = robot.GetTargetPayload(0)
31 rtn, cogT = robot.GetTargetPayloadCog(0)
32 print(f"GetTargetPayload {weightT:.6f} {cogT[0]:.6f} {cogT[1]:.6f} {cogT[2]:.6f}")
33 coordSet = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
34
35 rtn = robot.SetToolCoord(1, coordSet, 0, 0, 1, 0)
36 print(f"SetToolCoord rtn is {rtn}")
37
38 rtn = robot.SetWObjCoord(1, coordSet, 0)
39 print(f"SetWObjCoord rtn is {rtn}")
40
41 rtn = robot.SetLoadWeight(1, 1.3)
42 print(f"SetLoadWeight rtn is {rtn}")
43
44 rtn = robot.SetLoadCoord(10.0, 20.0, 30.0,1)
45 print(f"SetLoadCoord rtn is {rtn}")
46
47 etcp = [0.0, 0.0, 100.0, 0.0, 0.0, 0.0]
48 etool = [0.0, 0.0, 50.0, 0.0, 0.0, 0.0]
49 rtn = robot.SetExToolCoord(21, etcp, etool)
50 print(f"SetExToolCoord rtn is {rtn}")
51
52 rtn = robot.ExtAxisActiveECoordSys(1, 1, coordSet, 1)
53 print(f"ExtAxisActiveECoordSys rtn is {rtn}")
54
55 robot.CloseRPC()
56
57if __name__ == "__main__":
58 main()