Sha256: d1abfa789c973728dc338e92879d948c2f4f389ed7b10a59d7c8f2e734f47da3

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

require 'artoo/adaptors/adaptor'

module Artoo
  module Adaptors
    # Connect to a ARDrone 2.0 navigation data stream
    # @see http://rubydoc.info/gems/hybridgroup-argus/0.2.0/Argus/NavStreamer Argus NavStremer Documentation
    class ArdroneNavigation < Adaptor
      attr_reader :ardrone

      # Creates connection with Argus NavStreamer and starts ardrone device
      # @return [Boolean]
      def connect
        require 'argus' unless defined?(Argus)
        @ardrone = Argus::NavStreamer.new(socket: connect_to_udp, remote_host: port.host, port: port.port.to_i)
        @ardrone.start
        super
      end

      # Closes connection with ardrone device
      # @return [Boolean]
      def disconnect
        ardrone.close
        super
      end

      # Calls ardrone actions using method missing
      # @see http://rubydoc.info/gems/hybridgroup-argus/0.2.0/Argus/Drone Argus Drone Documentation
      def method_missing(method_name, *arguments, &block)
        ardrone.send(method_name, *arguments, &block)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
artoo-ardrone-1.1.0 lib/artoo/adaptors/ardrone_navigation.rb
artoo-ardrone-1.0.3 lib/artoo/adaptors/ardrone_navigation.rb