ROS Integration Testing
Last updated
Last updated
This topic explains how to run (and extend) PX4's ROS-based integration tests.
:::note is preferred when writing new tests. Use the ROS-based integration test framework for use cases that require ROS (e.g. object avoidance).
All PX4 integraton tests are executed automatically by our system. :::
To run the MAVROS tests:
test_target
is a makefile targets from the set: tests_mission, tests_mission_coverage, tests_offboard and tests_avoidance.
Test can also be executed directly by running the test scripts, located under test/
:
For example:
Tests can also be run with a GUI to see what's happening (by default the tests run "headless"):
The .test files launch the corresponding Python tests defined in integrationtests/python_src/px4_it/mavros/
This section explains how to write a new python test using ROS 1/MAVROS, test it, and add it to the PX4 test suite.
To write a new test:
Create a new test script by copying the empty test skeleton below:
Run the new test only
Start the simulator:
Run test (in a new shell):
Add new test node to a launch file
In test/
create a new <test_name>.test
ROS launch file.
Call the test file using one of the base scripts rostest_px4_run.sh or rostest_avoidance_run.sh
(Optional) Create a new target in the Makefile
Open the Makefile
Search the Testing section
Add a new target name and call the test
For example:
Run the tests as described above.
We recommend you review the existing tests as examples/inspiration (). The official ROS documentation also contains information on how to use (on which this test suite is based).