artoo-ardrone 1.1.0 → 1.2.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: 9706ba383d1eff7aca691823e9d17367de039fc1
4
- data.tar.gz: 229303eb61dad5208c2112a269fb74806e030f82
3
+ metadata.gz: 2bc5acd4687ec069209f7bb716184b457813530d
4
+ data.tar.gz: 60232183554a45cc4faa9c9fc966e3366b651dd5
5
5
  SHA512:
6
- metadata.gz: b18a4864a49bf138104f7447c1372f570cff1ec8c99e97537ce804257f451b7aeb6bff01393ec4aff243e16a08c239cd496502cec9f9d65d159eeef08ec1d762
7
- data.tar.gz: f11be5ec4f6aae5bfebd2e23daa62aacc3698a126a170ac5e46133d0825ce7c31e82d2e317d6404d6b5d1f1d510b62b5daa280927afdd2d6174158a94b0d9d33
6
+ metadata.gz: 9f670ede922a86b83dbe08a8d298a554c78d0828e551a5e2bfbac5028ec72d6f600f166b197859673ec3a131952a7d59c8e9a6d645cde599b5804da23e929c05
7
+ data.tar.gz: 0033765d9674b4d3ab3a21dc8ac254641eed1a51882e1ca28db68aa36297acc38c96b00efd5e08026b5cf4f047e95e3a3163ca005255fed24a4857904eb98168
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in artoo-sphero.gemspec
4
4
  gemspec
