Page 1 of 2

no take off LPS nodes + crazyflie

Posted: Thu Jul 23, 2020 7:28 pm
by curiousstudent
Hi!

I just recently started to use the LPS system for crazyflie for the first and I got all the nodes to connect (so they all have green bars)in the cfclient.
So when I try to launch the basic motion_commander.py script the drone does not take off.

I am slightly confused. To have the drone fly with the nodes (I did install the LPS shield on the crazyflie) do I need to keep it connected to the cfclient?
But when I do that I keep getting:

Connecting to radio://0/75/2M/E7E7E7E701
ERROR:cflib.crazyflie:Couldn't load link driver: [Errno 16] Resource busy

Traceback (most recent call last):
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crazyflie/__init__.py", line 223, in open_link
link_uri, self._link_quality_cb, self._link_error_cb)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/__init__.py", line 91, in get_link_driver
instance.connect(uri, link_quality_callback, link_error_callback)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 163, in connect
address)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 102, in __init__
_RadioManager._radios[self._devid] = _SharedRadio(self._devid)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 71, in __init__
self.radio = Crazyradio(devid=devid)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/drivers/crazyradio.py", line 140, in __init__
self.dev.set_configuration(1)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 869, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 148, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 794, in set_configuration
_check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
File "/home/edwin/.local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 16] Resource busy

Connection to radio://0/75/2M/E7E7E7E701 failed: Couldn't load link driver: [Errno 16] Resource busy

Traceback (most recent call last):
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crazyflie/__init__.py", line 223, in open_link
link_uri, self._link_quality_cb, self._link_error_cb)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/__init__.py", line 91, in get_link_driver
instance.connect(uri, link_quality_callback, link_error_callback)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 163, in connect
address)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 102, in __init__
_RadioManager._radios[self._devid] = _SharedRadio(self._devid)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 71, in __init__
self.radio = Crazyradio(devid=devid)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/drivers/crazyradio.py", line 140, in __init__
self.dev.set_configuration(1)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 869, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 148, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 794, in set_configuration
_check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
File "/home/edwin/.local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 16] Resource busy

Traceback (most recent call last):
File "/home/edwin/Desktop/1drone.py", line 53, in <module>
with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crazyflie/syncCrazyflie.py", line 67, in __enter__
self.open_link()
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crazyflie/syncCrazyflie.py", line 64, in open_link
raise Exception(self._error_message)
Exception: Couldn't load link driver: [Errno 16] Resource busy

Traceback (most recent call last):
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crazyflie/__init__.py", line 223, in open_link
link_uri, self._link_quality_cb, self._link_error_cb)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/__init__.py", line 91, in get_link_driver
instance.connect(uri, link_quality_callback, link_error_callback)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 163, in connect
address)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 102, in __init__
_RadioManager._radios[self._devid] = _SharedRadio(self._devid)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/crtp/radiodriver.py", line 71, in __init__
self.radio = Crazyradio(devid=devid)
File "/home/edwin/.local/lib/python3.6/site-packages/cflib/drivers/crazyradio.py", line 140, in __init__
self.dev.set_configuration(1)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 869, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/core.py", line 148, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "/home/edwin/.local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 794, in set_configuration
_check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
File "/home/edwin/.local/lib/python3.6/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 16] Resource busy

when I launch the python script.

Thank you in advance,

any help is greatly appreciated!

Re: no take off LPS nodes + crazyflie

Posted: Fri Jul 24, 2020 8:04 am
by kimberly
Hi!

This error indicates that the crazyradio is already occupied with something else, as in this case it is the cf-client:

Code: Select all

usb.core.USBError: [Errno 16] Resource busy
The crazyflie can not be connected to the cfclient and the script at the same time. Also for the LPS system, the crazyflie already has the positioning directly onboard, and the cfclient is just there as feedback to see if everything is okay.

The motion_commander_demo.py is designed for the flowdeck but it should work for other positioning systems as well... not sure what is going on there but maybe best to try something else first:

Make sure you are able to go through this tutorial with the cfclient: https://www.bitcraze.io/documentation/t ... using-lps/

If that works, it is probably best to try out the autonomousSequence.py example instead. I would then change the sequence coordinates to only go up a little bit:

Code: Select all

sequence = [
    (2.5, 2.5, 0.4, 0),
]
Hope this will set you in the right direction!

Re: no take off LPS nodes + crazyflie

Posted: Fri Jul 24, 2020 3:07 pm
by curiousstudent
Yep ok so the autonomous sequence works but the:
motion_commander.py does not

Thanks for your reply!

on another note so the autonomous sequence works based off of the positions the drone is told to go. can I use the velocity commands from multiranger_push.py to control the drone inside of the autonomous sequence.py?

Re: no take off LPS nodes + crazyflie

Posted: Mon Jul 27, 2020 12:11 pm
by kimberly
You should be able to use the motion commander class like in the multiranger, yes. But since the motion commander script doesn't work, I wonder what else is going on.

I tried to recreate this by the way, and I am able to fly the examples/motion_commander_demo.py in the LPS system (TDOA3). Even though the demo was made for the flowdeck, it still uses the same principle as with the autonomous_sequence.py. Can you confirm that you wer using motion_commander_demo.py and not motion_commander.py (which is a class and not an example code), just to avoid confusion?

By the way, this thread also mentioned a problem with the motion_commander_demo.py. But his problem was mostly because the crazyflie thought it was already in the air (due to z axis position estimated being 20 cm in the air while the crazyflie is on the ground. You can try to see if you can change the default height of the motion commander when the instance is started:

Code: Select all

        with MotionCommander(scf, default_height=0.7) as mc:

Re: no take off LPS nodes + crazyflie

Posted: Fri Jul 31, 2020 1:48 am
by newcuriousstudent
Hello,

(first of all this is the same person as curiousstudent I forgot my password and then forgot the email account I used with my original account so I created a new account)

So I definitely tried this code:
https://github.com/bitcraze/crazyflie-l ... er_demo.py


So the drone starts up, connects, and then moves along on the floor. But it just does not take off.

Re: no take off LPS nodes + crazyflie

Posted: Fri Jul 31, 2020 1:49 am
by newcuriousstudent
OH wait. Do I need to be in TDOA3? I set up the nodes do be in TWR. Is that the issue?

Re: no take off LPS nodes + crazyflie

Posted: Fri Jul 31, 2020 7:56 am
by kimberly
For a single drone you don't need to be in TDOA3. That shouldn't matter.

Did you change the default height of the motion commander? Have you looked at the LPS tab at the position estimate, or the State-Estimates position in the plotter (stateEstimate.x/y/z)? It seems to me that the script works but the crazyflie 'thinks' its already 20-30 cm in the air. The default height of the motion commander is 30 cm in the air, so if the crazyflie thinks its already there it will not take off.

Have you tried to change the default height of the motion commander to a higher value like I said in the previous message?

Code: Select all

        with MotionCommander(scf, default_height=0.7) as mc:

Re: no take off LPS nodes + crazyflie

Posted: Fri Jul 31, 2020 3:14 pm
by newcuriousstudent
Ah ok. Yeah so in the LPS tab it says crazyflie status is at position (1.80,0.97,0.85).

So how do I change the default height inside of motion commander? I went through the thread you link but I am still confused.

Re: no take off LPS nodes + crazyflie

Posted: Mon Aug 03, 2020 9:44 am
by kimberly
So if the crazyflie says it is on (1.80,0.97,0.85), while it is on the ground, it actualy thinks that it is 0.85 meter in the air, which is a lot! The default height would need to be change do something higher than that, like default_height=1.25. Then the crazyflie will fly up to 0.5 meters (1.25-0.85). The controller inside of the crazyflie uses this position estimate within its position control, so if you give it a value that it can not reach (0.7 means that the crazyflie needs to go through the floor in order to achieve that), you will get problems for sure.

However I do think it is important that you double check the positions set in the LPS nodes, since this is quite a big difference. Checkout this step again in the tutorial and make sure you set the positions exactly on how the nodes are setup in your flight area (especially in the z-axis).

Re: no take off LPS nodes + crazyflie

Posted: Sat Aug 22, 2020 8:04 pm
by newcuriousstudent
So by checking the position on the LPS nodes that solved the issue.
I realized that some of the positions for the nodes were off causing the drone to believe its position was something other than what it truly was.