ur-sock 0.3 → 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 22f897ede8181850bb4bcf8074fb6147b8d06bb5618b566b9becb111fc4231ac
4
- data.tar.gz: 4dea79150693e0c196975f203b6fb08f696d0477410d4ea68084a5f3d50976ad
3
+ metadata.gz: 77f86804b68a66dbe0f5c547004d2bb58e0a84385a8f57d4b0dab4c60d7b1baf
4
+ data.tar.gz: d96c731d006689f1dd80f3052e84084d3219964e8670a9f40afaac97f38710bb
5
5
  SHA512:
6
- metadata.gz: 9933643d022f7f939a9e10bdc42218015dde6dabf7826608cab685387ae00eb1740dcb3d493fd64c1444c2b0413ce20accd2140e43eed1442241c8193c111562
7
- data.tar.gz: e54083279f2cea25d2f843037b0efde6bc51f972ce6b4fde0d9a957c6b0a9a278c080140736b7c63a4b62650a2898410c162b69a9f1324faaae450ae0216fc92
6
+ metadata.gz: e48eadd3e4f07cd3fab23c3c77e397ed7ed91ca350251683944552a8759b1086487c4e4933bb5aaa068b4949b54ff69379f64d72cb39accdcb1c5086bc7254ac
7
+ data.tar.gz: c770cbc905113eac5fa35ec8f658ee215f24ea5076e85aa4520a12e2aa88eb893ff79d4f53a84380d769abf98859009de462f932a10466a00e4d9ad70f59e22c
data/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  Universal robot interface implementation in ruby. This library provides functions using different interfaces of the universal robot. Primary this was designed for the new e-series.
4
4
 
5
+ ## Requirements
6
+
7
+ This software requires URControl version newer than 5.1.
8
+ Latest supported URControl vresion: 5.5
9
+
5
10
  ## Getting Started
6
11
 
7
12
  This library uses 3 interfaces of the universal robot:
@@ -79,7 +84,7 @@ Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c6
79
84
  * **Florian Pauker**
80
85
  * **Jürgen Mangler**
81
86
 
