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(socket = nil, host = '192.168.1.1', port = '5556') ⇒ Drone

Returns a new instance of Drone.



9
10
11
12
13
14
15
16
# File 'lib/argus/drone.rb', line 9

def initialize(socket=nil, host='192.168.1.1', port='5556')
  @socket = socket || UDPSocket.new
  @sender = Argus::UdpSender.new(@socket, host, port)
  @at = Argus::ATCommander.new(@sender)
  @controller = Argus::Controller.new(@at)
  
  @enable_nav_monitor = false
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

#enable_nav_monitorObject (readonly)

Returns the value of attribute enable_nav_monitor.



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

def enable_nav_monitor
  @enable_nav_monitor
end

Instance Method Details

#commanderObject



18
19
20
# File 'lib/argus/drone.rb', line 18

def commander
  @at
end


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



22
23
24
25
26
27
28
29
30
31
# File 'lib/argus/drone.rb', line 22

def start(enable_nav_monitor=true)
  @enable_nav_monitor = enable_nav_monitor
  
  if enable_nav_monitor
    @nav = NavMonitor.new(@controller)
    @nav.start
  end

  @at.start
end

#stopObject



33
34
35
36
37
38
39
40
41
# File 'lib/argus/drone.rb', line 33

def stop
  @controller.land

  @at.stop
  @nav.stop if enable_nav_monitor

  @at.join
  @nav.join if enable_nav_monitor
end