# UR3 TCP/IP communication protocol

I'm currently programming a C socket for communicating via (Ethernet) TCP/IP with an UR3 robot which control software is version 3.3. I'm able to get raw data from the ports 30001,30002, and 30003. I can deserialize the data thanks to the source of a ROS driver. But I wish to have more information about deserialization, and Universal Robots seems to not provide such information. Do anybody knows where to get info about the TCP packets that the robot sends?

• Further detail might help to answer the question. Do you have a real-time application? what is the cycle time? Do you use URScript via ethernet or Modbus? – 50k4 Nov 28 '16 at 11:02

Based on the ports you have mentioned you are probably using URScript. Are you aware of this documentation from the UR website, describing the ethernet packets?

The example given is

Lets say the client has recieved this data:

Bytes: [0] [0] [1] [209] [16] [0] [0] [0] [29] [0] [0] [0] [0] [0] [0] [5] [7] [246] [1] [1] [1] [0] [0] [0] [0] [0] [63] [240] [0] [0] [0] [0] [0] [0] [0] [0]
[0] [251] [1] [64] [1] [78] [244] [77] [189] [249] [149] [64] [1] [78] [247] [89] [95] [104] [85] [0] [0] [0] [0] [0] [0] [0] [0] [188] [220] [97] [3] [66] [62]
[0] [0] [66] [0] [102] [103] [66] [99] [153] [154] [253] [191] [246] [74] [170] [216] [242] [29] [102] [191] [246] [74] [178] [44] [92] [72] [137] [0] [0] [0] [0]
[0] [0] [0] [0] [192] [1] [106] [78] [66] [63] [153] [154] [66] [4] [204] [205] [66] [104] [0] [0] [253] [63] [253] [49] [202] [91] [202] [8] [64] [63] [253] [49]
[210] [233] [51] [16] [35] [0] [0] [0] [0] [0] [0] [0] [0] [191] [155] [135] [34] [66] [62] [0] [0] [65] [249] [153] [154] [66] [100] [0] [0] [253] [191] [220] [115]
[204] [104] [205] [239] [254] [191] [220] [118] [68] [109] [49] [34] [158] [0] [0] [0] [0] [0] [0] [0] [0] [190] [60] [245] [109] [66] [63] [153] [154] [66] [25] [51]
[51] [66] [116] [204] [205] [253] [63] [242] [146] [224] [105] [231] [66] [209] [63] [242] [146] [65] [3] [193] [196] [156] [0] [0] [0] [0] [0] [0] [0] [0] [190] [115]
[157] [190] [66] [62] [0] [0] [66] [21] [51] [51] [66] [119] [153] [154] [253] [191] [231] [207] [8] [215] [85] [22] [88] [191] [231] [206] [77] [130] [151] [190] [17]
[191] [146] [242] [158] [148] [114] [240] [57] [188] [224] [224] [96] [66] [68] [102] [103] [66] [37] [153] [154] [66] [127] [153] [154] [253] [0] [0] [0] [53] [4] [63]
[217] [153] [52] [224] [36] [238] [93] [191] [217] [153] [169] [67] [241] [211] [23] [63] [207] [255] [137] [8] [22] [253] [198] [63] [240] [0] [170] [111] [207] [54]
[176] [63] [243] [51] [88] [137] [58] [151] [217] [63] [201] [148] [119] [151] [70] [237] [237] [0] [0] [0] [29] [5] [64] [143] [64] [0] [0] [0] [0] [0] [64] [143] [64]
[0] [0] [0] [0] [0] [64] [143] [64] [0] [0] [0] [0] [0] [0] [0] [0] [61] [3] [0] [63] [0] [0] [0] [0] [63] [123] [129] [184] [27] [129] [184] [28] [63] [112] [225]
[14] [16] [225] [14] [17] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [0] [66] [87] [51] [51] [66] [66] [0] [0] [62] [35] [215] [11] [61]
[241] [169] [253] [0] [0] [0] [37] [2] [0] [0] [63] [141] [83] [47] [180] [171] [196] [232] [63] [137] [46] [99] [102] [69] [149] [155] [66] [55] [51] [51] [0] [59]
[68] [155] [166] [66] [92] [0] [0] [253] [0]

So to start from the beginning:

[0],[0],[1],[209]: Length is 1*256+209 = 465

[16] Package type is "Robot State"

[0][0][0][29] First package length is 29

[0] Package type is 0: "Robot Mode Data"

[0] [0] [0] [0] [0] [5] [7] [246] Timestamp is 329718

[1] isRobotConnected True

[1] isRealRobotEnabled True

[1] isPowerOnRobot True

[0] isEmergencyStopped False

[0] isSecurityStopped False

[0] isProgramRunning False

[0] isProgrampaused False

[0] robot mode is 0

[63] [240] [0] [0] [0] [0] [0] [0] Speed fraction as a double                       see     http://en.wikipedia.org/wiki/Double-precision_floating-point_format                             , network byte order

[0] [0] [0] [251] Second package length is 251

[1] Second package type is "joint data"

[64] [1] [78][244] [77] [189] [249] [149] Joint 0 position

[64] [1] [78] [247] [89] [95] [104] [85] Joint 0 target position

[0] [0] [0] [0] [0] [0] [0] [0] Joint 0 target speed

[188] [220] [97] [3] Joint 0 current

[66] [62] [0] [0] Joint 0 voltage

[66] [0] [102] [103]  Joint 0 motor temperature

[66] [99] [153] [154] Joint 0 microprocessor temperature

[253] Joint 0 joint mode

[191] [246] [74] [170] [216] [242] [29] [102] Joint 1 position