class Crubyflie::RadioAck

An acknowlegdement packet from the Crazyflie

Attributes

ack[RW]
data[RW]
powerDet[RW]
retry_count[RW]

Public Class Methods

from_raw(data, arc=0) click to toggle source

Create from raw usb response @param data [String] binary data @return [RadioAck] a properly initialized RadioAck

# File lib/crubyflie/crazyradio/radio_ack.rb, line 38
def self.from_raw(data, arc=0)
    response = data.unpack('C*')
    header = response.shift()
    ack = (header & 0x01) != 0
    powerDet = (header & 0x02) != 0
    retry_count = header != 0 ? header >> 4 : arc
    return RadioAck.new(ack, powerDet, retry_count, response)
end
new(ack=nil, powerDet=nil, retry_count=0, data=[]) click to toggle source

Initialize a Radio Ack @param ack [TrueClass,FalseClass] indicates if it is an ack @param powerDet [TrueClass,FalseClass] powerDet @param retry_count [Integer] the times we retried to send the packet @param data [Array] the payload of the ack packet

# File lib/crubyflie/crazyradio/radio_ack.rb, line 28
def initialize(ack=nil, powerDet=nil, retry_count=0, data=[])
    @ack = ack
    @powerDet = powerDet
    @retry_count = retry_count
    @data = data
end