Error when running "ramp.py" in virtual machine setup

Firmware/software/electronics/mechanics
Post Reply
bpospeck
Beginner
Posts: 14
Joined: Tue Jan 10, 2017 4:42 am

Error when running "ramp.py" in virtual machine setup

Post by bpospeck »

Hello,

I want to experiment with the python scripts and have tried running "ramp.py". Whenever I do, I have 1 of 2 things occur:
1) It finds multiple radios to connect to, not always the same amount. The only time it finds just "radio://0/80/250k" is when I set the crazyflie down several feet away from the Crazyradio PA. Why is this?

2) When it does connect with "radio://0/80/250k", it starts executing the script just fine and the motors start spinning. But it fails quickly with the lengthy error message below:

Exception in thread Thread-1 (most likely raised during interpreter shutdown):Exception in thread Thread-9 (most likely raised during interpreter shutdown): Traceback (most recent call last):

File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_innerTraceback (most recent call last):

File "/usr/lib/python2.7/threading.py", line 763, in run File "/usr/lib/python2.7/threading.py", line 810, in __boostrap_inner

File "build/bdist.linux-i686/egg/cflib/crazyflie/__init__.py", line 371, in run File "ramp.py", line 106, in _ramp_motors

File "build/bdist.linux-i686/egg/cflib/crtp/radiodriver.py", line 232, in receive_packet File "build/bdist.linux-i686/egg/cflib/crazyflie/__init__.py", line 250, in close_link

<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty' File "build/bdist.linux-i686/egg/cflib/crtp/radiodriver.py", line 265, in close

File "build/bdist.linux-i686/egg/cflib/crtp/radiodriver.py", line 103, in close
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute '_config_lock'


I'm only familiar with the basics of Python and I'm not really sure what's going on with this. I've tried looking through the code at some of these places, but I don't understand a lot of what's happening with how much code there is. I am running this on the virtual machine that was setup by bitcraze so, as far as I'm aware, all dependencies should already be installed. Let me know if anything needs more clarification. I appreciate any help! Thanks!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Error when running "ramp.py" in virtual machine setup

Post by arnaud »

Hi,

for 1): At 250K there is some "cross-talk" between channel at high power that can cause the lib to find the Crazyflie on many channel. This is certainly due to non-linearity in the radio path. One way to get rid of it is to set the radio datarate to 2M, this way you should find only one Crazyflie whatever the power is.

For 2) This looks like a solved bug, did you upgrade the project with the update_all script from the desktop?
bpospeck
Beginner
Posts: 14
Joined: Tue Jan 10, 2017 4:42 am

Re: Error when running "ramp.py" in virtual machine setup

Post by bpospeck »

Thanks for the quick response! Even if it took me a few days to get back to this.

1) Alright, cool, thanks for the help.

2) I hadn't updated for a couple of weeks. Just to be sure that wasn't the problem, I did hit "Update all projects" on the desktop. I still get errors when trying to run ramp.py after updating.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Error when running "ramp.py" in virtual machine setup

Post by arnaud »

Hi,
I cannot reproduce here, I have Ubuntu Linux as a host system. What is your host system on which you are running VirtualBox?
bpospeck
Beginner
Posts: 14
Joined: Tue Jan 10, 2017 4:42 am

Re: Error when running "ramp.py" in virtual machine setup

Post by bpospeck »

I am running VirtualBox on Windows 10.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Error when running "ramp.py" in virtual machine setup

Post by arnaud »

I have tried on Windows 10 with Virtual box and it is working fine form me. Though I had to install the libusbK driver (as explained there: https://wiki.bitcraze.io/doc:crazyradio ... dows_zadig) in order to get the Crazyradio to connect properly with the virtual machine. Did you install the crazyradio driver?
bpospeck
Beginner
Posts: 14
Joined: Tue Jan 10, 2017 4:42 am

Re: Error when running "ramp.py" in virtual machine setup

Post by bpospeck »

I just installed libusbK onto my Windows OS. I've also double checked under devices to see if it's recognized as the "Crazyradio PA USB Dongle" and it is.

The crazyradio driver should be installed on the virtual machine. I can clearly connect to the dongle on the virtual machine. I've also had no issues flashing the crazyflie firmware. Lately I've been messing around with parameters to figure those out, and have successfully ran the "basicparam.py" script without any kind of errors too.

This has to be really frustrating for you since I seem to be the only person having an issue with ramp.py, but I really appreciate you sticking with me on this! Thanks!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Error when running "ramp.py" in virtual machine setup

Post by arnaud »

Well when the answer is "it works for me" it is usually frustrating for both sides .... but at least for me it works so I am better off. I hope we can find out what your problem is.

I just tried from a clean VM on Windows 10 with the latest Virtualbox and it still works for me ;-), you can maybe try the same procedure. What I did is:
- Import the Bitcraze VM 2016-06
- Start it, refuse the multiple upgrade request (we need to re-generate a VM from the latest ubuntu btw....)
- Launch the "update all" script from the desktop, wait for it to finish
- Attach Crazyradio to the VM
- Open a terminal, and in the terminal:

Code: Select all

cd projects/crazyflie-lib-python/examples
python3 ramp.py
Some 10-20 seconds later my crazyflie spins.

Hope this help, tell me if you still see the same problem.
bpospeck
Beginner
Posts: 14
Joined: Tue Jan 10, 2017 4:42 am

Re: Error when running "ramp.py" in virtual machine setup

Post by bpospeck »

So I think I know what the problem was. One of those tiny issues I shouldn't have missed but definitely did.

I'm fairly certain I was just neglecting the 3 at the end of python, so it wasn't using the correct version of python. I feel like I've wasted quite a bit of both of our time, but I appreciate your help nonetheless! Thanks!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Error when running "ramp.py" in virtual machine setup

Post by arnaud »

No problem, glad that this got solved.

For the record: the lib (and the example) works both with Python 2 and Python 3. So if you where to install the lib in python2 with "pip install -e ." it would work with just "python". The GUI client though requires Python 3 and this is why we use it by default.
Post Reply