82
- See also the list of [contributors](https://intra.acdp.at/gogs/fpauker/ua4ur/contributors) who participated in this project.
87
+ See also the list of [contributors](https://github.com/fpauker/ua4ur/contributors) who participated in this project.
83
88
 
84
89
  ## License
85
90
 
@@ -6,23 +6,43 @@ require 'uri'
6
6
  module UR
7
7
 
8
8
  class Dash
9
+ class Reconnect < Exception; end
10
+
9
11
  module ConnectionState
10
- DISCONNECTED = 0
11
- CONNECTED = 1
12
- STARTED = 2
13
- PAUSED = 3
12
+ DISCONNECTED = 'DISCONNECTED'
13
+ CONNECTED = 'CONNECTED'
14
+ STARTED = 'STARTED'
15
+ PAUSED = 'PAUSED'
16
+ end
17
+
18
+ module ProgramState
19
+ STOPPED = 'STOPPED'
20
+ PLAYING ='PLAYING'
21
+ PAUSED = 'PAUSED'
22
+ end
23
+
24
+ module SafetyMode
25
+ NORMAL = "NORMAL"
26
+ REDUCED = "REDUCED"
27
+ PROTECTIVE_STOP = "PROTECTIVE_STOP"
28
+ RECOVERY = "RECOVERY"
29
+ SAFEGUARD_STOP = "SAFEGUARD_STOP"
30
+ SYSTEM_EMERGENCY_STOP = "SYSTEM_EMERGENCY_STOP"
31
+ ROBOT_EMERGENCY_STOP = "ROBOT_EMERGENCY_STOP"
32
+ VIOLATION = "VIOLATION"
33
+ FAULT = "FAULT"
14
34
  end
15
35
 
16
36
  module ProgramState
17
- NO_CONTROLLER = "NO_CONTROLLER"
18
- DISCONNECTED = "DISCONNECTED"
19
- CONFIRM_SAFETY = "CONFIRM_SAFETY"
20
- BOOTING = "BOOTING"
21
- POWER_OFF = "POWER_OFF"
22
- POWER_ON = "POWER_ON"
23
- IDLE = "IDLE"
24
- BACKDRIVE = "BACKDRIVE"
25
- RUNNING = "RUNNING"
37
+ NO_CONTROLLER = 'NO_CONTROLLER'
38
+ DISCONNECTED = 'DISCONNECTED'
39
+ CONFIRM_SAFETY = 'CONFIRM_SAFETY'
40
+ BOOTING = 'BOOTING'
41
+ POWER_OFF = 'POWER_OFF'
42
+ POWER_ON = 'POWER_ON'
43
+ IDLE = 'IDLE'
44
+ BACKDRIVE = 'BACKDRIVE'
45
+ RUNNING = 'RUNNING'
26
46
  end
27
47
 
28
48
  def initialize(host, logger=Logger.new(STDOUT,level: :INFO))
@@ -58,84 +78,330 @@ module UR
58
78
  end
59
79
  end
60
80
 
81
+ def load_program (programname)
82
+ @logger.debug "loadprogram"
83
+ send = "load " + programname + ".urp\n"
84
+ @sock.write send
85
+ line = @sock.gets.strip
86
+ if line.match(/^L/)
87
+ @logger.debug line
88
+ true
89
+ else
90
+ @logger.error line
91
+ raise UR::Dash::Reconnect.new('Dashboard server down or not in Remote Mode')
92
+ end
93
+ end
94
+
61
95
  def start_program
62
96
  @sock.write("play\n")
63
97
  line = @sock.gets.strip
64
98
  if line == "Starting program"
65
- @logger.info line
99
+ @logger.debug line
100
+ true
66
101
  else
67
102
  @logger.error line
103
+ raise UR::Dash::Reconnect.new('Dashboard server down or not in Remote Mode')
68
104
  end
69
105
  end
70
106
 
71
- def power_off
72
- @sock.write("power off\n")
73
- @logger.info @sock.gets.strip
107
+ def stop_program
108
+ @sock.write("stop\n")
109
+ line = @sock.gets.strip
110
+ if line == "Stopped"
111
+ @logger.debug line
112
+ true
113
+ else
114
+ @logger.error line
115
+ raise UR::Dash::Reconnect.new('Dashboard server down or not in Remote Mode')
116
+ end
74
117
  end
75
118
 
76
- def power_on
77
- @sock.write("power on\n")
78
- @logger.info @sock.gets.strip
119
+ def pause_program
120
+ @sock.write("pause\n")
121
+ line = @sock.gets.strip
122
+ if line == "Pausing program"
123
+ @logger.debug line
124
+ true
125
+ else
126
+ @logger.error line
127
+ raise UR::Dash::Reconnect.new('Dashboard server down or not in Remote Mode')
128
+ end
79
129
  end
80
130
 
81
- def break_release
82
- @sock.write("brake release\n")
83
- @logger.info @sock.gets.strip
131
+ def shutdown
132
+ @sock.write("shutdown\n")
133
+ line = @sock.gets.strip
134
+ if line == "Shutting down"
135
+ @logger.debug line
136
+ true
137
+ else
138
+ @logger.error line
139
+ raise UR::Dash::Reconnect.new('Dashboard server down or not in Remote Mode')
140
+ end
141
+ end
142
+
143
+ def running?
144
+ @sock.write("running\n")
145
+ line = @sock.gets.strip
146
+ if line == "Program running: True"
147
+ @logger.debug line
148
+ true
149
+ else
150
+ @logger.error line
151
+ raise UR::Dash::Reconnect.new('Dashboard server down or not in Remote Mode')
152
+ end
153
+ end
154
+
155
+ def get_robotmode
156
+ @sock.write("robotmode\n")
157
+ line = @sock.gets.strip
158
+ @logger.debug line
159
+ result = $1.strip if line.match(/^Robotmode:\s(.+)/)
160
+ end
161
+
162
+ def get_loaded_program
163
+ begin
164
+ @sock.write ("get loaded program\n")
165
+ line = @sock.gets.strip
166
+ rescue
167
+ raise UR::Dash::Reconnect.new('Loaded program can not be got. Dashboard server down or not in Remote Mode')
168
+ end
169
+ @logger.debug line
170
+ if line.match(/^Loaded program:\s(.+)/)
171
+ $1.strip
172
+ elsif line.match(/^No program loaded/)
173
+ nil
174
+ else
175
+ raise UR::Dash::Reconnect.new('Loaded program can not be got. Dashboard server down or not in Remote Mode')
176
+ end
177
+ end
178
+
179
+ def open_popupmessage(message)
180
+ @sock.write ("popup " + message.to_s + "\n")
181
+ @logger.debug @sock.gets.strip
182
+ end
183
+
184
+ def close_popupmessage
185
+ @sock.write ("close popup\n")
186
+ @logger.debug @sock.gets.strip
187
+ end
188
+
189
+ def add_to_log(message)
190
+ @sock.write ("addToLog " + message.to_s + "\n")
191
+ line = @sock.gets.strip
192
+ if line.match(/^Added log message/)
193
+ @logger.debug line
194
+ else
195
+ @logger.error line
196
+ raise UR::Dash::Reconnect.new('Dashboard server down or not in Remote Mode')
197
+ end
198
+ end
199
+
200
+ def is_program_saved?
201
+ @sock.write("isProgramSaved\n")
202
+ line = @sock.gets.strip
203
+ if line == "True"
204
+ @logger.debug line
205
+ true
206
+ else
207
+ @logger.error line
208
+ raise UR::Dash::Reconnect.new('Cant determine if program is saved. Dashboard server down or not in Remote Mode')
209
+ end
210
+ end
211
+
212
+ def get_program_state
213
+ @sock.write("programState\n")
214
+ line = @sock.gets.strip
215
+ @logger.debug line
216
+ line
217
+ end
218
+
219
+ def get_polyscope_version
220
+ @sock.write("PolyscopeVersion\n")
221
+ line = @sock.gets.strip
222
+ @logger.debug line
223
+ line
224
+ end
225
+
226
+ def set_operation_mode_manual
227
+ @sock.write("set operational mode manual\n")
228
+ line = @sock.gets.strip
229
+ if line.match(/^S/)
230
+ @logger.debug line
231
+ else
232
+ @logger.error line
233
+ raise UR::Dash::Reconnect.new('Cant set operation mode manual. Dashboard server down or not in Remote Mode')
234
+ end
84
235
  end
85
236
 
86
237
  def set_operation_mode_auto
87
- @sock.write("set operational mode automatic\n") #, where manual is
88
- @logger.info @sock.gets.strip
238
+ @sock.write("set operational mode automatic\n")
239
+ line = @sock.gets.strip
240
+ if line.match(/^S/)
241
+ @logger.debug line
242
+ else
243
+ @logger.error line
244
+ raise UR::Dash::Reconnect.new('Cant set operation mode automatic. Dashboard server down or not in Remote Mode')
245
+ end
89
246
  end
90
247
 
91
248
  def clear_operation_mode
249
+ @sock.write("clear operational mode\n")
250
+ line = @sock.gets.strip
251
+ if line.match(/^operational/)
252
+ @logger.debug line
253
+ true
254
+ else
255
+ @logger.error line
256
+ raise UR::Dash::Reconnect.new('Cant clear operation mode. Dashboard server down or not in Remote Mode')
257
+ end
258
+ end
92
259
 
93
- @sock.write("clear operational mode\n") #, where manual is
94
- @logger.info @sock.gets.strip
260
+ def power_on
261
+ @sock.write("power on\n")
262
+ line = @sock.gets.strip
263
+ if line.match(/^Powering/)
264
+ @logger.debug line
265
+ true
266
+ else
267
+ @logger.error line
268
+ raise UR::Dash::Reconnect.new('Cant power on. Dashboard server down or not in Remote Mode')
269
+ end
95
270
  end
96
271
 
97
- def popupmessage(message)
98
- @sock.write ("popup " + message.to_s + "\n")
99
- @logger.info @sock.gets.strip
272
+ def power_off
273
+ @sock.write("power off\n")
274
+ line = @sock.gets.strip
275
+ if line.match(/^Powering/)
276
+ @logger.debug line
277
+ true
278
+ else
279
+ @logger.error line
280
+ raise UR::Dash::Reconnect.new('Cant power off. Dashboard server down or not in Remote Mode')
281
+ end
100
282
  end
101
- def pause_program
102
- @sock.write("pause\n")
103
- @logger.info "paused program"
104
- @logger.info @sock.gets.strip
283
+
284
+ def break_release
285
+ @sock.write("brake release\n")
286
+ line = @sock.gets.strip
287
+ if line.match(/^Brake/)
288
+ @logger.debug line
289
+ true
290
+ else
291
+ @logger.error line
292
+ raise UR::Dash::Reconnect.new('Cant release breaks. Dashboard server down or not in Remote Mode')
293
+ end
105
294
  end
106
295
 
107
- def stop_program
108
- @sock.write("stop\n")
109
- @logger.info "stopped program"
110
- @logger.info @sock.gets.strip
296
+ def get_safety_mode
297
+ @sock.write("safetymode\n")
298
+ line = @sock.gets.strip
299
+ @logger.debug line
300
+ result = $1.strip if line.match(/^Safetymode:\s(.+)/)
111
301
  end
112
302
 
113
- def get_robotmode
114
- @sock.write("robotmode\n")
303
+ def unlock_protective_stop
304
+ @sock.write("unlock protective stop\n")
115
305
  line = @sock.gets.strip
116
- @logger.info line
117
- result = $1.strip if line.match(/^Robotmode:\s(.+)/)
306
+ if line.match(/^Protective/)
307
+ @logger.debug line
308
+ true
309
+ else
310
+ @logger.error line
311
+ raise UR::Dash::Reconnect.new('Cant unlock protective stop. Dashboard server down or not in Remote Mode')
312
+ end
118
313
  end
119
314
 
120
- def get_loaded_program
121
- @sock.write ("get loaded program\n")
315
+ def close_safety_popup
316
+ @sock.write("close safety popup\n")
122
317
  line = @sock.gets.strip
123
- @logger.info line
124
- path = $1.strip if line.match(/^Loaded program:\s(.+)/)
318
+ if line.match(/^closing/)
319
+ @logger.debug line
320
+ true
321
+ else
322
+ @logger.error line
323
+ raise UR::Dash::Reconnect.new('Cant close safety popup. Dashboard server down or not in Remote Mode')
324
+ end
125
325
  end
126
326
 
127
- def load_program (programname)
128
- @logger.info "loadprogram"
129
- send = "load " + programname + ".urp\n"
130
- puts send
131
- @sock.write (send)
327
+ def load_installation
328
+ @sock.write("load installation\n")
132
329
  line = @sock.gets.strip
133
- @logger.info line
330
+ if line.match(/^Loading/)
331
+ @logger.debug line
332
+ true
333
+ else
334
+ @logger.error line
335
+ raise UR::Dash::Reconnect.new('Cant load installation. Dashboard server down or not in Remote Mode')
336
+ end
134
337
  end
135
338
 
136
- def get_program_state
339
+ def restart_safety
340
+ @sock.write("restart safety\n")
341
+ line = @sock.gets.strip
342
+ if line.match(/^Brake/)
343
+ @logger.debug line
344
+ true
345
+ elsif line.match(/^could not understand/)
346
+ @logger.warn'Could not execute restart_safety: Please upgrade to current version'
347
+ line
348
+ else
349
+ @logger.error line
350
+ raise UR::Dash::Reconnect.new('Cant restart safety. Dashboard server down or not in Remote Mode')
351
+ end
352
+ end
137
353
 
354
+ def get_operational_mode
355
+ @sock.write("get operational mode\n")
356
+ line = @sock.gets.strip
357
+ if line == "MANUAL" || line == "AUTOMATIC"
358
+ @logger.debug line
359
+ line
360
+ elsif line == "NONE"
361
+ @logger.warn'No password set, so no modes variable is available'
362
+ elsif line.match(/^could not understand/)
363
+ @logger.warn'Could not execute get_operational_mode: Please upgrade to current version'
364
+ line
365
+ else
366
+ @logger.error line
367
+ raise UR::Dash::Reconnect.new('Cant restart safety. Dashboard server down or not in Remote Mode')
368
+ end
369
+ end
370
+
371
+ def is_in_remote_control
372
+ @sock.write("is in remote control\n")
373
+ line = @sock.gets.strip
374
+ if line.match(/^could not understand/)
375
+ @logger.warn'Could not execute is_in_remote_control: Please upgrade to current version'
376
+ line
377
+ else
378
+ @logger.debug line
379
+ line
380
+ end
138
381
  end
139
- end
140
382
 
383
+ def get_serial_number
384
+ @sock.write("get serial number\n")
385
+ line = @sock.gets.strip
386
+ if line.match(/^could not understand/)
387
+ @logger.warn'Could not execute get_serial_number: Please upgrade to current version'
388
+ line
389
+ else
390
+ @logger.debug line
391
+ line
392
+ end
393
+ end
394
+
395
+ def get_robot_model
396
+ @sock.write("get robot model\n")
397
+ line = @sock.gets.strip
398
+ if line.match(/^could not understand/)
399
+ @logger.warn'Could not execute get_robot_model: Please upgrade to current version'
400
+ line
401
+ else
402
+ @logger.debug line
403
+ line
404
+ end
405
+ end
406
+ end
141
407
  end
@@ -7,6 +7,66 @@ module UR
7
7
 
8
8
  class Rtde
9
9
  PROTOCOL_VERSION = 2
10
+ ROBOTMODE = {
11
+ -1 => 'No Controller',
12
+ 0 => 'Disconnected',
13
+ 1 => 'Confirm Safety',
14
+ 2 => 'Booting',
15
+ 3 => 'Power Off',
16
+ 4 => 'Power On',
17
+ 5 => 'Idle',
18
+ 6 => 'Backdrive',
19
+ 7 => 'Running',
20
+ 8 => 'Updating Firmware'
21
+ }
22
+ PROGRAMSTATE = {
23
+ 1 => 'Stopped',
24
+ 2 => 'Playing',
25
+ 4 => 'Paused'
26
+ }
27
+ JOINTMODE = {
28
+ 235 => 'JOINT_MODE_RESET',
29
+ 236 => 'JOINT_MODE_SHUTTING_DOWN',
30
+ 237 => 'JOINT_PART_D_CALIBRATION_MODE (INTERNAL USE ONLY)',
31
+ 238 => 'JOINT_MODE_BACKDRIVE',
32
+ 239 => 'JOINT_MODE_POWER_OFF',
33
+ 240 => 'JOINT_MODE_READY_FOR_POWER_OFF (FROM VERSION 5.1)',
34
+ 245 => 'JOINT_MODE_NOT_RESPONDING',
35
+ 246 => 'JOINT_MODE_MOTOR_INITIALISATION',
36
+ 247 => 'JOINT_MODE_BOOTING',
37
+ 248 => 'JOINT_PART_D_CALIBRATION_ERROR_MODE (INTERNAL USE ONLY)',
38
+ 249 => 'JOINT_MODE_BOOTLOADER',
39
+ 250 => 'JOINT_CALIBRATION_MODE (INTERNAL USE ONLY)',
40
+ 251 => 'JOINT_MODE_VIOLATION',
41
+ 252 => 'JOINT_MODE_FAULT',
42
+ 253 => 'JOINT_MODE_RUNNING',
43
+ 255 => 'JOINT_MODE_IDLE'
44
+ }
45
+ SAFETYMODE = {
46
+ 11 => 'SAFETY_MODE_UNDEFINED_SAFETY_MODE',
47
+ 10 => 'SAFETY_MODE_VALIDATE_JOINT_ID',
48
+ 9 => 'SAFETY_MODE_FAULT',
49
+ 8 => 'SAFETY_MODE_VIOLATION',
50
+ 7 => 'SAFETY_MODE_ROBOT_EMERGENCY_STOP',
51
+ 6 => 'SAFETY_MODE_SYSTEM_EMERGENCY_STOP',
52
+ 5 => 'SAFETY_MODE_SAFEGUARD_STOP',
53
+ 4 => 'SAFETY_MODE_RECOVERY',
54
+ 3 => 'SAFETY_MODE_PROTECTIVE_STOP',
55
+ 2 => 'SAFETY_MODE_REDUCED',
56
+ 1 => 'SAFETY_MODE_NORMAL'
57
+ }
58
+
59
+ TOOLMODE = {
60
+ 235 => 'JOINT_MODE_RESET',
61
+ 236 => 'JOINT_MODE_SHUTTING_DOWN',
62
+ 239 => 'JOINT_MODE_POWER_OFF',
63
+ 245 => 'JOINT_MODE_NOT_RESPONDING',
64
+ 247 => 'JOINT_MODE_BOOTING',
65
+ 249 => 'JOINT_MODE_BOOTLOADER',
66
+ 252 => 'JOINT_MODE_FAULT',
67
+ 253 => 'JOINT_MODE_RUNNING',
68
+ 255 => 'JOINT_MODE_IDLE'
69
+ }
10
70
 
11
71
  module Command #{{{
12
72
  RTDE_REQUEST_PROTOCOL_VERSION = 86 # ASCII V
@@ -18,6 +78,7 @@ module UR
18
78
  RTDE_CONTROL_PACKAGE_START = 83 # ASCII S
19
79
  RTDE_CONTROL_PACKAGE_PAUSE = 80 # ascii p
20
80
  end #}}}
81
+
21
82
  module ConnectionState #{{{
22
83
  DISCONNECTED = 0
23
84
  CONNECTED = 1
@@ -40,7 +101,7 @@ module UR
40
101
  def connect #{{{
41
102
  return if @sock
42
103
 
43
- @buf = '' # buffer data in binary format
104
+ @buf = ''.b # buffer data in binary format
44
105
  begin
45
106
  @sock = Socket.new Socket::AF_INET, Socket::SOCK_STREAM
46
107
  @sock.setsockopt Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1
@@ -98,18 +159,18 @@ module UR
98
159
  @logger.error 'Cannot send when RTDE synchroinization is inactive'
99
160
  return
100
161
  end
101
- if not @input_config.key?(input_data.recipe_id)
162
+ if not @input_config.include? input_data.recipe_id
102
163
  @logger.error 'Input configuration id not found: ' + @input_data.recipe_id
103
164
  return
104
165
  end
105
166
  config = @input_config[input_data.recipe_id]
106
167
  send_all Command::RTDE_DATA_PACKAGE, config.pack(input_data)
107
168
  end #}}}
108
- def send_and_receive(cmd, payload = '') #{{{
169
+ def send_and_receive(cmd, payload = ''.b) #{{{
109
170
  @logger.debug 'Start send_and_receive'
110
171
  send_all(cmd, payload) ? recv(cmd) : nil
111
172
  end #}}}
112
- def send_all(command, payload = '') #{{{
173
+ def send_all(command, payload = ''.b) #{{{
113
174
  fmt = 'S>C'
114
175
  size = ([0,0].pack fmt).length + payload.length
115
176
  buf = [size, command].pack(fmt) + payload
@@ -200,16 +261,16 @@ module UR
200
261
  return true
201
262
  end #}}}
202
263
 
203
- def receive #{{{
264
+ def receive(binary=false) #{{{
204
265
  @logger.debug 'Start receive'
205
266
  if !@output_config
206
267
  @logger.error 'Output configuration not initialized'
207
268
  nil
208
269
  end
209
270
  return nil if @conn_state != ConnectionState::STARTED
210
- recv Command::RTDE_DATA_PACKAGE
271
+ recv Command::RTDE_DATA_PACKAGE, binary
211
272
  end #}}}
212
- def recv(command) #{{{
273
+ def recv(command, binary=false) #{{{
213
274
  @logger.debug 'Start recv' + @buf.to_s
214
275
  while connected?
215
276
  readable, _, xlist = IO.select([@sock], [], [@sock])
@@ -250,7 +311,7 @@ module UR
250
311
  end
251
312
  if packet_header.command == command
252
313
  @logger.debug 'returning becuase of packet_header.command == command'
253
- return data
314
+ return binary ? packet[1..-1] : data
254
315
  else
255
316
  @logger.info 'skipping package(2)'
256
317
  end
@@ -64,6 +64,8 @@ module UR
64
64
  data[offset...offset+size].map(&:to_i)
65
65
  elsif data_type == 'INT32' or data_type == 'UINT8'
66
66
  data[offset].to_i
67
+ elsif data_type == 'BOOL'
68
+ data[offset].to_i > 0 ? true : false
67
69
  else
68
70
  raise TypeError.new('unpack_field: unknown data type: ' + data_type)
69
71
  end
@@ -95,19 +97,10 @@ module UR
95
97
  obj = DataObject.new
96
98
  offset = 0
97
99
  obj.recipe_id = data[0]
98
-
99
- #puts "Datat:" + data.to_s
100
-
101
100
  names.each_with_index do |name,i|
102
- #obj.values[i] = data[1..-1].unpack('x' * offset + types[i])
103
- #puts unpack_field(data[1..-1], offset, types[i])
104
-
105
101
  obj.values[name] = Serialize.unpack_field(data[1..-1], offset, types[i])
106
- #puts "obj"
107
- #puts obj.values[i]
108
102
  offset += Serialize::get_item_size(types[i])
109
103
  end
110
- #puts "obj:" + obj.values.to_s
111
104
  obj
112
105
  end
113
106
 
@@ -140,7 +133,6 @@ module UR
140
133
  rmd.id = buf.unpack('C')[0]
141
134
  rmd.types = buf[1..-1].split(',')
142
135
  rmd.fmt = 'C'
143
- p rmd.types
144
136
  rmd.types.each do |i|
145
137
  if i == 'INT32'
146
138
  rmd.fmt += 'i>'
@@ -160,20 +152,19 @@ module UR
160
152
  rmd.fmt += 'Q>'
161
153
  elsif i == 'UINT8'
162
154
  rmd.fmt += 'C'
155
+ elsif i == 'BOOL'
156
+ rmd.fmt += '?'
163
157
  elsif i == 'IN_USE'
164
- raise TypeError 'An input parameter is already in use.'
158
+ #raise TypeError 'An input parameter is already in use.'
165
159
  else
166
- raise TypeError 'Unknown data type: ' + i
160
+ #raise TypeError 'Unknown data type: ' + i
167
161
  end
168
162
  end
169
163
  rmd
170
164
  end
171
165
 
172
166
  def pack(state)
173
- p state.class
174
167
  l = state.pack(self.names, self.types)
175
- p l
176
- p self.fmt
177
168
  l.pack(self.fmt)
178
169
  end
179
170
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ur-sock"
3
- s.version = "0.3"
3
+ s.version = "1.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Preliminary release of Universal Robot (UR) Socket Communication."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ur-sock
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Pauker
@@ -9,28 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-05-20 00:00:00.000000000 Z
12
+ date: 2020-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-smart
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '0'
21
18
  - - ">="
22
19
  - !ruby/object:Gem::Version
23
20
  version: 0.3.6
21
+ - - "~>"
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
29
- - !ruby/object:Gem::Version
30
- version: '0'
31
28
  - - ">="
32
29
  - !ruby/object:Gem::Version
33
30
  version: 0.3.6
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
34
  description: see https://github.com/fpauker/ur-sock
35
35
  email: florian.pauker@gmail.com
36
36
  executables: []
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.0.3
70
+ rubygems_version: 3.1.2
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: Preliminary release of Universal Robot (UR) Socket Communication.