How to add external library in px4 code?

#1

I am trying to bring a Filter class into px4 library.

  1. I created a folder name Filter under /src/lib folder and all the relevant files into the folder.

  2. I modified CMakeLists.txt in lib folder to add sub directory by
    add_subdirectory(Filter)

  3. In /src/lib/Filter, I also created CMakeLists.txt and added followings
    px4_add_library(Filter
    LowPassFilter.cpp
    )

  4. Tried to build the firmware and no errors found.

  5. I checked Filter folder created under /build/nuttx_px4fmu-v2_default/src/lib/ however, there is no binary files created in CMakeFiles!
    This creates not defined error when the class is imported in other source code.
    Is there anything missing in adding class templetes into px4 source project?
    Hope someone can help.

Kyu

#2

I sort of figured this out myself.
I found filters in mathlib and I think additional filters can be added there too.

#3

@Kyuhyong_You It would be great if you could share how you solved the problem :slight_smile: