Parrot Mambo - Python


#1

Hi,

I am a school teacher wanting to engage my students in Computer Science. I love the idea of our students using the Parrot Mambo and programming it with Python. I have found a few tutorials for the AR Drone, but none for the Mambo.

Is it possible (read: practical) to program the Mambo with Python in a classroom setting?


#2

Alternatively, is there any other small drones that can be programmed with Python?


#3

Hi Sletts021 .

My father is a teacher too , and will like to use python for programming mambo parrot drone , I saw your wish was excatly like his wish , did you find any solution for it ?
Thank you Sletts

Adrian


#4

I have released a python interface for the mambo. It was posted on the forum here a few weeks ago.


#5

Awesome! I am ordering a mambo tomorow now!

Can I donate?


#6

Glad to help! :slight_smile: I’m doing it for the students also! There will be an international K-12 educational curriculum and contest we intend to roll out next fall. We are demo-ing in the spring.


#7

I just checked out the FPV! That will be so amazing if/when you can code it.

Thanks again - just waiting on the mambo to arrive!


#8

@CaptainSaavik - Would FPV mean that we could use OpenCV for object detection/facial recognition activities?


#9

Yes! And I have it working, streaming into opencv. I just haven’t written it up nicely enough to release yet. I’ve got a lot of competing deadlines right now but I’ll get this one released soon!


#10

So our Mambos arrived last week! I had the chance to play with the Pi - so good. One dependency that wasn’t in the docs is bluepy and bluepy-helper
$ sudo apt-get install python-pip libglib2.0-dev
$ sudo pip install bluepy

But that wasn’t hard. I really wanted a way for kids to be able to program from their laptops (Windows)… it turns out using VirtualBox was a relatively simple way to achieve this. The only caveat is that they need access to device manager to disable bluetooth and re-enable it for it to be captured in the vm.

This allows students to use it straight from their Windows laptop without having to SSH to the Pi! Thank you so much CaptainSaavik. Can’t wait to see the voodoo you do to get FPV working!


#11

Thank you, I will fix the docs! Also, I’m glad it works on Windows.

Fun news: I’m in the process of making a wifi interface. It will handle the camera. The camera was a failure on the pi as it can’t handle the bandwidth but my laptop can so I’ll get the released with those caveats. Waiting on an answer in another forum post about part of my wifi interface from parrot :slight_smile:


#12

I’ve been working to update the mambo python interface and now have a new package that I am releasing. Because it is a complete redesign and intended beyond just the Mambo (it works for the Bebop too), I changed its name. The new package is on GitHub here:


#13

Awesome!!! I can’t wait to try it again! I’ll definitely be taking a mambo home during school holidays to test it out for 2018.

Thanks so much for your work on this. I’ll be sure to update you when my kids have had a chance to code!


#14

I had a brief play with my Windows machine with the pyParrot and ran in to the following issue.

I can confirm I was connected to the Mambo’s wifi. Any idea on what my issue is? Is it possible to run it via Windows? (That’d be amazing!)

Thanks again for your efforts :slight_smile:

===== RESTART: C:\Users\Scott\Desktop\pyparrot-master\demoMamboTricks.py =====

trying to connect
e[38;5;196m connection failed: did you remember to connect your machine to the Drone’s wifi network? e[0m
connected: False
sleeping
Traceback (most recent call last):
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 365, in safe_send
self.udp_send_sock.sendto(packet, (self.drone_ip, self.udp_send_port))
AttributeError: ‘WifiConnection’ object has no attribute ‘udp_send_sock’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\Scott\Desktop\pyparrot-master\demoMamboTricks.py”, line 21, in
mambo.ask_for_state_update()
File “C:\Users\Scott\Desktop\pyparrot-master\Mambo.py”, line 360, in ask_for_state_update
return self.drone_connection.send_noparam_command_packet_ack(command_tuple)
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 404, in send_noparam_command_packet_ack
self.send_command_packet_ack(packet, self.sequence_counter[‘SEND_WITH_ACK’])
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 385, in send_command_packet_ack
self.safe_send(packet)
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 370, in safe_send
self.udp_send_sock.connect((self.drone_ip, self.udp_send_port))
AttributeError: ‘WifiConnection’ object has no attribute ‘drone_ip’


#15

A callout for the author… datagrams (UDP protocol) has no actual connect. you bind to a socket and remote host/port and then just send and receive. This exception handler needs some TLC:

    while (not packet_sent and try_num < self.max_packet_retries):
        try:
            self.udp_send_sock.sendto(packet, (self.drone_ip, self.udp_send_port))
            packet_sent = True
        except:
            #print "resetting connection"
            self.udp_send_sock = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
            self.udp_send_sock.connect((self.drone_ip, self.udp_send_port))
            try_num += 1

Digging a little further the error you are receiving indicates a remote IP address has not been set, which caused safe_send to wind up in the exception block with the incorrect setup for a UDP socket.

The drone_ip is supposed to be retrieved by zeroconf (Bonjour / avahi mDNS auto discovery). My guess is this structure (connection_info) is empty and that is what caused the failure.

A quick and dirty way to around this is to hardcode the known IP address. If the mambo is like the bebop and disco you’ll find it @ 192.168.42.1

But the best thing to do is figure why the autoconf stuff is failing.

Hope this helps!


#16

I manually set to both the IP you provided and also the hotspot IP with no luck

 self.drone_ip = "192.168.99.32"

trying to connect

e[38;5;196m connection failed: did you remember to connect your machine to the Drone’s wifi network? e[0m
connected: False
sleeping
Traceback (most recent call last):
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 366, in safe_send
self.udp_send_sock.sendto(packet, (self.drone_ip, self.udp_send_port))
AttributeError: ‘WifiConnection’ object has no attribute ‘udp_send_sock’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\Scott\Desktop\pyparrot-master\demoMamboTricks.py”, line 21, in
mambo.ask_for_state_update()
File “C:\Users\Scott\Desktop\pyparrot-master\Mambo.py”, line 360, in ask_for_state_update
return self.drone_connection.send_noparam_command_packet_ack(command_tuple)
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 405, in send_noparam_command_packet_ack
self.send_command_packet_ack(packet, self.sequence_counter[‘SEND_WITH_ACK’])
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 386, in send_command_packet_ack
self.safe_send(packet)
File “C:\Users\Scott\Desktop\pyparrot-master\networking\wifiConnection.py”, line 371, in safe_send
self.udp_send_sock.connect((self.drone_ip, self.udp_send_port))
AttributeError: ‘WifiConnection’ object has no attribute ‘drone_ip’


#17

Hi,

The Mambo FPV IP is 192.168.99.3, not 192.168.42.1 as the Bebops & Disco (The last digit is .3 and not .1 because the access point is the camera, not the mambo itself). But ideally the IP should be discovered by zeroconf.

From what I’ve seen, pyparrot does seem to use zeroconf to discover the drones (as I do in Bybop) … Never tried it on windows, but maybe increasing the timeout given to WifiConnection.connect(...) might help.

Regards,
Nicolas.


#18

Thanks Nicholas!

I’m still not having any luck with 192.168.99.3. I have also tried increasing the WifiConnection.connect()

It would be really interesting to see if anyone else has any luck on Windows. I’ll see if I can try a different machine. I have also tried disabling firewall, at a pinch, with no luck.


#19

You can try to use Bybop to connect to the mambo. I provide a sample which should connect & dump some information about the drone.


#20

It says in the error what is wrong. Are you connecting to the drone’s wifi? It requires you to be connected to it and not to your own wifi to work.