ur-sock 0.2 → 0.3

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: 6e73ba1728ec6f9dbe31b47e258eecae23f768436d334563f31c6396c408296d
4
- data.tar.gz: e32570a81a62e2a8eca025438d0f814352e4f0327782ae0495ae5edc1223481d
3
+ metadata.gz: 22f897ede8181850bb4bcf8074fb6147b8d06bb5618b566b9becb111fc4231ac
4
+ data.tar.gz: 4dea79150693e0c196975f203b6fb08f696d0477410d4ea68084a5f3d50976ad
5
5
  SHA512:
6
- metadata.gz: f3057def5171a85e2d5ce6a4fa77cfe6c036afd0ee71005e07aeead532c6cb4197480981bbb4e6ca67e2c3d10046bd456761bb2a10b1370057a6e10391411c0c
7
- data.tar.gz: 6099733c5bedbd6638265e489c10ff037f11983774711107cb5a49174b302106524423833a7bed628a83775ac0b1c195fed5aa2d6aecffa24dde6fdaa7f57eb7
6
+ metadata.gz: 9933643d022f7f939a9e10bdc42218015dde6dabf7826608cab685387ae00eb1740dcb3d493fd64c1444c2b0413ce20accd2140e43eed1442241c8193c111562
7
+ data.tar.gz: e54083279f2cea25d2f843037b0efde6bc51f972ce6b4fde0d9a957c6b0a9a278c080140736b7c63a4b62650a2898410c162b69a9f1324faaae450ae0216fc92
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
- # ur-smart
1
+ # ur-sock
2
2
 
3
- RTDE interface implementation in ruby
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
5
  ## Getting Started
6
6
 
7
- Uses the RTDE socekt of universal robots. The commands are sent using TCP socket on port 30002.
7
+ This library uses 3 interfaces of the universal robot:
8
+ * RTDE Interface (port 30002)
9
+ * Primary/Secondary Interface (port 30003)
10
+ * Dashboard Interface (port 29999)
8
11
 
9
12
  ### Prerequisites & Intallation
10
13
 
@@ -12,10 +15,60 @@ To run the server we need the following packages:
12
15
 
13
16
 
14
17
  ```
18
+ #installation of the necessary packages
19
+ gem install xml-smart
15
20
 
21
+ #installation of the gem
22
+ gem install ur-sock
16
23
  ```
17
24
 
25
+ ### Interfaces
18
26
 
27
+ #### RTDE
28
+
29
+ The Real-Time Data Exchange (RTDE) interface can be configured with an XML file.
30
+ * Output: robot-, joint-, tool- and safety status, analog and digital I/O's and general purpose output registers
31
+ * Input: digital and analog outputs and general purpose input registers
32
+
33
+ The complete documentation of all available in- and outputs can be found on:
34
+ https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/real-time-data-exchange-rtde-guide-22229/
35
+
36
+ * Loading Config file
37
+ ```ruby
38
+ #Loading the config file
39
+ conf = UR::XMLConfigFile.new "test.conf.xml"
40
+
41
+ #configure output
42
+ output_names, output_types = conf.get_recipe('out')
43
+ ```
44
+
45
+ ```ruby
46
+ ### Set Speed to very slow
47
+ # speed_names, speed_types = conf.get_recipe('speed')
48
+ # speed = con.send_input_setup(speed_names, speed_types)
49
+ # speed["speed_slider_mask"] = 1
50
+ # speed["speed_slider_fraction"] = 0
51
+ # con.send(speed)
52
+
53
+ #connecting to the RTDE interfaces on port 30002
54
+ rtde = UR::Rtde.new ('192.168.1.2').connect
55
+ ```
56
+
57
+ ### Examples
58
+
59
+ Loading Config for RTDE interface
60
+ ```ruby
61
+
62
+ ```
63
+ Connecting to robot
64
+
65
+ ```ruby
66
+ #connecting to the proimary/secondary interface (psi) on port 30003
67
+ psi = UR::Transfer.new('192.168.1.2').connect
68
+
69
+ #connecting to the dashboard interface on port 29999
70
+ dash = UR::Dash.new('192.168.1.2').connect
71
+ ```
19
72
 
20
73
  ## Contributing
21
74
 
@@ -23,12 +76,11 @@ Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c6
23
76
 
24
77
  ## Authors
25
78
 
26
- * **Florian Pauker** - ** -
27
- * **Jürgen Mangler** - ** -
79
+ * **Florian Pauker**
80
+ * **Jürgen Mangler**
28
81
 
