2. Data Structure Description
2.1. Joint position data type
1/**
2* @brief Joint position data type
3*/
4struct JointPos
5{
6 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
7 public double[] jPos; /* Six joint positions in deg */
8}
2.2. Cartesian space position data type
1/**
2* @brief Cartesian spatial position datatype.
3*/
4struct DescTran
5{
6 public double x; /* x-axis coordinate in mm */
7 public double y; /* y-axis coordinate in mm */
8 public double z; /* z-axis coordinate in mm */
9}
2.3. Euler Angle Attitude data type
1/**
2* @brief Euler Angle Attitude data type.
3*/
4struct Rpy
5{
6public double rx; /* Angle of rotation around fixed axis X in deg */
7public double ry; /* Angle of rotation around fixed axis Y in degrees */
8public double rz; /* Angle of rotation about fixed axis Z in degrees */
9}
2.4. Cartesian space position data type
1/**
2*@brief Cartesian space position type.
3*/
4struct DescPose
5{
6 public DescTran tran; /* Cartesian space position */
7 public Rpy rpy; /* Cartesian space pose */
8}
2.5. Extended axis position data type
1/**
2* @brief Extended axis position datatype.
3*/
4struct ExaxisPos
5{
6 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
7 public double[] ePos; /* Four extended axis positions in mm */
8}
2.6. Torque sensor data type
1/**
2* @brief Force components and moment components of a force sensor.
3*/
4struct ForceTorque
5{ public double fx; /* Force component along x-axis, in N */
6 public double fx; /* Force component along x-axis in N */
7 public double fy; /* Force component along y-axis in N */
8 public double fz; /* Component of force along z-axis in N */
9 public double tx; /* Component of moment around x-axis, unit Nm */
10 public double ty; /* Component of moment around y-axis, in Nm */
11 public double tz; /* Moment component around z-axis, in Nm */
12}
2.7. Helix parameter data type
1/**
2* @brief Spiral parameter data types
3*/
4public struct SpiralParam
5{
6 public int circle_num; /* Number of spiral turns */
7 public float circle_angle; /* Spiral inclination angle */
8 public float rad_init; /* Initial spiral radius, unit: mm */
9 public float rad_add; /* Radius increment */
10 public float rotaxis_add; /* Rotation axis direction increment */
11 public uint rot_direction; /* Rotation direction, 0-clockwise, 1-counterclockwise */
12 public int velAccMode; // Velocity/acceleration parameter mode: 0-constant angular velocity; 1-constant linear velocity
13
14 public SpiralParam(int num, float angle, float initRad, float addRad, float axisAdd, uint direction, int mode)
15 {
16 circle_num = num;
17 circle_angle = angle;
18 rad_init = initRad;
19 rad_add = addRad;
20 rotaxis_add = axisAdd;
21 rot_direction = direction;
22 velAccMode = mode;
23 }
24}
2.8. Extended axis state type
Changed in version C#SDK-v1.0.7.
1/**
2* @brief Extended axis state type
3*/
4[StructLayout(LayoutKind.Sequential, Pack = 1)]
5public struct ROBOT_AUX_STATE
6{
7 public byte servoId; // servo drive ID number
8 public int servoErrCode; //servo drive error code
9 public int servoState; //servo drive state
10 public double servoPos; //Servo current position
11 public float servoVel; //Servo current speed
12 public float servoTorque; //Servo current torque
13}
2.9. Welding interrupt status
1[StructLayout(LayoutKind.Sequential, Pack = 1)]
2public struct WELDING_BREAKOFF_STATE
3{
4 public byte breakOffState; // Welding interrupt status
5 public byte weldArcState; // Welding arc interrupted state
6}
2.10. Robot Status Feedback Structure Type
New in version C#SDK-V1.1.4: Web-3.8.3
1/**
2* @brief Robot status feedback structure type
3*/
4[StructLayout(LayoutKind.Sequential, Pack = 1)]
5public class ROBOT_STATE_PKG
6{
7 public UInt16 frame_head; // Frame header 0x5A5A
8 public byte frame_cnt; // Frame count
9 public UInt16 data_len; // Data length 5
10 public byte program_state; // Program running status, 1-stopped; 2-running; 3-paused;
11 public byte robot_state; // Robot motion status, 1-stopped; 2-running; 3-paused; 4-dragging
12 public int main_code; // Main fault code
13 public int sub_code; // Sub fault code
14 public byte robot_mode; // Robot mode, 1-manual mode; 0-automatic mode;
15
16 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
17 public double[] jt_cur_pos; // Current joint positions of 6 axes, unit deg
18 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
19 public double[] tl_cur_pos; // Current tool position
20 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
21 public double[] flange_cur_pos; // Current end flange position
22 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
23 public double[] actual_qd; // Current velocities of 6 joints, unit deg/s
24 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
25 public double[] actual_qdd; // Current accelerations of 6 joints, unit deg/s^2
26 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
27 public double[] target_TCP_CmpSpeed;// TCP composite command speed (position, orientation)
28 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
29 public double[] target_TCP_Speed; // TCP command speed
30 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
31 public double[] actual_TCP_CmpSpeed;// TCP composite actual speed
32 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
33 public double[] actual_TCP_Speed; // TCP actual speed
34 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
35 public double[] jt_cur_tor; // Current torques of 6 axes, unit N·m
36
37 public int tool; // Applied tool coordinate system number
38 public int user; // Applied workpiece coordinate system number
39 public byte cl_dgt_output_h; // Control box digital IO output 15-8
40 public byte cl_dgt_output_l; // Control box digital IO output 7-0
41 public byte tl_dgt_output_l; // Tool digital IO output 7-0, only bit0-bit1 valid
42 public byte cl_dgt_input_h; // Control box digital IO input 15-8
43 public byte cl_dgt_input_l; // Control box digital IO input 7-0
44 public byte tl_dgt_input_l; // Tool digital IO input 7-0, only bit0-bit1 valid
45
46 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
47 public UInt16[] cl_analog_input; // Control box analog input
48 public UInt16 tl_anglog_input; // Tool analog input
49
50 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
51 public double[] ft_sensor_raw_data; // Force/torque sensor raw data
52 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
53 public double[] ft_sensor_data; // Force/torque sensor data
54 public byte ft_sensor_active; // Force/torque sensor activation status, 0-reset, 1-activated
55
56 public byte EmergencyStop; // Emergency stop flag, 0-not pressed, 1-pressed
57 public int motion_done; // Motion completion signal, 1-completed, 0-not completed
58 public byte gripper_motiondone; // Gripper motion completion signal, 1-completed, 0-not completed
59 public int mc_queue_len; // Motion command queue length
60 public byte collisionState; // Collision detection, 1-collision, 0-no collision
61 public int trajectory_pnum; // Trajectory point number
62 public byte safety_stop0_state; // Safety stop signal SI0
63 public byte safety_stop1_state; // Safety stop signal SI1
64 public byte gripper_fault_id; // Faulty gripper number
65 public UInt16 gripper_fault; /* Gripper fault */
66 public UInt16 gripper_active; /* Gripper activation status */
67 public byte gripper_position; // Gripper position
68 public byte gripper_speed; /* Gripper speed */
69 public byte gripper_current; /* Gripper current */
70 public int gripper_temp; // Gripper temperature
71 public int gripper_voltage; // Gripper voltage
72
73 public ROBOT_AUX_STATE auxState; // 485 extension axis status
74
75 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
76 public EXT_AXIS_STATUS[] extAxisStatus; // UDP extension axis status
77
78 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
79 public UInt16[] extDIState; // Extension DI input
80 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
81 public UInt16[] extDOState; // Extension DO output
82 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
83 public UInt16[] extAIState; // Extension AI input
84 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
85 public UInt16[] extAOState; // Extension AO output
86
87 public int rbtEnableState; // Robot enable status
88
89 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
90 public double[] jointDriverTorque; // Robot joint driver torque
91 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
92 public double[] jointDriverTemperature; // Robot joint driver temperature
93
94 public ROBOT_TIME robotTime; // Robot system time
95 public int softwareUpgradeState; // Robot software upgrade status
96 public UInt16 endLuaErrCode; // End Lua running status
97
98 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
99 public UInt16[] cl_analog_output; // Control box analog output
100 public UInt16 tl_analog_output; // Tool analog output
101
102 public float gripperRotNum; // Current rotation count of rotating gripper
103 public byte gripperRotSpeed; // Current rotation speed percentage of rotating gripper
104 public byte gripperRotTorque; // Current rotation torque percentage of rotating gripper
105
106 public WELDING_BREAKOFF_STATE weldingBreakOffState; // Welding interruption status
107
108 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
109 public double[] jt_tgt_tor; // Joint command torque
110 public int smartToolState; // SmartTool handle button status
111 public float wideVoltageCtrlBoxTemp; // Wide voltage control box temperature
112 public UInt16 wideVoltageCtrlBoxFanVel; // Wide voltage control box fan current (mA)
113
114 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
115 public double[] toolCoord; // Current tool coordinate system values; x,y,z,rx,ry,rz
116 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
117 public double[] wobjCoord; // Current workpiece coordinate system values; x,y,z,rx,ry,rz
118 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
119 public double[] extoolCoord; // Current external tool coordinate system values; x,y,z,rx,ry,rz
120 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
121 public double[] exAxisCoord; // Current extension axis coordinate system values; x,y,z,rx,ry,rz
122
123 public double load; // Load mass
124 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
125 public double[] loadCog; // Load center of gravity
126 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
127 public double[] lastServoTarget; // Last ServoJ target position in the queue
128 public int servoJCmdNum; // ServoJ command count
129
130 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
131 public double[] targetJointPos; // 6 joints command position, unit °
132 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
133 public double[] targetJointVel; // 6 joints command velocity, unit °/s
134 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
135 public double[] targetJointAcc; // 6 joints command acceleration, unit °/s²
136 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
137 public double[] targetJointCurrent; // 6 joints command current, unit A
138 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
139 public double[] actualJointCurrent; // 6 joints current current, unit A
140 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
141 public double[] actualTCPForce; // Robot end-effector torque Nm; x,y,z,rx,ry,rz
142 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
143 public double[] targetTCPPos; // Robot TCP command position mm; x,y,z,rx,ry,rz
144 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
145 public byte[] collisionLevel; // Robot collision level
146
147 public double speedScaleManual; // Manual mode global speed percentage
148 public double speedScaleAuto; // Automatic mode global speed percentage
149 public int luaLineNum; // Current Lua program running line number
150 public byte abnomalStop; // 0-no abnormality; 1-abnormality present
151
152 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
153 public byte[] currentLuaFileName; // Name of currently running Lua program
154 public byte programTotalLine; // Total lines of Lua program
155 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
156 public byte[] safetyBoxSingal; // Robot button box button status
157
158 public double weldVoltage; // Welding voltage V
159 public double weldCurrent; // Welding current
160 public double weldTrackVel; // Seam tracking speed mm/s
161
162 public byte tpdException; // TPD trajectory load count exceeded, 0-not exceeded, 1-exceeded
163 public byte alarmRebootRobot; // Warning, 1-release emergency stop button and power cycle the control box, 2-joint communication abnormality, power cycle the control box
164 public byte modbusMasterConnect; // bit0-bit7 correspond to ModbusTCP master 0-7 connection status 0-not connected 1-connected
165 public byte modbusSlaveConnect; // ModbusTCP slave connection status 0-not connected; 1-connected
166 public byte btnBoxStopSignal; // Button box emergency stop signal, 0-emergency stop released; 1-emergency stop pressed
167 public byte dragAlarm; // Drag warning, currently in automatic mode, 0-no alarm, 1-alarm, 2-position feedback abnormality, no switching
168 public byte safetyDoorAlarm; // Safety door warning; 0-safety door closed; 1-safety door open
169 public byte safetyPlaneAlarm; // Entering safety wall warning; 0-not entering safety wall; 1-entered safety wall
170 public byte motonAlarm; // Motion warning
171 public byte interfaceAlarm; // Entering interference area warning
172 public int udpCmdState; // Port 20007 UDP communication connection status
173 public byte weldReadyState; // Welder ready status
174 public byte alarmCheckEmergStopBtn; // 0-normal; 1-communication abnormality, check if emergency stop button is released
175 public byte tsTmCmdComError; // 0-normal; 1-torque command communication failure
176 public byte tsTmStateComError; // 0-normal; 1-torque status communication failure
177 public int ctrlBoxError; // Control box error
178 public byte safetyDataState; // Safety data status flag, 0-normal, 1-abnormal
179 public byte forceSensorErrState; // Force sensor connection timeout fault; bit0-bit1 correspond to force sensor ID1-ID2
180
181 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
182 public byte[] ctrlOpenLuaErrCode; // 4 controller peripheral protocol error codes (500 error code)
183
184 public byte strangePosFlag; // Currently in singular posture flag; 0-normal; 1-singular posture
185 public byte alarm; // Warning
186 public byte driverAlarm; // Driver alarm axis number
187 public byte aliveSlaveNumError; // Active slave count error, 0: normal; 1: count error
188
189 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
190 public byte[] slaveComError; // Slave error, 0: normal; 1: slave offline; 2: slave status inconsistent with set value; 3: slave not configured; 4: slave configuration error; 5: slave initialization error; 6: slave mailbox communication initialization error
191
192 public byte cmdPointError; // Command point error
193 public byte IOError; // IO error
194 public byte gripperError; // Gripper error
195 public byte fileError; // File error
196 public byte paraError; // Parameter error
197 public byte exaxisOutLimitError; // External axis soft limit exceeded error
198
199 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
200 public byte[] driverComError; // Driver communication fault
201 public byte driverError; // Driver communication fault axis number
202 public byte outSoftLimitError; // Soft limit exceeded fault
203
204 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)]
205 public byte[] axleGenComData; // Robot end-effector transparent transmission feedback data
206
207 public byte socketConnTimeout; // Socket connection timeout flag
208 public byte socketReadTimeout; // Socket read timeout flag
209 public byte tsWebStateComErr; // ts_web_state_com_err
210
211 public UInt16 check_sum; /* Checksum */
212
213 // Constructor: initialize all array fields
214 public ROBOT_STATE_PKG()
215 {
216 jt_cur_pos = new double[6];
217 tl_cur_pos = new double[6];
218 flange_cur_pos = new double[6];
219 actual_qd = new double[6];
220 actual_qdd = new double[6];
221 target_TCP_CmpSpeed = new double[2];
222 target_TCP_Speed = new double[6];
223 actual_TCP_CmpSpeed = new double[2];
224 actual_TCP_Speed = new double[6];
225 jt_cur_tor = new double[6];
226 cl_analog_input = new ushort[2];
227 ft_sensor_raw_data = new double[6];
228 ft_sensor_data = new double[6];
229 extAxisStatus = new EXT_AXIS_STATUS[4];
230 extDIState = new ushort[8];
231 extDOState = new ushort[8];
232 extAIState = new ushort[4];
233 extAOState = new ushort[4];
234 jointDriverTorque = new double[6];
235 jointDriverTemperature = new double[6];
236 cl_analog_output = new ushort[2];
237 jt_tgt_tor = new double[6];
238 toolCoord = new double[6];
239 wobjCoord = new double[6];
240 extoolCoord = new double[6];
241 exAxisCoord = new double[6];
242 loadCog = new double[3];
243 lastServoTarget = new double[6];
244 targetJointPos = new double[6];
245 targetJointVel = new double[6];
246 targetJointAcc = new double[6];
247 targetJointCurrent = new double[6];
248 actualJointCurrent = new double[6];
249 actualTCPForce = new double[6];
250 targetTCPPos = new double[6];
251 collisionLevel = new byte[6];
252 currentLuaFileName = new byte[256];
253 safetyBoxSingal = new byte[6];
254 ctrlOpenLuaErrCode = new byte[4];
255 slaveComError = new byte[8];
256 driverComError = new byte[6];
257 axleGenComData = new byte[130];
258 }
259}
2.11. Robot Configurable Status Enumeration
1/**
2* @brief Robot configurable status enumeration, range 3~131
3*/
4public enum RobotState
5{
6 ProgramState = 3,
7 RobotState = 4,
8 MainCode = 5,
9 SubCode = 6,
10 RobotMode = 7,
11 JointCurPos = 8,
12 ToolCurPos = 9,
13 FlangeCurPos = 10,
14 ActualJointVel = 11,
15 ActualJointAcc = 12,
16 TargetTCPCmpSpeed = 13,
17 TargetTCPSpeed = 14,
18 ActualTCPCmpSpeed = 15,
19 ActualTCPSpeed = 16,
20 ActualJointTorque = 17,
21 Tool = 18,
22 User = 19,
23 ClDgtOutputH = 20,
24 ClDgtOutputL = 21,
25 TlDgtOutputL = 22,
26 ClDgtInputH = 23,
27 ClDgtInputL = 24,
28 TlDgtInputL = 25,
29 ClAnalogInput = 26,
30 TlAnglogInput = 27,
31 FtSensorRawData = 28,
32 FtSensorData = 29,
33 FtSensorActive = 30,
34 EmergencyStop = 31,
35 MotionDone = 32,
36 GripperMotiondone = 33,
37 McQueueLen = 34,
38 CollisionState = 35,
39 TrajectoryPnum = 36,
40 SafetyStop0State = 37,
41 SafetyStop1State = 38,
42 GripperFaultId = 39,
43 GripperFault = 40,
44 GripperActive = 41,
45 GripperPosition = 42,
46 GripperSpeed = 43,
47 GripperCurrent = 44,
48 GripperTemp = 45,
49 GripperVoltage = 46,
50 AuxState = 47,
51 ExtAxisStatus = 48,
52 ExtDIState = 49,
53 ExtDOState = 50,
54 ExtAIState = 51,
55 ExtAOState = 52,
56 RbtEnableState = 53,
57 JointDriverTorque = 54,
58 JointDriverTemperature = 55,
59 RobotTime = 56,
60 SoftwareUpgradeState = 57,
61 EndLuaErrCode = 58,
62 ClAnalogOutput = 59,
63 TlAnalogOutput = 60,
64 GripperRotNum = 61,
65 GripperRotSpeed = 62,
66 GripperRotTorque = 63,
67 WeldingBreakOffState = 64,
68 TargetJointTorque = 65,
69 SmartToolState = 66,
70 WideVoltageCtrlBoxTemp = 67,
71 WideVoltageCtrlBoxFanCurrent = 68,
72 ToolCoord = 69,
73 WobjCoord = 70,
74 ExtoolCoord = 71,
75 ExAxisCoord = 72,
76 Load = 73,
77 LoadCog = 74,
78 LastServoTarget = 75,
79 ServoJCmdNum = 76,
80 TargetJointPos = 77,
81 TargetJointVel = 78,
82 TargetJointAcc = 79,
83 TargetJointCurrent = 80,
84 ActualJointCurrent = 81,
85 ActualTCPForce = 82,
86 TargetTCPPos = 83,
87 CollisionLevel = 84,
88 SpeedScaleManual = 85,
89 SpeedScaleAuto = 86,
90 LuaLineNum = 87,
91 AbnomalStop = 88,
92 CurrentLuaFileName = 89,
93 ProgramTotalLine = 90,
94 SafetyBoxSingal = 91,
95 WeldVoltage = 92,
96 WeldCurrent = 93,
97 WeldTrackVel = 94,
98 TpdException = 95,
99 AlarmRebootRobot = 96,
100 ModbusMasterConnect = 97,
101 ModbusSlaveConnect = 98,
102 BtnBoxStopSignal = 99,
103 DragAlarm = 100,
104 SafetyDoorAlarm = 101,
105 SafetyPlaneAlarm = 102,
106 MotonAlarm = 103,
107 InterfaceAlarm = 104,
108 UdpCmdState = 105,
109 WeldReadyState = 106,
110 AlarmCheckEmergStopBtn = 107,
111 TsTmCmdComError = 108,
112 TsTmStateComError = 109,
113 CtrlBoxError = 110,
114 SafetyDataState = 111,
115 ForceSensorErrState = 112,
116 CtrlOpenLuaErrCode = 113,
117 StrangePosFlag = 114,
118 Alarm = 115,
119 DriverAlarm = 116,
120 AliveSlaveNumError = 117,
121 SlaveComError = 118,
122 CmdPointError = 119,
123 IOError = 120,
124 GripperError = 121,
125 FileError = 122,
126 ParaError = 123,
127 ExaxisOutLimitError = 124,
128 DriverComError = 125,
129 DriverError = 126,
130 OutSoftLimitError = 127,
131 AxleGenComData = 128,
132 SocketConnTimeout = 129, // Socket connection timeout, bit0-bit4: socketID 1-4
133 SocketReadTimeout = 130, // Socket read timeout, bit0-bit4: socketID 1-4
134 TsWebStateComErr = 131 // Web-torque communication failure; 0-normal; 1-failed
135}