Mambo Wifi commands


#1

@Nicolas and @Djavan I am stumped on getting the wifi packets right to the Mambo (and also the Bebop, I tried there and failed as well). As you know, my BLE Mambo interface works well and I can control the mambo using BLE. I’ve been trying to get the wifi interface working and the only thing I can get the Mambo to do is to turn its eyes red and refuse to take off. I’ve read the bybop code and the arsdkparser to ensure that my parser is doing the same thing but it comes down to a clear mis-understanding between the documentation on packets for wifi and what the Mambo actually wants. So I need some help! Thank you in advance!!

Here is my send command:

(4, 11, 1, 10, 2, 0, 1)

It is sent using:

self.udp_send_sock.sendto(packet, (self.drone_ip, self.udp_send_port))

My understanding of your protocol documentation says this packet means:

  • 4 is the data type (and 4 specifically means a command that should be ACK’d by the drone and is used for all commands except PCMD)

  • 11 is the buffer id for sending with an ack requested

  • 1 is the sequence id for this buffer (e.g. first packet I sent)

  • 10 is the full size of the frame

  • 2 is the id of mini drone.xml project

  • 0 is the id for the Piloting class

  • 1 is the id for the takeoff command

These are packed using <BBBIBBH, which is how you packed in your bybop code. The Mambo is getting the data but it doesn’t do anything with it other than turn its eyes red. The batteries are full. I can immediately disconnect from the laptop and fly it just fine from the iPhone app. I assume I’m missing something in my understanding of the packet but I cannot find it in your code or the documentation. Help?

Thank you!!


#2

Quick thought here … but your full frame size should be 11, not 10:

  • 7 bytes for the ARNetwork header (1 for type, 1 for buffer id, 1 for sequence number, and 4 for size)
  • 4 bytes for a command without argument (1 for project id, 1 for class id, 2 for command ID)

This is in line with the format string you pass to struct (best thing is to use the struct.calcsize() method to know the length of a formatted packet)


#3

@Nicolas Thank you for the quick answer. I had thought it should be 11 but talked myself into 10.

I have narrowed the problem down to threading. I can now reliably take off but then it still gets red eyes and falls out of the air, also reliably. I have a thread that is listening to the port for data from the Mambo. It is pretty much identical to what you are doing for that. So far as I can tell, if I call thread.sleep in the main thread, it will fall out of the sky 100% reliably. But I need a way to simply sleep and only wake for notifications while not actively sending it commands. In BLE mode, you could do that and it would hover. In wifi mode, it seems to crash instead. I’m assuming it is because it is wanting some data from me and I’m not providing it but I don’t know what that is. Ideas?

Thank you!


#4

@Nicolas I have a related question: is the mambo supposed to be able to be fully controlled via wifi or is the wifi just being used as the streaming and to get some of the data (e.g. altitude and position) back? Because even a simple command like common.Common.Allstates doesn’t actually return the full set of states, like it does in BLE. Started to make me wonder if I mis-understood and was trying to do something that the mambo wasn’t intended to do (e.g. control via wifi only).


#5

@Nicolas I solved my problem! I was sending incorrect ACK packets so it was disconnecting and falling out of the sky. I just happened to discover this in my continual comparison to your code. I am now flying around using wifi control :slight_smile: When I have all of the same commands implemented as I did with BLE, I’ll release the new code! Then I’ll have bebop questions as that is my next target (and I’m already getting data from it, just haven’t flown yet with python).