ur-sock 0.4444 → 1.0.4

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: 017a63d81101ae4de90a1b421a94c589006f8887b236cf0fba9e4208fd58ac6d
4
- data.tar.gz: '06908cfefab950c4a9c82ef2cea5f8919dcd1cb1c1a237bfaae8f4aa794fa545'
3
+ metadata.gz: 7be2d1f734a78bd295a8e9023dee10cd9e65b29f9c459ee2ffc08c5a4b627791
4
+ data.tar.gz: 9d72fec84e68af601731d1f5953237728564929a4fc7d253cde73ff303f8bd6f
5
5
  SHA512:
6
- metadata.gz: 8c93c0e40e543d0f2388a78620989b22d3ad8f93bdb49ced229895342730728ba1277e3d2dd9c86589dd4dea6fc348bd1d69ea43e46ff99a53c86b851489805c
7
- data.tar.gz: f9d20ab1d6e5c4ba9f46887e785e5a0cb9b927dcec4c3fccf8eb100359ea04a3b3cc49a9696277030ef301563ad2ca1b0c6941b688868b2b419a78f072f0fd15
6
+ metadata.gz: a2690f4ab4269dd2ebce975cafd15568a4905fb7a4b16ef901af80667747af6221f26008395afb656d8d02263733ca9b0ba640c09c4451d2fa75c183eb946b00
7
+ data.tar.gz: e347503cea9df73a77389888046a15354c98e90ba3eea7bc91a1ca40f9018cc65b529d7a933f04890b8decaa24cfd90628c254c52d8509349c1e0536d9a666e2
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:
@@ -165,12 +165,13 @@ module UR
165
165
  line = @sock.gets.strip
166
166
  rescue
167
167
  raise UR::Dash::Reconnect.new('Loaded program can not be got. Dashboard server down or not in Remote Mode')
168
- end
168
+ end
169
+ @logger.debug line
169
170
  if line.match(/^Loaded program:\s(.+)/)
170
- @logger.debug line
171
- path = $1.strip
171
+ $1.strip
172
+ elsif line.match(/^No program loaded/)
173
+ nil
172
174
  else
173
- @logger.error line
174
175
  raise UR::Dash::Reconnect.new('Loaded program can not be got. Dashboard server down or not in Remote Mode')
175
176
  end
176
177
  end
@@ -229,7 +230,7 @@ module UR
229
230
  @logger.debug line
230
231
  else
231
232
  @logger.error line
232
- raise UR::Dash::Reconnect.new('Cant set operation mode manual. DDashboard server down or not in Remote Mode')
233
+ raise UR::Dash::Reconnect.new('Cant set operation mode manual. Dashboard server down or not in Remote Mode')
233
234
  end
234
235
  end
235
236
 
@@ -341,11 +342,76 @@ module UR
341
342
  if line.match(/^Brake/)
342
343
  @logger.debug line
343
344
  true
345
+ elsif line.match(/^could not understand/)
346
+ @logger.warn'Could not execute restart_safety: Please upgrade to current version'
347
+ nil
344
348
  else
345
349
  @logger.error line
346
350
  raise UR::Dash::Reconnect.new('Cant restart safety. Dashboard server down or not in Remote Mode')
347
351
  end
348
352
  end
349
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
+ nil
363
+ elsif line.match(/^could not understand/)
364
+ @logger.warn'Could not execute get_operational_mode: Please upgrade to current version'
365
+ nil
366
+ else
367
+ @logger.error line
368
+ raise UR::Dash::Reconnect.new('Cant get operational mode. Dashboard server down or not in Remote Mode')
369
+ end
370
+ end
371
+
372
+ def is_in_remote_control
373
+ @sock.write("is in remote control\n")
374
+ line = @sock.gets.strip
375
+ if line.match(/^could not understand/)
376
+ @logger.warn'Could not execute is_in_remote_control: Please upgrade to current version'
377
+ nil
378
+ elsif line == 'true' || line == 'false'
379
+ @logger.debug line
380
+ line == 'true'
381
+ else
382
+ @logger.error line
383
+ raise UR::Dash::Reconnect.new('Cant determine if robot is in remote control mode. Dashboard server down maybe down')
384
+ end
385
+ end
386
+
387
+ def get_serial_number
388
+ @sock.write("get serial number\n")
389
+ line = @sock.gets.strip
390
+ if line.match(/^could not understand/)
391
+ @logger.warn'Could not execute get_serial_number: Please upgrade to current version'
392
+ nil
393
+ elsif line.match(/^\d+$/)
394
+ @logger.debug line
395
+ line
396
+ else
397
+ @logger.error line
398
+ raise UR::Dash::Reconnect.new('Cant get serial number. Dashboard server down maybe down or not in Remote Mode')
399
+ end
400
+ end
401
+
402
+ def get_robot_model
403
+ @sock.write("get robot model\n")
404
+ line = @sock.gets.strip
405
+ if line.match(/^could not understand/)
406
+ @logger.warn'Could not execute get_robot_model: Please upgrade to current version'
407
+ nil
408
+ elsif line.match(/^UR/)
409
+ @logger.debug line
410
+ line
411
+ else
412
+ @logger.error line
413
+ raise UR::Dash::Reconnect.new('Cant get robot model. Dashboard server down maybe down or not in Remote Mode')
414
+ end
415
+ end
350
416
  end
351
417
  end
data/lib/psi.rb CHANGED
@@ -6,6 +6,8 @@ require 'uri'
6
6
  module UR
7
7
 
8
8
  class Psi
9
+ class Reconnect < Exception; end
10
+
9
11
  module ConnectionState
10
12
  DISCONNECTED = 0
11
13
  CONNECTED = 1
@@ -41,18 +43,35 @@ module UR
41
43
  @sock.close
42
44
  @sock = nil
43
45
  @conn_state = ConnectionState::DISCONNECTED
44
- @logger.info "Connection closed " + @hostname + ":" + @port.to_s
46
+ @logger.info 'Connection closed ' + @hostname + ':' + @port.to_s
45
47
  end
46
48
  end
47
49
 
48
- def transfer(filename)
49
- File.open(filename) do |file|
50
- while not file.eof?
51
- @sock.write(file.read(1024))
50
+ def execute_ur_script_file(filename)
51
+ @logger.info 'Executing UR Script File: ' + filename
52
+ begin
53
+ File.open(filename) do |file|
54
+ while not file.eof?
55
+ @sock.write(file.readline)
56
+ line = @sock.gets.strip
57
+ @logger.debug line
58
+ end
52
59
  end
60
+ rescue => e
61
+ raise UR::Psi::Reconnect.new('UR Script can not be got. PSI server down or not in Remote Mode')
53
62
  end
54
63
  end
55
64
 
65
+ def execute_ur_script(str)
66
+ @logger.info 'Executing UR Script ...'
67
+ begin
68
+ @sock.write(str)
69
+ line = @sock.gets.strip
70
+ @logger.debug line
71
+ rescue => e
72
+ raise UR::Psi::Reconnect.new('UR Script can not be got. PSI server down or not in Remote Mode')
73
+ end
74
+ end
56
75
  end
57
76
 
58
77
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ur-sock"
3
- s.version = "0.4444"
3
+ s.version = "1.0.4"
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.4444'
4
+ version: 1.0.4
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-09-26 00:00:00.000000000 Z
12
+ date: 2020-09-09 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.