Testing scripts to test ulogs for px4-specific implementations.
To prevent any conflict with the system python version, it is suggested to use a virtual enrionment with python version 3.6 and higher. Otherwise, python 3.6 and higher must be the python system version. If you don't have 3.6 installed on your machinge, you can follow this tutorial.
First install virtualenv:
sudo apt install virtualenvInstall virtualenvrapper: this will install virtualenvwrapper.sh in ~/.local/bin
pip install virtualenvwrapperCreate a virtual environement directory
mkdir ~/.virtualenvsAdd virtual envrionment working-folder to bashrc and source virtualenvwrapper:
export WORKON_HOME=$HOME/.virtualenvs
source $HOME/.local/bin/virtualenvwrapper.shOpen new terminal or source bashrc:
source ~/.bashrcCreate a virtual environment with python version 3 and no site packages included (python3 must be installed)
mkvirtualenv --python=python3 --no-site-packages [name-of-new-env]You now created a new virtual environment with name [name-of-new-env].
To enter [name-of-new-env]:
workon [name-of-new-env]To exit [name-of-new-env]:
deactivateTo test a log file, pass its absolute path as a command line argument (see example below)
All the tests are in the tests directory. Tests should be split into tests that apply for any ulog file and tests that are coupled to a specific simulated test.
To run general tests:
py.test -s tests/test_general.py --filepath=absolute/path/to/logfile.ulgUsing -s allows you to see print statements for the skipped tests
With the current default log, the test for tilt will fail because the vehicle flipped during the actual flight.