mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 14:19:57 +08:00
* build(mavsdk_tests): stop building the C++ integration tests The integration tests are moving to the native MAVSDK Python package, so the C++ test binary and its pinned libmavsdk-dev package are no longer needed. The C++ sources stay in the tree as a reference until all tests are ported. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): run the integration tests with MAVSDK Python The MAVSDK pip package is now a native binding of the C++ library, so the tests can be written in Python without a C++ build or a matching libmavsdk-dev package, and the version is pinned in requirements.txt. The existing runner keeps starting PX4 for each case; only the test executable changes to pytest. Cases are pytest node IDs and the Catch2 tags become pytest markers. The tester is a port of the C++ AutopilotTester core. Checks done in telemetry callbacks are collected and fail the test at teardown, since MAVSDK Python swallows exceptions raised in callbacks. The first ported test is takeoff and hold position. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): port the multicopter tests to Python Ports missions, offboard, manual flight, failsafes, failure injection, RTL with rally points and geofence avoidance, home yaw and parameter FTP. The tester gains the raw mission, manual control, failure, FTP and MavlinkDirect helpers these need, plus an RTL subclass for rally points and the geofence breach monitor. The failsafe tests are parametrized over the height source instead of being duplicated. The parameter FTP download test now waits for the baro GNSS calibration before comparing, since the offset it writes could otherwise change between the PARAM_VALUE and the FTP download. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): port the VTOL and control allocation tests to Python Ports the VTOL missions, the VTOL return tests, figure eight, loiter reposition, airspeed failure, the SIH XVert transition and the gazebo-classic control allocation tests. The loiter and figure-eight testers are merged into one loiter tester that sends its commands as COMMAND_INT through MavlinkDirect. NaN fields are sent as JSON null, since NaN is not valid JSON and MAVSDK reads null as NaN. Timeouts that were host time in C++ (approaches, figure eight) are now sim time with values that fit the speed factors used in CI. The gazebo runner can now take the world from the config, since pytest node IDs no longer carry "(name.world)". Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): settle the hover before injecting motor failures The altitude and speed waits both pass while the vehicle is still slowing down at the top of the climb, so the altitude reference for the failure was taken mid-climb. At 30x speed the following overshoot was just over the 1 m tolerance. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): port the follow-me tests to Python The C++ follow-me tests were never built: they were disabled pending a MAVSDK change that has long since been merged, and the RC adjustment test did not even compile. They now run with the other multicopter tests. Running them for the first time showed a few test bugs: target locations were sent before follow-me was active, manual control was dropped after 20 s, and the angle check ignored the rate limit from FLW_TGT_MAX_VEL. The RC checks now measure the change from right before each stick input. The follow distance adjusts at about 40% of the nominal speed, since PX4 only grows the setpoint while the drone is within 1 m of it. The test accepts that for now. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): remove the C++ integration tests All tests now run with MAVSDK Python, so the C++ tests, the tester classes and the bundled Catch2 are no longer needed. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * build(setup): install the integration test requirements The MAVSDK and pytest pins move to Tools/setup/test-requirements.txt, which the setup scripts and the dev container now install, so the integration tests work after the normal environment setup. The mavsdk pin allows 4.0.x patch releases only. The file lives in Tools/setup because that is the dev container's build context. Container builds that stage only requirements.txt skip it. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * docs(test_and_ci): describe the Python MAVSDK integration tests Covers the setup, running test cases by pytest ID, running a test against a PX4 instance started by hand, and writing tests with the testers and fixtures. Drops the Catch2 notes and the outdated list of test cases. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * refactor(packaging): port the SIH container mission test to MAVSDK v4 Since v4, the mavsdk package is the native binding with a different API, so the script failed to import with the version the setup scripts now install. It now uses the synchronous API. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): work around MAVSDK-Python unsubscribe crash Up to MAVSDK-Python 4.0.6, unsubscribe_*() releases the callback trampoline before the C unsubscribe returns, so a callback that is running or waiting for the GIL can jump into freed memory. This crashed the hex test in CI. Keep the subscription entries until the tester is closed, until the pin includes the fix. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): retry the param FTP comparison until values settle Waiting for CAL_BARO0_OFF to change does not work everywhere: at the CI home location the baro already matches GNSS and the calibration writes an offset of 0. Instead, compare the PARAM_VALUE and FTP downloads and retry a few times while parameters still settle. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): port the vision target tests to Python Port the precision landing tests from #29265: the pad is simulated with TARGET_RELATIVE and TARGET_ABSOLUTE sent through MavlinkDirect, and the estimate is checked from LANDING_TARGET. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): fail when a filter or case selects nothing A config filter that matched no test, for example because of a typo, ran zero cases and passed. Also, --case used fnmatch, which reads the brackets of parametrized test IDs as a character class, so such a test could not be selected by its ID. Treat brackets literally and fail when nothing is selected. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): check the COMMAND_ACK of sent commands Commands sent through MavlinkDirect were sent once and the ACK was ignored, so a dropped or denied command only showed up later as an unrelated timeout. Retry until acked like MAVSDK does, and check the result. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): check the condition once more on poll timeout Also make the comment of check_rtl_approaches say that it can't fail. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> * test(mavsdk_tests): disable baro auto-calibration in the param FTP test Port #29359 to the Python test: the baro GNSS calibration can save a new CAL_BARO0_OFF between the PARAM_VALUE and FTP downloads. Disable it instead of retrying the comparison. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Julian Oes <julian@oes.ch> --------- Signed-off-by: Julian Oes <julian@oes.ch>
44 lines
1.2 KiB
Docker
44 lines
1.2 KiB
Docker
# PX4 base development environment
|
|
FROM ubuntu:24.04
|
|
LABEL maintainer="Daniel Agar <daniel@agar.ca>, Ramon Roche <mrpollo@gmail.com>"
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV LANG=C.UTF-8
|
|
ENV LC_ALL=C.UTF-8
|
|
ENV DISPLAY=:99
|
|
ENV TERM=xterm
|
|
ENV TZ=UTC
|
|
ENV RUNS_IN_DOCKER=true
|
|
|
|
# SITL UDP PORTS
|
|
EXPOSE 14556/udp
|
|
EXPOSE 14557/udp
|
|
|
|
# Install Shell Script Entrypoint
|
|
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
|
|
|
|
# Install PX4 Requirements
|
|
COPY requirements.txt /tmp/requirements.txt
|
|
COPY test-requirements.txt /tmp/test-requirements.txt
|
|
COPY ubuntu.sh /tmp/ubuntu.sh
|
|
|
|
RUN bash /tmp/ubuntu.sh --no-sim-tools
|
|
|
|
# Install the optional tooling requirements as well, so CI jobs that need them
|
|
# (itcm_check) don't have to reach out to PyPI on every run.
|
|
COPY optional-requirements.txt /tmp/optional-requirements.txt
|
|
|
|
RUN python3 -m pip install --break-system-packages -r /tmp/optional-requirements.txt
|
|
|
|
# Make sure git is ok with your local copy
|
|
RUN git config --global --add safe.directory '*'
|
|
|
|
# Create user with id 1001 (jenkins docker workflow default)
|
|
RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user
|
|
|
|
ENV PATH="${PATH}:/opt/xtensa-esp-elf/bin"
|
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
|
|
CMD ["/bin/bash"]
|