Add new library

Hello
I would like to add a new library to the ardupilot library.
However, I do not know the correct procedure to add libraries.
I have created a new “AC_MYPID” folder in the library directory.
After that, I made AC_MYPID.cpp and AC_MYPID.h

library / AC_MYPID / AC_MYPID.cpp
library / AC_MYPID / AC_MYPID.h

However, I built it with sim_vehicle.py, but AC_MYPID.cpp was not built.
Please let me know the correct procedure

I found that it is enough to add libraries to wscript

Hi,
I am trying to do the exact same thing, but I’m building ArduCopter with Make. Can anyone let me know what needs to be done to include a new library in the build process? I would like to use it on the Pixhawk target as well, so I want to just add it to all make targets. I couldn’t locate a make file which adds the libraries, can someone help?

Thanks!

Hi friend, have you solved this problem?

I think you should add your lib to ArduCopter/make.inc and ArduCopter/wscript

Hi! I also try to add a library to ArduCopter (using version 3.6.11). So I added the files to make.inc and wscript, as @ejngnng suggested it.

My new library is called AC_GroundProfileAcquisition, and I put the files in libraries/AC_GroundProfileAcquisition. There I have three files so far:

  1. AC_GroundProfileAcquisition.h, which only consists of #include <AC_GroundProfileAcquisition/GroundProfileAcquisition.h>
  2. GroundProfileAcquisition.h with the declarations
  3. GroundProfileAcquisition.cpp with the definitions
    I found this structure in other ArduCopter libraries, such as AP_RangeFinder.

When building it with waf, I get a strange error:

Dependency /home/crowdsweeper/git/ardupilot-Copter_3_6_11-AltCS/ardupilot/libraries/GroundProfileAcquisition.h for 
{task 139665330699504: cxx AC_Loiter.cpp -> AC_Loiter.cpp.0.o} is missing: check the task declaration and the build order!

I didn’t use any files of my new library in AC_Loiter
The compiler goes on (I will leave out the python call stack of waf) with a Build failed
[…]

KeyError: /home/crowdsweeper/git/ardupilot-Copter_3_6_11-AltCS/ardupilot/libraries/GroundProfileAcquisition.h

strange thing is, I never put an #include "GroundProfileAcquisition.h", but rather <AC_GroundProfileAcquisition/GroundProfileAcquisition.h>.
How can I tell waf to use the correct path?