Drivers

Artoo has a extensible system for connecting to hardware devices.

Ardrone Navigation


Allows user to receive in-flight navgation data from an ARDrone. Navigation data includes such information as the ARDrone's current pitch and yaw, along with many other data elements.

How To Connect

Communication with the ARDrone's navigation data interface takes place using a WiFi connection. The ARDrone is a WiFi access point, so it normally can be the only device you connect to, without some additional effort to reconfigure the drone itself to put it into infrastructure mode.

require 'artoo'
connection :navigation, :adaptor => :ardrone_navigation, :port => '192.168.1.1:5554'
device :nav, :driver => :ardrone_navigation, :connection => :navigation

How To Use

How to use events and call them on your drivers

Pretty simple, when the connection and the driver have been setup (as explained above) you can call events on them as follows:

on nav, :navdata => proc { |caller, navdata| puts "Sequence number: #{ navdata.sequence_number }" }
on nav, :demo => proc { |caller, navdata, nav_option_demo|
  puts "Ardrone pitch: #{ nav_option_demo.pitch }"
  puts "Ardrone roll:  #{ nav_option_demo.roll }"
  puts "Ardrone yaw:   #{ nav_option_demo.yaw }"
}
on nav, :vision_detect => proc { |caller, navdata, nav_option_vision_detect|
  puts "Vision detect count: #{ nav_option_vision_detect.detected_count }"
  puts "Vision detect type: #{ nav_option_vision_detect.type }"
  puts "Vision detect name: #{ nav_option_vision_detect.name }"
}

Example of receiving navigation data from an ARDrone.

require 'artoo'

connection :navigation, :adaptor => :ardrone_navigation, :port => '192.168.1.1:5554'
device :nav, :driver => :ardrone_navigation, :connection => :navigation

work do
  on nav, :navdata => :nav_update
end

def nav_update(*data)
  p data[1].inspect
end

Commands

emergency_landing?

Text here

Params

no params

Returns

``

Events

start_driver

Starts the driver

Gets triggered every time interval amount of time passes, returns and lets you access a NavData object containing the attributes described below:

  • navdata.sequence_number → String (returns the sequence number) -
  • navdata.vision_flag → String (returns the sequence number) -
  • navdata.flying? → Boolean (is the ardrone flying?) -
  • navdata.communication_lost? → Boolean (is communication lost?) -
  • navdata.com_watchdog_problem? → Boolean (is there a watchdog problem?) -
  • navdata.bootstrap? → Boolean (boostrap navigation setup?) -

demo

Gets triggered every time interval amount of time passes, returns and lets you access a NavOptionDemo object containing navigation data as described below:

  • nav_option_demo.control_state_name → String (returns control state name) -
  • nav_option_demo.control_state → Integer (returns control state) -
  • nav_option_demo.battery_level → Integer -
  • nav_option_demo.pitch → float (returns the current pitch) -
  • nav_option_demo.roll → float (returns the current roll) -
  • nav_option_demo.yaw → float (returns the current yaw) -
  • nav_option_demo.altitude → float (returns the current altitude) -
  • nav_option_demo.vx → float (returns the current velocity on X axis) -
  • nav_option_demo.vy → float (returns the current velocity on Y axis) -
  • nav_option_demo.vz → float (returns the current velocity on Z axis) -

vision_detect

Gets triggered every time interval amount of time passes, returns and lets you access a NavOptionVisionDetect object containing the following data:

  • nav_option_vision_detect.detected_count → Integer (Number of devices detected) -
  • nav_option_vision_detect.type → String -
  • nav_option_vision_detect.name → String -
  • nav_option_vision_detect.x → integer -
  • nav_option_vision_detect.y → integer -
  • nav_option_vision_detect.width → integer -
  • nav_option_vision_detect.height → integer -
  • nav_option_vision_detect.distance → integer -
  • nav_option_vision_detect.orientation_angle → float -
  • nav_option_vision_detect.camera_source → integer -

Compatibility