Commit Graph

348 Commits

Author SHA1 Message Date
Claudio Chies
651b8687b8 feat(failure_injection): selectable detected/un-detected motor failure via SYS_FAIL_MOT_OFF (#28210)
* feat(failure-injection): implement motor failure injection with soft and hard modes

* feat(failure-injection): update motor failure injection descriptions and behaviors for annunciated and un-annunciated modes

* feat(failure-injection): update motor failure injection terminology to detected and undetected modes

* feat(failure-injection): refine motor failure injection handling for detected and undetected modes

* fix(boards): remove FailureInjector::update() from itcm_functions

FailureInjector was replaced by the shared failure_injection library, so
the symbol no longer exists and the ITCM check fails on the boards that
still list it. Its successor failure_injection::Config::update() is an
inline no-op unless MODULES_FAILURE_INJECTION_MANAGER is enabled, which
none of these boards do, so there is no replacement symbol to map.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Claudio-Chies <61051109+Claudio-Chies@users.noreply.github.com>

---------

Signed-off-by: Claudio-Chies <61051109+Claudio-Chies@users.noreply.github.com>
Co-authored-by: Claudio Chies <chiesc@chies.com>
2026-09-16 10:10:18 +02:00
Ramon Roche
b28ba0eedb ci(ros2): test PR firmware in the ROS development container
Build each PR firmware and matching ROS workspace from source against the digest-pinned Jazzy toolchain. Run the interface library unit and SIH integration suites without reusing stale firmware or generated messages.

Assisted-by: Copilot:gpt-6-astra
2026-09-10 16:07:58 -07:00
Jacob Dahl
dcfce4343a feat(mavlink): serve and accept packed parameters as @PARAM/param.pck (#28435)
* feat(mavlink): serve packed parameters as @PARAM/param.pck

QGC already downloads ArduPilot parameters as a packed FTP file, which
is much more reliable on lossy SiK links than the PARAM_VALUE firehose.
Serve the same format from PX4 so a hash miss can use that path.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(mavlink): serialize the full message when resending a cached FTP reply

_last_reply caches only the header, PayloadHeader and four data bytes,
but the resend path handed that 19-byte array to the serializer as a
complete mavlink_file_transfer_protocol_t, which reads 254 bytes and
transmits whatever follows the cache. The decoded request is dead once
the resend decision is made, so expand the cache into it instead of
adding another message to the receiver thread's stack. Clear the unused
payload before caching so a resent NAK matches the original.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* test(mavsdk_tests): download parameters via MAVLink FTP

Fetch @PARAM/param.pck through MAVSDK's burst download on SIH and check
every entry against the PARAM_VALUE stream, so the packed format and the
FTP server's session, size and EOF handling stay covered by the SITL
tests that QGC and MAVSDK both rely on.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(mavlink): cache FTP Open ACKs whose size LSB is 5

_reply skipped the compact cache whenever data[0] was kErrNoSessionsAvailable. On a NAK that is the error code; on an Open ACK it is the file size LSB. A lost Open ACK for param.pck of that length was retried as a second Open and failed.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* feat(tools): download packed parameters over MAVFTP

Host-side check of @PARAM/param.pck against the PARAM_VALUE stream.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(mavlink): pad so a defaulted value does not straddle an FTP block

pack() kept the last 4 bytes of an entry in one chunk. With withdefaults those bytes are the default, so the value can still split. QGC always requests defaults; a hole-fill then retries one chunk with a live param_get().

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(mavlink): snapshot param.pck at open so a param_set cannot corrupt it

Pack the used set once into a heap buffer. Reads memcpy that snapshot, so a value change during the download cannot shift later entries or splice two generations across a retried FTP block.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(mavlink): freeze param.pck membership instead of snapshotting the file

Keep which parameters appear and whether each includes a default in bitsets (~1 KB). Pack values live. Layout cannot shift mid-download; a retried block cannot splice a number.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* style(mavlink): format MavlinkFtpParamTest.cpp

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* refactor(mavlink): keep FTP work buffers as members

@PARAM/param.pck is a connect-time path, not the rare path the lazy new[] was for. send() could free the buffers after 2 s of no request while a burst was still running. Fold them into the instance (495 B) and always idle-close the session at 30 s.

A new Open takes over the single session so a lost Terminate on a slow link does not NAK until that close.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(tools): make mavftp_param.py reliable on a radio link

pymavlink applied FTP timings after ResetSessions, wrote param.pck?withdefaults=1 into cwd, and bumped the session id on Open retry (PX4 only ACKs session 0). Set radio timings at construction, pin session 0, retry a missed Open, and treat a complete decode as success.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* feat(mavlink): accept packed parameter FTP uploads

CreateFile/Write/Terminate of @PARAM/param.pck applies the ArduPilot
packed stream so a GCS can bulk-load without a PARAM_SET round trip per
value. Unknown and read-only names are skipped; Terminate NAKs a
truncated file or the with-defaults magic.

* test(mavsdk_tests): upload MPC_XY_P via packed param FTP

Pin the SIH upload case to a known float instead of whatever
get_all_params() returns first.

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-09-08 20:16:14 -06:00
Roman Bapst
338592cb98 fix(simulation): fix test filter for loiter tests (#28271)
The fixed wing loiter tests were not running because the test filter did not match.

Also the test was failing because the altitude threshold when to stop checking the "established on loiter" criteria was lower than the fixed wing altitude acceptance radius, so the test was always failing.
2026-09-04 16:42:06 +02:00
Saibernard
290f56d6a8 fix(navigator): keep a VTOL in multicopter mode through mission RTL (#28399)
* fix(navigator): preserve VTOL mode in direct mission RTL

Remove the unconditional multicopter-to-fixed-wing transition from direct mission-land RTL so the return uses the VTOL mode active when RTL starts. This allows an MC-mode vehicle to proceed through the mission landing sequence instead of becoming stuck after an unnecessary forward transition.

Add module-level and MAVSDK SITL regressions covering an airborne multicopter-mode VTOL with a planned mission landing.

Refs #27817

Refs #24323

Assisted-by: Codex:gpt-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

* fix(navigator): drop the fixed wing transition from the fast RTL modes too

The fast and the reverse mission RTL carried the same request for a
transition to fixed wing as the direct mission land RTL. The VTOL
attitude controller rejects that command during RTL, so a VTOL in
multicopter mode waited on it forever instead of flying the mission.
Remove both. A VTOL in multicopter mode now flies the mission RTL as a
multicopter, the same as direct RTL does. Reported in #24323.

Two unit tests pin the active item to a waypoint for a VTOL in
multicopter mode, and two MAVSDK cases fly it on the standard VTOL in
SIH: the mission landing and the reverse mission both stay in
multicopter mode to touchdown, within 5 m of the land item and of home.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>

---------

Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
2026-09-03 13:04:25 -06:00
Anil Kircaliali
c5e1372058 feat(rtl): add RTL_TYPE 6 prioritizing home over rally points with battery reachability check (#26968)
Return home if the estimated flight time to home fits within the
remaining battery time; otherwise return to the closest rally point.
If the battery time estimate is unavailable, return to the closest
safe point (home or rally).
2026-08-14 10:39:42 -06:00
James Botwina
47ce421a88 fix(simulator_sih): restore xvert front transition (#28090)
* fix(simulator_sih): correct tailsitter pitot axis

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

* fix(airframes/10042): tune xvert transition

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

* test(mavsdk_tests): cover xvert transition

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

* fix(airframes/10042): disable airspeed scaling

Signed-off-by: jbotwina <jimbotwina16@gmail.com>

---------

Signed-off-by: jbotwina <jimbotwina16@gmail.com>
2026-07-29 13:01:51 -06:00
Roman Bapst
9467506bff fix(navigator): resolve DO_JUMP set as current mission item (#28063)
* test(mavsdk): add multicopter DO_JUMP set-current regression test

Add an integration test for an external MISSION_SET_CURRENT that targets a
DO_JUMP item mid-mission - the scenario that used to strand the vehicle on an
invalid IDLE setpoint (fixed in the following navigator commit).

The test flies a multicopter mission containing a DO_JUMP that loops back to an
earlier waypoint, commands the current item to the DO_JUMP index while airborne,
and checks that the mission still resolves the jump, runs to completion, lands
and disarms within the timeout.

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* fix(navigator): resolve DO_JUMP when loading the current mission item

An external MISSION_SET_CURRENT sets the current sequence verbatim, with no
jump resolution. If it points directly at a DO_JUMP item, the navigator loaded
that jump as the current mission item. A DO_JUMP carries no position, so
setActiveMissionItems() never overwrote the current setpoint left behind by
reset_triplets() - an invalid IDLE setpoint. The vehicle then loitered in place
at altitude indefinitely, never resolving the jump and never completing the
mission (observed in a real flight).

Resolve the jump when loading the current item: follow it to its target without
consuming a repetition (a set-current is an out-of-band action, not a normal
traversal). For an already-resolved, non-jump current item this is a no-op, so
normal mission traversal is unaffected.

Also harden two related paths:
- getNonJumpItem() now reports failure instead of returning a still-unresolved
  DO_JUMP when it runs out of iterations (jump loop or a chain longer than
  MAX_JUMP_ITERATION), which would otherwise be loaded as the current item.
- treat a DO_JUMP as reached/completed in the mission block as a safety net, so
  the navigator advances rather than hanging should one ever reach that point.

Signed-off-by: RomanBapst <bapstroman@gmail.com>

---------

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2026-07-28 14:21:32 +03:00
Mahima Yoga
8e7b370cde fix(mavlink): accept INT32_MIN as "param not used" in mission item validation (#28079)
QGC leaves unused float params as NaN and converts them into the int32
x/y fields of MISSION_ITEM_INT, which comes out as INT32_MIN. This made
PX4 reject any mission with camera items (set mode, take photo/video,
stop photo/video) with INVALID_PARAM5. Treat INT32_MIN as "param not
used", the same as INT32_MAX.

Signed-off-by: mahima-yoga <mahima@auterion.com>
2026-07-24 11:51:58 -06:00
Julian Oes
a6e6ebfe95 chore(mavsdk_tests): bump library version (#27996)
This includes quite a few bugfixes.
2026-07-22 20:04:53 +12:00
Jacob Dahl
a617a1433c fix(mavsdk_tests): stabilize takeoff-and-hold altitude check
wait_until_altitude() returns on the first touch of the target band while
the vehicle is still climbing, so start_checking_altitude() latched the hold
reference mid-climb. The normal takeoff overshoot (~0.24 m) and slow VTOL
settle then exceeded the 0.15 m tolerance and the standard_vtol job failed
intermittently.

Wait for the overshoot to damp before capturing the reference, and restore
the 0.2 m tolerance established in #26106 (a later SIH rewrite had tightened
it back to 0.15 m). Steady-state hover holds to ~0.05 m, so the check stays
sensitive to real altitude-hold failures.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-07-22 16:17:17 +12:00
Jacob Dahl
73ca0e2137 fix(mavsdk_tests): don't wait for Land mode on mission GPS loss (#28017)
Since #27918 a blind descend reports the distinct Descend flight mode
instead of masquerading as Land. MAVSDK v3.17.1 has no Descend mode, so
wait_for_flight_mode(Land) timed out and SITL failed on main.

Losing GPS in SIH removes all horizontal position aiding, so the vehicle
always blind-descends after the mission GPS loss; a controlled Land is
never entered. The test already waits for the automatic disarm after
landing, which is the meaningful check.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-07-21 19:13:05 -06:00
Claudio Chies
282c969687 fix(commander): capture home orientation on ground independent of local position (#27946) 2026-07-21 11:49:06 -07:00
Julian Oes
0f78cd65a0 test(mavsdk): retry arming to tolerate transient is_armable flicker
wait_until_ready() polls MAVSDK's is_armable, but a known hysteresis gap
(and estimator heading-reference flicker at startup) means the flag can
read armable while PX4 then denies the arm command with 'no heading
reference'. This made arm() fail intermittently. Retry the arm command
until the autopilot accepts it, so the transient is absorbed while real
failures still time out.

Signed-off-by: Julian Oes <julian@oes.ch>
2026-07-17 10:51:42 -05:00
Julian Oes
ac14e4a93e test(mavsdk): raise RTL disarm timeout to 150s to match siblings
The four older VTOL RTL tests waited only 120s for disarm while running
the same climb-to-550m-and-land missions as the other RTL tests, which
already use 150s. 'RTL direct Mission Land' occasionally tipped just
over 120s of sim time (observed 123.76s), failing wait_until_disarmed.
Align all of them to 150s for margin.

Signed-off-by: Julian Oes <julian@oes.ch>
2026-07-17 10:51:42 -05:00
Julian Oes
9976825d80 test(mavsdk): loosen takeoff altitude reach tolerance to 0.1m
The 0.01m (1cm) tolerance was not reachable within the 15s sim-time
window for the standard_vtol, causing the takeoff-and-hold test to time
out. Use 0.1m, which still verifies altitude hold but is physically
achievable, and stays below the 0.15m hold-monitoring tolerance.

Signed-off-by: Julian Oes <julian@oes.ch>
2026-07-17 10:51:42 -05:00
Julian Oes
8e9ab68f11 test(mavsdk): retry offboard start to beat MAVSDK setpoint watchdog
MAVSDK's OffboardImpl::process_heartbeat() resets the setpoint state to
NotActive when a heartbeat without offboard mode arrives more than 3 s
after _last_started. _last_started is only ever written by start(), so
before the first start() it is epoch zero and the guard is always true:
any heartbeat that slips in between set_*() and start() makes start()
fail with NoSetpointSet.

At speed factor 30 PX4's 1 Hz (sim time) heartbeat arrives every ~33 ms
of wall time, which made 'Offboard attitude control' fail roughly one
run in three. Re-send the setpoint and retry start() in a small loop at
both offboard start sites. Failed 1/3 before, 16/16 after.

This is arguably a MAVSDK bug (_last_started should be initialized when
setpoint streaming begins); a retry keeps the tests robust either way.

Signed-off-by: Julian Oes <julian@oes.ch>
2026-07-17 10:51:42 -05:00
Julian Oes
ac8f3df583 refactor(mavsdk_tests): use sim time directly for execute_mission timeout
poll_condition_with_timeout polls the autopilot's monotonic time, which is
already simulation time. The previous code divided a sim-time budget by the
speed factor to compute a wall-clock timeout, but this is unnecessary and
adds a dependency on the speed-factor query.
2026-07-17 10:51:42 -05:00
Ramon Roche
9a446cce0c fix(mavsdk_tests): use simulation time for sleeps in basics test
Replace std::this_thread::sleep_for() with tester.sleep_for() to use
simulation-aware sleep that accounts for speed factor under lockstep.
2026-07-17 10:51:42 -05:00
Ramon Roche
d5cfc0fd97 fix(mavsdk_tests): use simulation time for timeouts
Replace 5 functions that used std::future::wait_for() (wall-clock time)
with poll_condition_with_timeout() (simulation time). This prevents
timeouts from expiring prematurely when running at high speed factors
under lockstep.

Affected functions:
- wait_until_altitude()
- wait_for_landed_state()
- wait_for_flight_mode()
- start_and_wait_for_mission_sequence()
- wait_until_speed_lower_than()

Also remove debug printf statements from start_checking_altitude().
2026-07-17 10:51:42 -05:00
Julian Oes
991f8d40af test(mavsdk): clear unused params in land-start VTOL plan
The DO_LAND_START item carried loiter params (heading required, radius,
and a stray 1 in param3) hand-copied from the adjacent LOITER_TO_ALT
item, and LOITER_TO_ALT itself had param3 set, which the spec defines
as empty. PX4's mission item param validation now rejects such items.

Signed-off-by: Julian Oes <julian@oes.ch>
2026-07-17 10:51:42 -05:00
Julian Oes
18dc9a2665 fix(mavsdk_tests): bump MAVSDK version 2026-07-17 10:51:42 -05:00
Julian Oes
ec982625b6 test(ros): add new model_prefix 2026-07-17 10:51:42 -05:00
Julian Oes
eaaf6f676a test(mavsdk): leave tests backwards compatible but enable SIH
This reverts some of the changes to keep runners of classic Gazebo in
there but leave it optional, so we can still use it if required.
2026-07-17 10:51:42 -05:00
Matthias Grob
cf8a65c5dd test(mavsdk): switch tests to SIH simulator 2026-07-17 10:51:42 -05:00
Roman Bapst
ee7134681d fix(navigator): keep established loiter on RTL/Hold and let each mode own its triplet reset (#27836)
* fix(navigator): remove generic reset of navigator triplets on mode change

- make each navigation mode decide if it needs the reset and what data it
wants to capture before the reset
- fix RTL climbing so that it remains on an established loiter when RTL
is being activated -> avoids weird trajectories and potential geofence breaches

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* feat(mavsdk_tests): added various integration tests for loitering behavior:

- make sure RTL climb remains on established loiter
- make sure new loiter at current location is set when HOLD is engaged while
vehicle is transiting to another loiter
- make sure altitude is locked to current altitude when vehicle is currently
flying an established loiter but is transiting to a higher altitude
- make sure vehicle resets from figure of 8 to a loiter when HOLD is engaged
while vehicle is established on a figure of 8

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* navigator: improve wording

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* rtl_mission_direct_land: avoid loitering on a previously set figure of 8

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* fix(navigator): harden geofence position checks and preserve loiter on breach

The GF_SOURCE_GPS path previously gated the breach check on the global
position timestamp even though it evaluated the fence against raw GPS
coordinates. Validate each source against the data it actually uses:
the fused global position on freshness (<1s), and raw GPS on freshness
(<2s) plus a valid fix.

For the LOITER breach action, only issue the reposition when the fused
global position is valid, since the setpoint is flown on that estimate,
and source all reposition coordinates from it. When the vehicle is
already established on a circular (orbit) loiter, keep that loiter's
center instead of re-centering on the current position to avoid a jump.

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* fixup

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* make methods const

Signed-off-by: RomanBapst <bapstroman@gmail.com>

---------

Signed-off-by: RomanBapst <bapstroman@gmail.com>
2026-07-16 18:07:04 +03:00
Jonas Perolini
5ea3cf8cb9 feat(navigator): extend detect and avoid module to follow regulatory standards such as ASTM F3442 (#26815)
* feat(navigator): extend detect and avoid module to follow regulatory standards such as ASTM F3442

* docs(docs): minor subedit

* refactor(navigator): reduce flash by grouping notif into same events

* docs(daa): Improve docs readability with ::: details blocks

* fix(navigator): single event when on ground with conflict

* refactor(boards): increase flash length from 4M - 128k to 5M - 128k

* rework(general): define DAA standard at build with new CONFIG_NAVIGATOR_ADSB_F3442

* clean(navigator): minor changes to clean the PR

* feat(boards): add CONFIG_NAVIGATOR_ADSB_FAKE_TRAFFIC in visionTargetEstStatic.px4board

* rework(daa): reduce amount of abstractions and minor cleaning

* refactor(boards): allyes revert flash length to 4M-128K

* refactor(boards): allyes increase flash length to 5M-128K

* rework(daa): rework event notifications to improve clarity

* docs(docs): move details inside of ::: details block

* docs(docs): run npx prettier

* refactor(daa): avoid void mutator functions

* docs(docs): Improve Python helper to decode daa unique id

* rework(daa): move encoded id handling to the adsb lib and refactor on_active

* refactor(daa): naming and zero init

* fix(daa): move dataman dep from daa level to unit test level

* refactor(daa): define common daa_input and rework process_transponder_report

* fix(daa): remove stale todo

* refactor(daa): rename crosstrack_based_daa to crosstrack_standard

* refactor(daa): rename F34_ params to DAA_

* docs(docs): revert changes to autogenerated docs

* docs(docs): Add Detect And Avoid in index.md

* refactor(daa): update message on init failed

* refactor(daa): only publish most_urgent conflict once in on_active()

* refactor(daa): move conflict buffer handling in the adsb lib

* refactor(daa): move notifications into new class ConflictNotifier and only notify once per cycle

* refactor(daa): uninit _cycle_changes to store into .bss (and save flash)

* docs(docs): remove unused image link

* refactor(daa): move automated action policy to the adsb lib

* refactor(daa): move self detection into adsb lib as DaaTrafficFilter

* refactor(daa): minor changes in unit tests

* refactor(daa): merge DaaTrafficFilter and DaaEncoding

* fix(daa): fix CI by removing navigator from the DAA deps

* refactor(daa): reduce stack size

* fix(daa): advertise _fake_traffic_pub in constructor

* refactor(daa): Comments only,  simplify and reduce comments

* fix(daa): brief comment missing end star

* Disable CONFIG_NAVIGATOR_ADSB in ark_fpv_default board

* docs(docs): General clarifications and remove the 1.18 badge

* refactor(daa): cleaning

* refactor(daa): minor cleaning

* refactor(adsb): simplify conflict tracker assuming push_back cannot fail

* build(cmake): cleaner fix to protect regex alternations

* refactor(daa): Crosstrack, remove unit test requiring finite yaw (yaw not used by standard)

* refactor(daa): minor cleaning and fix callsign to uint64

---------

Co-authored-by: jonas <jonas.perolini@rigi.tech>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
2026-07-13 16:14:42 -06:00
Roman Bapst
40e61d2429 feat(navigator): Geofence Aware RTL (#27145)
Plan RTL paths that route around geofence boundaries — both inclusion
and exclusion zones — instead of flying straight through them and
breaching. The planner builds a visibility graph over the margin-inflated
geofence polygons and circles and runs Dijkstra to find the shortest
legal return path, falling back to a straight line to the destination
when no valid path exists.

Highlights:
- New reusable libraries: src/lib/dijkstra (generic shortest path) and
  src/lib/geofence (fixed-point geometry, polygon inflation, bitangent
  visibility); the RTL planner lives in navigator/RTLPlanner.
- Visibility graph keeps only bitangent edges and skips edges that poke
  into a forbidden region, greatly reducing edge-cost computation.
- Corner splitting is limited to sharp convex corners.
- Geometry validation: reject self-intersecting polygons and vertices
  outside the fixed-point range; centimeter fixed-point scaling keeps
  orientation tests exact and avoids drift at large distances.
- Failure handling: a Status enum replaces silent bool returns, and
  failures (unbuildable fence, planner capacity overflow, dataman load
  errors, NaN waypoints, destinations that breach the fence) are
  surfaced to the operator via MAVLink warnings/criticals; the planner
  falls back to a straight-line RTL.
- Destination updates are centralized in RTL::setRtlTypeAndDestination;
  the path is replanned only when the destination or geometry changes.
- VTOLs always use the fixed-wing margin (FW loiter radius).
- kMaxNodes is exposed as a Kconfig option (default 100); the feature is
  disabled on flash-constrained boards (FMUv4 and older, various F4/F7).
- Tests: unit tests for the Dijkstra lib, geofence geometry utils, and
  the avoidance planner, plus a MAVSDK SITL test flying an RTL through a
  geofence.
- Documentation: new "Geofence Awareness" section in the RTL docs.

Co-authored-by: Balduin <balduin@auterion.com>
2026-07-09 15:08:27 +03:00
Julian Oes
ccd444726e test: add TSan suppressions for Gazebo sim transport
Running SITL with the Gazebo bridge under ThreadSanitizer reports many data races
inside libzmq and gz-transport (and the GZBridge glue) - third-party simulation
transport that is not in the flight path or the SIH-based CI and that we cannot
fix. Add a suppressions file so the TSan signal stays usable for finding real
races. Use via TSAN_OPTIONS="suppressions=test/sitl_tsan.supp".
2026-07-02 08:42:49 -07:00
Julian Oes
344c5c356e fix(build): disable fuzztest when building with TSAN
fuzztest's coverage instrumentation is incompatible with Thread
Sanitizer. Add px4_setup_gtest_without_fuzztest() macro to
cmake/px4_add_gtest.cmake that fetches GTest standalone and stubs out
fuzztest cmake functions. Guard all fuzztest-specific code on
TARGET fuzztest::fuzztest so it compiles cleanly without fuzztest.
2026-07-02 08:42:49 -07:00
bvrtoverfitprimes
cd900a8973 fix(mavlink): reject unsupported params in commands and missions (#27541)
* fix(mavlink): reject unsupported params in commands and missions

PX4 accepted any non-NaN value in params it does not use for a given
MAV_CMD, silently storing or ignoring them. This made it impossible for
a GCS to detect that a mission item or command was malformed, and risked
unexpected behaviour if the param meaning is assigned in a future update.

Add mavlink_command_params.h: a header-only sorted lookup table mapping
each supported MAV_CMD to uint8 bitmasks (one for mission items, one for
commands) indicating which of params 1-4 are valid.  check_params() does
a binary search and returns the 1-based index of the first offending
param, or 0 if all unsupported params are unset.

A param is considered unset when it is NaN (the MAVLink standard) or 0.0
(the conventional GCS default for unused float fields).  Any other value
in an unsupported slot is rejected:

- Mission uploads (MISSION_ITEM / MISSION_ITEM_INT): NACK with
  MAV_MISSION_INVALID_PARAMn for the offending param index.
- Commands (COMMAND_LONG / COMMAND_INT): ACK with MAV_RESULT_DENIED.

Validation is placed at the MAVLink ingress boundary
(parse_mavlink_mission_item and handle_message_command_both) before any
downstream processing, keeping Commander and Navigator unmodified.

The table covers all 45 MAV_CMDs handled by PX4's mission and command
parsers.  The static_assert enforces sort order at compile time.

Fixes #27483

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): split mission/command p5-7 masks, fix int_mode branch, add vehicle overrides

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): fix 142-char lines and Python CI type/style errors

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): pack p5-7 bits into mission/command byte, fix astyle/type-limits/mypy

* fix(mavlink): range-for over VehicleParamOverrides, fix mypy ignore code

* fix(mavlink): wire check_params_for_vehicle, add int variant, drop non-vehicle check_params

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): suppress clang unused-function on check_params_*_for_vehicle

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): rename local vs to avoid shadow in handle_message_command_both

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): cache vehicle_type_bitmask as member, update on vehicle_status change

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): use named VEHICLE_TYPE_* consts, fix masks, drop WARN spam, fix int_mode cast

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): normalize INT32_MAX to 0 for MAV_FRAME_MISSION p5/p6 in int_mode

For MAV_FRAME_MISSION items, x/y are generic p5/p6 params (not lat/lon),
so GCS tools send 0 for unused params — not INT32_MAX. Using
check_params_int_for_vehicle here caused int_param_is_unset(0)=false,
which rejected valid DO_LAND_START and similar items with x=y=0.

Fix by normalizing INT32_MAX to 0.0f before calling check_params_for_vehicle,
so both the MISSION_ITEM_INT sentinel and the conventional float zero are
treated as unset. This restores acceptance of zero-param items like
DO_LAND_START while still correctly rejecting items that carry non-zero,
non-sentinel values in unsupported param slots.

Signed-off-by: Himaghna <pen314paper@gmail.com>

* fix(mavlink): address review feedback on VTOL masks, NaN sentinel, dead enum, and RTL test frame

* fix(mavlink): move param validation test out of mavsdk_tests, rename header to .hpp

* fix(mavlink): dedupe param-scan loop shared by check_params_for_vehicle variants

---------

Signed-off-by: Himaghna <pen314paper@gmail.com>
2026-07-02 10:11:56 +12:00
Ramon Roche
92fa89d7d7 ci(mavros): remove MAVROS integration test suite
Coverage overlaps with mavsdk_tests on iris (mission + offboard
posctl); MAVROS plugin behavior belongs to the MAVROS project.
Drops the workflow, .test launchers, rostest_px4_run.sh, and the
integrationtests/ python helpers.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-05-14 10:40:14 -07:00
Ramon Roche
6baef6ba88 ci(ros_integration_tests): restart XRCE-DDS Agent between tests
Restart the Micro-XRCE-DDS Agent before each integration test so DDS
graph state from a previous PX4 instance does not leak into the next
test.

The MicroXRCEAgent is started once per session, but PX4 reboots between
tests. The Agent retains writer entries from the previous PX4, so when
the new PX4 reconnects, count_publishers() in px4-ros2-interface-lib's
waitForFMU returns >0 immediately against a stale entry. Phase 1
(discovery) returns instantly, then Phase 2 (heartbeat) times out
waiting for a message on a subscription matched to a dead writer.

This is why ModesTest.denyArming (first test) passes while every later
ModesTest fails with "timeout while waiting for FMU heartbeat".

Adds an optional pre_test_hook on test_runner.Tester so ROS-specific
lifecycle stays out of the shared test_runner. The workflow stops
starting the Agent externally; ros_test_runner.py owns the lifecycle.

Refs #27328

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-05-13 10:16:39 -07:00
Onur Özkan
0d18be5049 fix(scripts): replace hardcoded /bin/bash shebangs
Several helper scripts assumes bash is available at /bin/bash. That breaks on systems
such as NixOS, where bash is resolved from PATH instead of a fixed /bin location and
causes failures like `bad interpreter` during `make format`, e.g., on my host machine:

```sh
$ make format

/PX4-Autopilot/Tools/astyle/check_code_style.sh: /PX4-Autopilot/Tools/astyle/fix_code_style.sh: /bin/bash: bad interpreter: No such file or directory
```

This change switches these entrypoints to `#!/usr/bin/env bash` so they locate bash properly.

No functional changes intended.

Signed-off-by: Onur Özkan <work@onurozkan.dev>
2026-04-01 12:25:28 -08:00
Marco Hauswirth
7297364484 fix ros-test-config for multi-APG 2026-02-20 17:43:45 +01:00
Farhang
14186cf74f [Tests] [CI] fix flaky altitude SITL test (#26106)
* test: increase altitude tolerance to fix flaky test

Altitude tolerance increased from 0.1f to 0.15f to handle simulation
timing variations. Test was failing at 0.201m with 0.2m tolerance.

* test: increase altitude tolerance further to 0.3m

* ci: re-add branch trigger for SITL tests

* Revert "ci: re-add branch trigger for SITL tests"

This reverts commit e5e4c9637b.
2025-12-13 09:13:23 -09:00
Julian Oes
1de6001163 mavsdk_tests: bump MAVSDK version to v3.11.2 (#26024)
This should hopefully fix the annoying segfaults on destruction that we
have been seeing.
2025-12-01 13:30:08 -08:00
Julian Oes
ff06a206d1 mavsdk_tests: bump version to 3.11.1
This should now include the figure eight messages.
2025-11-20 23:23:40 -09:00
Julian Oes
46ed71fa5b mavsdk_tests: figure eight is in common now 2025-11-20 23:23:40 -09:00
Hamish Willee
7d509d832a Update to latest mavlink that includes support for WIP warnings (#25804)
* Update to latest mavlink that includes support for WIP warnings

* mavsdk_tests: pass build for now

We need this until the figure eight stuff has moved to common.

---------

Co-authored-by: Julian Oes <julian@oes.ch>
2025-10-29 12:43:10 +11:00
Beat Küng
3d1cace7b7 test: add google fuzztest to unit test build
From https://github.com/google/fuzztest.
This will now also add gtest (via cmake FetchContent)

And requires newer cmake (container updates):
CMake 3.19 or higher is required.  You are running version 3.16.3
2025-07-11 10:39:28 +02:00
mahima-yoga
ee953640ee MAVSDK: bump version to 3.7.0 2025-07-09 07:43:20 +12:00
Julian Oes
bfbd9bfe27 mavsdk_test: fix mission timeout check
We shouldn't adjust for lockstep speedup twice.
2025-06-30 09:20:44 -07:00
Julian Oes
d03b1171f9 mavsdk_tests: fix mission finished state
This is an attempt to use MAVSDK's is_mission_finished APIs instead.
2025-06-30 09:20:44 -07:00
Julian Oes
4126dde11f mavsdk_tests: bump to v3.4.0
This should fix some of the lockups and segfaults we see.
2025-05-19 07:37:02 -07:00
Julian Oes
d4be5d3ff0 mavsdk_tests: add events to log 2025-05-19 07:37:02 -07:00
Julian Oes
1f65cc46b9 mavsdk_tests: bump MAVSDK to v3.3.4 2025-05-19 07:37:02 -07:00
Julian Oes
56eb9bcc18 mavsdk_tests: workaround race condition
PX4 needs a bit of time to process an uploaded mission before it is
ready to accept the mission mode.

Therefore, we need to wait a bit.

Alternatively, we could wait on the mission progress arriving properly,
but this sleep is simple enough for now.
2025-05-19 07:37:02 -07:00
Julian Oes
e19d245355 mavsdk_tests: remove hacks for rally points
We can now just use MAVSDK to upload rally points.
2025-05-19 07:37:02 -07:00
Julian Oes
66deae172d mavsdk_tests: update to MAVSDK 3.0.0 2025-05-19 07:37:02 -07:00