diff --git a/docs/en/SUMMARY.md b/docs/en/SUMMARY.md index 3e4b81b770..468ba9d7ed 100644 --- a/docs/en/SUMMARY.md +++ b/docs/en/SUMMARY.md @@ -890,7 +890,6 @@ - [Integration Testing](test_and_ci/integration_testing.md) - [MAVSDK Integration Testing](test_and_ci/integration_testing_mavsdk.md) - [PX4 ROS2 Interface Library Integration Testing](test_and_ci/integration_testing_px4_ros2_interface.md) - - [ROS 1 Integration Testing](test_and_ci/integration_testing_ros1_mavros.md) - [Docker Containers](test_and_ci/docker.md) - [Maintenance](test_and_ci/maintenance.md) - [Drone Apps & APIs](robotics/index.md) diff --git a/docs/en/test_and_ci/index.md b/docs/en/test_and_ci/index.md index dbb1aa7c11..3c964c0529 100644 --- a/docs/en/test_and_ci/index.md +++ b/docs/en/test_and_ci/index.md @@ -11,6 +11,5 @@ Test topics include: - [Integration Testing](../test_and_ci/integration_testing.md) - [MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md) - [PX4 ROS2 Interface Library Integration Testing](../test_and_ci/integration_testing_px4_ros2_interface.md) - - [ROS 1 Integration Testing](../test_and_ci/integration_testing_ros1_mavros.md) (Deprecated) - [Docker](../test_and_ci/docker.md) - [Maintenance](../test_and_ci/maintenance.md) diff --git a/docs/en/test_and_ci/integration_testing.md b/docs/en/test_and_ci/integration_testing.md index 2cb01ca697..2eb4671267 100644 --- a/docs/en/test_and_ci/integration_testing.md +++ b/docs/en/test_and_ci/integration_testing.md @@ -8,6 +8,3 @@ The tests are run in [Continuous Integration (CI)](../test_and_ci/continous_inte _This is the recommended framework for writing new Integration tests_ - [PX4 ROS2 Interface Library Integration Testing](../test_and_ci/integration_testing_px4_ros2_interface.md) - Integration Tests for the [PX4 ROS 2 Interface Library](../ros2/px4_ros2_interface_lib.md). -The following framework should only be used for tests that require ROS 1: - -- [ROS 1 Integration Testing](../test_and_ci/integration_testing_ros1_mavros.md) (Deprecated) diff --git a/docs/en/test_and_ci/integration_testing_ros1_mavros.md b/docs/en/test_and_ci/integration_testing_ros1_mavros.md deleted file mode 100644 index 6b689fe3b7..0000000000 --- a/docs/en/test_and_ci/integration_testing_ros1_mavros.md +++ /dev/null @@ -1,151 +0,0 @@ -# Integration Testing using ROS 1 - -This topic explains how to run (and extend) PX4's ROS (1) and MAVROS -based integration tests. - -:::warning This test framework is deprecated. -It should be used only for new test cases that _require_ ROS 1. - -[MAVSDK Integration Testing](../test_and_ci/integration_testing_mavsdk.md) is preferred when writing new tests. -::: - -::: info -All PX4 integration tests are executed automatically by our [Continuous Integration](../test_and_ci/continous_integration.md) system. -::: - -## Prerequisites - -- [Gazebo Classic Simulator](../sim_gazebo_classic/index.md) -- [ROS and MAVROS](../simulation/ros_interface.md) - -## Execute Tests - -To run the MAVROS tests: - -```sh -source /devel/setup.bash -cd -make px4_sitl_default sitl_gazebo -make -``` - -`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/`: - -```sh -source /devel/setup.bash -cd -make px4_sitl_default sitl_gazebo -./test/ -``` - -For example: - -```sh -./test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test -``` - -Tests can also be run with a GUI to see what's happening (by default the tests run "headless"): - -```sh -./test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test gui:=true headless:=false -``` - -The **.test** files launch the corresponding Python tests defined in `integrationtests/python_src/px4_it/mavros/` - -## Write a New MAVROS Test (Python) - -This section explains how to write a new python test using ROS 1/MAVROS, test it, and add it to the PX4 test suite. - -We recommend you review the existing tests as examples/inspiration ([integrationtests/python_src/px4_it/mavros/](https://github.com/PX4/PX4-Autopilot/tree/main/integrationtests/python_src/px4_it/mavros)). -The official ROS documentation also contains information on how to use [unittest](https://wiki.ros.org/unittest) (on which this test suite is based). - -To write a new test: - -1. Create a new test script by copying the empty test skeleton below: - - ```python - #!/usr/bin/env python - # [... LICENSE ...] - - # - # @author Example Author - # - PKG = 'px4' - - import unittest - import rospy - import rosbag - - from sensor_msgs.msg import NavSatFix - - class MavrosNewTest(unittest.TestCase): - """ - Test description - """ - - def setUp(self): - rospy.init_node('test_node', anonymous=True) - rospy.wait_for_service('mavros/cmd/arming', 30) - - rospy.Subscriber("mavros/global_position/global", NavSatFix, self.global_position_callback) - self.rate = rospy.Rate(10) # 10hz - self.has_global_pos = False - - def tearDown(self): - pass - - # - # General callback functions used in tests - # - def global_position_callback(self, data): - self.has_global_pos = True - - def test_method(self): - """Test method description""" - - # FIXME: hack to wait for simulation to be ready - while not self.has_global_pos: - self.rate.sleep() - - # TODO: execute test - - if __name__ == '__main__': - import rostest - rostest.rosrun(PKG, 'mavros_new_test', MavrosNewTest) - ``` - -1. Run the new test only - - Start the simulator: - - ```sh - cd - source Tools/simulation/gazebo/setup_gazebo.bash - roslaunch launch/mavros_posix_sitl.launch - ``` - - - Run test (in a new shell): - - ```sh - cd - source Tools/simulation/gazebo/setup_gazebo.bash - rosrun px4 mavros_new_test.py - ``` - -1. Add new test node to a launch file - - In `test/` create a new `.test` ROS launch file. - - Call the test file using one of the base scripts _rostest_px4_run.sh_ or _rostest_avoidance_run.sh_ - -1. (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: - - ```sh - tests_: rostest - @"$(SRC_DIR)"/test/rostest_px4_run.sh mavros_posix_tests_.test - ``` - -Run the tests as described above.