artoo 0.1.1 → 0.1.2

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.
@@ -1,7 +1,7 @@
1
1
  require 'artoo'
2
2
 
3
- connection :ardrone, :adaptor => :ardrone
4
- device :drone, :driver => :ardrone
3
+ connection :ardrone, :adaptor => :ardrone, :port => '192.168.1.1:5556'
4
+ device :drone, :driver => :ardrone, :connection => :ardrone
5
5
 
6
6
  work do
7
7
  drone.start
@@ -11,8 +11,8 @@ work do
11
11
  drone.start
12
12
  drone.take_off
13
13
 
14
- after(25.seconds) { drone.hover.land }
15
- after(30.seconds) { drone.stop }
14
+ after(50.seconds) { drone.hover.land }
15
+ after(60.seconds) { drone.stop }
16
16
  end
17
17
 
18
18
  def nav_update(*data)
@@ -1,6 +1,6 @@
1
1
  require 'artoo'
2
2
 
3
- connection :firmata, :adaptor => :firmata, :port => '4567' #/dev/tty.usbserial-A700636n'
3
+ connection :firmata, :adaptor => :firmata, :port => '4567'
4
4
  device :board
5
5
  device :led, :driver => :led, :pin => 13
6
6
 
@@ -9,7 +9,7 @@ class HelloRobot < Artoo::Robot
9
9
  device :pinger, :driver => :pinger
10
10
  device :pinger2, :driver => :pinger2
11
11
 
12
- api :host => '127.0.0.1', :port => '4321'
12
+ api :host => '127.0.0.1', :port => '8080'
13
13
 
14
14
  work do
15
15
  puts "Hello from '#{name}' attached to API running at #{api_host}:#{api_port}..."
@@ -1,6 +1,6 @@
1
1
  require 'artoo'
2
2
 
3
- connection :sphero, :adaptor => :sphero, :port => '4560' #/dev/tty.Sphero-YRR-RN-SPP'
3
+ connection :sphero, :adaptor => :sphero, :port => '4560'
4
4
  device :sphero, :driver => :sphero
5
5
 
6
6
  work do
@@ -1,12 +1,12 @@
1
1
  require 'artoo'
2
2
 
3
- connection :sphero, :adaptor => :sphero, :port => '4560' #/dev/tty.Sphero-YRR-RN-SPP'
3
+ connection :sphero, :adaptor => :sphero, :port => '4560'
4
4
  device :sphero, :driver => :sphero
5
5
 
6
6
  work do
7
7
  @count = 1
8
8
  every(3.seconds) do
9
- sphero.set_color(@count % 2 == 0 ? :green : :red)
9
+ sphero.set_color(@count % 2 == 0 ? :green : :blue)
10
10
  @count += 1
11
11
  sphero.roll 60, rand(360)
12
12
  end
@@ -1,6 +1,6 @@
1
1
  require 'artoo'
2
2
 
3
- connection :sphero, :adaptor => :sphero, :port => '4560' #'/dev/tty.Sphero-BWY-RN-SPP'
3
+ connection :sphero, :adaptor => :sphero, :port => '4560'
4
4
  device :sphero, :driver => :sphero
5
5
 
6
6
  work do
@@ -1,13 +1,4 @@
1
1
  require 'artoo/robot'
2
-
3
- #SPHEROS = ["4567", "4568", "4569", "4570", "4571"]
4
- SPHEROS = {"4560" => "/dev/tty.Sphero-BRG-RN-SPP",
5
- "4561" => "/dev/tty.Sphero-YBW-RN-SPP",
6
- "4562" => "/dev/tty.Sphero-BWY-RN-SPP",
7
- "4563" => "/dev/tty.Sphero-YRR-RN-SPP",
8
- "4564" => "/dev/tty.Sphero-OBG-RN-SPP",
9
- "4565" => "/dev/tty.Sphero-GOB-RN-SPP",
10
- "4566" => "/dev/tty.Sphero-PYG-RN-SPP"}
11
2
 
