Commit Graph

29324 Commits

Author SHA1 Message Date
Matthias Grob ffef31fb06 fix(commander): Remove COM_IMB_PROP_ACT (#27260)
and hardcode the default warning. The feature can still be disabled by setting FD_IMB_PROP_THR to zero.
2026-04-30 23:40:55 +02:00
Matthias Grob 5e86be131c fix(commander): Remove COM_OBC_LOSS_T (#27261)
hardcoding the default 5 second timeout.
2026-04-30 23:40:44 +02:00
Balduin b5fcd649eb feat(navigator): add logging to surface reason for mission invalidity (#27254) 2026-04-30 10:30:45 +02:00
Hamish Willee 2857ad59dc fix(battery): Add invalid sentinel for BatteryStatus remaining_capacity_wh and nominal_voltage (#27236) 2026-04-30 18:19:12 +10:00
Julian Oes d00372cc04 fix(logger): add MiB unit to SDLOG_MAX_SIZE (#27245)
This required to add MiB as a unit to the parsers.

While at it, I decided to clean up the MB log output and be correct
using MiB instead.
2026-04-30 16:40:08 +12:00
mahima-yoga c4c68df4e4 chore(tecs): remove TECS airspeed filter parameters
These parameters are never tuned by the end-user, so we can use constants instead and immediately set the kalman gain at compile time
2026-04-29 22:28:16 +02:00
Claudio Chies 76ce06c931 feat(sih): Add thrust model for hexacopter simulation (#26587)
* Quadratic thrust for SIH hexarotor (#67)

* sih: add thrust model hexacopter model

* fix: add missing line break

* sihsim_hey airframe: add THR_MDL_FAC

to accomodate for simulated quadratic motor thrust.

* fix(sih):  fix quadratic model in simulation

The square was done in place and the low pass filter also effected the same variable, the result was that for small numbers the low pass filter gain was not enouhg with respect to the decay caused by squaring numbers close to zero. As a result even if you where trying to send 1 xcommands in simulation it would stoip around 0.008. Now the square is done in a different variable, the problem is not there anymore.

Tested in simulation
---------

Signed-off-by: Gennaro Guidone <gennaroguido2002@gmail.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
Co-authored-by: Gennaro Guidone <gennaroguido2002@gmail.com>
2026-04-29 09:18:05 -06:00
Hamish Willee 95d6a3c171 docs(params): Fix up params that render badly after prettier (#27211) 2026-04-29 11:55:09 +10:00
pfilimonov eceec6c861 fix(gimbal): add YAW_IN_VEHICLE/EARTH_FRAME flags to GIMBAL_DEVICE_SET_ATTITUDE (#27198) 2026-04-29 10:16:39 +12:00
Silvan d84f6c324a feat(fw-tecs): increase default of FW_T_HRATE_FF from 0.3 to 0.5
Signed-off-by: Silvan <silvan@auterion.com>
2026-04-28 19:10:47 +02:00
alexcekay a433f75736 feat(drivers): add AUAV L60D support 2026-04-28 18:43:03 +02:00
Marco Hauswirth 72f1c1f6f9 fix(ekf2): set cs.heading_observable to true prior to manual reset 2026-04-28 16:07:53 +02:00
Ryan Johnston 622e72c26a feat(commander): accept optional heading arg for mag quick calibration (#24637)
* Update Mag quick Cal to accept heading arguments

* Fixed formatting

* Update src/modules/commander/Commander.cpp

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>

* Update src/modules/commander/Commander.cpp

---------

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
2026-04-28 00:46:53 -08:00
Ramon Roche 64a2463441 fix(mavlink): don't write empty signing key file on shutdown (#27222)
Mavlink::request_stop() unconditionally called
_sign_control.write_key_and_timestamp() on every instance shutdown,
which created /fs/microsd/mavlink/mavlink-signing-key.bin filled with a
zero key and zero timestamp on FCs that never enabled signing.

The shutdown write is redundant: every signing state transition
(KEY_ACCEPTED, SIGNING_DISABLED) already persists synchronously inside
check_for_signing() before returning. The in-memory state is always
flushed to disk at the moment it changes.

Aggravated by mavlink_main.cpp:3334 calling request_stop() up to 1000
times in a tight loop while waiting for the thread to exit, plus the
~Mavlink() destructor path. Each call re-truncates and rewrites the
phantom file.

Reported by Jake Dahl on two separate flight controllers running
mainline.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-27 11:14:20 -08:00
Ramon Roche bc080e3044 chore(sbom): bump PX4-OpticalFlow to commit with LICENSE file
Bumps the submodule pointer to pick up the BSD-3-Clause LICENSE file
added in PX4/PX4-OpticalFlow#20.

Resolves the SBOM audit NOASSERTION finding without needing a manual
override entry in Tools/ci/license-overrides.yaml.

Fixes #27217

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-27 11:37:02 -06:00
mahima-yoga 86800b4fdf refactor(wind-estimator): remove unused parameters and unify coding style
Remove ASPD_SCALE_NSD, ASPD_BETA_NOISE, ASPD_TAS_GATE, ASPD_BETA_GATE as these
are never changed in practice. Keep ASPD_WIND_NSD and ASPD_TAS_NOISE tunable as
they are relevant for high-altitude (wind NSD) and high-speed (TAS noise) use cases.
2026-04-27 15:52:04 +02:00
Phil-Engljaehringer 13d9f0b193 feat(adc): Add driver for ADS7128 ADC (#26471)
* feat: add driver for ADS7128 ADC

* style: used make format

* fix: only read 1 byte in adc_get()

* fix: set correct min/max/def value for VRef

* fix: print i2c address in status

* feat: add threshhold to failures before reset

* feat: add failure_threshhold_count

* style: remove unused variable definition from module.yaml

* fix: removed retry logic from poll functions

* fix: decreased sleep time in probe function

* feat: add driver for ADS7128 ADC

* style: used make format

* fix: only read 1 byte in adc_get()

* fix: changed scheduling logic

* fix: ensure no false values are published

* fix: removed unused variable definition

* style: used make format

* fix: removed merge artifact

* fix: removed some merge artifacts
2026-04-27 13:47:10 +02:00
Marco Hauswirth 854c43dde8 fix(ekf2): dont adjust inactive height bias estimators on altitude reset 2026-04-27 09:49:24 +02:00
Julian Oes b48ec2dd68 feat(params): add board-level read-only parameter support (#26522)
Integrators can declare read-only parameters in a per-board YAML file:
readonly_params.yaml.

There are two ways to define the read-only params:
- "block": default writable, explicitly list params to be locked
- "allow": default readonly, explicitly list params to be writable

Enforcement is activated by `param lock` in rcS after all startup
scripts have run, so board defaults and airframe scripts can still set
params during init.

The feedback via MAVLink uses the new
MAV_PARAM_ERROR_READ_ONLY as part of the PARAM_ERROR message.
2026-04-27 09:06:43 +12:00
Valentin Bugrov 4c89e38595 fix(drvers/vtxtable): Fix VtxTable clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov 7589f13bcd fix(drvers/roboclaw): Fix roboclaw clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov 0000f6d80e fix(drvers/cyphal): Fix cyphal clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov a7f8ede393 fix(drvers/actuators): Fix vertiq_io clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov 2b76573301 fix(drvers/ins): Fix Microstrain codestyle according astyle-config 2026-04-24 15:37:25 -07:00
Valentin Bugrov a7ebab58cb fix(drvers/ins): Fix Microstrain clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov 2c693e4113 fix(drvers/ins): Apply to sbgECom copilot code-improvements 2026-04-24 15:37:25 -07:00
Valentin Bugrov 0d5cc985b8 fix(drvers/ins): Fix sbgECom clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov 3089cc4ebd fix(drvers/ins): Fix InertialLabs clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov 7848216e1d fix(drvers/ins): Fix EulerNav clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov d665d64df2 fix(drvers/ins): Fix VectorNav clang-tidy errors 2026-04-24 15:37:25 -07:00
Valentin Bugrov d2ad2b52b5 fix(drvers/ins): Disable clang-tidy checks for VectorNav lib 2026-04-24 15:37:25 -07:00
Matthias Grob eb30c0b6b0 refactor(AttitudeControl): comment type "c{a}ompared" 2026-04-24 10:43:54 -07:00
Silvan ba0b4abbfa fix(airspeed_selector): use CAS instead of IAS for in-flight logic
Signed-off-by: Silvan <silvan@auterion.com>
2026-04-24 18:42:45 +02:00
Jacob Dahl 2e87050745 fix(mavlink): gate UAVCAN param bridge on observed camera heartbeat (#27181)
Build all targets / Scan for Board Targets (push) Has been cancelled
Checks / Gate Checks [check_format] (push) Has been cancelled
Checks / Gate Checks [check_newlines] (push) Has been cancelled
Checks / Gate Checks [module_documentation] (push) Has been cancelled
Checks / Gate Checks [shellcheck_all] (push) Has been cancelled
Checks / Gate Checks [validate_module_configs] (push) Has been cancelled
Checks / Unit Tests (push) Has been cancelled
Static Analysis / Clang-Tidy (push) Has been cancelled
MacOS build / build (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:22.04) (push) Has been cancelled
Ubuntu environment build / Build and Test (ubuntu:24.04) (push) Has been cancelled
Container build / Set Tags and Variables (push) Has been cancelled
Docs - Orchestrator / T1: Detect Changes (push) Has been cancelled
Docs - Orchestrator / T2: Metadata Sync (push) Has been cancelled
Docs - Crowdin - Upload Guide sources (en) / upload-to-crowdin (push) Has been cancelled
Failsafe Simulator Build / build (failsafe_web) (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v5x (push) Has been cancelled
FLASH usage analysis / Analyzing px4_fmu-v6x (push) Has been cancelled
ITCM check / Checking nxp_mr-tropic (push) Has been cancelled
ITCM check / Checking nxp_tropic-community (push) Has been cancelled
ITCM check / Checking px4_fmu-v5x (push) Has been cancelled
ITCM check / Checking px4_fmu-v6xrt (push) Has been cancelled
MAVROS Tests / MAVROS Mission (push) Has been cancelled
MAVROS Tests / MAVROS Offboard (push) Has been cancelled
Python CI Checks / build (push) Has been cancelled
ROS Integration Tests / build (push) Has been cancelled
ROS Translation Node Tests / Build and test [humble] (push) Has been cancelled
ROS Translation Node Tests / Build and test [jazzy] (push) Has been cancelled
SBOM License Check / verify-licenses (push) Has been cancelled
SITL Tests / Testing PX4 iris (push) Has been cancelled
Build all targets / Seed [${{ matrix.chip_family }}] (push) Has been cancelled
Build all targets / Build [${{ matrix.runner }}][${{ matrix.group }}] (push) Has been cancelled
Build all targets / Upload Artifacts (push) Has been cancelled
Container build / Build Container (amd64) (push) Has been cancelled
Container build / Build Container (arm64) (push) Has been cancelled
Container build / Deploy To Registry (push) Has been cancelled
Docs - Orchestrator / T2: PR Metadata (push) Has been cancelled
Docs - Orchestrator / T2: Link Check (push) Has been cancelled
Docs - Orchestrator / T3: Build Site (push) Has been cancelled
Docs - Orchestrator / T4: Deploy (push) Has been cancelled
FLASH usage analysis / Publish Results (push) Has been cancelled
Fuzzing / Fuzzing (push) Has been cancelled
Handle stale issues and PRs / stale (push) Has been cancelled
Docs - Crowdin - Download Guide Translations / Synchronize with Crowdin (ko) (push) Has been cancelled
Docs - Crowdin - Download Guide Translations / Synchronize with Crowdin (uk) (push) Has been cancelled
Docs - Crowdin - Download Guide Translations / Synchronize with Crowdin (zh-CN) (push) Has been cancelled
SBOM Monthly Audit / audit (push) Has been cancelled
* fix(mavlink): gate UAVCAN param bridge on observed camera heartbeat

Only exclude target_component 100..105 from the MAVLink -> UAVCAN
parameter bridge when a MAVLink HEARTBEAT with MAV_TYPE_CAMERA has
been observed on that component within the last 5s. When no camera
has been seen, forward to the matching UAVCAN node as before.

The bridge maps target_component 1:1 onto UAVCAN node_id, so the
unconditional 100..105 exclusion added in #25651 also made DroneCAN
peripherals assigned those node IDs unreachable via MAVLink params.
This preserves #25651's intent for real MAVLink cameras while
unblocking DroneCAN devices in that ID range.

Fixes #27180

* fix(mavlink): warn when camera shadows DroneCAN node in 100..105

Emit a one-shot mavlink_log_warning per comp ID when both a MAVLink
camera (observed via camera_status / MAV_TYPE_CAMERA heartbeat) and a
DroneCAN node (via dronecan_node_status) are present at the same ID
in 100..105. The camera takes precedence at the UAVCAN parameter
bridge (intent of #25651), so the CAN node's params become unreachable
via MAVLink. The warning surfaces the ambiguity in QGC's message tray
so the user can reassign the CAN node ID.

Fires regardless of which side joined first. Sticky per comp ID for
the boot — the user only sees it once per conflicting ID.

* Update src/modules/mavlink/mavlink_parameters.cpp

* Update src/modules/mavlink/mavlink_parameters.cpp
2026-04-23 18:03:42 -08:00
Ramon Roche b911d4414e build(sim): convert PX4-OpticalFlow to git submodule (#27184)
Replace the ExternalProject_Add-based fetch of PX4/PX4-OpticalFlow with a
proper git submodule at src/modules/simulation/gz_plugins/optical_flow/PX4-OpticalFlow,
matching how every other external C++ dependency is integrated in PX4 (mavlink,
gps/devices, Micro-XRCE-DDS-Client, libevents, heatshrink, etc.).

The previous approach cloned the repo over the network on every clean build,
pinned to GIT_TAG master (unreproducible), and had generated a string of
follow-up PRs over the last year chasing ExternalProject quirks (install
paths, macOS .dylib vs .so, permissions).

The plugin now consumes the upstream OpticalFlow target directly via
add_subdirectory and px4_add_git_submodule. The upstream repo predates PX4's
strict warning policy, so the OpticalFlow and klt_feature_tracker targets get
-Wno-error plus a few specific -Wno-* flags and -fvisibility=default to build
cleanly inside the PX4 tree.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-23 11:57:02 -08:00
Balduin f8bb3f00df feat(sensor_airspeed_sim): Implement off, stuck, and wrong airspeed failure
- wrong and off equal to simulator_mavlink implementation
     - but wrong is over timescale of 10s rather than 1s by default to
       make it harder for innovation check to flag (closer to icing)
 - stuck will just keep the last value before injecting the failure
2026-04-23 15:37:55 +02:00
Balduin 4b34cb8834 refactor(sensor_airspeed_sim): remove previous airspeed failure implementation 2026-04-23 15:37:55 +02:00
Julian Oes 174a6aab6f feat(mklittlefs): add command to format littlefs filesystems
Add an NSH command to format a device with littlefs, analogous to
mkfatfs for FAT filesystems. The command unmounts the mount point,
then remounts with forceformat to format and mount in one step.

Enable the command on boards that use littlefs as primary storage
(airbrainh743 and kakuteh7v2), and document it in the airbrainh743
flight controller page as a recovery procedure for a corrupted
flash filesystem.

Usage: mklittlefs /dev/mtd0 /fs/flash
2026-04-23 10:30:14 +12:00
Julian Oes f9fdda1a29 feat(logger): rework log rotation and cleanup
Make the logger practical on small flash storage (e.g. 128 MB W25N
NAND) while keeping the existing SD-card behaviour sensible.

- Move cleanup from boot to log start so logs can be downloaded via
  MAVLink FTP before deletion.
- Delete individual .ulg files (oldest first) instead of whole
  directories, prioritising the naming scheme not currently in use
  (session dirs vs date dirs).
- Add SDLOG_MAX_SIZE (new, default 1024 MB): maximum size of a single
  log file. When reached, the log rotates to a new file. The value is
  also reserved as headroom in the cleanup threshold.
- Add SDLOG_ROTATE (new, default 90): maximum disk usage percentage.
  Cleanup guarantees (100 - SDLOG_ROTATE)% free at all times, even
  during writing of a new log file. 0 disables space-based cleanup,
  100 allows filling the disk.
- Repurpose SDLOG_DIRS_MAX as an orthogonal directory-count cap
  (default 0 = disabled). Useful for capping log usage by count
  independent of disk size, e.g. in SITL.
- Drop the implicit ~300 MB free-space floor that used to fire even
  with SDLOG_DIRS_MAX=0; space is now governed entirely by
  SDLOG_ROTATE + SDLOG_MAX_SIZE.
- Split pure parsing helpers into util_parse.{h,cpp} and add unit
  tests (loggerUtilTest.cpp).
- Simplify get_log_time to rely on clock_gettime (set by the GPS
  driver); safer string handling in directory parsing.
- Reset _total_written in LogFileBuffer::reset() so callers reading
  get_total_written() between stop and start don't see stale counts.

Sponsored by CubePilot.
2026-04-23 10:30:14 +12:00
Julian Oes 0d91b428d6 fix(ekf2): break unbounded recursion
fuseDirectStateMeasurement() ends with a call to constrainStateVariances(),
which iterates every state and, for any whose variance has grown past its
limit, calls fuseDirectStateMeasurement() again to apply a corrective
fuse. That inner call then runs its own constrainStateVariances(),
repeating the loop.

Call chain:

  fuseDirectStateMeasurement                      ekf_helper.cpp:1030
   `- constrainStateVariances                     ekf_helper.cpp:1085
       `- constrainStateVar                       covariance.cpp:290
           `- fuseDirectStateMeasurement          covariance.cpp:302
               `- constrainStateVariances              (recursion)
                   `- ...

Under normal operation the P(i,i) > max branch is rarely taken and the
recursion stays shallow, however, while doing unrelated overnight testing
we saw a hard-fault with TCB corruption, presumably due to a stack overflow.

The trace pointed to fuseDirectStateMeasurement where Claude detected
the recursive call.

This fix breaks the recursion by gating the constrainStateVariances()
call on a new parameter, defaulting to true for existing callers.
constrainStateVar() passes false when it re-enters the fuse from the
constraint path, capping the worst-case recursion depth at 2.
2026-04-21 17:23:34 -07:00
Vuk-SFL f7f9557eac fix(zenoh): Zenoh various minor fixes and improvements regarding failed setup (#27147)
* fix(zenoh) : zenoh_subscirber / zenoh_publisher: print() method checks if key expression exists before printing

* fix(zenoh) : added cleanupSession method, called when setup steps fail and when module is closing
2026-04-21 13:35:00 -08:00
gguidone 4fee468f3f docs: add Remote ID in-flight failsafe documentation
Update safety.md, remote_id.md, and releases/main.md to document the extended COM_ARM_ODID parameter  and the new in-flight failsafe behaviour that will be introduced in PX4 v1.18.
2026-04-21 10:42:57 +02:00
gguidone 6e980423e5 feat(commander): add Remote ID in-flight failsafe
Extend COM_ARM_ODID into a unified arming + in-flight failsafe parameter (0 = Disabled, 1 = Warning, 2 = Return, 3 = Land, 4 = Terminate)

Values >= 2 block arming and trigger the configured action if Remote ID
is lost while airborne.
2026-04-21 10:42:57 +02:00
bresch ca1fdb24af fix(fw rate ctrl): override reset_integral when in acro mode 2026-04-21 09:09:41 +02:00
Jacob Dahl 68083e6ba8 test(pid): add regression test for derivative-on-measurement sign (#27153)
PIDTest never exercised the D path with a non-zero gain, which let the
sign error fixed in #27140 slip through. Add a D-only test that asserts
the output opposes a known feedback ramp.

Fails on main, passes with #27140.
2026-04-20 21:07:47 -08:00
Eurus bf1e6ec208 ekf2: fix external heading accuracy-to-variance conversion for yaw reset (#27143)
Co-authored-by: AkaiEurus <1826983968@qq.com>
2026-04-20 21:06:15 -08:00
Eurus 404b357782 fix(navigator): fix navigator_mission_item origin field assignment (#27137)
* navigator: fix navigator_mission_item origin field assignment

* navigator: fix navigator_mission_item origin field assignment in rtl_direct

---------

Co-authored-by: AkaiEurus <1826983968@qq.com>
2026-04-20 20:52:22 -08:00
Michael Fritsche 23b15d55d9 fix(pid): fixed typo in PID output calculation (#27140) 2026-04-20 19:17:08 -08:00
Ramon Roche 9c2e634325 build(macos): make gz SITL work out-of-box after homebrew 4.5
The px4-sim / px4-sim-gazebo Homebrew meta-formulae can no longer
pull their Gazebo dependency chain because Homebrew 4.5+ stopped
auto-resolving cross-tap deps. PX4/homebrew-px4#104 already
deprecated px4-dev into a no-op; #111 does the same for the sim
formulae. This PR is the PX4-side counterpart: move the sim install
into Tools/setup/macos.sh with an explicit package list and tap
registration, mirroring the pattern already used for the toolchain
block. Adds xquartz install on --sim-tools.

Beyond install, three runtime and configure gaps kept make px4_sitl
gz_x500 from working on a clean macOS:

- gz-gui8 (pulled in by gz-sim8) links against Qt5, but Homebrew's
  qt@5 is keg-only so CMake cannot find it. Add a POSIX-scoped hint
  in platforms/posix/cmake/px4_impl_os.cmake that resolves
  brew --prefix qt@5 and appends it to CMAKE_PREFIX_PATH. No-ops on
  non-APPLE builds and respects a user-set Qt5_DIR.

- On macOS, dyld does not search /opt/homebrew/lib by default.
  gobject-introspection typelibs reference libs by bare basename,
  causing gst-plugin-scanner to fail to load plugins and adding
  ~90s of timeout to Gazebo's cold start. Set
  DYLD_FALLBACK_LIBRARY_PATH to the Homebrew prefix lib dir in
  gz_env.sh so the bridge launch inherits it. Darwin-scoped, no
  effect on Linux or CI.

- configure_file on gz_env.sh.in now uses @ONLY so shell ${VAR}
  references pass through untouched.

Verified locally on macOS 26.4 / arm64 / Homebrew 5.1.7: configure
clean, 1119/1119 targets compile and link, vehicle spawns in
Gazebo Harmonic 8.11.0 with a single "Waiting for Gazebo world"
wait (was ~18 before the dyld fix).

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-20 16:15:41 -07:00
Dima Timofeev 059da2fcf7 fix(simulation): fix macOS gz SITL build
Add the GStreamer pkg-config library directories so the Gazebo camera plugin links cleanly with Homebrew installs on macOS. Cast ESC actuator outputs to double before publishing rotor velocities to avoid clang's -Wdouble-promotion build failure.

Signed-off-by: Dima Timofeev <dimkat@gmail.com>
2026-04-20 16:15:41 -07:00