urua 0.99.5002 → 0.99.5004

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3ee01168708553d0decf46b79486a4f166e2c8fb0bc4ca242632136788bffb8
4
- data.tar.gz: aace03047b700a0db3ea42a27d6b2dc843c0243f927190be6fe97fb25a806fbc
3
+ metadata.gz: 94ce72efcb23082b842157f2e93e065493c5654785e3fd1e992967336552b814
4
+ data.tar.gz: d7d7b4dac9cedd7a849120b8f8d4fe9bc8bc73b07bac9225a787fd4d29e4d673
5
5
  SHA512:
6
- metadata.gz: 2d0f01cf260daca24bbf05e85f1ad841b8c2f8b0d49f39d602bfe866a81e26798053d0046e93a5b2cbd445b3b0ad4b885c947c62a46bb801781fc551ae9c2984
7
- data.tar.gz: 29f862c4783ab81a8c38890cf768b7f4f919b123ebfa05622a31b126934603f807575105bbe6993973f067895bae7b19bc392c9c13706aba0ad21242b7b20c4f
6
+ metadata.gz: f1dddcdd1e2bbd4d501b3c813d6f88d4914fbeb484aee42fffb2e8e907deb083f1eed95c681595196efb6ab87f0efb2deb946fee44f48f15417da8ea200ce494
7
+ data.tar.gz: d213ed840b83bb818d4b8dc49f46f0e6d560e916a2fe91418f3f020dc91ca2d758fd54fcba217c7521bae825f20e3d60d54ba74fc45faeefb1df206ebf45bc51
data/README.md CHANGED
@@ -2,28 +2,68 @@
2
2
 
3
3
  # URUA
4
4
 
5
- OPC UA Server for Universal Robots
5
+ A simple OPC UA server for Universal robots in ruby, which uses the ur-sock and opcua-smart library.
6
6
 
7
7
  ## Getting Started
8
8
 
9
- A simple ruby server, which uses th ur-sock and opcua-smart library.
9
+ A simple ruby server, which uses the ur-sock and opcua-smart library.
10
10
 
11
11
  ### Prerequisites & Intallation
12
12
 
13
- To run the server we need the following packages:
13
+ For this server the OPC UA installation of the opcua-smart gem is required.
14
+ Please follow the instructions at https://github.com/etm/opcua-smart and install the opcua gem.
14
15
 
15
- * ruby gems:
16
+ Additionally you have to install the URUA gem with:
17
+
18
+ ```
19
+ gem install urua
20
+ ```
21
+
22
+ If you want to develop or extend the server, just use the following instruction
23
+ ```
24
+ git clone https://github.com/fpauker/urua
25
+ git clone https://github.com/fpauker/ur-sock
26
+ git clone https://github.com/etm/opcua-smart
16
27
  ```
17
- gem install opcua
18
- gem install ur-sock
28
+
29
+ Just follow the install instructions of the 3 projects.
30
+ After installing all packages do
31
+
32
+ ```
33
+ cd urua/server
19
34
  ```
35
+ in this directory the devserver.rb and the devserver.config are located.
36
+
37
+ ### Starting the server
38
+
39
+ To start the server type in the following commands:
40
+
41
+ ```
42
+ cd urua/server
43
+ ./uruaserver.rb start
44
+ ```
45
+ or
46
+ ```
47
+ cd urua/server
48
+ ./devserver.rb start
49
+ ```
50
+ to start the developing server.
51
+
20
52
 
21
53
  ## Adress space
22
54
 