5
+
6
+ # uncomment the following line for local development:
7
+ #gem 'hybridgroup-argus', :path => '~/Development/argus'
@@ -1,15 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- artoo-ardrone (1.1.0)
5
- argus (>= 0.4.0)
6
- artoo (>= 1.2.1)
4
+ artoo-ardrone (1.2.0)
5
+ artoo (>= 1.3.0)
6
+ hybridgroup-argus (>= 0.5.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- argus (0.4.0)
12
- artoo (1.2.2)
11
+ artoo (1.3.0)
13
12
  celluloid (~> 0.15.0)
14
13
  celluloid-io (~> 0.15.0)
15
14
  multi_json (~> 1.6)
@@ -17,7 +16,7 @@ GEM
17
16
  rake
18
17
  reel (~> 0.4.0)
19
18
  thor (~> 0.18.1)
20
- celluloid (0.15.1)
19
+ celluloid (0.15.2)
21
20
  timers (~> 1.1.0)
22
21
  celluloid-io (0.15.0)
23
22
  celluloid (>= 0.15.0)
@@ -26,13 +25,14 @@ GEM
26
25
  http (0.5.0)
27
26
  http_parser.rb
28
27
  http_parser.rb (0.6.0.beta.2)
28
+ hybridgroup-argus (0.5.0)
29
29
  metaclass (0.0.1)
30
30
  method_source (0.8.2)
31
31
  minitest (5.0.1)
32
32
  minitest-happy (1.0.0)
33
33
  mocha (0.14.0)
34
34
  metaclass (~> 0.0.1)
35
- multi_json (1.8.0)
35
+ multi_json (1.8.2)
36
36
  nio4r (0.5.0)
37
37
  pry (0.9.12.2)
38
38
  coderay (~> 1.0.5)
data/README.md CHANGED
@@ -19,17 +19,19 @@ gem install artoo-ardrone
19
19
  ## Using
20
20
 
21
21
  ```ruby
22
- require 'artoo'
23
22
 
24
- connection :ardrone, :adaptor => :ardrone, :port => '192.168.0.43:5556'
23
+ connection :ardrone, :adaptor => :ardrone
25
24
  device :drone, :driver => :ardrone, :connection => :ardrone
26
25
 
27
26
  work do
27
+ on drone, :ready => :fly
28
28
  drone.start
29
+ end
30
+
31
+ def fly(*data)
29
32
  drone.take_off
30
-
31
- after(25.seconds) { drone.hover.land }
32
- after(30.seconds) { drone.stop }
33
+ after(15.seconds) { drone.hover.land }
34
+ after(20.seconds) { drone.stop }
33
35
  end
34
36
  ```
35
37
 
@@ -37,6 +39,30 @@ end
37
39
 
38
40
  The ARDrone is a WiFi device, so there is no additional work to establish a connection to a single drone. However, in order to connect to multiple drones, you need to perform some configuration steps on each drone via SSH.
39
41
 
42
+ ## Automatic Reset From Emergency Mode
43
+
44
+ When you first connect to the ARDrone by calling the `start` method, if it is in "emergency" mode, the ARDrone will not take off. Artoo can automatically reset it back "normal" mode, to be able to fly IF you pass in the navigation like this example:
45
+
46
+ ```ruby
47
+
48
+ connection :ardrone, :adaptor => :ardrone
49
+ device :drone, :driver => :ardrone, :connection => :ardrone
50
+
51
+ connection :navigation, :adaptor => :ardrone_navigation
52
+ device :nav, :driver => :ardrone_navigation, :connection => :navigation
53
+
54
+ work do
55
+ on drone, :ready => :fly
56
+ drone.start(nav) # pass the nav object into the start method
57
+ end
58
+
59
+ def fly(*data)
60
+ drone.take_off
61
+ after(15.seconds) { drone.hover.land }
62
+ after(20.seconds) { drone.stop }
63
+ end
64
+ ```
65
+
40
66
  ## Contributing
41
67
 
42
68
  1. Fork it
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "artoo-ardrone"
7
7
  s.version = Artoo::Ardrone::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Ron Evans", "Adrian Zankich"]
9
+ s.authors = ["Ron Evans", "Adrian Zankich", "Julian Cheal", "Joe Merante", "Benjamin Abruzzo"]
10
10
  s.email = ["artoo@hybridgroup.com"]
11
11
  s.homepage = "https://github.com/hybridgroup/artoo-ardrone"
12
12
  s.summary = %q{Artoo adaptor and driver for Parrot ARDrone 2.0}
@@ -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.2.1'
23
- s.add_runtime_dependency 'argus', '>= 0.4.0'
22
+ s.add_runtime_dependency 'artoo', '>= 1.3.0'
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'
26
26
  s.add_development_dependency 'mocha', '>= 0.14.0'
@@ -1,12 +1,15 @@
1
1
  require 'artoo'
2
2
 
3
- connection :ardrone, :adaptor => :ardrone, :port => '192.168.1.1:5556'
3
+ connection :ardrone, :adaptor => :ardrone
4
4
  device :drone, :driver => :ardrone, :connection => :ardrone
5
5
 
6
6
  work do
7
+ on drone, :ready => :fly
7
8
  drone.start
8
- drone.take_off
9
+ end
9
10
 
11
+ def fly(*data)
12
+ drone.take_off
10
13
  after(15.seconds) { drone.hover.land }
11
14
  after(20.seconds) { drone.stop }
12
15
  end
@@ -0,0 +1,19 @@
1
+ require 'artoo'
2
+
3
+ connection :ardrone, :adaptor => :ardrone
4
+ device :drone, :driver => :ardrone, :connection => :ardrone
5
+
6
+ connection :navigation, :adaptor => :ardrone_navigation
7
+ device :nav, :driver => :ardrone_navigation, :connection => :navigation
8
+
9
+ work do
10
+ on drone, :ready => :fly
11
+ drone.start(nav)
12
+ end
13
+
14
+ def fly(*data)
15
+ drone.take_off
16
+ after(10.seconds) { drone.animate(:turnaround, 3000) }
17
+ after(15.seconds) { drone.hover.land }
18
+ after(20.seconds) { drone.stop }
19
+ end
@@ -0,0 +1,18 @@
1
+ require 'artoo'
2
+
3
+ connection :ardrone, :adaptor => :ardrone
4
+ device :drone, :driver => :ardrone, :connection => :ardrone
5
+
6
+ connection :navigation, :adaptor => :ardrone_navigation, :port => '192.168.1.1:5554'
7
+ device :nav, :driver => :ardrone_navigation, :connection => :navigation
8
+
9
+ work do
10
+ on drone, :ready => :fly
11
+ drone.start(nav)
12
+ end
13
+
14
+ def fly(*data)
15
+ drone.take_off
16
+ after(15.seconds) { drone.hover.land }
17
+ after(20.seconds) { drone.stop }
18
+ end
@@ -7,12 +7,16 @@ connection :navigation, :adaptor => :ardrone_navigation, :port => '192.168.1.1:5
7
7
  device :nav, :driver => :ardrone_navigation, :connection => :navigation
8
8
 
9
9
  work do
10
+ on drone, :ready => :fly
10
11
  on nav, :navdata => :nav_update
11
- drone.start
12
+
13
+ drone.start(nav)
14
+ end
15
+
16
+ def fly(*data)
12
17
  drone.take_off
13
-
14
- after(25.seconds) { drone.hover.land }
15
- after(30.seconds) { drone.stop }
18
+ after(15.seconds) { drone.hover.land }
19
+ after(20.seconds) { drone.stop }
16
20
  end
17
21
 
18
22
  def nav_update(*data)
@@ -7,12 +7,16 @@ connection :videodrone, :adaptor => :ardrone_video, :port => '192.168.1.1:5555'
7
7
  device :video, :driver => :ardrone_video, :connection => :videodrone
8
8
 
9
9
  work do
10
+ on drone, :ready => :fly
10
11
  on video, :frame => :v_frame
12
+
11
13
  drone.start
12
- drone.take_off
14
+ end
13
15
 
14
- after(25.seconds) { drone.hover.land }
15
- after(30.seconds) { drone.stop }
16
+ def fly(*data)
17
+ drone.take_off
18
+ after(15.seconds) { drone.hover.land }
19
+ after(20.seconds) { drone.stop }
16
20
  end
17
21
 
18
22
  def v_frame(*data)
@@ -1,5 +1,5 @@
1
1
  module Artoo
2
2
  module Ardrone
3
- VERSION = '1.1.0'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -19,8 +19,8 @@ module Artoo
19
19
  # Creates Argus Drone connection with device
20
20
  # @return [Boolean]
21
21
  def connect
22
- require 'argus' unless defined?(Argus)
23
- @ardrone = Argus::Drone.new(socket: connect_to_udp, host: port.host, port: port.port)
22
+ require 'argus' unless defined?(::Argus::Drone)
23
+ @ardrone = ::Argus::Drone.new(socket: connect_to_udp, host: port.host, port: port.port)
24
24
  super
25
25
  end
26
26
 
@@ -10,8 +10,8 @@ module Artoo
10
10
  # Creates connection with Argus NavStreamer and starts ardrone device
11
11
  # @return [Boolean]
12
12
  def connect
13
- require 'argus' unless defined?(Argus)
14
- @ardrone = Argus::NavStreamer.new(socket: connect_to_udp, remote_host: port.host, port: port.port.to_i)
13
+ require 'argus' unless defined?(::Argus::NavStreamer)
14
+ @ardrone = ::Argus::NavStreamer.new(socket: connect_to_udp, remote_host: port.host, port: port.port.to_i)
15
15
  @ardrone.start
16
16
  super
17
17
  end
@@ -12,9 +12,8 @@ module Artoo
12
12
  # Argus PaVE Parser starting a stream with ardrone device
13
13
  # @return [Boolean]
14
14
  def connect
15
- require 'argus' unless defined?(Argus)
16
- require 'argus'
17
- @ardrone = Argus::VideoStreamer.new(socket: connect_to_tcp, host: port.host, post: port.port)
15
+ require 'argus' unless defined?(::Argus::VideoStreamer)
16
+ @ardrone = ::Argus::VideoStreamer.new(socket: connect_to_tcp, host: port.host, post: port.port)
18
17
  @ardrone.start(connect_to_udp)
19
18
  super
20
19
  end
@@ -5,12 +5,48 @@ module Artoo
5
5
  # Ardrone driver behaviors
6
6
  # @see https://github.com/hybridgroup/argus/blob/master/lib/argus/drone.rb Argus::Drone docs for supported actions
7
7
  class Ardrone < Driver
8
- COMMANDS = [:start, :stop, :hover, :land, :take_off, :emergency,
8
+ COMMANDS = [:start, :stop, :hover, :land, :take_off, :enable_emergency, :disable_emergency,
9
9
  :front_camera, :bottom_camera, :up, :down, :left, :right,
10
10
  :forward, :backward, :turn_left, :turn_right, :reset_watchdog, :led].freeze
11
11
 
12
- def start
12
+ def start(nav=nil)
13
13
  connection.start(false) # send false, so Argus does not use NavMonitor
14
+
15
+ if nav
16
+ start_with_nav(nav)
17
+ else
18
+ publish(event_topic_name("ready"))
19
+ end
20
+ end
21
+
22
+ def start_with_nav(nav)
23
+ until !nav.emergency_landing?.nil?
24
+ sleep 0.1
25
+ end
26
+
27
+ if nav.emergency_landing?
28
+ connection.disable_emergency
29
+ after(1) do
30
+ connection.disable_emergency(false)
31
+ publish(event_topic_name("ready"))
32
+ end
33
+ else
34
+ publish(event_topic_name("ready"))
35
+ end
36
+ end
37
+
38
+ def enable_emergency
39
+ connection.enable_emergency
40
+ after(1) do
41
+ connection.enable_emergency(false)
42
+ end
43
+ end
44
+
45
+ def disable_emergency
46
+ connection.disable_emergency
47
+ after(1) do
48
+ connection.disable_emergency(false)
49
+ end
14
50
  end
15
51
  end
16
52
  end
@@ -4,6 +4,7 @@ module Artoo
4
4
  module Drivers
5
5
  # Ardrone navigation driver behaviors
6
6
  class ArdroneNavigation < Driver
7
+ COMMANDS = [:emergency_landing?].freeze
7
8
 
8
9
  # Starts driver and handle updates from device
9
10
  def start_driver
@@ -12,15 +13,41 @@ module Artoo
12
13
  end
13
14
 
14
15
  super
16
+
17
+ publish(event_topic_name("ready"))
15
18
  end
16
19
 
17
20
  # Receives data from navigation and publishes
18
21
  # and event in update topic for it
19
22
  def handle_update
20
23
  navdata = connection.receive_data
24
+ return unless navdata
25
+
26
+ @emergency_landing = navdata.emergency_landing?
27
+
28
+ navdata.options.each do |opt|
29
+ n = navdata.clone
30
+ n.options = opt
31
+
32
+ case
33
+ when opt.is_a?(::Argus::NavOptionDemo)
34
+ publish(event_topic_name("update"), "navdata_demo", n, opt)
35
+ publish(event_topic_name("demo"), n, opt)
36
+
37
+ when opt.is_a?(::Argus::NavOptionVisionDetect)
38
+ publish(event_topic_name("update"), "navdata_vision_detect", n, opt)
39
+ publish(event_topic_name("vision_detect"), n, opt)
40
+
41
+ end
42
+ end
43
+
21
44
  publish(event_topic_name("update"), "navdata", navdata)
22
45
  publish(event_topic_name("navdata"), navdata)
23
46
  end
47
+
48
+ def emergency_landing?
49
+ @emergency_landing
50
+ end
24
51
  end
25
52
  end
26
53
  end
metadata CHANGED
@@ -1,15 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artoo-ardrone
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ron Evans
8
8
  - Adrian Zankich
9
+ - Julian Cheal
10
+ - Joe Merante
11
+ - Benjamin Abruzzo
9
12
  autorequire:
10
13
  bindir: bin
11
14
  cert_chain: []
12
- date: 2013-09-27 00:00:00.000000000 Z
15
+ date: 2013-10-17 00:00:00.000000000 Z
13
16
  dependencies:
14
17
  - !ruby/object:Gem::Dependency
15
18
  name: artoo
@@ -17,28 +20,28 @@ dependencies:
17
20
  requirements:
18
21
  - - '>='
19
22
  - !ruby/object:Gem::Version
20
- version: 1.2.1
23
+ version: 1.3.0
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
28
  - - '>='
26
29
  - !ruby/object:Gem::Version
27
- version: 1.2.1
30
+ version: 1.3.0
28
31
  - !ruby/object:Gem::Dependency
29
- name: argus
32
+ name: hybridgroup-argus
30
33
  requirement: !ruby/object:Gem::Requirement
31
34
  requirements:
32
35
  - - '>='
33
36
  - !ruby/object:Gem::Version
34
- version: 0.4.0
37
+ version: 0.5.0
35
38
  type: :runtime
36
39
  prerelease: false
37
40
  version_requirements: !ruby/object:Gem::Requirement
38
41
  requirements:
39
42
  - - '>='
40
43
  - !ruby/object:Gem::Version
41
- version: 0.4.0
44
+ version: 0.5.0
42
45
  - !ruby/object:Gem::Dependency
43
46
  name: minitest
44
47
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +101,8 @@ files:
98
101
  - Rakefile
99
102
  - artoo-ardrone.gemspec
100
103
  - examples/ardrone.rb
104
+ - examples/ardrone_animate.rb
105
+ - examples/ardrone_autoreset.rb
101
106
  - examples/ardrone_nav.rb
102
107
  - examples/ardrone_video.rb
103
108
  - lib/artoo-ardrone.rb