PC Client Code no Longer Works the Same
Posted: Thu Apr 14, 2016 5:08 pm
Hi,
In my application, I transfer packet data from the Crazyflie 2 to the PC client using crtp port 0x06.
My PC client source code works successfully using 2015.08 release and Python 2.7. In switching to release 2016.2 using Python 3.4, the same code works differently. Packet data being sent from the PC client to the Crazyflie looks ok. Packet data sent from the Crazyflie to the PC client is different. I'd appreciate your help with this problem.
A snippet of the python source in question is as follows:
import struct
from cflib.utils.callbacks import Caller
from cflib.crtp.crtpstack import CRTPPacket, CRTPPort
from PyQt4.QtCore import pyqtSlot, pyqtSignal
class Ablock:
receivedChar = Caller()
def __init__(self, crazyflie):
"""
Initialize the ablock and register it to receive data from the copter.
"""
self.cf = crazyflie
self.cf.add_port_callback(CRTPPort.ABLOCK, self.incoming)
def incoming(self, packet):
ablock_text = "%s" % struct.unpack("%is" % len(packet.data),
packet.data)
self.receivedChar.call(ablock_text)
print ("indata %s" % ablock_text)
Foe example, I receive
ablock_text == "<S>\n" using Python 2.7 PC client (release 2015.08)
but receive
ablock_text == "b'<S>\n''" using Python 3.4 PC client (release 2016.02)
I hope this is enough information to understand the problem.
In my application, I transfer packet data from the Crazyflie 2 to the PC client using crtp port 0x06.
My PC client source code works successfully using 2015.08 release and Python 2.7. In switching to release 2016.2 using Python 3.4, the same code works differently. Packet data being sent from the PC client to the Crazyflie looks ok. Packet data sent from the Crazyflie to the PC client is different. I'd appreciate your help with this problem.
A snippet of the python source in question is as follows:
import struct
from cflib.utils.callbacks import Caller
from cflib.crtp.crtpstack import CRTPPacket, CRTPPort
from PyQt4.QtCore import pyqtSlot, pyqtSignal
class Ablock:
receivedChar = Caller()
def __init__(self, crazyflie):
"""
Initialize the ablock and register it to receive data from the copter.
"""
self.cf = crazyflie
self.cf.add_port_callback(CRTPPort.ABLOCK, self.incoming)
def incoming(self, packet):
ablock_text = "%s" % struct.unpack("%is" % len(packet.data),
packet.data)
self.receivedChar.call(ablock_text)
print ("indata %s" % ablock_text)
Foe example, I receive
ablock_text == "<S>\n" using Python 2.7 PC client (release 2015.08)
but receive
ablock_text == "b'<S>\n''" using Python 3.4 PC client (release 2016.02)
I hope this is enough information to understand the problem.