29
82
  See also the list of [contributors](https://intra.acdp.at/gogs/fpauker/ua4ur/contributors) who participated in this project.
30
83
 
31
84
  ## License
32
85
 
33
86
  This project is licensed under the LGPL3 License - see the [LICENSE.md](LICENSE.md) file for details
34
-
data/lib/dashboard.rb ADDED
@@ -0,0 +1,141 @@
1
+ #!/usr/bin/env ruby
2
+ require 'socket' # Sockets are in standard library
3
+ require 'logger'
4
+ require 'uri'
5
+
6
+ module UR
7
+
8
+ class Dash
9
+ module ConnectionState
10
+ DISCONNECTED = 0
11
+ CONNECTED = 1
12
+ STARTED = 2
13
+ PAUSED = 3
14
+ end
15
+
16
+ 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"
26
+ end
27
+
28
+ def initialize(host, logger=Logger.new(STDOUT,level: :INFO))
29
+ host = '//' + host if host !~ /\/\//
30
+ uri = URI::parse(host)
31
+ @logger = logger
32
+ @hostname = uri.host
33
+ @port = uri.port.nil? ? 29999 : uri.port
34
+ @conn_state = ConnectionState::DISCONNECTED
35
+ @sock = nil
36
+ end
37
+
38
+ def connect
39
+ return if @sock
40
+ @sock = Socket.new Socket::AF_INET, Socket::SOCK_STREAM
41
+ @sock.setsockopt Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1
42
+ @sock = TCPSocket.new(@hostname, @port)
43
+ @conn_state = ConnectionState::CONNECTED
44
+ @logger.info @sock.gets.strip
45
+ self
46
+ end
47
+
48
+ def connected?
49
+ @conn_state != ConnectionState::DISCONNECTED
50
+ end
51
+
52
+ def disconnect
53
+ if @sock
54
+ @sock.close
55
+ @sock = nil
56
+ @conn_state = ConnectionState::DISCONNECTED
57
+ @logger.info "Connection closed " + @hostname + ":" + @port.to_s
58
+ end
59
+ end
60
+
61
+ def start_program
62
+ @sock.write("play\n")
63
+ line = @sock.gets.strip
64
+ if line == "Starting program"
65
+ @logger.info line
66
+ else
67
+ @logger.error line
68
+ end
69
+ end
70
+
71
+ def power_off
72
+ @sock.write("power off\n")
73
+ @logger.info @sock.gets.strip
74
+ end
75
+
76
+ def power_on
77
+ @sock.write("power on\n")
78
+ @logger.info @sock.gets.strip
79
+ end
80
+
81
+ def break_release
82
+ @sock.write("brake release\n")
83
+ @logger.info @sock.gets.strip
84
+ end
85
+
86
+ def set_operation_mode_auto
87
+ @sock.write("set operational mode automatic\n") #, where manual is
88
+ @logger.info @sock.gets.strip
89
+ end
90
+
91
+ def clear_operation_mode
92
+
93
+ @sock.write("clear operational mode\n") #, where manual is
94
+ @logger.info @sock.gets.strip
95
+ end
96
+
97
+ def popupmessage(message)
98
+ @sock.write ("popup " + message.to_s + "\n")
99
+ @logger.info @sock.gets.strip
100
+ end
101
+ def pause_program
102
+ @sock.write("pause\n")
103
+ @logger.info "paused program"
104
+ @logger.info @sock.gets.strip
105
+ end
106
+
107
+ def stop_program
108
+ @sock.write("stop\n")
109
+ @logger.info "stopped program"
110
+ @logger.info @sock.gets.strip
111
+ end
112
+
113
+ def get_robotmode
114
+ @sock.write("robotmode\n")
115
+ line = @sock.gets.strip
116
+ @logger.info line
117
+ result = $1.strip if line.match(/^Robotmode:\s(.+)/)
118
+ end
119
+
120
+ def get_loaded_program
121
+ @sock.write ("get loaded program\n")
122
+ line = @sock.gets.strip
123
+ @logger.info line
124
+ path = $1.strip if line.match(/^Loaded program:\s(.+)/)
125
+ end
126
+
127
+ def load_program (programname)
128
+ @logger.info "loadprogram"
129
+ send = "load " + programname + ".urp\n"
130
+ puts send
131
+ @sock.write (send)
132
+ line = @sock.gets.strip
133
+ @logger.info line
134
+ end
135
+
136
+ def get_program_state
137
+
138
+ end
139
+ end
140
+
141
+ end
@@ -5,7 +5,7 @@ require 'uri'
5
5
 
6
6
  module UR
7
7
 
8
- class Transfer
8
+ class Psi
9
9
  module ConnectionState
10
10
  DISCONNECTED = 0
11
11
  CONNECTED = 1
data/lib/ur-sock.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require_relative 'conf'
2
2
  require_relative 'rtde'
3
- require_relative 'transfer'
3
+ require_relative 'psi'
4
+ require_relative 'dashboard'
data/ur-sock.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "ur-sock"
3
- s.version = "0.2"
3
+ s.version = "0.3"
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.2'
4
+ version: '0.3'
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-17 00:00:00.000000000 Z
12
+ date: 2019-05-20 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.3.6
21
18
  - - "~>"
22
19
  - !ruby/object:Gem::Version
23
20
  version: '0'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.3.6
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.3.6
31
28
  - - "~>"
32
29
  - !ruby/object:Gem::Version
33
30
  version: '0'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.6
34
34
  description: see https://github.com/fpauker/ur-sock
35
35
  email: florian.pauker@gmail.com
36
36
  executables: []
@@ -42,9 +42,10 @@ files:
42
42
  - README.md
43
43
  - Rakefile
44
44
  - lib/conf.rb
45
+ - lib/dashboard.rb
46
+ - lib/psi.rb
45
47
  - lib/rtde.rb
46
48
  - lib/serialize.rb
47
- - lib/transfer.rb
48
49
  - lib/ur-sock.rb
49
50
  - ur-sock.gemspec
50
51
  homepage: https://github.com/fpauker/ur-sock
@@ -66,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
67
  - !ruby/object:Gem::Version
67
68
  version: '0'
68
69
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 2.7.6.2
70
+ rubygems_version: 3.0.3
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: Preliminary release of Universal Robot (UR) Socket Communication.