arplaboratory / learning-to-fly

Training transferable end-to-end quadrotor control policies on a laptop in 18 seconds.
MIT License
387 stars 35 forks source link

Cmake issues #4

Open XxA7medxX opened 7 months ago

XxA7medxX commented 7 months ago

Hello I get this when i run cmake .. -DCMAKE_BUILD_TYPE=Release -DHDF5_ROOT=/opt/homebrew/opt/hdf5 -DCMAKE_PREFIX_PATH="/opt/homebrew/opt/abseil" in the build folder. How to solve this issue? (I am using a macos m1 pro chip). Do you know how can I perhaps fix this? Thanks in advance!

CMake Error at /opt/homebrew/lib/cmake/protobuf/protobuf-targets.cmake:71 (set_target_properties): The link interface of target "protobuf::libprotobuf" contains:

absl::absl_check

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

Call Stack (most recent call first): /opt/homebrew/lib/cmake/protobuf/protobuf-config.cmake:16 (include) CMakeLists.txt:16 (find_package)

jonas-eschmann commented 7 months ago

Hi thanks a lot for reaching out! I suspect this is a problem related to the Tensorboard logger which in turn depends on protobuf and abseil. I suspect this is related to the recent update of protobuf from 25.1 to 25.2 in brew. I just updated to 25.2 and ran into some issues (other than yours, though). I will investigate and try to get it to work with 25.2

PS: You shouldn't have to set -DHDF5_ROOT=/opt/homebrew/opt/hdf5 and DCMAKE_PREFIX_PATH="/opt/homebrew/opt/abseil" as cmake should be able to find them on its own

I'll keep you updated!

jonas-eschmann commented 7 months ago

Okay for me brew link protobuf (after upgrading it) fixed the issue. Can you try it and let me know if it works for you? If you still face the same issue you can also try to disable Tensorboard in the CMakeLists.txt (set(RL_TOOLS_ENABLE_TENSORBOARD OFF)) to see if that lets you compile it

XxA7medxX commented 7 months ago

Hello Jonas, thanks for the reply now I have tried linking it and when I run the cmake in the build folder using cmake .. -DCMAKE_BUILD_TYPE=Release I get the following: even though the boost is already installed.

CMake Error at /opt/homebrew/Cellar/cmake/3.28.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Boost (missing: Boost_INCLUDE_DIR system serialization) Call Stack (most recent call first): /opt/homebrew/Cellar/cmake/3.28.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /opt/homebrew/Cellar/cmake/3.28.2/share/cmake/Modules/FindBoost.cmake:2393 (find_package_handle_standard_args) external/rl_tools/external/highfive/CMake/HighFiveTargetDeps.cmake:52 (find_package) external/rl_tools/external/highfive/CMakeLists.txt:96 (include)

-- Configuring incomplete, errors occurred! (base) ahmedtamer@Ahmeds-MacBook-Pro build % brew --prefix boost /opt/homebrew/opt/boost

jonas-eschmann commented 7 months ago

Okay mhh, I was on boost 1.83 and upgraded to 1.84 but that didn't break it. I was using cmake 3.27.x and upgraded to 3.28.3 but it is still working. Did you try brew link boost or brew reinstall boost?

XxA7medxX commented 7 months ago

Okay I have used export BOOST_ROOT=/opt/homebrew/opt/boost and it seemed to make the build. Now when I run cmake --build . -j8 I get clang: error: linker command failed with exit code 1 (use -v to see invocation) is it normal?

jonas-eschmann commented 7 months ago

Weird that you need to give it the BOOST_ROOT 🤔 but at least it works! No it is not normal 😄 I just ran it cmake --build . -j8 and it successfully compiled everything Do you get any other error output?

XxA7medxX commented 7 months ago

so the build is only working when I have this toggled off set(RL_TOOLS_ENABLE_TENSORBOARD ON) otherwise I get this even though I have reinstalled the package and verified that it is installed CMake Error at /opt/homebrew/Cellar/cmake/3.28.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR) (found version "25.2.0") Call Stack (most recent call first): /opt/homebrew/Cellar/cmake/3.28.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /opt/homebrew/Cellar/cmake/3.28.2/share/cmake/Modules/FindProtobuf.cmake:749 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) external/rl_tools/CMakeLists.txt:197 (find_package)

jonas-eschmann commented 7 months ago

That is strange, did you try to remove the build dir and re-configured from scratch? Apart from that I'm not really sure what is going on (because I can not provoke the same error)

I was thinking about alternatives to Tensorboard logging (because its dependencies are a bit of a pain (mainly due to protobuf) but there is not so much out there.

XxA7medxX commented 7 months ago

I tried using docker instwad and it worked and I have managed to flash the firmware, now I have some questions: first I tried an old script of mine that it makes the crazyflie to take off and then it hovers. It showed to keep hovering very good even when I add disturbances however, when I use your trigger.py I get that

Screenshot 2024-02-10 at 22 36 03
jonas-eschmann commented 7 months ago

I'm happy to hear that it worked!

These are defined in https://github.com/bitcraze/crazyflie-lib-python/blame/7599d54da8a78f573ad2c2778d65a849c71c0652/cflib/crazyflie/commander.py#L37 so maybe updating cflib pip install --upgrade cflib might do the trick?

XxA7medxX commented 7 months ago

That did the work! I really love what you did, by the way; now it's working fine, but I have one small remark about what happened to the landing because in my old code, it used to land. but now it just drops

jonas-eschmann commented 7 months ago

Great, I am very happy that you could get it to work! I agree about the landing but how do you distinguish between "Emergency Kill" and "Landing" when you only have a single button input? I used to use a gamepad, where the trigger was on one of the should buttons and then I could release it, and land it manually or catch it when it goes crazy but for that I had to modify the cfclient ui (discussion here) which was not very stable (button assignment etc.). So I think it is more reliable with this trigger script