Class: Artoo::Adaptors::Ardrone
- Defined in:
- lib/artoo/adaptors/ardrone.rb
Overview
This class connects to a ARDrone 2.0
Instance Attribute Summary collapse
-
#ardrone ⇒ Object
readonly
Returns the value of attribute ardrone.
Attributes inherited from Adaptor
Instance Method Summary collapse
-
#connect ⇒ Boolean
Creates Argus Drone connection with device.
-
#disconnect ⇒ Boolean
Disconnects device by stopping it and ending connection.
-
#finalize ⇒ Object
Finalizes connection with ARDrone by landing and stopping the device.
-
#method_missing(method_name, *arguments, &block) ⇒ Object
Calls ardrone actions using method missing.
Methods inherited from Adaptor
#connect_to, #connect_to_serial, #connect_to_tcp, #connect_to_udp, #connected?, #initialize, #reconnect
Constructor Details
This class inherits a constructor from Artoo::Adaptors::Adaptor
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
Calls ardrone actions using method missing
36 37 38 |
# File 'lib/artoo/adaptors/ardrone.rb', line 36 def method_missing(method_name, *arguments, &block) ardrone.send(method_name, *arguments, &block) end |
Instance Attribute Details
#ardrone ⇒ Object (readonly)
Returns the value of attribute ardrone.
9 10 11 |
# File 'lib/artoo/adaptors/ardrone.rb', line 9 def ardrone @ardrone end |
Instance Method Details
#connect ⇒ Boolean
Creates Argus Drone connection with device
21 22 23 24 25 |
# File 'lib/artoo/adaptors/ardrone.rb', line 21 def connect require 'argus' unless defined?(::Argus) @ardrone = Argus::Drone.new(connect_to_udp, port.host, port.port) super end |
#disconnect ⇒ Boolean
Disconnects device by stopping it and ending connection
29 30 31 32 |
# File 'lib/artoo/adaptors/ardrone.rb', line 29 def disconnect ardrone.stop super end |
#finalize ⇒ Object
Finalizes connection with ARDrone by landing and stopping the device
12 13 14 15 16 17 |
# File 'lib/artoo/adaptors/ardrone.rb', line 12 def finalize if connected? ardrone.land ardrone.stop end end |