12
3
  class SpheroRobot < Artoo::Robot
13
4
  connection :sphero, :adaptor => :sphero
@@ -15,14 +6,29 @@ class SpheroRobot < Artoo::Robot
15
6
 
16
7
  work do
17
8
  @count = 1
18
- every(3.seconds) do
19
- sphero.set_color(@count % 2 == 0 ? :green : :red)
9
+
10
+ every(1.second) do
11
+ sphero.set_color(@count % 2 == 0 ? :white : :blue)
20
12
  @count += 1
13
+ end
14
+
15
+ every(3.seconds) do
21
16
  sphero.roll 90, rand(360)
22
17
  end
18
+
19
+ after(60.seconds) do
20
+ sphero.stop
21
+ end
23
22
  end
24
23
  end
25
24
 
25
+ SPHEROS = {"4560" => "/dev/tty.Sphero-BRG-RN-SPP",
26
+ "4561" => "/dev/tty.Sphero-YBW-RN-SPP",
27
+ "4562" => "/dev/tty.Sphero-BWY-RN-SPP",
28
+ "4563" => "/dev/tty.Sphero-YRR-RN-SPP",
29
+ "4564" => "/dev/tty.Sphero-OBG-RN-SPP",
30
+ "4565" => "/dev/tty.Sphero-GOB-RN-SPP",
31
+ "4566" => "/dev/tty.Sphero-PYG-RN-SPP"}
26
32
  robots = []
27
33
  SPHEROS.each_key {|p|
28
34
  robots << SpheroRobot.new(:connections =>
@@ -9,7 +9,6 @@ module Artoo
9
9
 
10
10
  def finalize
11
11
  if connected?
12
- #sphero.stop
13
12
  sphero.close
14
13
  end
15
14
  end
@@ -116,7 +116,11 @@ module Artoo
116
116
  if resp && !resp.nil?
117
117
  return if req.is_a?(Reel::WebSocket)
118
118
  status, body = resp
119
- req.respond status, body
119
+ begin
120
+ req.respond status, body
121
+ rescue Errno::EAGAIN
122
+ retry
123
+ end
120
124
  else
121
125
  req.respond :not_found, "NOT FOUND"
122
126
  end
@@ -1,5 +1,5 @@
1
1
  module Artoo
2
2
  unless const_defined?('VERSION')
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ prerelease:
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ron Evans
@@ -10,7 +10,7 @@ authors:
10
10
  - Ari Lerner
11
11
  - Mario Ricalde
12
12
  - Daniel Fischer
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
  date: 2013-02-23 00:00:00.000000000 Z
@@ -24,7 +24,7 @@ executables:
24
24
  extensions: []
25
25
  extra_rdoc_files: []
26
26
  files:
27
- - .gitignore
27
+ - ".gitignore"
28
28
  - Gemfile
29
29
  - Gemfile.lock
30
30
  - Guardfile
@@ -81,7 +81,6 @@ files:
81
81
  - examples/sphero_firmata.rb
82
82
  - examples/sphero_messages.rb
83
83
  - examples/sphero_multiple.rb
84
- - examples/wiiclassic.rb
85
84
  - lib/artoo.rb
86
85
  - lib/artoo/adaptors/adaptor.rb
87
86
  - lib/artoo/adaptors/ardrone.rb
@@ -137,32 +136,28 @@ files:
137
136
  - test/utility_test.rb
138
137
  homepage: https://github.com/hybridgroup/artoo
139
138
  licenses: []
140
- post_install_message:
139
+ post_install_message:
141
140
  rdoc_options: []
142
141
  require_paths:
143
142
  - lib
144
143
  required_ruby_version: !ruby/object:Gem::Requirement
145
- none: false
146
144
  requirements:
147
- - - ! '>='
145
+ - - ">="
148
146
  - !ruby/object:Gem::Version
149
- version: '0'
150
- segments:
151
- - 0
152
- hash: 655550087860009642
153
- required_rubygems_version: !ruby/object:Gem::Requirement
147
+ version: !binary |-
148
+ MA==
154
149
  none: false
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
151
  requirements:
156
- - - ! '>='
152
+ - - ">="
157
153
  - !ruby/object:Gem::Version
158
- version: '0'
159
- segments:
160
- - 0
161
- hash: 655550087860009642
154
+ version: !binary |-
155
+ MA==
156
+ none: false
162
157
  requirements: []
163
158
  rubyforge_project: artoo
164
- rubygems_version: 1.8.23
165
- signing_key:
159
+ rubygems_version: 1.8.24
160
+ signing_key:
166
161
  specification_version: 3
167
162
  summary: Ruby-based microframework for robotics
168
163
  test_files:
@@ -1,94 +0,0 @@
1
- require 'artoo'
2
-
3
- connection :ardrone, :adaptor => :ardrone, :port => '192.168.1.1:5556'
4
- #connection :ardrone, :adaptor => :ardrone, :port => '192.168.0.100:5556'
5
- device :drone, :driver => :ardrone, :connection => :ardrone
6
-
7
- #connection :arduino, :adaptor => :firmata, :port => "/dev/ttyACM0"
8
- connection :arduino, :adaptor => :firmata, :port => "8023"
9
- device :classic, :driver => :wiiclassic, :connection => :arduino, :interval => 0.1
10
-
11
- work do
12
- @rotate_pitch = 0.5
13
- @fly_pitch = 0.7
14
- @altitude_pitch = 1
15
- @toggle_camera = 0
16
- on classic, :a_button => proc {
17
- puts "Take Off"
18
- drone.take_off
19
- }
20
- on classic, :b_button => proc {
21
- puts "Hover"
22
- drone.hover
23
- }
24
- on classic, :x_button => proc {
25
- puts "Land"
26
- drone.land
27
- }
28
- on classic, :y_button => proc {
29
- puts "Toggle camera"
30
- if @toggle_camera == 0
31
- puts "Bottom Camera Enabled"
32
- drone.bottom_camera
33
- @toggle_camera = 1
34
- else
35
- puts "Front Camera Enabled"
36
- drone.front_camera
37
- @toggle_camera = 0
38
- end
39
- }
40
- on classic, :home_button => proc {
41
- puts "EMERGENGY!!!"
42
- drone.emergency
43
- }
44
- on classic, :start_button => proc {
45
- puts "Start"
46
- drone.start
47
- }
48
- on classic, :select_button => proc {
49
- puts "Stop"
50
- drone.stop
51
- }
52
- on classic, :ry_up => proc {
53
- puts "Up"
54
- drone.up(@altitude_pitch)
55
- }
56
- on classic, :ry_down => proc {
57
- puts "Down"
58
- drone.down(@altitude_pitch)
59
- }
60
- on classic, :ly_up => proc {
61
- puts "Forward"
62
- drone.forward(@fly_pitch)
63
- }
64
- on classic, :ly_down => proc {
65
- puts "Backward"
66
- drone.backward(@fly_pitch)
67
- }
68
- on classic, :lx_right => proc {
69
- puts "Right"
70
- drone.right(@fly_pitch)
71
- }
72
- on classic, :lx_left => proc {
73
- puts "Left"
74
- drone.left(@fly_pitch)
75
- }
76
- on classic, :reset_pitch_roll => proc {
77
- drone.left(0.0)
78
- drone.forward(0.0)
79
- }
80
- on classic, :rotate_left => proc {
81
- puts "rotate left"
82
- drone.turn_left(@rotate_pitch)
83
- }
84
- on classic, :rotate_right => proc {
85
- puts "rotate right"
86
- drone.turn_right(@rotate_pitch)
87
- }
88
- on classic, :reset_rotate => proc {
89
- drone.turn_left(0.0)
90
- }
91
- on classic, :reset_altitude => proc {
92
- drone.up(0.0)
93
- }
94
- end