23
- ![Architecture](adressspace/ur1.png?raw=true | width=50)
24
- ![Architecture](adressspace/ur2.png?raw=true | width=50)
25
- ![Architecture](adressspace/ur3.png?raw=true | width=50)
26
- ![Architecture](adressspace/ur5.png?raw=true | width=50)
55
+ The server's adress space is shown in the pictures below.
56
+
57
+ ![Architecture](https://github.com/fpauker/urua/blob/master/adressspace/ur1.png?raw=true)
58
+ ![Architecture](https://github.com/fpauker/urua/blob/master/adressspace/ur2.png?raw=true)
59
+ ![Architecture](https://github.com/fpauker/urua/blob/master/adressspace/ur3.png?raw=true)
60
+ ![Architecture](https://github.com/fpauker/urua/blob/master/adressspace/ur5.png?raw=true)
61
+
62
+ It offers several features combining 3 different interfaces of the Universal robot. It uses the
63
+
64
+ * Primary Secondary Interface for direct execution of UR scripts
65
+ * Dashboard server for orchestration functions e.g. starting/stopping a program
66
+ * RTDE interface for getting the robot states
27
67
 
28
68
  ## Contributing
29
69
 
@@ -28,13 +28,17 @@ module URUA
28
28
  opts['dash'] = UR::Dash.new(opts['ipadress']).connect rescue nil
29
29
  end #}}}
30
30
 
31
+ def self::start_psi(opts)
32
+ opts['psi'] = UR::Psi.new(opts['ipadress']).connect rescue nil
33
+ end
34
+
31
35
  def self::start_rtde(opts) #{{{
32
36
  ### Loading config file
33
37
  conf = UR::XMLConfigFile.new opts['rtde_config']
34
38
  output_names, output_types = conf.get_recipe opts['rtde_config_recipe_base']
35
39
  opts['rtde'] = UR::Rtde.new(opts['ipadress']).connect
36
40
 
37
- ### Set Speed to very slow
41
+ ### Set Speed
38
42
  if opts['rtde_config_recipe_speed']
39
43
  speed_names, speed_types = conf.get_recipe opts['rtde_config_recipe_speed']
40
44
  opts['speed'] = opts['rtde'].send_input_setup(speed_names, speed_types)
@@ -56,22 +60,34 @@ module URUA
56
60
  begin
57
61
  yield
58
62
  rescue UR::Dash::Reconnect => e
63
+ puts e.message
59
64
  tries += 1
60
65
  if tries < 2
61
66
  URUA::start_dash opts
62
67
  retry
63
68
  end
69
+ rescue UR::Psi::Reconnect => e
70
+ puts e.message
71
+ tries += 1
72
+ if tries < 2
73
+ URUA::start_psi opts
74
+ retry
75
+ end
64
76
  end
65
77
  end #}}}
66
78
 
67
79
  def self::ssh_start(opts) #{{{
68
- opts['ssh'] = opts['password'] ? Net::SSH.start(opts['ipadress'], opts['username'], password: opts['password']) : Net::SSH.start(opts['ipadress'], opts['username'])
80
+ if opts['certificate']
81
+ opts['ssh'] = Net::SSH.start(opts['ipadress'], opts['username'], :keys => [ opts['certificate'] ])
82
+ else
83
+ opts['ssh'] = opts['password'] ? Net::SSH.start(opts['ipadress'], opts['username'], password: opts['password']) : Net::SSH.start(opts['ipadress'], opts['username'])
84
+ end
69
85
  end #}}}
70
86
 
71
87
  def self::download_program(opts,name) #{{{
72
88
  counter = 0
73
89
  begin
74
- opts['ssh'].scp.download File.join(opts['url'],name)
90
+ opts['ssh'].scp.download! File.join(opts['url'],name)
75
91
  rescue => e
76
92
  counter += 1
77
93
  URUA::ssh_start opts
@@ -102,9 +118,14 @@ module URUA
102
118
  progs
103
119
  end #}}}
104
120
 
121
+ def self::robotprogram_running?(opts)
122
+ opts['ps'].value == 'Playing'
123
+ end
124
+
105
125
  def self::implementation_startup(opts) #{{{
106
126
  opts['rtde_config'] ||= File.join(__dir__,'rtde.conf.xml')
107
127
  opts['rtde_config_recipe_base'] ||= 'out'
128
+ opts['rtde_config_recipe_speed'] ||= 'speed'
108
129
 
109
130
  Proc.new do
110
131
  on startup do |opts|
@@ -113,6 +134,7 @@ module URUA
113
134
  opts['dash'] = nil
114
135
  opts['rtde'] = nil
115
136
  opts['programs'] = nil
137
+ opts['psi'] = nil
116
138
 
117
139
  # ProgramFile
118
140
  opts['pf'] = opts['server'].types.add_object_type(:ProgramFile).tap{ |p|
@@ -123,10 +145,20 @@ module URUA
123
145
  end
124
146
  end
125
147
  p.add_method :StartProgram do |node|
126
- a = node.id.to_s.split('/')
127
- URUA::protect_reconnect_run(opts) do
128
- opts['dash'].load_program(a[-2])
129
- opts['dash'].start_program
148
+ unless URUA::robotprogram_running?(opts)
149
+ a = node.id.to_s.split('/')
150
+ URUA::protect_reconnect_run(opts) do
151
+ opts['dash'].load_program(a[-2])
152
+ opts['dash'].start_program
153
+ end
154
+ end
155
+ end
156
+ p.add_method :StartAsUrScript do |node|
157
+ unless URUA::robotprogram_running?(opts)
158
+ a = node.id.to_s.split('/')
159
+ URUA::protect_reconnect_run(opts) do
160
+ opts['psi'].execute_ur_script(URUA::download_program(opts, a[-2]+".script"))
161
+ end
130
162
  end
131
163
  end
132
164
  }
@@ -172,8 +204,10 @@ module URUA
172
204
  end
173
205
  end
174
206
  r.add_method :StartProgram do
175
- URUA::protect_reconnect_run(opts) do
176
- nil unless opts['dash'].start_program
207
+ unless URUA::robotprogram_running?(opts)
208
+ URUA::protect_reconnect_run(opts) do
209
+ nil unless opts['dash'].start_program
210
+ end
177
211
  end
178
212
  end
179
213
  r.add_method :StopProgram do
@@ -186,6 +220,13 @@ module URUA
186
220
  opts['dash'].pause_program
187
221
  end
188
222
  end
223
+ r.add_method :RunUrScript, content: OPCUA::TYPES::STRING do |node, content|
224
+ unless URUA::robotprogram_running?(opts)
225
+ URUA::protect_reconnect_run(opts) do
226
+ opts['psi'].execute_ur_script(content)
227
+ end
228
+ end
229
+ end
189
230
  r.add_method :PowerOn do
190
231
  if opts['rm'].value.to_s != 'Running'
191
232
  Thread.new do
@@ -232,7 +273,7 @@ module URUA
232
273
  }
233
274
  ### populating the adress space
234
275
  ### Robot object
235
- robot = opts['server'].objects.manifest(:UR10e, rt)
276
+ robot = opts['server'].objects.manifest(File.basename(opts['namespace']), rt)
236
277
 
237
278
  opts['sn'] = robot.find(:SerialNumber)
238
279
  opts['model'] = robot.find(:RobotModel)
@@ -291,6 +332,7 @@ module URUA
291
332
  ### Connecting to universal robot
292
333
  URUA::start_rtde opts
293
334
  URUA::start_dash opts
335
+ URUA::start_psi opts
294
336
 
295
337
  ### Manifest programs
296
338
  opts['programs'] = robot.find(:Programs)
@@ -298,7 +340,7 @@ module URUA
298
340
  opts['progs'] = []
299
341
  opts['semaphore'] = Mutex.new
300
342
  ### check if interfaces are ok
301
- raise if !opts['dash'] || !opts['rtde'] ##### TODO, don't return, raise
343
+ raise if !opts['dash'] || !opts['rtde'] || !opts['psi']
302
344
 
303
345
  # Functionality for threading in loop
304
346
  opts['doit_state'] = Time.now.to_i
@@ -308,6 +350,17 @@ module URUA
308
350
  # Serious comment (we do the obvious stuff)
309
351
  opts['sn'].value = opts['dash'].get_serial_number
310
352
  opts['model'].value = opts['dash'].get_robot_model
353
+ rescue Errno::ECONNREFUSED => e
354
+ print 'ECONNREFUSED: '
355
+ puts e.message
356
+ rescue UR::Dash::Reconnect => e
357
+ URUA::start_dash opts
358
+ puts e.message
359
+ puts e.backtrace
360
+ rescue UR::Psi::Reconnect => e
361
+ URUA::start_psi opts
362
+ puts e.message
363
+ puts e.backtrace
311
364
  rescue => e
312
365
  puts e.message
313
366
  puts e.backtrace
@@ -338,14 +391,12 @@ module URUA
338
391
  # check every 10 seconds for new programs
339
392
  progs = URUA::get_robot_programs(opts)
340
393
  delete = opts['progs'] - progs
341
- # puts 'Missing Nodes: ' + delete.to_s
342
394
  delete.each do |d|
343
395
  d = d[0..-5]
344
396
  opts['prognodes'][d].delete!
345
397
  opts['prognodes'].delete(d)
346
398
  end
347
399
  add = progs - opts['progs']
348
- # puts 'New nodes: ' + add.to_s
349
400
  add.each do |a|
350
401
  a = a[0..-5]
351
402
  opts['prognodes'][a] = opts['programs'].manifest(a, opts['pf'])
@@ -383,10 +434,14 @@ module URUA
383
434
  URUA::split_vector6_data(data['actual_qd'],opts['as'], opts['asa']) # Actual TCP Speed
384
435
  URUA::split_vector6_data(data['actual_qd'],opts['af'], opts['afa']) # Actual TCP Force
385
436
 
437
+ ######TODO Fix Write Values that opc ua does not overwrite the speed slider mask of manual changes
386
438
  # Write values
387
439
  if opts['rtde_config_recipe_speed']
388
- opts['speed']['speed_slider_fraction'] = opts['ov'].value / 100.0
389
- opts['rtde'].send(opts['speed'])
440
+ #if opts['ov'] != opts['ovold']
441
+ # if opts['ov'] == data['target_speed_fraction']
442
+ #opts['speed']['speed_slider_fraction'] = opts['ov'].value / 100.0
443
+ #opts['rtde'].send(opts['speed'])
444
+ opts['ovold'] = data['target_speed_fraction']
390
445
  end
391
446
  else
392
447
  if Time.now.to_i - 10 > opts['doit_rtde']
@@ -394,18 +449,21 @@ module URUA
394
449
  URUA::start_rtde opts
395
450
  end
396
451
  end
397
-
398
452
  rescue Errno::ECONNREFUSED => e
399
- puts 'ECONNREFUSED:'
453
+ print 'ECONNREFUSED: '
400
454
  puts e.message
401
455
  rescue UR::Dash::Reconnect => e
402
456
  URUA::start_dash opts
457
+ puts e.message
458
+ puts e.backtrace
459
+ rescue UR::Psi::Reconnect => e
460
+ URUA::start_psi opts
461
+ puts e.message
462
+ puts e.backtrace
403
463
  rescue => e
404
- unless opts['dash']
405
- URUA::start_dash opts
406
- end
407
- p e.message
408
- p e.backtrace
464
+ puts e.message
465
+ puts e.backtrace
466
+ raise
409
467
  end
410
468
  end
411
469
  end #}}}
@@ -1,12 +1,12 @@
1
1
  ### OPC UA specific config
2
2
  ### --------------------------------------------------------------------------
3
- namespace: https://centurio.work/ur10evva
3
+ namespace: https://centurio.work/urwst51
4
4
 
5
5
  ### UR specific config
6
6
  ### --------------------------------------------------------------------------
7
- ipadress: 192.168.1.26
8
- username: ur
9
- password: easybot
7
+ ipadress: 131.130.37.204
8
+ username: root
9
+ certificate: /home/paukerf87/Projects/urua/server/devserver.rsa
10
10
  url: /programs
11
11
 
12
12
  ### UR simulation specific config
@@ -1,6 +1,6 @@
1
1
  ### OPC UA specific config
2
2
  ### --------------------------------------------------------------------------
3
- namespace: https://centurio.work/ur10evva
3
+ namespace: https://centurio.work/ur10
4
4
 
5
5
  ### UR specific config
6
6
  ### --------------------------------------------------------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urua
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.5002
4
+ version: 0.99.5004
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Pauker
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: tools
11
11
  cert_chain: []
12
- date: 2020-07-17 00:00:00.000000000 Z
12
+ date: 2020-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: opcua
@@ -46,6 +46,9 @@ dependencies:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0.5'
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 0.5.9
49
52
  type: :runtime
50
53
  prerelease: false
51
54
  version_requirements: !ruby/object:Gem::Requirement
@@ -53,6 +56,23 @@ dependencies:
53
56
  - - "~>"
54
57
  - !ruby/object:Gem::Version
55
58
  version: '0.5'
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.9
62
+ - !ruby/object:Gem::Dependency
63
+ name: net-ssh
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.2'
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.2'
56
76
  - !ruby/object:Gem::Dependency
57
77
  name: net-scp
58
78
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +87,40 @@ dependencies:
67
87
  - - "~>"
68
88
  - !ruby/object:Gem::Version
69
89
  version: '3.0'
90
+ - !ruby/object:Gem::Dependency
91
+ name: ed25519
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1'
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '1.2'
100
+ type: :runtime
101
+ prerelease: false
102
+ version_requirements: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - "~>"
105
+ - !ruby/object:Gem::Version
106
+ version: '1'
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '1.2'
110
+ - !ruby/object:Gem::Dependency
111
+ name: bcrypt_pbkdf
112
+ requirement: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1'
117
+ type: :runtime
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1'
70
124
  description: OPC UA Server for Universal Robots. See https://github.com/fpauker/urua
71
125
  email: florian.pauker@gmail.com
72
126
  executables: