PX4 can be tested end to end to using integration tests based on MAVSDK.
The tests are primarily developed against SITL for now and run in continuous integration (CI). However, they are meant to generalize to real tests eventually.
The tests need the MAVSDK C++ library installed system-wide (e.g. in
MAVSDK can either be installed as a prebuilt library or alternatively be built from source and installed system-wide.
Download the matching .deb file (whichever is correct for your system) from MAVSDK releases.
Install it using
sudo dpkg -i mavsdk_0.23.0_ubuntu18.04_amd64.deb
Download the matching .rpm file (whichever is correct for your system) from MAVSDK releases.
Install it using
sudo rpm -U mavsdk-0.23.0-1.fc30-x86_64.rpm
Install the library using brew:
brew install mavsdk
Instead of installing the latest pre-built release, MAVSDK can also be built from sources. This enables you to build the library if there is is no prebuilt package for your platform, or because you need to use the latest develop branch, or some custom branch or pull request. Also, you can specify the compile options, e.g. to select a debug build.
First fetch the sources from GitHub:
git clone https://github.com/mavlink/MAVSDK.git --recursive
Then build and install the library:
cd MAVSDK cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_BACKEND=OFF -Bbuild -H. && cmake --build build -j 8 && sudo cmake --build build --target install
To build the PX4 code, use:
DONT_RUN=1 make px4_sitl gazebo mavsdk_tests
To run all tests, use:
test/mavsdk_tests/mavsdk_test_runner.py --speed-factor 20 --gui
To see all possible command line arguments, check out: