Controlling over Python

Post here to get support
Post Reply
Slaxx
Member
Posts: 86
Joined: Tue Mar 03, 2015 11:19 am
Location: Switzerland

Controlling over Python

Post by Slaxx »

My goal is to control the Crazyfly using some Motion Capture System (MCS). For this reason I need to read UDP packages that come from the Computer the MCS runs on and then I have to send the necessary thrust and angles to the quadro. Since everything is already in Python I thought the best is probably to do this in Python as well. Do you think this is possible?

However, I already got stuck when testing the examples that are provided. The ramp.py file gives the following output.
/usr/bin/python2.7 /home/bitcraze/projects/crazyflie-clients-python/examples/ramp.py
Scanning interfaces for Crazyflies...
Crazyflies found:
radio://0/80/250K
Connecting to radio://0/80/250K
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
File "../lib/cflib/crazyflie/__init__.py", line 357, in run
File "../lib/cflib/crtp/radiodriver.py", line 158, in receive_packet
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'

Process finished with exit code 0
I tested it with the PyCharm Community Edition 4.0.4 in the Virtual Machine. So I guess it is a code error?
Slaxx
Member
Posts: 86
Joined: Tue Mar 03, 2015 11:19 am
Location: Switzerland

Re: Controlling over Python

Post by Slaxx »

Big thanks to ataffanel who uploaded a running version of the ramp.py inside the dev-inputmux branch.

Before the while loop can start, the startup thrust protection must be unlocked:
#Unlock startup thrust protection
self._cf.commander.send_setpoint(0, 0, 0, 0)

please change that, so future users won't sit almost 2 hours in front of the code and wonder whats possibly wrong...
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: Controlling over Python

Post by chad »

You can make the change on a fork of the GitHub repository. Then create a pull request so Arnaud, Marcus, or Tobias can merge it... Your pain, everyone's gain. Open source is great!!
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
Slaxx
Member
Posts: 86
Joined: Tue Mar 03, 2015 11:19 am
Location: Switzerland

Re: Controlling over Python

Post by Slaxx »

I have no clue how that can be done...
poizone
Member
Posts: 59
Joined: Thu Feb 05, 2015 3:59 am
Location: Ohio, USA

Re: Controlling over Python

Post by poizone »

Slaxx wrote:I have no clue how that can be done...
Git tutorial by GitHub: https://try.github.io/levels/1/challenges/1

Git is a very useful tool that anyone interested in open-source projects should look into. There is a graphical GitHub client also that can help you manage your repositories and how you work with them. There is support for Git on most IDEs through native integration or plugins/extensions/whathaveyou.
One day our flies will drown out the sun in an autonomous Skynet of whirring motors and blinking lights.
Post Reply