artoo-ardrone 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/Gemfile.lock +14 -13
- data/LICENSE +1 -1
- data/README.md +22 -5
- data/artoo-ardrone.gemspec +1 -1
- data/docs/commands_flight.md +234 -0
- data/docs/commands_nav.md +13 -0
- data/docs/events_flight.md +9 -0
- data/docs/events_nav.md +47 -0
- data/docs/events_video.md +9 -0
- data/examples/ardrone_ps3.rb +73 -0
- data/lib/artoo-ardrone/version.rb +1 -1
- data/test/drivers/ardrone_navigation_test.rb +44 -1
- data/test/drivers/ardrone_test.rb +47 -1
- data/test/drivers/ardrone_video_test.rb +19 -1
- metadata +26 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 911540059c16451ee7d89eb38fff846c096caa56
|
4
|
+
data.tar.gz: e9aae4aa678c9e33ddb077b129ee89501353c52f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a401b77d074bad0c57354d9ef3ca29f72b77db86049f03568e4739ac5d56e8f4bb2e02e3b366f0a47e4ed2fba4f36072d1af8797c3424a4987ed8e91ee7b286
|
7
|
+
data.tar.gz: 04913e0221fb6f4365fe0209c4f4b095f308b78e21690a2e5adb93207343e179b78258120fd05e7122270ff9b7bb4d4f0bb549c70ff65988654e4d7712374b8e
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
artoo-ardrone (1.
|
5
|
-
artoo (>= 1.
|
4
|
+
artoo-ardrone (1.4.0)
|
5
|
+
artoo (>= 1.6.0)
|
6
6
|
hybridgroup-argus (>= 0.5.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
artoo (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
|
25
|
+
coderay (1.1.0)
|
25
26
|
http (0.5.0)
|
26
27
|
http_parser.rb
|
27
|
-
http_parser.rb (0.6.0
|
28
|
+
http_parser.rb (0.6.0)
|
28
29
|
hybridgroup-argus (0.5.1)
|
29
30
|
metaclass (0.0.1)
|
30
31
|
method_source (0.8.2)
|
@@ -32,24 +33,24 @@ GEM
|
|
32
33
|
minitest-happy (1.0.0)
|
33
34
|
mocha (0.14.0)
|
34
35
|
metaclass (~> 0.0.1)
|
35
|
-
multi_json (1.8.
|
36
|
-
nio4r (0.
|
37
|
-
pry (0.9.12.
|
38
|
-
coderay (~> 1.0
|
36
|
+
multi_json (1.8.4)
|
37
|
+
nio4r (1.0.0)
|
38
|
+
pry (0.9.12.6)
|
39
|
+
coderay (~> 1.0)
|
39
40
|
method_source (~> 0.8)
|
40
41
|
slop (~> 3.4)
|
41
|
-
rake (10.1.
|
42
|
+
rake (10.1.1)
|
42
43
|
reel (0.4.0)
|
43
44
|
celluloid (>= 0.15.1)
|
44
45
|
celluloid-io (>= 0.15.0)
|
45
46
|
http (>= 0.5.0)
|
46
47
|
http_parser.rb (>= 0.6.0.beta.2)
|
47
48
|
websocket_parser (>= 0.1.4)
|
48
|
-
|
49
|
+
robeaux (0.0.3)
|
50
|
+
slop (3.4.7)
|
49
51
|
thor (0.18.1)
|
50
52
|
timers (1.1.0)
|
51
|
-
websocket_parser (0.1.
|
52
|
-
http
|
53
|
+
websocket_parser (0.1.6)
|
53
54
|
|
54
55
|
PLATFORMS
|
55
56
|
ruby
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -59,10 +59,27 @@ def fly(*data)
|
|
59
59
|
end
|
60
60
|
```
|
61
61
|
|
62
|
+
## Documentation
|
63
|
+
|
64
|
+
Check out our [documentation](http://artoo.io/documentation/) for lots of information about how to use Artoo.
|
65
|
+
|
66
|
+
## IRC
|
67
|
+
|
68
|
+
Need more help? Just want to say "Hello"? Come visit us on IRC freenode #artoo
|
69
|
+
|
62
70
|
## Contributing
|
63
71
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
72
|
+
* All patches must be provided under the Apache 2.0 License
|
73
|
+
* Please use the -s option in git to "sign off" that the commit is your work and you are providing it under the Apache 2.0 License
|
74
|
+
* Submit a Github Pull Request to the appropriate branch and ideally discuss the changes with us in IRC.
|
75
|
+
* We will look at the patch, test it out, and give you feedback.
|
76
|
+
* Avoid doing minor whitespace changes, renamings, etc. along with merged content. These will be done by the maintainers from time to time but they can complicate merges and should be done seperately.
|
77
|
+
* Take care to maintain the existing coding style.
|
78
|
+
* Add unit tests for any new or changed functionality.
|
79
|
+
* All pull requests should be "fast forward"
|
80
|
+
* If there are commits after yours use “git rebase -i <new_head_branch>”
|
81
|
+
* If you have local changes you may need to use “git stash”
|
82
|
+
* For git help see [progit](http://git-scm.com/book) which is an awesome (and free) book on git
|
83
|
+
|
84
|
+
|
85
|
+
(c) 2012-2014 The Hybrid Group
|
data/artoo-ardrone.gemspec
CHANGED
@@ -19,7 +19,7 @@ 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.
|
22
|
+
s.add_runtime_dependency 'artoo', '>= 1.6.0'
|
23
23
|
s.add_runtime_dependency 'hybridgroup-argus', '>= 0.5.0'
|
24
24
|
s.add_development_dependency 'minitest', '>= 5.0'
|
25
25
|
s.add_development_dependency 'minitest-happy'
|
@@ -0,0 +1,234 @@
|
|
1
|
+
# Commands
|
2
|
+
|
3
|
+
## start
|
4
|
+
|
5
|
+
Starts up the drone.
|
6
|
+
|
7
|
+
##### Params
|
8
|
+
|
9
|
+
`no params`
|
10
|
+
|
11
|
+
##### Returns
|
12
|
+
|
13
|
+
`drone`
|
14
|
+
|
15
|
+
## stop
|
16
|
+
|
17
|
+
Stops the drone.
|
18
|
+
|
19
|
+
##### Params
|
20
|
+
|
21
|
+
`no params`
|
22
|
+
|
23
|
+
##### Returns
|
24
|
+
|
25
|
+
`drone`
|
26
|
+
|
27
|
+
## hover
|
28
|
+
|
29
|
+
Causes the drone to hover at current altitude.
|
30
|
+
|
31
|
+
##### Params
|
32
|
+
|
33
|
+
`no params`
|
34
|
+
|
35
|
+
##### Returns
|
36
|
+
|
37
|
+
`drone`
|
38
|
+
|
39
|
+
## land
|
40
|
+
|
41
|
+
Causes the drone to begin its landing sequence.
|
42
|
+
|
43
|
+
##### Params
|
44
|
+
|
45
|
+
`no params`
|
46
|
+
|
47
|
+
##### Returns
|
48
|
+
|
49
|
+
`drone`
|
50
|
+
|
51
|
+
## take_off
|
52
|
+
|
53
|
+
Causes the drone to take off, if already started.
|
54
|
+
|
55
|
+
##### Params
|
56
|
+
|
57
|
+
`no params`
|
58
|
+
|
59
|
+
##### Returns
|
60
|
+
|
61
|
+
`drone`
|
62
|
+
|
63
|
+
## emergency
|
64
|
+
|
65
|
+
Causes the drone to make an immediate emergency landing.
|
66
|
+
|
67
|
+
##### Params
|
68
|
+
|
69
|
+
`no params`
|
70
|
+
|
71
|
+
##### Returns
|
72
|
+
|
73
|
+
`drone`
|
74
|
+
|
75
|
+
## front_camera
|
76
|
+
|
77
|
+
Causes the drone to turn on the front-facing camera.
|
78
|
+
|
79
|
+
##### Params
|
80
|
+
|
81
|
+
`no params`
|
82
|
+
|
83
|
+
##### Returns
|
84
|
+
|
85
|
+
`drone`
|
86
|
+
|
87
|
+
## bottom_camera
|
88
|
+
|
89
|
+
Causes the drone to turn on the bottom-facing camera.
|
90
|
+
|
91
|
+
##### Params
|
92
|
+
|
93
|
+
`no params`
|
94
|
+
|
95
|
+
##### Returns
|
96
|
+
|
97
|
+
`drone`
|
98
|
+
|
99
|
+
## up
|
100
|
+
|
101
|
+
Causes the drone to increase altitude.
|
102
|
+
|
103
|
+
##### Params
|
104
|
+
|
105
|
+
`no params`
|
106
|
+
|
107
|
+
##### Returns
|
108
|
+
|
109
|
+
`drone`
|
110
|
+
|
111
|
+
## down
|
112
|
+
|
113
|
+
Causes the drone to decrease altitude.
|
114
|
+
|
115
|
+
##### Params
|
116
|
+
|
117
|
+
`no params`
|
118
|
+
|
119
|
+
##### Returns
|
120
|
+
|
121
|
+
`drone`
|
122
|
+
|
123
|
+
## left
|
124
|
+
|
125
|
+
Causes the drone to bank to the left.
|
126
|
+
|
127
|
+
##### Params
|
128
|
+
|
129
|
+
`no params`
|
130
|
+
|
131
|
+
##### Returns
|
132
|
+
|
133
|
+
`drone`
|
134
|
+
|
135
|
+
## right
|
136
|
+
|
137
|
+
Causes the drone to bank to the right.
|
138
|
+
|
139
|
+
##### Params
|
140
|
+
|
141
|
+
`no params`
|
142
|
+
|
143
|
+
##### Returns
|
144
|
+
|
145
|
+
`drone`
|
146
|
+
|
147
|
+
## forward
|
148
|
+
|
149
|
+
Causes the drone to bank forward.
|
150
|
+
|
151
|
+
##### Params
|
152
|
+
|
153
|
+
`no params`
|
154
|
+
|
155
|
+
##### Returns
|
156
|
+
|
157
|
+
`drone`
|
158
|
+
|
159
|
+
## backward
|
160
|
+
|
161
|
+
Causes the drone to bank backward.
|
162
|
+
|
163
|
+
##### Params
|
164
|
+
|
165
|
+
`no params`
|
166
|
+
|
167
|
+
##### Returns
|
168
|
+
|
169
|
+
`drone`
|
170
|
+
|
171
|
+
## turn_left
|
172
|
+
|
173
|
+
Causes the drone to rotate to the left.
|
174
|
+
|
175
|
+
##### Params
|
176
|
+
|
177
|
+
`no params`
|
178
|
+
|
179
|
+
##### Returns
|
180
|
+
|
181
|
+
`drone`
|
182
|
+
|
183
|
+
## turn_right
|
184
|
+
|
185
|
+
Causes the drone to rotate to the right.
|
186
|
+
|
187
|
+
##### Params
|
188
|
+
|
189
|
+
`no params`
|
190
|
+
|
191
|
+
##### Returns
|
192
|
+
|
193
|
+
`drone`
|
194
|
+
|
195
|
+
## reset_watchdog
|
196
|
+
|
197
|
+
Reset the watchdog in the drone.
|
198
|
+
|
199
|
+
##### Params
|
200
|
+
|
201
|
+
`no params`
|
202
|
+
|
203
|
+
##### Returns
|
204
|
+
|
205
|
+
`drone`
|
206
|
+
|
207
|
+
## led(color_animation, strength, duration)
|
208
|
+
|
209
|
+
Turn on the drone's built in LEDs with the color_animation passed, strength and duration color_animation might be one of the following: `:blink_green_red`, `:blink_green`, `:blink_red`, `:blink_orange`, `:snake_green_red`, `:fire`, `:standard`, `:red`, `:green`, `:red_snake`, `:blank`, `:right_missile`, `:left_missile`, `:double_missile`, `:front_left_green_others_red`, `:front_right_green_others_red`, `:rear_right_green_others_red`, `:rear_left_green_others_red`, `:left_green_right_red`, `:left_red_right_green`, `:blink_standard`
|
210
|
+
|
211
|
+
##### Params
|
212
|
+
|
213
|
+
- **color_animation** - params
|
214
|
+
- **strength** - params
|
215
|
+
- **duration** - params
|
216
|
+
|
217
|
+
##### Returns
|
218
|
+
|
219
|
+
`drone`
|
220
|
+
|
221
|
+
## animate(animation, duration)
|
222
|
+
|
223
|
+
Animate the ardrone to do flips and turns depending on selection, available animation options are: `:phi_m30_deg`,`:phi_30_deg`, `:theta_m30_deg`, `:theta_30_deg`, `:theta_20_deg_yaw_200_deg`, `:theta_20_deg_yaw_m_200_deg`, `:turnaround`, `:turnaround_go_down`, `:yaw_shake`, `:yaw_dance`, `:phi_dance`, `:theta_dance`, `:vz_dance`, `:wave`, `:phi_theta_mixed`, `:double_phi_theta_mixed`, `:flip_ahead`, `:flip_behind`, `:flip_left`, `:flip_right`
|
224
|
+
|
225
|
+
##### Params
|
226
|
+
|
227
|
+
- **animation** - params
|
228
|
+
- **duration** - params
|
229
|
+
|
230
|
+
##### Returns
|
231
|
+
|
232
|
+
`drone`
|
233
|
+
|
234
|
+
|
data/docs/events_nav.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Events
|
2
|
+
|
3
|
+
## start_driver
|
4
|
+
|
5
|
+
Starts the driver
|
6
|
+
|
7
|
+
## navdata
|
8
|
+
|
9
|
+
Gets triggered every time interval amount of time passes, returns and lets you access a NavData object containing the attributes described below:
|
10
|
+
|
11
|
+
- navdata.sequence_number → String (returns the sequence number) -
|
12
|
+
- navdata.vision_flag → String (returns the sequence number) -
|
13
|
+
- navdata.flying? → Boolean (is the ardrone flying?) -
|
14
|
+
- navdata.communication_lost? → Boolean (is communication lost?) -
|
15
|
+
- navdata.com_watchdog_problem? → Boolean (is there a watchdog problem?) -
|
16
|
+
- navdata.bootstrap? → Boolean (boostrap navigation setup?) -
|
17
|
+
|
18
|
+
|
19
|
+
## demo
|
20
|
+
|
21
|
+
Gets triggered every time interval amount of time passes, returns and lets you access a NavOptionDemo object containing navigation data as described below:
|
22
|
+
|
23
|
+
- nav_option_demo.control_state_name → String (returns control state name) -
|
24
|
+
- nav_option_demo.control_state → Integer (returns control state) -
|
25
|
+
- nav_option_demo.battery_level → Integer -
|
26
|
+
- nav_option_demo.pitch → float (returns the current pitch) -
|
27
|
+
- nav_option_demo.roll → float (returns the current roll) -
|
28
|
+
- nav_option_demo.yaw → float (returns the current yaw) -
|
29
|
+
- nav_option_demo.altitude → float (returns the current altitude) -
|
30
|
+
- nav_option_demo.vx → float (returns the current velocity on X axis) -
|
31
|
+
- nav_option_demo.vy → float (returns the current velocity on Y axis) -
|
32
|
+
- nav_option_demo.vz → float (returns the current velocity on Z axis) -
|
33
|
+
|
34
|
+
## vision_detect
|
35
|
+
|
36
|
+
Gets triggered every time interval amount of time passes, returns and lets you access a NavOptionVisionDetect object containing the following data:
|
37
|
+
|
38
|
+
- nav_option_vision_detect.detected_count → Integer (Number of devices detected) -
|
39
|
+
- nav_option_vision_detect.type → String -
|
40
|
+
- nav_option_vision_detect.name → String -
|
41
|
+
- nav_option_vision_detect.x → integer -
|
42
|
+
- nav_option_vision_detect.y → integer -
|
43
|
+
- nav_option_vision_detect.width → integer -
|
44
|
+
- nav_option_vision_detect.height → integer -
|
45
|
+
- nav_option_vision_detect.distance → integer -
|
46
|
+
- nav_option_vision_detect.orientation_angle → float -
|
47
|
+
- nav_option_vision_detect.camera_source → integer -
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'artoo'
|
2
|
+
|
3
|
+
connection :ardrone, :adaptor => :ardrone, :port => '192.168.1.1:5556'
|
4
|
+
device :drone, :driver => :ardrone, :connection => :ardrone
|
5
|
+
|
6
|
+
connection :joystick, :adaptor => :joystick
|
7
|
+
device :controller, :driver => :ps3, :connection => :joystick, :interval => 0.01
|
8
|
+
|
9
|
+
OFFSETS = {
|
10
|
+
:dx => 32767.0
|
11
|
+
}
|
12
|
+
@toggle_camera = 0
|
13
|
+
|
14
|
+
work do
|
15
|
+
on controller, :button_square => proc { drone.take_off }
|
16
|
+
on controller, :button_triangle => proc { drone.hover }
|
17
|
+
on controller, :button_x => proc { drone.land }
|
18
|
+
on controller, :button_circle => proc {
|
19
|
+
unless @toggle_camera
|
20
|
+
drone.bottom_camera
|
21
|
+
@toggle_camera = 1
|
22
|
+
else
|
23
|
+
drone.front_camera
|
24
|
+
@toggle_camera = 0
|
25
|
+
end
|
26
|
+
}
|
27
|
+
on controller, :button_home => proc { drone.emergency }
|
28
|
+
on controller, :button_start => proc { drone.start }
|
29
|
+
on controller, :button_select => proc { drone.stop }
|
30
|
+
|
31
|
+
on controller, :joystick_0 => proc { |*value|
|
32
|
+
pair = value[1]
|
33
|
+
if pair[:y] < 0
|
34
|
+
drone.forward(validate_pitch(pair[:y], OFFSETS[:dx]))
|
35
|
+
elsif pair[:y] > 0
|
36
|
+
drone.backward(validate_pitch(pair[:y], OFFSETS[:dx]))
|
37
|
+
else
|
38
|
+
drone.forward(0.0)
|
39
|
+
end
|
40
|
+
|
41
|
+
if pair[:x] > 0
|
42
|
+
drone.right(validate_pitch(pair[:x], OFFSETS[:dx]))
|
43
|
+
elsif pair[:x] < 0
|
44
|
+
drone.left(validate_pitch(pair[:x], OFFSETS[:dx]))
|
45
|
+
else
|
46
|
+
drone.right(0.0)
|
47
|
+
end
|
48
|
+
}
|
49
|
+
|
50
|
+
on controller, :joystick_1 => proc { |*value|
|
51
|
+
pair = value[1]
|
52
|
+
if pair[:y] < 0
|
53
|
+
drone.up(validate_pitch(pair[:y], OFFSETS[:dx]))
|
54
|
+
elsif pair[:y] > 0
|
55
|
+
drone.down(validate_pitch(pair[:y], OFFSETS[:dx]))
|
56
|
+
else
|
57
|
+
drone.up(0.0)
|
58
|
+
end
|
59
|
+
|
60
|
+
if pair[:x] > 0
|
61
|
+
drone.turn_right(validate_pitch(pair[:x], OFFSETS[:dx]))
|
62
|
+
elsif pair[:x] < 0
|
63
|
+
drone.turn_left(validate_pitch(pair[:x], OFFSETS[:dx]))
|
64
|
+
else
|
65
|
+
drone.turn_right(0.0)
|
66
|
+
end
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
def validate_pitch(data, offset)
|
71
|
+
value = data.abs / offset
|
72
|
+
value >= 0.1 ? (value <= 1.0 ? value.round(2) : 1.0) : 0.0
|
73
|
+
end
|
@@ -5,7 +5,50 @@ describe Artoo::Drivers::ArdroneNavigation do
|
|
5
5
|
before do
|
6
6
|
@device = mock('device')
|
7
7
|
@driver = Artoo::Drivers::ArdroneNavigation.new(:parent => @device)
|
8
|
+
@connection = mock('connection')
|
9
|
+
@device.stubs(:connection).returns(@connection)
|
10
|
+
@navdata = mock('navdata')
|
8
11
|
end
|
9
12
|
|
10
|
-
|
13
|
+
describe 'ArdroneNavigation#start_driver' do
|
14
|
+
it 'starts driver and handles updates' do
|
15
|
+
@device.expects(:interval).returns(0.01)
|
16
|
+
@device.expects(:event_topic_name).with('ready')
|
17
|
+
@driver.start_driver
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'ArdroneNavigation#handle_update' do
|
22
|
+
it 'receives data and publishes demo when demo option' do
|
23
|
+
@connection.expects(:receive_data).returns(@navdata)
|
24
|
+
@navdata.stubs(:emergency_landing?)
|
25
|
+
@navdata.expects(:options).returns([::Argus::NavOptionDemo])
|
26
|
+
@navdata.expects(:options=).with(Argus::NavOptionDemo)
|
27
|
+
@device.expects(:event_topic_name).with('update')
|
28
|
+
@device.expects(:event_topic_name).with('navdata')
|
29
|
+
@driver.handle_update
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'receives data and publishes vision_detect when vision_detect option' do
|
33
|
+
@connection.expects(:receive_data).returns(@navdata)
|
34
|
+
@navdata.stubs(:emergency_landing?)
|
35
|
+
@navdata.expects(:options).returns([::Argus::NavOptionVisionDetect])
|
36
|
+
@navdata.expects(:options=).with(Argus::NavOptionVisionDetect)
|
37
|
+
@device.expects(:event_topic_name).with('update')
|
38
|
+
@device.expects(:event_topic_name).with('navdata')
|
39
|
+
@driver.handle_update
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'ArdroneNavigation#emergency_landing?' do
|
44
|
+
it 'returns emergency_landing value true when true' do
|
45
|
+
@driver.instance_variable_set(:@emergency_landing, true)
|
46
|
+
@driver.emergency_landing?.must_equal true
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'returns emergency_landing value false when false' do
|
50
|
+
@driver.instance_variable_set(:@emergency_landing, false)
|
51
|
+
@driver.emergency_landing?.must_equal false
|
52
|
+
end
|
53
|
+
end
|
11
54
|
end
|
@@ -5,7 +5,53 @@ describe Artoo::Drivers::Ardrone do
|
|
5
5
|
before do
|
6
6
|
@device = mock('device')
|
7
7
|
@driver = Artoo::Drivers::Ardrone.new(:parent => @device)
|
8
|
+
@connection = mock('connection')
|
9
|
+
@device.stubs(:connection).returns(@connection)
|
8
10
|
end
|
9
11
|
|
10
|
-
|
12
|
+
describe 'Ardrone#start' do
|
13
|
+
it 'starts without nav when nav is nil' do
|
14
|
+
@connection.expects(:start).with(false)
|
15
|
+
@device.expects(:event_topic_name).with("ready")
|
16
|
+
@driver.start(false)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'starts with nav when nav is not nil' do
|
20
|
+
@connection.expects(:start).with(false)
|
21
|
+
@driver.stubs(:start_with_nav).returns([])
|
22
|
+
@driver.start(true)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe 'Ardrone#start_with_nav' do
|
27
|
+
before do
|
28
|
+
@nav = mock('navigation')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'starts with nav when theres no emergency landing' do
|
32
|
+
@nav.stubs(:emergency_landing?).returns(false)
|
33
|
+
@device.expects(:event_topic_name).with("ready")
|
34
|
+
@driver.start_with_nav(@nav)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'starts with nav when theres an emergency landing' do
|
38
|
+
@nav.stubs(:emergency_landing?).twice.returns(true)
|
39
|
+
@connection.expects(:disable_emergency)
|
40
|
+
@driver.start_with_nav(@nav)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'Ardrone#enable_emergency' do
|
45
|
+
it 'enables emergency' do
|
46
|
+
@connection.expects(:enable_emergency)
|
47
|
+
@driver.enable_emergency
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'Ardrone#disable_emergency' do
|
52
|
+
it 'disables emergency' do
|
53
|
+
@connection.expects(:disable_emergency)
|
54
|
+
@driver.disable_emergency
|
55
|
+
end
|
56
|
+
end
|
11
57
|
end
|
@@ -5,7 +5,25 @@ describe Artoo::Drivers::ArdroneVideo do
|
|
5
5
|
before do
|
6
6
|
@device = mock('device')
|
7
7
|
@driver = Artoo::Drivers::ArdroneVideo.new(:parent => @device)
|
8
|
+
@connection = mock('connection')
|
9
|
+
@device.stubs(:connection).returns(@connection)
|
10
|
+
@video = mock('video')
|
8
11
|
end
|
9
12
|
|
10
|
-
|
13
|
+
describe 'ArdroneVideo#start_driver' do
|
14
|
+
it 'starts drives and handles video frame' do
|
15
|
+
@device.expects(:interval).returns(0.01)
|
16
|
+
@driver.start_driver
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'ArdroneVideo#handle_frame' do
|
21
|
+
it 'retrieves frame and publishes data' do
|
22
|
+
@connection.expects(:receive_data).returns(@video)
|
23
|
+
@device.expects(:event_topic_name).with('update')
|
24
|
+
@device.expects(:event_topic_name).with('frame')
|
25
|
+
@video.expects(:frame)
|
26
|
+
@driver.handle_frame
|
27
|
+
end
|
28
|
+
end
|
11
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artoo-ardrone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ron Evans
|
@@ -12,76 +12,76 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: artoo
|
19
19
|
requirement: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.
|
23
|
+
version: 1.6.0
|
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: 1.
|
30
|
+
version: 1.6.0
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: hybridgroup-argus
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: 0.5.0
|
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
44
|
version: 0.5.0
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: minitest
|
47
47
|
requirement: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '5.0'
|
52
52
|
type: :development
|
53
53
|
prerelease: false
|
54
54
|
version_requirements: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '5.0'
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: minitest-happy
|
61
61
|
requirement: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
|
-
- -
|
63
|
+
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: mocha
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- -
|
77
|
+
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: 0.14.0
|
80
80
|
type: :development
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- -
|
84
|
+
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: 0.14.0
|
87
87
|
description: Artoo adaptor and driver for Parrot ARDrone 2.0
|
@@ -91,19 +91,25 @@ executables: []
|
|
91
91
|
extensions: []
|
92
92
|
extra_rdoc_files: []
|
93
93
|
files:
|
94
|
-
- .gitignore
|
95
|
-
- .rvmrc.example
|
96
|
-
- .travis.yml
|
94
|
+
- ".gitignore"
|
95
|
+
- ".rvmrc.example"
|
96
|
+
- ".travis.yml"
|
97
97
|
- Gemfile
|
98
98
|
- Gemfile.lock
|
99
99
|
- LICENSE
|
100
100
|
- README.md
|
101
101
|
- Rakefile
|
102
102
|
- artoo-ardrone.gemspec
|
103
|
+
- docs/commands_flight.md
|
104
|
+
- docs/commands_nav.md
|
105
|
+
- docs/events_flight.md
|
106
|
+
- docs/events_nav.md
|
107
|
+
- docs/events_video.md
|
103
108
|
- examples/ardrone.rb
|
104
109
|
- examples/ardrone_animate.rb
|
105
110
|
- examples/ardrone_autoreset.rb
|
106
111
|
- examples/ardrone_nav.rb
|
112
|
+
- examples/ardrone_ps3.rb
|
107
113
|
- examples/ardrone_video.rb
|
108
114
|
- lib/artoo-ardrone.rb
|
109
115
|
- lib/artoo-ardrone/version.rb
|
@@ -127,17 +133,17 @@ require_paths:
|
|
127
133
|
- lib
|
128
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
135
|
requirements:
|
130
|
-
- -
|
136
|
+
- - ">="
|
131
137
|
- !ruby/object:Gem::Version
|
132
138
|
version: '0'
|
133
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
140
|
requirements:
|
135
|
-
- -
|
141
|
+
- - ">="
|
136
142
|
- !ruby/object:Gem::Version
|
137
143
|
version: '0'
|
138
144
|
requirements: []
|
139
145
|
rubyforge_project: artoo-ardrone
|
140
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.2.1
|
141
147
|
signing_key:
|
142
148
|
specification_version: 4
|
143
149
|
summary: Artoo adaptor and driver for Parrot ARDrone 2.0
|