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 |
# File 'lib/argus/drone.rb', line 9 def initialize(opts={}) @host = opts[:remote_host] || '192.168.1.1' port = opts[:post] || '5556' @sender = opts[:sender] || Argus::UdpSender.new(socket: opts[:socket], remote_host: @host, port: port) @at = Argus::ATCommander.new(@sender) @controller = Argus::Controller.new(@at) if 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
22 23 24 |
# File 'lib/argus/drone.rb', line 22 def commander @at end |
#nav_callback(*args, &block) ⇒ Object
41 42 43 |
# File 'lib/argus/drone.rb', line 41 def nav_callback(*args, &block) @nav.callback(*args, &block) end |
#start(enable_nav_monitor = true) ⇒ Object
26 27 28 29 |
# File 'lib/argus/drone.rb', line 26 def start(enable_nav_monitor=true) @nav.start @at.start end |
#stop ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/argus/drone.rb', line 31 def stop @controller.land @at.stop @nav.stop @at.join @nav.join end |