8. Robot Status Check
8.1. Get current joint position (angle).
1/**
2* @brief Get current joint position (angle).
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] jPos Six joint positions in deg.
5* @return Error code.
6*/
7int GetActualJointPosDegree(byte flag, ref JointPos jPos);
8.2. Get current joint position in degrees of arc.
1/**
2* @brief Get current joint position in radians.
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] jPos six joint positions in rad
5* @return Error code
6*/
7int GetActualJointPosRadian(byte flag, ref JointPos jPos);
8.3. Get the joint feedback velocity
1/**
2* @brief Get joint feedback speed -deg/s
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] speed Six joint speeds.
5* @return Error code.
6*/
7int GetActualJointSpeedsDegree(byte flag, ref double[] speed);
8.4. Get joint feedback acceleration
1/**
2* @brief Get the 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*/
7int GetActualJointAccDegree(byte flag, ref double[] acc);
8.5. Get TCP command velocity - joint velocity
1/**
2* @brief Get TCP command speed-combining speed.
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] tcp_speed linear_speed
5* @param [out] ori_speed Attitude Speed
6* @return error code
7*/
8int GetTargetTCPCompositeSpeed(byte flag, ref double tcp_speed, ref double ori_speed);
8.6. Get TCP feedback speed-composite speed
1/**
2* @brief Get TCP feedback speed-combination speed.
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] tcp_speed linear_speed
5* @param [out] ori_speed Attitude Speed
6* @return error code
7*/
8int GetActualTCPCompositeSpeed(byte flag, ref double tcp_speed, ref double ori_speed);
8.7. Get TCP command speed-composite speed
1/**
2* @brief Get TCP command speed-split.
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*/
7int GetTargetTCPSpeed(byte flag, ref double[] speed);
8.8. Get TCP feedback speed-split speed
1/**
2* @brief Get TCP feedback speed-cents.
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*/
7int GetActualTCPSpeed(byte flag, ref double[] speed);
8.9. Get current tool position
1/**
2* @brief Get current tool position
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] desc_pos Tool position.
5* @return Error code.
6*/
7int GetActualTCPPose(byte flag, ref DescPose desc_pos);
8.10. Get the current tool coordinate system number
1/**
2* @brief Get the 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(byte flag, ref int id).
8.11. Get the current tool coordinate system number
1/**
2* @brief Get the current workpiece coordinate system number.
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] id The workpiece coordinate system number.
5* @return Error code.
6*/
7int GetActualWObjNum(byte flag, ref int id);
8.12. Get the current end flange position
1/**
2* @brief Get the current end flange position.
3* @param [in] flag 0-blocking, 1-non-blocking
4* @param [out] desc_pos Flange position.
5* @return Error code.
6*/
7int GetActualToolFlangePose(byte flag, ref DescPose desc_pos);
8.13. Get the 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(byte flag, float[] torques).
8.14. Get System Time
1/**
2* @brief Get system time
3* @param [out] t_ms Unit ms, can be converted according to UTC time. When the robot is in a fault state, GetSystemClock returns 0 and returns an error code.
4* @return Error code
5*/
6public int GetSystemClock(ref double t_ms)
8.15. Synchronize System Time to Robot
1/**
2* @brief Get the current host system time and send it to the robot to synchronize the system time (due to QNX system limitations, synchronization accuracy is at the minute level)
3* @return Error code
4*/
5public int SetRobottime()
8.16. Synchronize System Time to Robot Code Example
1public void testSetAndGetRobotTime()
2{
3 double t_ms = 0.0;
4
5 int ret = robot.GetSystemClock(ref t_ms);
6 if (ret == 0)
7 {
8 Console.WriteLine($"system clock : {t_ms}");
9 // Convert millisecond timestamp to DateTime (UTC time)
10 DateTime utcTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(t_ms);
11 Console.WriteLine($"BEFORE UTC Time : {utcTime:yyyy-MM-dd HH:mm:ss}");
12 }
13 else
14 {
15 Console.WriteLine($"GetSystemClock failed,ret:{ret}");
16 }
17
18 robot.SetRobottime();
19
20 // Get the robot time after setting
21 double t_ms_after = 0;
22 ret = robot.GetSystemClock(ref t_ms_after);
23 if (ret == 0)
24 {
25 Console.WriteLine($"system clock : {t_ms}");
26 DateTime robotTimeAfter = DateTimeOffset.FromUnixTimeMilliseconds((long)t_ms_after).UtcDateTime;
27
28 // Get the PC time before setting (as expected value)
29 DateTime pcTimeBefore = DateTime.Now;
30
31 // Truncate both expected time (PC time) and robot time to minutes
32 DateTime pcMinute = new DateTime(pcTimeBefore.Year, pcTimeBefore.Month, pcTimeBefore.Day,
33 pcTimeBefore.Hour, pcTimeBefore.Minute, 0, DateTimeKind.Utc);
34 DateTime robotMinute = new DateTime(robotTimeAfter.Year, robotTimeAfter.Month, robotTimeAfter.Day,
35 robotTimeAfter.Hour, robotTimeAfter.Minute, 0, DateTimeKind.Utc);
36
37 // Compare consistency
38 bool isConsistent = (pcMinute == robotMinute);
39 if (isConsistent)
40 {
41 Console.WriteLine($"Consistent | PC time: {pcMinute:yyyy-MM-dd HH:mm} | Robot time: {robotMinute:yyyy-MM-dd HH:mm}");
42 }
43 else
44 {
45 Console.WriteLine($"[Inconsistent | PC time: {pcMinute:yyyy-MM-dd HH:mm} | Robot time: {robotMinute:yyyy-MM-dd HH:mm}");
46 }
47 }
48 else
49 {
50 Console.WriteLine($"GetSystemClock failed,ret:{ret}");
51 }
52}
8.17. Queries if the robot movement is complete
1/**
2* @brief Query if robot motion is complete.
3* @param [out] state 0-not completed, 1-completed
4* @return Error code.
5*/
6int GetRobotMotionDone(ref byte state).
8.18. Queries the length of the robot motion queue cache
1/**
2* @brief Query the robot motion queue cache length.
3* @param [out] len Cache length.
4* @return Error code.
5*/
6int GetMotionQueueLength(ref int len).
8.19. Get the robot emergency stop state
1/**
2* @brief Get the state of the robot's emergency stop.
3* @param [out] state Emergency stop state, 0-non-emergency stop, 1-emergency stop.
4* @return Error code.
5*/
6int GetRobotEmergencyStopState(ref byte state).
8.20. Get the state of the communication between the SDK and the robot
1/**
2* @brief Get the communication state of the SDK and the robot.
3* @param [out] state communication state, 0-normal communication, 1-abnormal communication.
4*/
5int GetSDKComState(ref int state).
8.21. Get safety stop signal
1/**
2* @brief Get the safe stop signal.
3* @param [out] si0_state Safe stop signal SI0, 0-invalid, 1-valid
4* @param [out] si1_state safe stop signal SI1, 0-invalid, 1-valid
5*/
6int GetSafetyStopState(ref byte si0_state, ref byte si1_state);
8.22. Get robot joint actuator temperature (℃)
1/**
2* @brief Get the robot's articulated actuator temperature (℃).
3* @return Error code
4*/
5int GetJointDriverTemperature(double[] temperature).
8.23. Get robot joint driver torque(Nm).
1/**
2* @brief Get robot joint actuator torque (Nm).
3* @return Error code
4*/
5int GetJointDriverTorque(double torque[]).
8.24. Get the Latest Frame of Robot Real-Time Status Data (Internal Mechanism Changed)
1/**
2* @brief Get the latest frame of robot real-time status data (internal thread continuously updates, this interface directly returns cached data)
3* @param [out] pkg Reference parameter for receiving robot status data (ROBOT_STATE_PKG structure)
4* @return Returns 0 on success; returns a negative error code on failure (e.g., network communication error)
5*/
6public int GetRobotRealTimeState(ref ROBOT_STATE_PKG pkg)
8.25. Sample Robot Status Query Code
1private void button29_Click(object sender, EventArgs e)
2{
3 ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
4 double yangle = 0, zangle = 0;
5 robot.GetRobotInstallAngle(ref yangle, ref zangle);
6 Console.WriteLine($"yangle:{yangle},zangle:{zangle}");
7
8 JointPos j_deg = new JointPos(0,0,0,0,0,0);
9 robot.GetActualJointPosDegree(0, ref j_deg);
10 Console.WriteLine($"joint pos deg:{j_deg.jPos[0]},{j_deg.jPos[1]},{j_deg.jPos[2]},{j_deg.jPos[3]},{j_deg.jPos[4]},{j_deg.jPos[5]}");
11
12 double[] jointSpeed = new double[6];
13 robot.GetActualJointSpeedsDegree(0, ref jointSpeed);
14 Console.WriteLine($"joint speeds deg:{jointSpeed[0]},{jointSpeed[1]},{jointSpeed[2]},{jointSpeed[3]},{jointSpeed[4]},{jointSpeed[5]}");
15
16 double[] jointAcc = new double[6];
17 robot.GetActualJointAccDegree(0, ref jointAcc);
18 Console.WriteLine($"joint acc deg:{jointAcc[0]},{jointAcc[1]},{jointAcc[2]},{jointAcc[3]},{jointAcc[4]},{jointAcc[5]}");
19
20 double tcp_speed = 0, ori_speed = 0;
21 robot.GetTargetTCPCompositeSpeed(0, ref tcp_speed, ref ori_speed);
22 Console.WriteLine($"GetTargetTCPCompositeSpeed tcp {tcp_speed}; ori {ori_speed}");
23
24 robot.GetActualTCPCompositeSpeed(0, ref tcp_speed, ref ori_speed);
25 Console.WriteLine($"GetActualTCPCompositeSpeed tcp {tcp_speed}; ori {ori_speed}");
26
27 double[] targetSpeed = new double[6];
28 robot.GetTargetTCPSpeed(0,ref targetSpeed);
29 Console.WriteLine($"GetTargetTCPSpeed {targetSpeed[0]},{targetSpeed[1]},{targetSpeed[2]},{targetSpeed[3]},{targetSpeed[4]},{targetSpeed[5]}");
30
31 double[] actualSpeed = new double[6];
32 robot.GetActualTCPSpeed(0, ref actualSpeed);
33 Console.WriteLine($"GetTargetTCPSpeed {actualSpeed[0]},{actualSpeed[1]},{actualSpeed[2]},{actualSpeed[3]},{actualSpeed[4]},{actualSpeed[5]}");
34
35 DescPose tcp = new DescPose(0, 0, 0, 0, 0, 0);
36 robot.GetActualTCPPose(0, ref tcp);
37 Console.WriteLine($"tcp pose:{tcp.tran.x},{tcp.tran.y},{tcp.tran.z},{tcp.rpy.rx},{tcp.rpy.ry},{tcp.rpy.rz}");
38
39 DescPose flange = new DescPose(0, 0, 0, 0, 0, 0);
40 robot.GetActualToolFlangePose(0, ref flange);
41 Console.WriteLine($"flange pose:{flange.tran.x},{flange.tran.y},{flange.tran.z},{flange.rpy.rx},{flange.rpy.ry},{flange.rpy.rz}");
42
43 int id = 0;
44 robot.GetActualTCPNum(0, ref id);
45 Console.WriteLine($"tcp num:{id}");
46
47 robot.GetActualWObjNum(0, ref id);
48 Console.WriteLine($"wobj num:{id}");
49
50 double[] jtorque = new double[6];
51 robot.GetJointTorques(0, jtorque);
52 Console.WriteLine($"torques:{jtorque[0]},{jtorque[1]},{jtorque[2]},{jtorque[3]},{jtorque[4]},{jtorque[5]}");
53
54 double t_ms = 0;
55 robot.GetSystemClock(ref t_ms);
56 Console.WriteLine($"system clock:{t_ms}");
57
58 int config = 0;
59 robot.GetRobotCurJointsConfig(ref config);
60 Console.WriteLine($"joint config:{config}");
61
62 byte motionDone = 0;
63 robot.GetRobotMotionDone(ref motionDone);
64 Console.WriteLine($"GetRobotMotionDone :{motionDone}");
65
66 int len = 0;
67 robot.GetMotionQueueLength(ref len);
68 Console.WriteLine($"GetMotionQueueLength :{len}");
69
70 byte emergState = 0;
71 robot.GetRobotEmergencyStopState(ref emergState);
72 Console.WriteLine($"GetRobotEmergencyStopState :{emergState}");
73
74 int comstate = 0;
75 robot.GetSDKComState(ref comstate);
76 Console.WriteLine($"GetSDKComState :{comstate}");
77
78 byte si0_state = 0, si1_state = 0;
79 robot.GetSafetyStopState(ref si0_state, ref si1_state);
80 Console.WriteLine($"GetSafetyStopState :{si0_state} {si1_state}");
81
82 double[] temp = new double[6];
83 robot.GetJointDriverTemperature(temp);
84 Console.WriteLine($"Temperature:{temp[0]},{temp[1]},{temp[2]},{temp[3]},{temp[4]},{temp[5]}");
85
86 double[] torque = new double[6];
87 robot.GetJointDriverTorque(torque);
88 Console.WriteLine($"torque:{torque[0]},{torque[1]},{torque[2]},{torque[3]},{torque[4]},{torque[5]}");
89
90 robot.GetRobotRealTimeState(ref pkg);
91}
8.26. Inverse kinematics solution
1/**
2* @brief Inverse kinematics solution
3* @param [in] type 0-absolute position (base coordinate system), 1-incremental position (base coordinate system), 2-incremental position (instrumental coordinate system)
4* @param [in] desc_pos Cartesian Position
5* @param [in] config joint_space_configuration, [-1] - solve with reference to the current joint position, [0~7] - solve according to a 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, ref JointPos joint_pos);
8.27. Inverse kinematics solution (reference position)
1/**
2* @brief Inverse kinematics solving, referencing a specified joint position to determine if there is a solution.
3* @param [in] type 0-absolute position (base coordinate system), 1-incremental position (base coordinate system), 2-incremental position (instrumental coordinate system)
4* @param [in] desc_pos Cartesian Position
5* @param [in] joint_pos_ref reference joint position
6* @param [out] result 0-no solution, 1-with solution
7* @return Error code
8*/
9int GetInverseKinRef(int posMode, DescPose desc_pos, JointPos joint_pos_ref, ref JointPos joint_pos);
8.28. Inverse Kinematics Solution, Cartesian Space Includes Extended Axis Position
1/**
2* @brief Inverse kinematics solution, Cartesian space includes extended axis position
3* @param [in] type 0-Absolute pose (base coordinate system), 1-Incremental pose (base coordinate system), 2-Incremental pose (tool coordinate system)
4* @param [in] desc_pos Cartesian pose
5* @param [in] exaxis Extended axis position
6* @param [in] tool Tool number
7* @param [in] workPiece Workpiece number
8* @param [out] joint_pos Joint position
9* @param [in] 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, ref JointPos joint_pos, int config = -1);
8.29. Example Code for Inverse Kinematics Solution Including Extended Axis Position
1public void TestInverseKinExaxis()
2{
3 ROBOT_STATE_PKG pkg = new ROBOT_STATE_PKG();
4 robot.GetRobotRealTimeState(ref pkg);
5 int toolnum = pkg.tool;
6 int workPcsNum = pkg.user;
7
8 DescPose desc = new DescPose(-547.469, -47.361, 184.149, 169.843, 4.579, 82.557);
9 ExaxisPos exaxis = new ExaxisPos(0.0, 0.0, 0.0, 0.0);
10 JointPos jointPos = new JointPos(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
11
12 robot.GetInverseKinExaxis(0, desc, exaxis, toolnum, workPcsNum, ref jointPos, 0);
13 Console.WriteLine($"GetInverseKinExaxis joint is {jointPos.jPos[0]}, {jointPos.jPos[1]}, {jointPos.jPos[2]}, {jointPos.jPos[3]}, {jointPos.jPos[4]}, {jointPos.jPos[5]}");
14}
8.30. Example Code for Inverse Kinematics Solution Including Extended Axis Position
1/**
2* @brief Inverse kinematics solution, determine if there is a solution for the specified reference joint position.
3* @param [in] posMode 0 absolute position, 1 relative position-base coordinate system, 2 relative position-tool coordinate system.
4* @param [in] desc_pos Cartesian position.
5* @param [in] joint_pos_ref Reference joint position.
6* @param [out] hasResult 0-no solution, 1-has solution
7* @return Error code
8*/
9int GetInverseKinHasSolution(int posMode, DescPose desc_pos, JointPos joint_pos_ref, ref bool hasResult);
8.31. Positive kinematics solution
1/**
2* @brief Positive kinematics solution.
3* @param [in] joint_pos joint position
4* @param [out] desc_pos Cartesian position
5* @return Error code.
6*/
7int GetForwardKin(JointPos joint_pos, ref DescPose desc_pos);
8.32. Robot Forward and Reverse Kinematics Calculation Code Example
1private void button30_Click(object sender, EventArgs e)
2{
3 JointPos j1 = new JointPos(-11.904f, -99.669f, 117.473f, -108.616f, -91.726f, 74.256f);
4 DescPose desc_pos1 = new DescPose(-419.524f, -13.000f, 351.569f, -178.118f, 0.314f, 3.833f);
5 JointPos inverseRtn = new JointPos(0, 0, 0, 0, 0, 0, 0, 0);
6 robot.GetInverseKin(0, desc_pos1, -1, ref inverseRtn);
7 Console.WriteLine($"dcs1 GetInverseKin rtn is {inverseRtn.jPos[0]} {inverseRtn.jPos[1]} {inverseRtn.jPos[2]} {inverseRtn.jPos[3]} { inverseRtn.jPos[4]} {inverseRtn.jPos[5]}");
8 robot.GetInverseKinRef(0, desc_pos1, j1, ref inverseRtn);
9 Console.WriteLine($"dcs1 GetInverseKinRef rtn is {inverseRtn.jPos[0]} {inverseRtn.jPos[1]} {inverseRtn.jPos[2]} {inverseRtn.jPos[3]} { inverseRtn.jPos[4]} {inverseRtn.jPos[5]}");
10 bool hasResut = false;
11 robot.GetInverseKinHasSolution(0, desc_pos1, j1, ref hasResut);
12 Console.WriteLine($"dcs1 GetInverseKinRef result {hasResut}");
13 DescPose forwordResult = new DescPose(0, 0, 0, 0, 0, 0, 0);
14 robot.GetForwardKin(j1, ref forwordResult);
15 Console.WriteLine($"jpos1 forwordResult rtn is {forwordResult.tran.x} {forwordResult.tran.y} {forwordResult.tran.z} {forwordResult.rpy.rx } {forwordResult.rpy.ry} {forwordResult.rpy.rz}");
16}
8.33. Querying Robot Teaching Management Point Data
1/**
2* @brief Query robot instruction management point data.
3* @param [in] name Point name.
4* @param [out] data 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* @return Error code
6*/
7int GetRobotTeachingPoint(string name, ref double[] data);
8.34. Get the robot DH parameter compensation value
1/**
2* @brief Get the robot DH parameter compensation value.
3* @param [out] dhCompensation Robot DH parameter compensation value (mm) [cmpstD1,cmpstA2,cmpstA3,cmpstD4,cmpstD5,cmpstD6]
4* @return Error code
5*/
6int GetDHCompensation(ref double[] dhCompensation).
8.35. Get control box SN code
1/**
2* @brief Get control box SN code.
3* @param [out] SNCode Control Box SN Code
4* @return Error code.
5*/
6int GetRobotSN(ref string SNCode);
8.36. Query the robot teaching management point data code example
1private void button31_Click(object sender, EventArgs e)
2{
3 string name = "A0";
4 double[] data = new double[20];
5 int rtn = robot.GetRobotTeachingPoint(name, ref data);
6 Console.WriteLine(" {0} name is: {1} \n", rtn, name);
7 for (int i = 0; i < 20; i++)
8 {
9 Console.WriteLine("data is: {0} \n", data[i]);
10 }
11
12 int que_len = 0;
13 rtn = robot.GetMotionQueueLength(ref que_len);
14 Console.WriteLine("GetMotionQueueLength rtn is: {0}, queue length is: {1} \n", rtn, que_len);
15
16 double[] dh = { 0, 0, 0, 0, 0, 0 };
17 int retval = 0;
18 retval = robot.GetDHCompensation(ref dh);
19 Console.WriteLine($"retval is {retval}");
20 Console.WriteLine($"dh is {dh[0]}, {dh[1]}, {dh[2]}, {dh[3]}, {dh[4]}, {dh[5]}");
21 string SN = "";
22 robot.GetRobotSN(ref SN);
23 Console.WriteLine($"robot SN is {SN}");
24}
8.37. Get Tool Coordinate System by ID
Changed in version C#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, ref DescPose coord, ref int type, ref int install, ref int toolID, ref int loadNo)
8.38. Get Workpiece Coordinate System by ID
Changed in version C#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, ref DescPose coord, ref int refFrame)
8.39. Get External Tool Coordinate System by ID
Changed in version C#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, ref DescPose coord, ref DescPose tcoord)
8.40. Get Extended Axis Coordinate System by ID
Changed in version C#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, ref DescPose coord, ref int axisCoordNum, ref int calibFlag)
8.41. Get Current Tool Coordinate System
Added in version C#SDK-V1.1.8: Web-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(ref DescPose coord)
8.42. Get Current Work Object Coordinate System
Added in version C#SDK-V1.1.8: Web-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(ref DescPose coord)
8.43. Get Current External Tool Coordinate System
Added in version C#SDK-V1.1.8: Web-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(ref DescPose coord)
8.44. Get Current Extended Axis Coordinate System
Added in version C#SDK-V1.1.8: Web-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(ref DescPose coord)
8.45. Code Example for Getting Coordinates by ID
Changed in version C#SDK-V3.9.8.
1public int TestCoord()
2{
3 int rtn;
4 int id = 1;
5
6 // GetToolCoordWithID
7 DescPose toolCoord = new DescPose(0, 0, 0, 0, 0, 0);
8 int type = 0, install = 0, toolID = 0, loadNo = 0;
9 rtn = robot.GetToolCoordWithID(id, ref toolCoord, ref type, ref install, ref toolID, ref loadNo);
10 Console.WriteLine("GetToolCoordWithID {0}, {1:F3} {2:F3} {3:F3} {4:F3} {5:F3} {6:F3}, type={7}, install={8}, toolID={9}, loadNo={10}",
11 id, toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
12 toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz, type, install, toolID, loadNo);
13
14 // GetWObjCoordWithID
15 DescPose wobjCoord = new DescPose(0, 0, 0, 0, 0, 0);
16 int refFrame = 0;
17 rtn = robot.GetWObjCoordWithID(id, ref wobjCoord, ref refFrame);
18 Console.WriteLine("GetWObjCoordWithID {0}, {1:F3} {2:F3} {3:F3} {4:F3} {5:F3} {6:F3}, refFrame={7}",
19 id, wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
20 wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz, refFrame);
21
22 // GetExToolCoordWithID
23 DescPose extoolCoord = new DescPose(0, 0, 0, 0, 0, 0);
24 DescPose exworkpieceCoord = new DescPose(0, 0, 0, 0, 0, 0);
25 rtn = robot.GetExToolCoordWithID(21, ref extoolCoord, ref exworkpieceCoord);
26 Console.WriteLine("GetExToolCoordWithID 21, {0:F3} {1:F3} {2:F3} {3:F3} {4:F3} {5:F3}",
27 extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
28 extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz);
29 Console.WriteLine(" tcoord: {0:F3} {1:F3} {2:F3} {3:F3} {4:F3} {5:F3}",
30 exworkpieceCoord.tran.x, exworkpieceCoord.tran.y, exworkpieceCoord.tran.z,
31 exworkpieceCoord.rpy.rx, exworkpieceCoord.rpy.ry, exworkpieceCoord.rpy.rz);
32
33 // GetExAxisCoordWithID
34 DescPose exAxisCoord = new DescPose(0, 0, 0, 0, 0, 0);
35 int axisCoordNum = 0, calibFlag = 0;
36 rtn = robot.GetExAxisCoordWithID(id, ref exAxisCoord, ref axisCoordNum, ref calibFlag);
37 Console.WriteLine("GetExAxisCoordWithID {0}, {1:F3} {2:F3} {3:F3} {4:F3} {5:F3} {6:F3}, axisCoordNum={7}, calibFlag={8}",
38 id, exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
39 exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz, axisCoordNum, calibFlag);
40
41 // GetTargetPayloadWithID
42 double weight = 0.0;
43 DescTran cog = new DescTran(0, 0, 0);
44 rtn = robot.GetTargetPayloadWithID(id, ref weight, ref cog);
45 Console.WriteLine("GetTargetPayloadWithID {0}, {1:F3} {2:F3} {3:F3} {4:F3}",
46 id, weight, cog.x, cog.y, cog.z);
47
48 // GetCurToolCoord
49 rtn = robot.GetCurToolCoord(ref toolCoord);
50 Console.WriteLine("GetCurToolCoord {0:F3} {1:F3} {2:F3} {3:F3} {4:F3} {5:F3}",
51 toolCoord.tran.x, toolCoord.tran.y, toolCoord.tran.z,
52 toolCoord.rpy.rx, toolCoord.rpy.ry, toolCoord.rpy.rz);
53
54 // GetCurWObjCoord
55 rtn = robot.GetCurWObjCoord(ref wobjCoord);
56 Console.WriteLine("GetCurWObjCoord {0:F3} {1:F3} {2:F3} {3:F3} {4:F3} {5:F3}",
57 wobjCoord.tran.x, wobjCoord.tran.y, wobjCoord.tran.z,
58 wobjCoord.rpy.rx, wobjCoord.rpy.ry, wobjCoord.rpy.rz);
59
60 // GetCurExToolCoord
61 rtn = robot.GetCurExToolCoord(ref extoolCoord);
62 Console.WriteLine("GetCurExToolCoord {0:F3} {1:F3} {2:F3} {3:F3} {4:F3} {5:F3}",
63 extoolCoord.tran.x, extoolCoord.tran.y, extoolCoord.tran.z,
64 extoolCoord.rpy.rx, extoolCoord.rpy.ry, extoolCoord.rpy.rz);
65
66 // GetCurExAxisCoord
67 rtn = robot.GetCurExAxisCoord(ref exAxisCoord);
68 Console.WriteLine("GetCurExAxisCoord {0:F3} {1:F3} {2:F3} {3:F3} {4:F3} {5:F3}",
69 exAxisCoord.tran.x, exAxisCoord.tran.y, exAxisCoord.tran.z,
70 exAxisCoord.rpy.rx, exAxisCoord.rpy.ry, exAxisCoord.rpy.rz);
71
72 // GetTargetPayload / GetTargetPayloadCog
73 double weightT = 0.0;
74 DescTran cogT = new DescTran(0, 0, 0);
75 robot.GetTargetPayload(0, ref weightT);
76 robot.GetTargetPayloadCog(0, ref cogT);
77 Console.WriteLine("GetTargetPayload {0:F3} {1:F3} {2:F3} {3:F3}",
78 weightT, cogT.x, cogT.y, cogT.z);
79
80 // SetToolCoord
81 DescPose coordSet = new DescPose(0, 1, 2, 3, 4, 5);
82 rtn = robot.SetToolCoord(1, coordSet, 0, 0, 1, 0);
83 Console.WriteLine("SetToolCoord(1) rtn={0}", rtn);
84
85 // SetWObjCoord
86 rtn = robot.SetWObjCoord(1, coordSet, 0);
87 Console.WriteLine("SetWObjCoord(1) rtn={0}", rtn);
88
89 // SetLoadWeight + SetLoadCoord
90 rtn = robot.SetLoadWeight(1, 1.3f);
91 Console.WriteLine("SetLoadWeight(1,1.3) rtn={0}", rtn);
92
93 DescTran loadCog = new DescTran(10, 20, 30);
94 rtn = robot.SetLoadCoord(1, loadCog);
95 Console.WriteLine("SetLoadCoord(1,10,20,30) rtn={0}", rtn);
96
97 // SetExToolCoord
98 DescPose etcp = new DescPose(0, 0, 100, 0, 0, 0);
99 DescPose etool = new DescPose(0, 0, 50, 0, 0, 0);
100 rtn = robot.SetExToolCoord(21, etcp, etool);
101 Console.WriteLine("SetExToolCoord(21) rtn={0}", rtn);
102 // SetExToolList
103 rtn = robot.SetExToolList(21, etcp, etool);
104 Console.WriteLine("SetExToolList(21) rtn={0}", rtn);
105
106 // ExtAxisActiveECoordSys
107 rtn = robot.ExtAxisActiveECoordSys(1, 1, coordSet, 1);
108 Console.WriteLine("ExtAxisActiveECoordSys(1,1,..,1) rtn={0}", rtn);
109
110 return 0;
111}