Class: Artoo::Drivers::ArdroneVideo

Inherits:
Driver
  • Object
show all
Defined in:
lib/artoo/drivers/ardrone_video.rb

Overview

Ardrone video driver behaviors

Constant Summary

Constants inherited from Driver

Driver::COMMANDS

Instance Attribute Summary

Attributes inherited from Driver

#parent

Instance Method Summary collapse

Methods inherited from Driver

#command, #commands, #connection, #event_topic_name, #initialize, #interval, #known_command?, #method_missing, #pin

Constructor Details

This class inherits a constructor from Artoo::Drivers::Driver

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Artoo::Drivers::Driver

Instance Method Details

#handle_frame(*params) ⇒ Object

Retrieves frame from video connection and publishes data to update and frame event topics



20
21
22
23
24
# File 'lib/artoo/drivers/ardrone_video.rb', line 20

def handle_frame(*params)
  video = connection.receive_data
  publish(event_topic_name("update"), "video", video)
  publish(event_topic_name("frame"), video.frame)
end

#start_driverObject

Starts drives and handles video frame



9
10
11
12
13
14
15
# File 'lib/artoo/drivers/ardrone_video.rb', line 9

def start_driver
  every(interval) do
    handle_frame
  end

  super
end