artoo-sphero 1.2.0 → 1.3.0

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
  SHA1:
3
- metadata.gz: e73a37bcec5b30a8ca3683e92523237e7bd0fd86
4
- data.tar.gz: 5c6eae27a54d587fd233dcb2b33e5a710d1b4319
3
+ metadata.gz: dd4ee78dc0212685f59e294a8e0d251a3829fe24
4
+ data.tar.gz: 4f7d8f33dcf7046f5eea874e3d059c36bab252ea
5
5
  SHA512:
6
- metadata.gz: 67f50d1cf5c9105877e8a5e06bfc7cecfbb50dfbd8e6157c470010028687f5f4443e9f4f6a138fb5d3387ec67c1585d305a11f78dc9b99a24acf581cfbd35dd7
7
- data.tar.gz: 36a066ea1516cd11283df95d61974a7445f4976b46db623c468e0979995b91edf299f0c7410f160f17f582041365a398c82f0221a0fabf1c9188572112dac3f7
6
+ metadata.gz: 43a82c9001d6e5ec14eb2d8ceb25328ef1e9304e0eae0b14edb81203b82b985e53da0d377b1d1e034f2befba1246a0488546941a361cfb73b6cbc3a6611bbdc8
7
+ data.tar.gz: a903b5eae8a65898e88340533eaa312b1dcbae953d056060055630d4deb6f441452179f000ed780cf53cd6a968269a4515f33bc800462c386f10ce35310dde59
@@ -1 +1 @@
1
- rbx-2.0.0-rc1
1
+ ruby-2.1.0
@@ -3,4 +3,4 @@ rvm:
3
3
  - 2.0.0
4
4
  - 1.9.3
5
5
  - jruby-19mode
6
- - rbx-19mode
6
+ - rbx-2.1.1
@@ -1,55 +1,56 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- artoo-sphero (1.2.0)
5
- artoo (>= 1.4.0)
6
- sphero (>= 1.4.1)
4
+ artoo-sphero (1.3.0)
5
+ artoo (>= 1.6.0)
6
+ sphero (>= 1.5.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- artoo (1.4.1)
11
+ artoo (1.6.0)
12
12
  celluloid (~> 0.15.0)
13
13
  celluloid-io (~> 0.15.0)
14
14
  multi_json (~> 1.6)
15
15
  pry (~> 0.9)
16
16
  rake
17
17
  reel (~> 0.4.0)
18
+ robeaux (~> 0.0.3)
18
19
  thor (~> 0.18.1)
19
20
  celluloid (0.15.2)
20
21
  timers (~> 1.1.0)
21
22
  celluloid-io (0.15.0)
22
23
  celluloid (>= 0.15.0)
23
24
  nio4r (>= 0.5.0)
24
- coderay (1.0.9)
25
+ coderay (1.1.0)
25
26
  http (0.5.0)
26
27
  http_parser.rb
27
- http_parser.rb (0.6.0.beta.2)
28
+ http_parser.rb (0.6.0)
28
29
  metaclass (0.0.1)
29
30
  method_source (0.8.2)
30
31
  minitest (5.0.6)
31
32
  minitest-happy (1.0.0)
32
33
  mocha (0.14.0)
33
34
  metaclass (~> 0.0.1)
34
- multi_json (1.8.2)
35
- nio4r (0.5.0)
36
- pry (0.9.12.2)
37
- coderay (~> 1.0.5)
35
+ multi_json (1.8.4)
36
+ nio4r (1.0.0)
37
+ pry (0.9.12.6)
38
+ coderay (~> 1.0)
38
39
  method_source (~> 0.8)
39
40
  slop (~> 3.4)
40
- rake (10.1.0)
41
+ rake (10.1.1)
41
42
  reel (0.4.0)
42
43
  celluloid (>= 0.15.1)
43
44
  celluloid-io (>= 0.15.0)
44
45
  http (>= 0.5.0)
45
46
  http_parser.rb (>= 0.6.0.beta.2)
46
47
  websocket_parser (>= 0.1.4)
47
- slop (3.4.6)
48
- sphero (1.4.1)
48
+ robeaux (0.0.3)
49
+ slop (3.4.7)
50
+ sphero (1.5.0)
49
51
  thor (0.18.1)
50
52
  timers (1.1.0)
51
- websocket_parser (0.1.4)
52
- http
53
+ websocket_parser (0.1.6)
53
54
 
54
55
  PLATFORMS
55
56
  ruby
data/README.md CHANGED
@@ -14,6 +14,12 @@ For more information abut Artoo, check out our repo at https://github.com/hybrid
14
14
  gem install artoo-sphero
15
15
  ```
16
16
 
17
+ Afterwards you need to install `socat` - for this please run the following command (works on both OSX and Linux):
18
+
19
+ ```
20
+ artoo install socat
21
+ ```
22
+
17
23
  ## Using
18
24
 
19
25
  ```ruby
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "artoo-sphero"
7
7
  s.version = Artoo::Sphero::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Ron Evans", "Adrian Zankich", "Mike Ford"]
9
+ s.authors = ["Ron Evans", "Adrian Zankich", "Mike Ford", "Tobias Pfeiffer", "Edgar Silva"]
10
10
  s.email = ["artoo@hybridgroup.com"]
11
11
  s.homepage = "https://github.com/hybridgroup/artoo-sphero"
12
12
  s.summary = %q{Artoo adaptor and driver for Sphero robot}
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_runtime_dependency 'artoo', '>= 1.4.0'
23
- s.add_runtime_dependency 'sphero', '>= 1.4.1'
22
+ s.add_runtime_dependency 'artoo', '>= 1.6.0'
23
+ s.add_runtime_dependency 'sphero', '>= 1.5.0'
24
24
  s.add_development_dependency 'minitest', '>= 5.0'
25
25
  s.add_development_dependency 'minitest-happy'
26
26
  s.add_development_dependency 'mocha', '>= 0.14.0'
@@ -0,0 +1,67 @@
1
+ # Commands
2
+
3
+ ## roll(speed, direction)
4
+
5
+ Starts the sphero rolling at the provided speed (value between `0` and `255`) and direction (value between `0` and `360`).
6
+
7
+ ##### Params
8
+
9
+ - **speed** - params
10
+ - **direction** - params
11
+
12
+ ##### Returns
13
+
14
+ `true or nil`
15
+
16
+ ## stop
17
+
18
+ Stops the sphero.
19
+
20
+ ##### Returns
21
+
22
+ `true or nil`
23
+
24
+ ## detect_collissions
25
+
26
+ Sets the sphero to detect collisions and report them.
27
+
28
+ ##### Returns
29
+
30
+ `true or nil`
31
+
32
+ ## messages → [sphero_event]
33
+
34
+ Returns an array of sphero events, the messages reported by the sphero.
35
+
36
+ ##### Returns
37
+
38
+ `sphero_event`
39
+
40
+ ## color(:color_symbol | [red, green, blue]) → [red_int, green_int, blue_int]
41
+
42
+ You can pass a color as a symbol or an array containing RGB colors from 0 to 255 `([255, 0, 0] == red)`, if passed a symbol returns the array of RGB corresponding to the color, if passed an array of colors it returns the same array (used when setting colors to the sphero).
43
+
44
+ ##### Params
45
+
46
+ - **color_symbol** - params
47
+ - **red** - params
48
+ - **green** - params
49
+ - **blue** - params
50
+
51
+ ##### Returns
52
+
53
+ `[red_int, green_int, blue_int]`
54
+
55
+ ## set_color([red, green, blue]) → true | nil
56
+
57
+ REVISION PENDING: You can either use it in tandem with color to set the color of the sphero or just pass an array containing RGB colors on the range `0` to `255` `([255, 0, 0] == red)`.
58
+
59
+ ##### Params
60
+
61
+ - **red** - params
62
+ - **green** - params
63
+ - **blue** - params
64
+
65
+ ##### Returns
66
+
67
+ `true or nil`
@@ -0,0 +1,29 @@
1
+ # Events
2
+
3
+ ## start_driver
4
+
5
+ Starts the driver.
6
+
7
+ ## handle_collision_detected(data)
8
+
9
+ Gets triggered when the Sphero has data to send to the user, related to "collision".
10
+
11
+ ##### Data
12
+
13
+ - **data**- The returned data
14
+
15
+ ## handle_power_notification(data)
16
+
17
+ Gets triggered when the Sphero has data to send to the user, related to "power".
18
+
19
+ ##### Data
20
+
21
+ - **data**- The returned data
22
+
23
+ ## handle_sensor_data(data)
24
+
25
+ Gets triggered when the Sphero has data to send to the user, related to "sensor".
26
+
27
+ ##### Data
28
+
29
+ - **data**- The returned data
@@ -1,5 +1,5 @@
1
1
  module Artoo
2
2
  module Sphero
3
- VERSION = '1.2.0'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
@@ -14,6 +14,10 @@ module Artoo
14
14
  COMMANDS = [:roll, :stop, :detect_collisions, :messages, :set_color, :color].freeze
15
15
 
16
16
  # Starts drives and required connections
17
+
18
+ # Public: Starts the driver.
19
+ #
20
+ # Returns null.
17
21
  def start_driver
18
22
  begin
19
23
  detect_collisions
@@ -30,6 +34,9 @@ module Artoo
30
34
  end
31
35
  end
32
36
 
37
+ # Public: Handles different message events.
38
+ #
39
+ # Returns sphero_event.
33
40
  def handle_message_events
34
41
  while not connection.messages.empty? do
35
42
  evt = connection.messages.pop
@@ -46,18 +53,43 @@ module Artoo
46
53
 
47
54
  # Detects collisions
48
55
  # @param [Hash] params
56
+
57
+ # Public: Sets the sphero to detect collisions and report them.
58
+ #
59
+ # Returns true | nil.
49
60
  def detect_collisions(params={})
50
61
  connection.configure_collision_detection 0x01, 0x20, 0x20, 0x20, 0x20, 0x50
51
62
  end
52
63
 
53
64
  # Set color
54
65
  # @param [Collection] colors
66
+
67
+ # Public: You can either use it in tandem with color to set the color of the
68
+ # sphero or just pass an array containing RGB colors on the range 0 to 255
69
+ # ([255, 0, 0] == red).
70
+ #
71
+ # red - params
72
+ # green - params
73
+ # blue -params
74
+ #
75
+ # Returns true | nil.
55
76
  def set_color(*colors)
56
77
  connection.rgb(*color(*colors))
57
78
  end
58
79
 
59
80
  # Retrieves color
60
81
  # @param [Collection] colors
82
+
83
+ # Public: You can pass a color as a symbol or an array containing RGB colors from 0 to 255
84
+ # ([255, 0, 0] == red), if passed a symbol returns the array of RGB corresponding to the
85
+ # color, if passed an array of colors it returns the same array (used when setting colors to the sphero).
86
+ #
87
+ # :color_symbol - color
88
+ # red - params
89
+ # green - params
90
+ # blue -params
91
+ #
92
+ # Returns true | nil.
61
93
  def color(*colors)
62
94
  case colors.first
63
95
  when :red then RED
@@ -72,16 +104,34 @@ module Artoo
72
104
  private
73
105
 
74
106
  # Publish collision events
107
+
108
+ # Public: Handles collision message events.
109
+ #
110
+ # data - params
111
+ #
112
+ # Returns nil.
75
113
  def handle_collision_detected(data)
76
114
  publish(event_topic_name("collision"), data)
77
115
  end
78
116
 
79
117
  # Publish collision events
118
+
119
+ # Public: Handles power message events.
120
+ #
121
+ # data - params
122
+ #
123
+ # Returns nil.
80
124
  def handle_power_notification(data)
81
125
  publish(event_topic_name("power"), data)
82
126
  end
83
127
 
84
128
  # Publish collision events
129
+
130
+ # Public: Handles sensor message events.
131
+ #
132
+ # data - params
133
+ #
134
+ # Returns nil.
85
135
  def handle_sensor_data(data)
86
136
  publish(event_topic_name("sensor"), data)
87
137
  end
metadata CHANGED
@@ -1,85 +1,87 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artoo-sphero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ron Evans
8
8
  - Adrian Zankich
9
9
  - Mike Ford
10
+ - Tobias Pfeiffer
11
+ - Edgar Silva
10
12
  autorequire:
11
13
  bindir: bin
12
14
  cert_chain: []
13
- date: 2013-10-18 00:00:00.000000000 Z
15
+ date: 2014-02-06 00:00:00.000000000 Z
14
16
  dependencies:
15
17
  - !ruby/object:Gem::Dependency
16
18
  name: artoo
17
19
  requirement: !ruby/object:Gem::Requirement
18
20
  requirements:
19
- - - '>='
21
+ - - ">="
20
22
  - !ruby/object:Gem::Version
21
- version: 1.4.0
23
+ version: 1.6.0
22
24
  type: :runtime
23
25
  prerelease: false
24
26
  version_requirements: !ruby/object:Gem::Requirement
25
27
  requirements:
26
- - - '>='
28
+ - - ">="
27
29
  - !ruby/object:Gem::Version
28
- version: 1.4.0
30
+ version: 1.6.0
29
31
  - !ruby/object:Gem::Dependency
30
32
  name: sphero
31
33
  requirement: !ruby/object:Gem::Requirement
32
34
  requirements:
33
- - - '>='
35
+ - - ">="
34
36
  - !ruby/object:Gem::Version
35
- version: 1.4.1
37
+ version: 1.5.0
36
38
  type: :runtime
37
39
  prerelease: false
38
40
  version_requirements: !ruby/object:Gem::Requirement
39
41
  requirements:
40
- - - '>='
42
+ - - ">="
41
43
  - !ruby/object:Gem::Version
42
- version: 1.4.1
44
+ version: 1.5.0
43
45
  - !ruby/object:Gem::Dependency
44
46
  name: minitest
45
47
  requirement: !ruby/object:Gem::Requirement
46
48
  requirements:
47
- - - '>='
49
+ - - ">="
48
50
  - !ruby/object:Gem::Version
49
51
  version: '5.0'
50
52
  type: :development
51
53
  prerelease: false
52
54
  version_requirements: !ruby/object:Gem::Requirement
53
55
  requirements:
54
- - - '>='
56
+ - - ">="
55
57
  - !ruby/object:Gem::Version
56
58
  version: '5.0'
57
59
  - !ruby/object:Gem::Dependency
58
60
  name: minitest-happy
59
61
  requirement: !ruby/object:Gem::Requirement
60
62
  requirements:
61
- - - '>='
63
+ - - ">="
62
64
  - !ruby/object:Gem::Version
63
65
  version: '0'
64
66
  type: :development
65
67
  prerelease: false
66
68
  version_requirements: !ruby/object:Gem::Requirement
67
69
  requirements:
68
- - - '>='
70
+ - - ">="
69
71
  - !ruby/object:Gem::Version
70
72
  version: '0'
71
73
  - !ruby/object:Gem::Dependency
72
74
  name: mocha
73
75
  requirement: !ruby/object:Gem::Requirement
74
76
  requirements:
75
- - - '>='
77
+ - - ">="
76
78
  - !ruby/object:Gem::Version
77
79
  version: 0.14.0
78
80
  type: :development
79
81
  prerelease: false
80
82
  version_requirements: !ruby/object:Gem::Requirement
81
83
  requirements:
82
- - - '>='
84
+ - - ">="
83
85
  - !ruby/object:Gem::Version
84
86
  version: 0.14.0
85
87
  description: Artoo adaptor and driver for Sphero robot
@@ -89,17 +91,19 @@ executables: []
89
91
  extensions: []
90
92
  extra_rdoc_files: []
91
93
  files:
92
- - .gitignore
93
- - .ruby-gemset
94
- - .ruby-version
95
- - .rvmrc.example
96
- - .travis.yml
94
+ - ".gitignore"
95
+ - ".ruby-gemset"
96
+ - ".ruby-version"
97
+ - ".rvmrc.example"
98
+ - ".travis.yml"
97
99
  - Gemfile
98
100
  - Gemfile.lock
99
101
  - LICENSE
100
102
  - README.md
101
103
  - Rakefile
102
104
  - artoo-sphero.gemspec
105
+ - docs/commands.md
106
+ - docs/events.md
103
107
  - examples/sphero.rb
104
108
  - examples/sphero2.rb
105
109
  - examples/sphero_color.rb
@@ -122,17 +126,17 @@ require_paths:
122
126
  - lib
123
127
  required_ruby_version: !ruby/object:Gem::Requirement
124
128
  requirements:
125
- - - '>='
129
+ - - ">="
126
130
  - !ruby/object:Gem::Version
127
131
  version: '0'
128
132
  required_rubygems_version: !ruby/object:Gem::Requirement
129
133
  requirements:
130
- - - '>='
134
+ - - ">="
131
135
  - !ruby/object:Gem::Version
132
136
  version: '0'
133
137
  requirements: []
134
138
  rubyforge_project: artoo-sphero
135
- rubygems_version: 2.0.3
139
+ rubygems_version: 2.2.1
136
140
  signing_key:
137
141
  specification_version: 4
138
142
  summary: Artoo adaptor and driver for Sphero robot