Class: Argus::Drone

Inherits:
Object
  • Object
show all
Defined in:
lib/argus/drone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#controllerObject (readonly)

Returns the value of attribute controller.



7
8
9
# File 'lib/argus/drone.rb', line 7

def controller
  @controller
end

Returns the value of attribute nav.



7
8
9
# File 'lib/argus/drone.rb', line 7

def nav
  @nav
end

Instance Method Details

#commanderObject



22
23
24
# File 'lib/argus/drone.rb', line 22

def commander
  @at
end


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

#stopObject



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