Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't connect to esp-drone #3

Open
livigni opened this issue Oct 6, 2024 · 8 comments
Open

can't connect to esp-drone #3

livigni opened this issue Oct 6, 2024 · 8 comments

Comments

@livigni
Copy link

livigni commented Oct 6, 2024

Hi,
trying to use this cfclient fork to connect to esp-drone (I'm on mac m1). I click scan, then connect and got the errore below. Wifi is connected to the esp-drone one.
Any hints?

Thanks

vicio@vicio-m1 crazyflie-clients-python % cfclient
UserWarning: Using SDL2 binaries from pysdl2-dll 2.24.0
INFO:cfclient.gui:Disabling STL printouts
INFO:cfclient.gui:Foundation not found. Menu will show python as application name
INFO:cfclient.utils.input.inputreaders:Input readers: ['linuxjsdev', 'pysdl2']
INFO:cfclient.utils.input.inputreaders:Could not initialize [linuxjsdev]: Only supported on Linux
INFO:cfclient.utils.input.inputreaders:Successfully initialized [pysdl2]
INFO:cfclient.utils.input.inputinterfaces:Found interfaces: ['leapmotion', 'wiimote', 'zmqpull']
INFO:cfclient.utils.input.inputinterfaces:Could not initialize [leapmotion]: Leap Motion library probably not installed (No module named 'leapsdk')
INFO:cfclient.utils.input.inputinterfaces:Could not initialize [wiimote]: Missing cwiid (wiimote) driver No module named 'cwiid'
INFO:cfclient.utils.config:Dist config read from /Users/vicio/src/espressif-esp-drone/crazyflie-clients-python/src/cfclient/configs/config.json
INFO:cfclient.utils.config:Config file read from [/Users/vicio/Library/Application Support/cfclient/config.json]
INFO:cfclient.utils.input.inputinterfaces:Could not initialize [zmqpull]: ZMQ input disabled in config file
INFO:OpenGL.acceleratesupport:No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
INFO:cfclient.utils.zmq_led_driver:ZMQ led disabled in config file
INFO:cfclient.utils.zmq_param:ZMQ param disabled in config file
INFO:cfclient.gui:If startup fails because of "xcb", install dependency with `sudo apt install libxcb-xinerama0`.
INFO:cfclient.utils.input:Using device blacklist [(VirtualBox|VMware)]
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
Cannot find a Crazyradio Dongle
INFO:cflib.drivers.cfusb:Looking for devices....
INFO:cflib.crtp.prrtdriver:Initialized PRRT driver.
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for toolbox_areas
INFO:cfclient.ui.tab_toolbox:No config found for open_toolboxes
INFO:cfclient.ui.tab_toolbox:No config found for open_toolboxes
WARNING: Populating font family aliases took 62 ms. Replace uses of missing font family "Palantino" with one that exists to avoid this cost.
WARNING:vispy:Populating font family aliases took 62 ms. Replace uses of missing font family "Palantino" with one that exists to avoid this cost.
INFO:cfclient.utils.input.inputreaders.pysdl2:Looking for devices
INFO:cfclient.utils.input.inputreaders.pysdl2:Found 1 devices
INFO:cfclient.utils.input:Selected MUX: Normal
INFO:cfclient.ui.main:Role of PS4 Controller is Device
INFO:cfclient.utils.input.mux:Adding device PS4 Controller to MUX Normal
WARNING:cfclient.ui.main:Cannot find a Crazyradio Dongle
Cannot find a Crazyradio Dongle
INFO:cflib.drivers.cfusb:Looking for devices....
INFO:cflib.crtp.prrtdriver:Initialized PRRT driver.
INFO:cflib.crazyflie:Callback->Connection initialized[udp://192.168.43.42:2390]
ERROR:cflib.crazyflie:Couldn't load link driver: [Errno 56] Socket is already connected

Traceback (most recent call last):
  File "/Users/vicio/.espressif/python_env/idf4.4_py3.11_env/lib/python3.11/site-packages/cflib/crazyflie/__init__.py", line 231, in open_link
    self.link = cflib.crtp.get_link_driver(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vicio/.espressif/python_env/idf4.4_py3.11_env/lib/python3.11/site-packages/cflib/crtp/__init__.py", line 99, in get_link_driver
    instance.connect(uri, link_quality_callback, link_error_callback)
  File "/Users/vicio/.espressif/python_env/idf4.4_py3.11_env/lib/python3.11/site-packages/cflib/crtp/udpdriver.py", line 62, in connect
    self.socket.sendto('\xFF\x01\x01\x01'.encode(), self.addr)
OSError: [Errno 56] Socket is already connected

INFO:cflib.crazyflie:Callback->Connected failed to [udp://192.168.43.42:2390]: Couldn't load link driver: [Errno 56] Socket is already connected

Traceback (most recent call last):
  File "/Users/vicio/.espressif/python_env/idf4.4_py3.11_env/lib/python3.11/site-packages/cflib/crazyflie/__init__.py", line 231, in open_link
    self.link = cflib.crtp.get_link_driver(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vicio/.espressif/python_env/idf4.4_py3.11_env/lib/python3.11/site-packages/cflib/crtp/__init__.py", line 99, in get_link_driver
    instance.connect(uri, link_quality_callback, link_error_callback)
  File "/Users/vicio/.espressif/python_env/idf4.4_py3.11_env/lib/python3.11/site-packages/cflib/crtp/udpdriver.py", line 62, in connect
    self.socket.sendto('\xFF\x01\x01\x01'.encode(), self.addr)
OSError: [Errno 56] Socket is already connected

INFO:cfclient.utils.config:Config file saved to [/Users/vicio/Library/Application Support/cfclient/config.json]
INFO:cflib.crazyflie:Closing link
INFO:cflib.crazyflie:Callback->Disconnected from [udp://192.168.43.42:2390]
@cranberrysoft
Copy link

You actually need to remove "connect" from the udpdriver https://github.com/leeebo/crazyflie-lib-python/blob/a430283a3b608db7c0b3227aa37d7120858c25ef/cflib/crtp/udpdriver.py#L60
And then build the client with the updated library this should solve your problem.

I still have some problems as it does look like it disconnects from the drone after a couple of seconds. It does read all the data and then it suddenly stops sending data. It might be something related to my drone which I built from scratch and had to slightly modify the firmware not sure yet...
Overall pretty cool project.

@lovefool
Copy link

I have same issue. cfclient is disconnected after a few seconds, w/ error of "WIFI_UDP: udp packet cksum unmatched" on esp-dorne log. Accouring to the author, he doesn't have this issue.

espressif/esp-drone#84

@livigni
Copy link
Author

livigni commented Oct 19, 2024

You actually need to remove "connect" from the udpdriver https://github.com/leeebo/crazyflie-lib-python/blob/a430283a3b608db7c0b3227aa37d7120858c25ef/cflib/crtp/udpdriver.py#L60 And then build the client with the updated library this should solve your problem.

Thanks for the reply. I have cloned the crazyflie-lib-python, edited accordingly and install it via "pip install -e .".

Then I reinstalled crazyflie-client via "pip install -e ." but I think it reinstall the unpatched crazflie-lib from leeebo rep. Do I need to modify somehow the setup.py? I am not a top expert on python unfortunately (quite hate all this pip and venv philosophy).

EDIT: I have edited setup.py commenting the dependance on the lib, so to use the previously edited installed one. So now the app connects and does something :) Still the drone spins motor but does not fly...will see what comes next

@cranberrysoft
Copy link

Hey just update
setup.py and point to your local modified version

    install_requires=['cflib @ file:///esphome/esp-home/crazyflie-lib-python',

PXL_20241020_065723341

I use the mobile app to control my drone. I also have problems with the drone being slightly heavy, ~74g. It does lift a little bit but does not fly... I'm planning to change the motors to bigger, the same as in DJI Tello.
In general it seems like 720 motors can not lift more than 60 grams

@livigni
Copy link
Author

livigni commented Oct 20, 2024

thanks for the support.
In my case drone lost connection after I make the motors spinning from the android app. the motors keep spinning but I'm not able to control anymore (still with no lift, but I understand that motor are not at max throttle). I need to try with a better battery: the one I use it's a 2Ah but the discharge rating is not known. I may look for a 30C discharge one.

@livigni
Copy link
Author

livigni commented Oct 20, 2024

Hey just update setup.py and point to your local modified version

    install_requires=['cflib @ file:///esphome/esp-home/crazyflie-lib-python',

PXL_20241020_065723341

I use the mobile app to control my drone. I also have problems with the drone being slightly heavy, ~74g. It does lift a little bit but does not fly... I'm planning to change the motors to bigger, the same as in DJI Tello. In general it seems like 720 motors can not lift more than 60 grams

I have noticed in your pic that IMU is not at the center of the drone body. have you accounted in firmware for this offset?

@cranberrysoft
Copy link

Hey just update setup.py and point to your local modified version

    install_requires=['cflib @ file:///esphome/esp-home/crazyflie-lib-python',

PXL_20241020_065723341
I use the mobile app to control my drone. I also have problems with the drone being slightly heavy, ~74g. It does lift a little bit but does not fly... I'm planning to change the motors to bigger, the same as in DJI Tello. In general it seems like 720 motors can not lift more than 60 grams

I have noticed in your pic that IMU is not at the center of the drone body. have you accounted in firmware for this offset?

Mobile app does allow to set the pitch to compensate this. I also placed the battery slightly towards the back. If this does not help then you are correct I may need to adjust the firmware.

When it comes to the battery 2C definitely you should have battery for drone with higher discharge. I made the same mistake at the beginning when I used a regular LiPo battery and the microcontroller would just restart.

@livigni
Copy link
Author

livigni commented Oct 21, 2024

ye, I will get a more suitable battery and see if things improve.
For the IMU alignment there are these defines in components/platform/platform_defaults.h:

// IMU alignment on the airframe
#ifndef IMU_PHI
#define IMU_PHI 0.0f
#endif
#ifndef IMU_THETA
#define IMU_THETA 0.0f
#endif
#ifndef IMU_PSI
#define IMU_PSI 0.0f
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants