bitcraze / crazyflie-simulation

MIT License
62 stars 27 forks source link

cffirmware python bindings pointing to the wrong folder #51

Open Maaaackster opened 10 months ago

Maaaackster commented 10 months ago

I'm trying to use the cffirmware bindings in webots. Followed instructions under:

https://www.bitcraze.io/documentation/repository/crazyflie-simulation/main/functional_areas/controllers/.

When running webots I get the following error:

Traceback (most recent call last): File "/home/marcus/LIU/TSRT10/crazyflie-simulation/webots/controllers/crazyflie_controller_py_firmware_pid/crazyflie_controller_py_firmware_pid.py", line 31, in import cffirmware File "/home/marcus/.local/lib/python3.10/site-packages/cffirmware.py", line 15, in import _cffirmware ModuleNotFoundError: No module named '_cffirmware' WARNING: 'crazyflie_controller_py_firmware_pid' controller exited with status: 1.

Would gladly appriciate any help I could get.

knmcguire commented 10 months ago

Hi! Have you updated this line to the actual location of your firmware?

https://github.com/bitcraze/crazyflie-simulation/blob/9fc77d2967be7f1aad0c2af608d729433e2880b7/simulator_files/webots/controllers/crazyflie_controller_py_firmware_pid/crazyflie_controller_py_firmware_pid.py#L30

And also have you build the python bindings as well?: https://www.bitcraze.io/documentation/repository/crazyflie-firmware/master/building-and-flashing/build/#build-python-bindings

Maaaackster commented 10 months ago

Hi! Thanks for the quick reply! So I have updated the line according to my folder structure, so that it looks like this:

sys.path.append('../../../../../../crazyflie-firmware')

I have also tried with the absolute path. But just to be clear, is it supposed to point to the parent directory of the crazyflie-firmware. Not the build directory "/build" where the python bindings are built as described in the link you now posted?

knmcguire commented 10 months ago

You might be right actually. Have you tried adding the build folder too? then we need to change the docs and such.

Crazyswarm2 also uses the same python bindings for their simulation and they refer to the build folder. https://imrclab.github.io/crazyswarm2/installation.html

Maaaackster commented 10 months ago

Okey now it is working! I tried changing the path to the actual build folder and that did it! :) Maybe I should have thought of that sooner... But anyways thanks so much for the help!

sys.path.append('../../../../../../crazyflie-firmware/build')

knmcguire commented 10 months ago

I'll keep it open as we actually need to fix this, and issues we see as 'a thing that we need to fix in the code or doc'. Regular support questions works differently but that is https://discussions.bitcraze.io/