artoo 1.6.7 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +6 -20
  4. data/artoo.gemspec +7 -7
  5. data/bin/artoo +0 -8
  6. data/examples/ardrone_nav_video_wii.rb +1 -1
  7. data/examples/ardrone_nav_wiiclassic.rb +1 -1
  8. data/examples/ardrone_wiiclassic.rb +1 -1
  9. data/examples/firmata.rb +1 -1
  10. data/examples/firmata_button.rb +1 -1
  11. data/examples/hello_api_multiple.rb +1 -1
  12. data/examples/roomba_wiichuck.rb +1 -1
  13. data/examples/sphero.rb +2 -2
  14. data/examples/sphero_color.rb +1 -1
  15. data/examples/sphero_color_wiichuck.rb +2 -2
  16. data/examples/sphero_cycle.rb +1 -1
  17. data/examples/sphero_messages.rb +1 -1
  18. data/examples/sphero_pebble.rb +42 -0
  19. data/examples/sphero_wiichuck.rb +3 -3
  20. data/examples/test_bot.rb +23 -0
  21. data/examples/wiichuck.rb +1 -1
  22. data/examples/wiiclassic.rb +1 -1
  23. data/lib/artoo/api/api.rb +93 -30
  24. data/lib/artoo/api/device_event_client.rb +15 -10
  25. data/lib/artoo/api/route_helpers.rb +14 -3
  26. data/lib/artoo/connection.rb +8 -5
  27. data/lib/artoo/device.rb +29 -11
  28. data/lib/artoo/drivers/driver.rb +4 -0
  29. data/lib/artoo/drivers/{pinger.rb → ping.rb} +6 -6
  30. data/lib/artoo/interfaces/interface.rb +37 -0
  31. data/lib/artoo/interfaces/ping.rb +17 -0
  32. data/lib/artoo/interfaces/rover.rb +35 -0
  33. data/lib/artoo/master.rb +45 -3
  34. data/lib/artoo/robot.rb +33 -8
  35. data/lib/artoo/utility.rb +10 -0
  36. data/lib/artoo/version.rb +1 -1
  37. data/test/api/api_routes_test.rb +46 -0
  38. data/test/connection_test.rb +2 -2
  39. data/test/device_test.rb +8 -1
  40. data/test/interfaces/interface_test.rb +29 -0
  41. data/test/master_test.rb +13 -7
  42. metadata +32 -28
  43. data/Gemfile.lock +0 -88
  44. data/lib/artoo/commands/bluetooth.rb +0 -74
  45. data/lib/artoo/commands/scan.rb +0 -42
  46. data/lib/artoo/ext/actor.rb +0 -18
  47. data/lib/artoo/ext/timers.rb +0 -41
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ron Evans
@@ -12,78 +12,78 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-04-07 00:00:00.000000000 Z
15
+ date: 2014-08-04 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: celluloid
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "~>"
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.15.0
23
+ version: 0.16.0.pre
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - "~>"
28
+ - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: 0.15.0
30
+ version: 0.16.0.pre
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: celluloid-io
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - "~>"
35
+ - - ">="
36
36
  - !ruby/object:Gem::Version
37
- version: 0.15.0
37
+ version: 0.16.0.pre
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - "~>"
42
+ - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.15.0
44
+ version: 0.16.0.pre
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: http
47
47
  requirement: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - "~>"
50
50
  - !ruby/object:Gem::Version
51
- version: 0.5.0
51
+ version: 0.6.1
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
56
  - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: 0.5.0
58
+ version: 0.6.1
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: reel
61
61
  requirement: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - "~>"
64
64
  - !ruby/object:Gem::Version
65
- version: 0.4.0
65
+ version: 0.5.0
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
- version: 0.4.0
72
+ version: 0.5.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: multi_json
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: 1.6.0
79
+ version: 1.10.1
80
80
  type: :runtime
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: 1.6.0
86
+ version: 1.10.1
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: rake
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -118,28 +118,28 @@ dependencies:
118
118
  requirements:
119
119
  - - "~>"
120
120
  - !ruby/object:Gem::Version
121
- version: 0.18.1
121
+ version: 0.19.1
122
122
  type: :runtime
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - "~>"
127
127
  - !ruby/object:Gem::Version
128
- version: 0.18.1
128
+ version: 0.19.1
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: robeaux
131
131
  requirement: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - "~>"
133
+ - - '='
134
134
  - !ruby/object:Gem::Version
135
- version: 0.0.4
135
+ version: 0.2.0
136
136
  type: :runtime
137
137
  prerelease: false
138
138
  version_requirements: !ruby/object:Gem::Requirement
139
139
  requirements:
140
- - - "~>"
140
+ - - '='
141
141
  - !ruby/object:Gem::Version
142
- version: 0.0.4
142
+ version: 0.2.0
143
143
  description: Ruby-based microframework for robotics
144
144
  email:
145
145
  - artoo@hybridgroup.com
@@ -156,7 +156,6 @@ files:
156
156
  - ".yardopts"
157
157
  - CONTRIBUTORS.md
158
158
  - Gemfile
159
- - Gemfile.lock
160
159
  - LICENSE
161
160
  - README.md
162
161
  - Rakefile
@@ -192,7 +191,9 @@ files:
192
191
  - examples/sphero_firmata.rb
193
192
  - examples/sphero_messages.rb
194
193
  - examples/sphero_multiple.rb
194
+ - examples/sphero_pebble.rb
195
195
  - examples/sphero_wiichuck.rb
196
+ - examples/test_bot.rb
196
197
  - examples/wiichuck.rb
197
198
  - examples/wiiclassic.rb
198
199
  - lib/artoo.rb
@@ -206,11 +207,9 @@ files:
206
207
  - lib/artoo/api/device_event_client.rb
207
208
  - lib/artoo/api/route_helpers.rb
208
209
  - lib/artoo/basic.rb
209
- - lib/artoo/commands/bluetooth.rb
210
210
  - lib/artoo/commands/commands.rb
211
211
  - lib/artoo/commands/generate.rb
212
212
  - lib/artoo/commands/install.rb
213
- - lib/artoo/commands/scan.rb
214
213
  - lib/artoo/commands/socket.rb
215
214
  - lib/artoo/connection.rb
216
215
  - lib/artoo/delegator.rb
@@ -219,14 +218,12 @@ files:
219
218
  - lib/artoo/drivers/device_info.rb
220
219
  - lib/artoo/drivers/driver.rb
221
220
  - lib/artoo/drivers/passthru.rb
222
- - lib/artoo/drivers/pinger.rb
221
+ - lib/artoo/drivers/ping.rb
223
222
  - lib/artoo/drivers/random.rb
224
223
  - lib/artoo/drivers/test.rb
225
224
  - lib/artoo/events.rb
226
225
  - lib/artoo/exceptions.rb
227
- - lib/artoo/ext/actor.rb
228
226
  - lib/artoo/ext/numeric.rb
229
- - lib/artoo/ext/timers.rb
230
227
  - lib/artoo/generators/adaptor.rb
231
228
  - lib/artoo/generators/adaptor/Gemfile.tt
232
229
  - lib/artoo/generators/adaptor/LICENSE
@@ -240,6 +237,9 @@ files:
240
237
  - lib/artoo/generators/adaptor/test/adaptors/%adaptor_name%_adaptor_test.rb.tt
241
238
  - lib/artoo/generators/adaptor/test/drivers/%adaptor_name%_driver_test.rb.tt
242
239
  - lib/artoo/generators/adaptor/test/test_helper.rb
240
+ - lib/artoo/interfaces/interface.rb
241
+ - lib/artoo/interfaces/ping.rb
242
+ - lib/artoo/interfaces/rover.rb
243
243
  - lib/artoo/main.rb
244
244
  - lib/artoo/master.rb
245
245
  - lib/artoo/port.rb
@@ -249,6 +249,7 @@ files:
249
249
  - lib/artoo/version.rb
250
250
  - test/adaptors/adaptor_test.rb
251
251
  - test/adaptors/loopback_test.rb
252
+ - test/api/api_routes_test.rb
252
253
  - test/api/api_test.rb
253
254
  - test/artoo_test.rb
254
255
  - test/connection_test.rb
@@ -256,6 +257,7 @@ files:
256
257
  - test/device_test.rb
257
258
  - test/drivers/driver_test.rb
258
259
  - test/ext/numeric_test.rb
260
+ - test/interfaces/interface_test.rb
259
261
  - test/master_test.rb
260
262
  - test/port_test.rb
261
263
  - test/robot_test.rb
@@ -289,6 +291,7 @@ summary: Ruby-based microframework for robotics
289
291
  test_files:
290
292
  - test/adaptors/adaptor_test.rb
291
293
  - test/adaptors/loopback_test.rb
294
+ - test/api/api_routes_test.rb
292
295
  - test/api/api_test.rb
293
296
  - test/artoo_test.rb
294
297
  - test/connection_test.rb
@@ -296,6 +299,7 @@ test_files:
296
299
  - test/device_test.rb
297
300
  - test/drivers/driver_test.rb
298
301
  - test/ext/numeric_test.rb
302
+ - test/interfaces/interface_test.rb
299
303
  - test/master_test.rb
300
304
  - test/port_test.rb
301
305
  - test/robot_test.rb
data/Gemfile.lock DELETED
@@ -1,88 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- artoo (1.6.7)
5
- celluloid (~> 0.15.0)
6
- celluloid-io (~> 0.15.0)
7
- http (~> 0.5.0)
8
- multi_json (~> 1.6.0)
9
- pry (~> 0.9.0)
10
- rake
11
- reel (~> 0.4.0)
12
- robeaux (~> 0.0.4)
13
- thor (~> 0.18.1)
14
-
15
- GEM
16
- remote: http://rubygems.org/
17
- specs:
18
- celluloid (0.15.2)
19
- timers (~> 1.1.0)
20
- celluloid-io (0.15.0)
21
- celluloid (>= 0.15.0)
22
- nio4r (>= 0.5.0)
23
- coderay (1.1.0)
24
- dotenv (0.9.0)
25
- foreman (0.63.0)
26
- dotenv (>= 0.7)
27
- thor (>= 0.13.6)
28
- foreman (0.63.0-java)
29
- dotenv (>= 0.7)
30
- thor (>= 0.13.6)
31
- http (0.5.0)
32
- http_parser.rb
33
- http_parser.rb (0.6.0)
34
- json (1.7.7)
35
- json (1.7.7-java)
36
- kramdown (1.2.0)
37
- libv8 (3.16.14.3)
38
- metaclass (0.0.1)
39
- method_source (0.8.2)
40
- minitest (5.0.8)
41
- minitest-happy (1.0.0)
42
- mocha (0.14.0)
43
- metaclass (~> 0.0.1)
44
- multi_json (1.6.1)
45
- nio4r (1.0.0)
46
- pry (0.9.12.6)
47
- coderay (~> 1.0)
48
- method_source (~> 0.8)
49
- slop (~> 3.4)
50
- rake (10.2.2)
51
- reel (0.4.0)
52
- celluloid (>= 0.15.1)
53
- celluloid-io (>= 0.15.0)
54
- http (>= 0.5.0)
55
- http_parser.rb (>= 0.6.0.beta.2)
56
- websocket_parser (>= 0.1.4)
57
- ref (1.0.5)
58
- robeaux (0.0.4)
59
- slop (3.5.0)
60
- therubyracer (0.12.0)
61
- libv8 (~> 3.16.14.0)
62
- ref
63
- therubyrhino (2.0.2)
64
- therubyrhino_jar (>= 1.7.3)
65
- therubyrhino_jar (1.7.4)
66
- thor (0.18.1)
67
- timers (1.1.0)
68
- websocket_parser (0.1.6)
69
- yard (0.8.7.2)
70
- yard-sinatra (1.0.0)
71
- yard (~> 0.7)
72
-
73
- PLATFORMS
74
- java
75
- ruby
76
-
77
- DEPENDENCIES
78
- artoo!
79
- foreman
80
- json (~> 1.7.7)
81
- kramdown
82
- minitest (~> 5.0.1)
83
- minitest-happy
84
- mocha (~> 0.14.0)
85
- therubyracer
86
- therubyrhino
87
- yard
88
- yard-sinatra
@@ -1,74 +0,0 @@
1
- require 'thor'
2
- require 'thor/group'
3
-
4
- module Artoo
5
- module Commands
6
- class Bluetooth < Commands
7
- package_name "bluetooth"
8
-
9
- desc "scan", "Scan for bluetooth devices"
10
- def scan
11
- Artoo::Commands::Scan.new().bluetooth()
12
- end
13
-
14
- desc "bind [ADDRESS] [NAME]", "Binds a Bluetooth device to a serial port"
15
- option :comm, :aliases => "-c", :default => 0, :desc => "Comm number"
16
- option :radio, :aliases => "-r", :default => "hci0", :desc => "Bluetooth radio address"
17
- def bind(address, name)
18
- case os
19
- when :linux
20
- run("sudo rfcomm -i #{options[:radio]} bind /dev/rfcomm#{options[:comm]} #{address} 1")
21
- run("sudo ln -s /dev/rfcomm#{options[:comm]} /dev/#{name}")
22
- when :macosx
23
- say "OSX binds devices on its own volition."
24
- else
25
- say "OS not yet supported..."
26
- end
27
- end
28
-
29
- desc "unbind [ADDRESS] [NAME]", "Unbinds a Bluetooth device from a serial port"
30
- def unbind(address, name)
31
- case os
32
- when :linux
33
- run("sudo rfcomm unbind #{address}")
34
- run("sudo rm /dev/#{name}")
35
- when :macosx
36
- say "OSX binds devices on its own volition."
37
- else
38
- say "OS not yet supported..."
39
- end
40
- end
41
-
42
- desc "connect [NAME] [PORT]", "Connect a serial device to a TCP socket using socat"
43
- option :retries, :aliases => "-r", :default => 0, :desc => "Number of times to retry connecting on failure"
44
- option :baudrate, :aliases => "-b", :default => 57600, :desc => "Baud rate to use to connect to the serial device"
45
- def connect(name, port)
46
- Artoo::Commands::Socket.new().connect(name, port, options[:retries], options[:baudrate])
47
- end
48
-
49
- desc "pair [ADDRESS]", "Pairs a Bluetooth device"
50
- def pair(address)
51
- case os
52
- when :linux
53
- run("bluez-simple-agent hci0 #{ address }")
54
- when :macosx
55
- say "OS X manages Bluetooth pairing itself."
56
- else
57
- say "OS not yet supported..."
58
- end
59
- end
60
-
61
- desc "unpair [ADDRESS]", "Unpairs a Bluetooth device"
62
- def unpair(address)
63
- case os
64
- when :linux
65
- run("bluez-simple-agent hci0 #{ address } remove")
66
- when :macosx
67
- say "OS X manages Bluetooth unpairing itself."
68
- else
69
- say "OS not yet supported..."
70
- end
71
- end
72
- end
73
- end
74
- end
@@ -1,42 +0,0 @@
1
- require 'thor'
2
- require 'thor/group'
3
-
4
- module Artoo
5
- module Commands
6
- class Scan < Commands
7
- package_name "scan"
8
-
9
- desc "serial", "Scan for connected serial devices"
10
- def serial
11
- case os
12
- when :linux
13
- run("ls /dev/tty*")
14
- when :macosx
15
- run("ls /dev/{tty,cu}.*")
16
- else
17
- say("OS not yet supported...")
18
- end
19
- end
20
-
21
- desc "usb", "Scan for connected usb devices"
22
- def usb
23
- case os
24
- when :linux
25
- run("lsusb")
26
- else
27
- say "OS not yet supported..."
28
- end
29
- end
30
-
31
- desc "bluetooth", "Scan for bluetooth devices"
32
- def bluetooth
33
- case os
34
- when :linux
35
- run("hcitool scan")
36
- else
37
- say "OS not yet supported..."
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,18 +0,0 @@
1
- # Monkeypatches for Celluloid Actor class
2
- module Celluloid
3
- def timers
4
- Actor.timers
5
- end
6
-
7
- class Actor
8
- attr_accessor :timers
9
-
10
- class << self
11
- def timers
12
- actor = Thread.current[:celluloid_actor]
13
- raise NotActorError, "not in actor scope" unless actor
14
- actor.timers
15
- end
16
- end
17
- end
18
- end
@@ -1,41 +0,0 @@
1
- # Monkeypatches for Timers & Timer classes used by Celluloid
2
- class Timers
3
- def initialize
4
- @timers = SortedSet.new
5
- @paused_timers = SortedSet.new
6
- end
7
-
8
- def pause(timer = nil)
9
- return pause_all if timer.nil?
10
- raise TypeError, "not a Timers::Timer" unless timer.is_a? Timers::Timer
11
- @timers.delete timer
12
- @paused_timers.add timer
13
- end
14
-
15
- def pause_all
16
- @timers.each {|timer| timer.pause}
17
- end
18
-
19
- def continue(timer = nil)
20
- return continue_all if timer.nil?
21
- raise TypeError, "not a Timers::Timer" unless timer.is_a? Timers::Timer
22
- @paused_timers.delete timer
23
- @timers.add timer
24
- end
25
-
26
- def continue_all
27
- @paused_timers.each {|timer| timer.continue}
28
- end
29
-
30
- class Timer
31
- # Pause this timer
32
- def pause
33
- @timers.pause self
34
- end
35
-
36
- # Continue this timer
37
- def continue
38
- @timers.continue self
39
- end
40
- end
41
- end