DevGuide/Mathlib

From PaparazziUAV
Jump to: navigation, search

The math lib located in sw/airborne/math is used in all airborne code of paparazzi. It provides functions:

  • to manipulate euler angles, quaternion and rotation matrix
  • for basic trigonometry using fixed-point algebra
  • to perform geodetic transform

The generated docs can be found on http://docs.paparazziuav.org/latest/group__math.html

A PDF documentation can also be generated from the TeX files in doc/pprz_algebra and doc/pprz_geodetic.

Install a shared library to use in other projects (Linux)

Build library

In sw/airborne/math folder, type

make shared_lib

The default build directory is var/build/math, to change it:

BUILDDIR=<your_build_dir> make shared_lib

Install library

In sw/airborne/math folder, type

make install_shared_lib

The default install dir is /usr and will install files in

/usr/lib
/usr/lib/pkgconfig
/usr/include/pprz

To change the install dir:

PREFIX=<your_install_dir> make install_shared_lib

Note: the default install dir needs root privilege. For "local" install, it is recommended to change the default install dir for ${HOME}/usr

Note: "make clean" will only clean the build directory

Use the shared library

  • with pkg-config --cflags --libs
  • by hand:
 LIBS: -L<prefix>/lib -lpprzmath
 CFLAGS: -I<prefix>/include/pprz