Class: Argus::Drone
- Inherits:
-
Object
- Object
- Argus::Drone
- Defined in:
- lib/argus/drone.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#nav ⇒ Object
readonly
Returns the value of attribute nav.
Instance Method Summary collapse
- #commander ⇒ Object
-
#initialize(opts = {}) ⇒ Drone
constructor
A new instance of Drone.
- #nav_callback(*args, &block) ⇒ Object
- #start(enable_nav_monitor = true) ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Drone
Returns a new instance of Drone.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/argus/drone.rb', line 9 def initialize(opts={}) host = opts[:remote_host] || '192.168.1.1' port = opts[:port] || '5556' @sender = opts[:sender] || Argus::UdpSender.new(socket: opts[:socket], remote_host: host, port: port) @at = opts[:commander] || Argus::ATCommander.new(@sender) @controller = opts[:controller] || Argus::Controller.new(@at) if opts[:nav_monitor] @nav = opts[:nav_monitor] elsif opts.fetch(:enable_nav_monitor, true) @nav = NavMonitor.new(@controller, host) else @nav = NullNavMonitor.new end end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
7 8 9 |
# File 'lib/argus/drone.rb', line 7 def controller @controller end |
#nav ⇒ Object (readonly)
Returns the value of attribute nav.
7 8 9 |
# File 'lib/argus/drone.rb', line 7 def nav @nav end |
Instance Method Details
#commander ⇒ Object
24 25 26 |
# File 'lib/argus/drone.rb', line 24 def commander @at end |
#nav_callback(*args, &block) ⇒ Object
43 44 45 |
# File 'lib/argus/drone.rb', line 43 def nav_callback(*args, &block) @nav.callback(*args, &block) end |
#start(enable_nav_monitor = true) ⇒ Object
28 29 30 31 |
# File 'lib/argus/drone.rb', line 28 def start(enable_nav_monitor=true) @nav.start @at.start end |
#stop ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/argus/drone.rb', line 33 def stop @controller.land @at.stop @nav.stop @at.join @nav.join end |