[SOLVED] Sending data with more than 240bits to commander

Firmware/software/electronics
Post Reply
CrazyGuy
Beginner
Posts: 27
Joined: Fri May 02, 2014 6:03 pm

[SOLVED] Sending data with more than 240bits to commander

Post by CrazyGuy »

Hello,

the title already says it: I want to send more than 240 bits to the commander. In fact i need to send the roll, pitch, yaw, thrust and a 4x6 matrix containing float-values to the commander. I've already compressed the data (lossy) but it's still to large. So my idea was to split the data and send two packages instead. But there is only for a very short time a connection to the crazyflie and then I always lose the connection with the message: "Too many packets lost"

I thought maybe the problem is, that I try to send two packets in quick succession to the commander. So I tried:
When I get new data from the joystick then I calculate that 4x6 matrix (depends on RPY and thrust) and send the first part of my data to the commander. The next RPY and thrust values from the joystick will be ignored. Instead I send the second part of my data to the commander. But I get the same error: "Too many packets lost"

My next guess is, that I pack the data wrong!? Right now it's like that:

Code: Select all

pk = CRTPPacket()
pk.port = CRTPPort.COMMANDER
pk.data = struct.pack('<BhhbBbBbBbBbBbBbBbBbBbBbBbB', self._id+1,int(roll*100),int(pitch*100),m11,e11,m12,e12,m13,e13,m14,e14,m15,e15,m16,e16,m21,e21,m22,e22,m23,e23,m24,e24,m25,e25,m26,e26)
self._cf.send_packet(pk)
So the size of the data = 1*len(B) + 2*len(h) + 12*len(bB) = 8 + 32 + 12*16 = 232 < 240
Of course I adjusted the struct "CommanderCrtpValues" on the crazyflie-firmware.

Are there any other restrictions I miss?

Thanks,
CrazyGuy
Last edited by CrazyGuy on Thu Jan 08, 2015 6:25 pm, edited 1 time in total.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Sending data with more than 240bits to commander

Post by arnaud »

Hi CrazyGuy,

30 bytes is the payload limit for a packet (1 byte header + 30 bytes payload). There is no restriction in how fast packet can be sent by the software, the radio dongle driver will send the packets one by one and extra packets are just queued.

Do you experience disconnection when running the normal client as well? this look like a radio communication problem. It could also be that you are crashing the Crazyflie and so it cannot receive new packets.

Best Regards,
Arnaud
CrazyGuy
Beginner
Posts: 27
Joined: Fri May 02, 2014 6:03 pm

Re: Sending data with more than 240bits to commander

Post by CrazyGuy »

Hi Arnaud,

thank you for your reply. Meanwhile I also think that my C++ code on the Crazyflie crashes. I suppose because of some casting-issues. I will figure it out.
Post Reply