Page 1 of 1

Controlling over Python

Posted: Tue Mar 10, 2015 2:37 pm
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?

Re: Controlling over Python

Posted: Wed Mar 11, 2015 8:16 am
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...

Re: Controlling over Python

Posted: Thu Mar 12, 2015 1:10 am
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!!

Re: Controlling over Python

Posted: Fri Mar 13, 2015 1:59 pm
by Slaxx
I have no clue how that can be done...

Re: Controlling over Python

Posted: Mon Mar 16, 2015 6:03 am
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.