Commit Graph
52069 Commits
Author SHA1 Message Date
PX4BuildBot 36572dfd1c docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-11-18 23:57:57 +00:00
Julian Oes 1c279adf75 docs(gps): add newer CubePilot GNSS modules and a Here4 page (#29861)
The docs only covered the discontinued Here2/Here+ and linked Here3
externally with a wrong receiver name. Add Here3+, Here4 and HerePro to
the RTK and DroneCAN lists, linking CubePilot's docs.

Add a Here4 page with what is needed to get it working on PX4: the one
CAN port the firmware supports, enabling the barometer (off by default
on the Here4), updating it from the SD card, and the mandatory
bootloader bulletin.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Julian Oes <julian@oes.ch>
2026-11-19 12:51:02 +13:00
Julian Oes caf8944d5f docs(cubepilot): use CubePilot name and drop connector/standards note (#29828)
- Rename remaining Hex/HEX/ProfiCNC references to CubePilot, including
  page file names (old pages redirect).
- Use the CubePilot spelling consistently.
- Remove the note on the Cube Black page advising against it for
  standards and patent reasons.

Assisted-by: Claude:claude-opus-5-5
2026-11-19 12:51:01 +13:00
Julian Oes 35223a381e fix(drivers): keep file descriptors on the task that opened them (#29858)
* fix(heater): open and use the PX4IO fd only on the work queue thread

File descriptors on NuttX are per task group. Since the multi-instance
rework (#26325) the PX4IO heater fd was opened in the constructor, i.e.
in the shell task running `heater start`, but used in Run() on
wq:lp_default. There the fd number refers to whatever that task group has
open, so the heater ioctls silently failed (heater never driven on
PX4IO boards) or hit an unrelated file. On a Cube Orange+ this ended in a
hardfault in fat_ioctl() when the number matched an SD card file.

stop() also issued an ioctl from the shell, and the exit path closed the
fd before turning the heater off with it.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* fix(cyphal): close the CAN fd on the work queue thread

The CAN socket/device is opened in Run() on wq:uavcan, but was only
closed from the destructor, which runs in the shell calling
`cyphal stop`. File descriptors are per task group on NuttX, so that
close did nothing and the SocketCAN socket stayed bound, keeping
received frames queued in the shared IOB pool. The NuttX CAN device was
never closed at all.

Close the interface in Run()'s exit branch and make close() idempotent.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* fix(uavcannode): close the DroneCAN shell pipes on the work queue thread

The shell pipes are created from a service callback on wq:uavcan, but on
`uavcannode stop` they were closed by the destructor in the shell task.
File descriptors are per task group on NuttX, so the work queue ends
stayed open and the spawned shell task never got EOF.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* fix(distance_sensor): close serial ports on the work queue thread

CM8JL65, uLanding, LeddarOne, Sony AS-DT1 and Lightware serial open
their UART in Run() on the work queue, but stop() closed it from the
shell calling `<driver> stop`. File descriptors are per task group on
NuttX, so the UART stayed open in the work queue group, leaking it on
every start/stop cycle. stop() also deleted the driver without waiting
for a Run() in progress.

stop() now asks Run() to close the port and waits for it. Error paths
reset the fd so a stale number is not reused, and ports opened in the
shell (LeddarOne init probe, Sony -p mode) are closed there.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* fix(uwb_sr150): schedule only after init succeeded

On init failure the instance is deleted in the shell, whose destructor
closes the UART. If Run() had already opened it on the work queue, that
closed an unrelated fd number, as file descriptors are per task group
on NuttX.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

* fix(sagetech_mxs): schedule only after init succeeded

On init failure the instance is deleted in the shell, whose destructor
closes the serial port. If Run() had already opened it on the work
queue, that closed an unrelated fd number, as file descriptors are per
task group on NuttX.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julian Oes <julian@oes.ch>

---------

Signed-off-by: Julian Oes <julian@oes.ch>
2026-11-19 12:48:08 +13:00
Jacob Dahl 4395d0bc23 fix(atxxxx): enable the display without forcing PAL (#29889)
enable_screen() ORed 0x48 into VM0, which set the PAL bit whatever OSD_ATXXXX_CFG said, so NTSC was never selected. init_osd() already sets the PAL bit when the parameter asks for it.
2026-11-18 16:47:11 -07:00
Hamish WilleeandRamon Roche bce8453e5b chore(mavlink): update submodule to latest (#29865)
Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Ramon Roche <mrpollo@gmail.com>
2026-11-19 08:13:49 +11:00
Julian Oes 0c74033da4 fix(hardfault_stream): return after cleanup in the stop path (#29859)
exit_and_cleanup() deletes the instance, but Run() carried on into the
state machine and used the freed object.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: Julian Oes <julian@oes.ch>
2026-11-18 11:49:37 -07:00
Matthias Grob c2875ad6a2 perf(nuttx): build the NuttX libraries with parallel make jobs
Each NuttX library and the apps are built by a make invocation that
ninja treats as a single opaque custom command, so they compiled one
file at a time.

Run them through a wrapper that honours a job count given to the
toplevel build (e.g. `make px4_fmu-v5x_default -j1`), which reaches it
through MAKEFLAGS, and otherwise uses the number of CPUs available to
the process. Unlike CMake's logical core count, nproc respects docker
--cpuset-cpus. A load limit keeps the concurrently running NuttX makes
from oversubscribing the host.

Mark the toplevel cmake build recipe as a sub-make with '+'. GNU make
before 4.4 (e.g. Ubuntu 22.04/24.04) passes its jobserver as pipe file
descriptors, which it otherwise closes for that recipe, leaving the
NuttX makes to fall back to serial builds.

Mention how to disable parallel builds in the docker docs.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-18 18:45:15 +01:00
Matthias Grob 355b900829 fix(nuttx): evaluate NuttX toolchain prefixes once in Make.defs
NuttX's tools/Config.mk defines DEFINE_PREFIX, INCDIR_PREFIX and
INCSYSDIR_PREFIX as exported recursive variables that run a shell
script on every expansion. Because they are exported, make expands
them for every recipe it spawns, serially in its main process.

The NuttX toplevel make hides this by handing the expanded values to
its sub-makes through the environment. PX4 calls the per-directory
sub-makes directly, so each one re-ran define.sh and incdir about 30
times per compiled file. That throttled the NuttX library builds to a
few objects per second regardless of the job count. Since the NuttX
12.12 upgrade, CINCPATH and CFLAGS reference these variables, which
turned this into a build time regression.

Evaluate them once with := after CC is defined. The generated compile
commands are unchanged. Rebuilding sched for fmu-v5x from scratch
drops from 37 s to under 4 s.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-18 18:45:15 +01:00
Matthias Grob a72242a215 build(style): skip parameter member renames referenced in other files
check_param_names.py --fix only renamed members in the declaring file and its
implementation file. Uses in other files, like the AFBRS50 calibration offsets
in AFBRS50_Calibration.cpp, kept the old name and broke the build, while the
declaration-only check still passed.

--fix now looks for the old name in all tracked sources first. If it appears
in a file whose stem does not declare it as its own parameter member, it skips
that member, reports it for manual renaming and exits with an error. A real use
can't be told apart from an unrelated member with the same name without a
compiler, so it reports both.
2026-11-18 18:40:12 +01:00
Matthias Grob 6d43f6e807 docs(parameters): document the parameter member naming convention
The DEFINE_PARAMETERS example used member names that make check_format now rejects, and the convention itself was never written down.

Assisted-by: Claude:claude-opus-5-5
2026-11-18 18:40:12 +01:00
Matthias Grob dbe4cd3e2e style(modules_drivers): name parameter members after their parameter name
Produced by make format with the new parameter member name check, plus the AFBRS50 calibration offsets used outside the declaring files.
2026-11-18 18:40:12 +01:00
Matthias Grob 9a4fef9c02 build(style): check parameter member naming convention in check_format
Parameter accessing members should according to convention be named _param_{lower case parameter name} so full text search reveals all use of a value in the code.
Nothing enforced it, and 429 members drifted into violating the convention.

There was a script to rename them once which got replaced with a new one to allow checking (in CI) to enforce the naming.
2026-11-18 18:40:12 +01:00
Ramon Roche 30621ae2c3 ci(build-all): bump voxl2 container to v1.8
The v1.7 image is Ubuntu 20.04 with Python 3.8.10. pymavlink's mavgen
now calls int.bit_count(), which needs Python 3.10, so the VOXL2 build
fails as soon as the mavlink submodule is updated (#29865):

  AttributeError: 'int' object has no attribute 'bit_count'

v1.8 keeps ModalAI's base image and Hexagon SDK and adds Python 3.12
in a venv that is first on PATH. That is the same minor version as
the main px4-dev container.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-11-18 09:03:31 -08:00
Andrea Bernasconi b2343f6b62 build(containers): use native astyle in the ROS images
astyle-py 1.1.0 requires PyYAML~=6.0.1, which conflicts with the distro
PyYAML 5.4.1 that the ROS humble image pins as a pip constraint, so the
image build fails with ResolutionImpossible. Install the distro astyle
(3.1 on jammy and noble, accepted by fix_code_style.sh) and leave
astyle-py out of the requirements installed in the ROS images.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
2026-11-18 08:23:56 -08:00
Matthias Grob 3d820c5e80 build(astyle): pin astyle 3.1 via astyle-py
Distros ship newer astyle versions (Ubuntu 26.04: 3.6) which are
incompatible with our options and format differently, so make
check_format failed out of the box and required manually installing
an old .deb. astyle-py bundles astyle 3.1 as WebAssembly and installs
via pip on any OS, giving byte-identical results to native 3.1.

Native astyle 2.06-3.1 is still accepted as fallback, so existing
setups and the current CI container keep working.

Files are now formatted in batches on a temporary copy instead of one
astyle call per file, which keeps make check_format fast despite the
interpreter startup.
2026-11-18 08:23:56 -08:00
Matthias Grob 1d85a376f9 refactor(px4io_protocol): keep crc8_tab[] private to the library 2026-11-18 16:50:02 +01:00
Matthias Grob 3bc7dcd7ad refactor(src/lib): make CMakeLists alphabetical again 2026-11-18 16:50:02 +01:00
Michael Rogov Papernov 554f60d6fd refactor(px4io): move protocol.h into px4io_protocol lib
Drivers and arch code no longer include a header from inside the IO
firmware module.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Michael Rogov Papernov <michael@membrowse.com>
2026-11-18 16:50:02 +01:00
Michael Rogov Papernov ae65871922 refactor(px4io): share one CRC-8 table between driver and IO firmware
crc8_tab and crc_packet() were static in protocol.h, so every flight
controller image carried two copies of the table: one for the px4io
driver and one for the arch serial code.

Move them into a px4io_protocol library. This saves 304 bytes of FLASH
on px4_fmu-v6x; the IO firmware is unchanged.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Michael Rogov Papernov <michael@membrowse.com>
2026-11-18 16:50:02 +01:00
PX4BuildBot a1e336967d docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-11-18 15:26:14 +00:00
Jonas Perolini baa4742bad feat(vtol_att_control): detect pusher failures in multicopter mode (#29631)
Assisted-by: Codex
2026-11-18 16:18:48 +01:00
Lim Jooyoung 6ab798c1f2 fix(rover): use the deceleration limit when the setpoint changes sign (#29832)
* fix(rover): use the deceleration limit when the setpoint changes sign

throttleControl() and speedControl() chose between the acceleration and
deceleration limits by comparing magnitudes only. A larger setpoint of
opposite sign, e.g. full reverse while driving forwards, therefore used
the acceleration limit for the whole manoeuvre, including braking
towards zero.

Treat braking towards zero for an opposite-sign setpoint as a
deceleration. In speedControl() this ends once the measured speed or the
rate limited setpoint has changed sign, so a lagging speed estimate does
not keep the deceleration limit after the rate limited setpoint has
crossed zero. Without a deceleration limit the previous behaviour is
kept.

Fixes #29727

Assisted-by: Claude:claude-opus-5-5

* refactor(rover): define the acceleration case directly

Replace the braking flag in throttleControl() and speedControl() with a
single accelerating condition, so that any case that is not accelerating
uses the deceleration limit. The selected limit is unchanged.

Add the case of a smaller setpoint of the same sign to the speedControl()
test.

Assisted-by: Claude:claude-opus-5-5
2026-11-18 15:25:47 +01:00
PX4BuildBot b65610b7bd docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-11-18 14:03:24 +00:00
Matthias Grob 96075cb00c fix(mag_bias_estimator): disable the mag bias estimator by default (#29342)
* fix(mag_bias_estimator): disable the mag bias estimator by default

It only helps if you have a very bad or no calibration in the first place or if the vehicle has magnets everywhere.
But it causes problems if you have a perfectly fresh calibration and no new disturbance
especially of course if the estimator runs twice, once on the can node, once on the autopilot.

* fix(mag_bias_estimator): remove the mag bias estimator from all cannodes

It will cause issues if the can nodes run their own online calibration and the autopilot expects to receive raw data. It's not super obvious but will lead to inaccuracies, drifts and inconsitencies in magnetometer heading.
2026-11-18 14:43:26 +01:00
Matthias Grob 79feb2e3f4 fix(commander): hide remaining legacy health texts from event-aware GCS (#29866)
Whenever the overall health/arming result changes, commander re-runs all
checks with the legacy mavlink_log publication and re-sends the
STATUSTEXT of every check that is still failing. Ground stations that
support events only drop these duplicates if the text starts with
"Preflight" or ends with a tab, so latched failures were shown again
each time an unrelated check changed.

Append the tab to the texts that duplicate an event but lacked it, as
described in docs/en/concept/events_interface.md:
- geofence violations (distance, altitude, custom fence)
- motor under/overcurrent and "not all ESCs armed"
- high ESC temperature
2026-11-18 14:30:44 +01:00
PX4BuildBot 269554ad7c docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-11-18 12:59:45 +00:00
Marco Hauswirth c863a4c0f1 refactor(ekf2): publish optical flow topics from OpticalFlowSource like AGP 2026-11-18 13:52:41 +01:00
Marco Hauswirth 8aada67965 refactor(ekf2): move the optical flow publications into OpticalFlowSource 2026-11-18 13:52:41 +01:00
Marco Hauswirth 3bd1839a72 feat(ekf2): support up to two optical flow sensors 2026-11-18 13:52:41 +01:00
bresch 95c82e84ea fix(ekf2): only save a mag bias observed by yawing
A mag bias reset that keeps the heading attributes the whole field
error to the bias, and its variance then converges without any
rotation. The bias is now only offered to the mag calibration once the
heading has changed by 90 degrees since its last reset.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: bresch <brescianimathieu@gmail.com>
2026-11-18 12:27:56 +01:00
bresch 5c831c9e1f test(ekf2): start GNSS after an in-flight mag loss
The heading stays aligned when the mag stops in flight, so GNSS starts
against a heading that may have drifted. A 60 degree error is corrected
by the GNSS fusion, a reversed heading by a yaw emergency reset.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: bresch <brescianimathieu@gmail.com>
2026-11-18 12:27:56 +01:00
bresch 24aafe12b7 test(ekf2): make the simulated GNSS position follow the trajectory
The trajectory only set the GNSS velocity, so the position stayed
fixed and contradicted it as soon as both were fused.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: bresch <brescianimathieu@gmail.com>
2026-11-18 12:27:56 +01:00
bresch 8bc38e0711 fix(ekf2): keep the yaw alignment when the mag stops in flight
When the mag fusion stopped without North-East aiding, the yaw
alignment was cleared and the heading reset to the mag when it came
back, also in flight. As for GNSS yaw, the alignment is now only
cleared before takeoff, and never after a manual heading.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: bresch <brescianimathieu@gmail.com>
2026-11-18 12:27:56 +01:00
bresch b408535e76 fix(ekf2): remove the manual heading expiry
The manual heading flag expired after 30 s of heading fusion to allow
heading resets to the mag again. In flight those resets are gone, so
the flag now stays set and keeps protecting the heading on the ground.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: bresch <brescianimathieu@gmail.com>
2026-11-18 12:27:56 +01:00
bresch d9855bcd76 fix(ekf2): keep the heading on in-flight WMM updates
A WMM update without North-East aiding reset the heading to the mag
and zeroed the learned mag bias, also in flight. The heading is now
only reset on the ground; in flight the bias absorbs the declination
change and the heading converges by yawing.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: bresch <brescianimathieu@gmail.com>
2026-11-18 12:27:56 +01:00
bresch e8c86e287f fix(ekf2): keep the heading when the mag fusion fails
Without North-East aiding, a mag rejected for 7 s reset the heading to
the measured field, so a disturbed or wrongly rotated mag made the
heading jump in flight. The mag states now absorb the error instead.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: bresch <brescianimathieu@gmail.com>
2026-11-18 12:27:56 +01:00
PX4BuildBot 9e34d7bba1 docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-11-18 10:13:41 +00:00
bresch 5df4249fe4 feat(land_detector): detect movement from the aided velocity
The IMU tests cannot see motion at constant speed, which an aided
velocity estimate does.
2026-11-18 11:05:45 +01:00
bresch 745d4c4c8a feat(land_detector): detect movement from the specific force change
The vibration metrics miss smooth accelerations such as a fixed-wing
takeoff roll, which let at_rest be declared while moving.
2026-11-18 11:05:45 +01:00
Matthias Grob eaff7221eb feat(failure_detector): pause the tilt check after a VTOL skips the back-transition
Replaying about 150 logs found false positives only on standard VTOLs
after a quad-chute, with the tilt error above 60° for up to 1.75 s
while recovering from fixed-wing flight in multicopter mode.

All VTOL types switch to multicopter without back-transition on a
quad-chute, detected or commanded, and when a front transition is
aborted. The check now pauses for 5 s after such a switch instead of
raising the threshold for all VTOLs, so it protects the rest of the
multicopter flight.
2026-11-18 11:02:27 +01:00
Matthias Grob b5e65cfbfd feat(airframes): keep the tilt failure check enabled on the omnicopter
The tilt check compares against the attitude setpoint, which the
omnicopter publishes and tracks at any orientation, including upside
down. Disabling the check is no longer needed for it to fly.
2026-11-18 11:02:27 +01:00
Matthias Grob fa877566a4 feat(failure_detector)!: rename the tilt parameters to FD_TILT_ERROR
The tilt check limits the error from the attitude setpoint, which the
FD_FAIL_R name no longer describes. FD_FAIL_R becomes FD_TILT_ERROR,
now a float, and FD_FAIL_R_TTRI becomes FD_TILT_ERROR_T.

The old roll and pitch limits and trigger times meant something else,
so they start at the new defaults instead of being taken over. Only a
check disabled for both roll and pitch stays disabled, as -1.
2026-11-18 11:02:27 +01:00
Matthias Grob 8225bb350f test(failure_detector): add tilt failure check unit tests
Cover the tilt error check: threshold in all directions, error relative
to the attitude setpoint, yaw ignored, fallback to level with a stale
setpoint, disabling, trigger time and its reset, and the tailsitter
fixed-wing frame.

Also make the altitude loss tests independent of each other: the
fixture set parameters after the detector had read them on
construction, so each test ran with the previous test's values. Both
fixtures are now the detector's parameter parent, like Commander, and
apply parameters with updateParams().
2026-11-18 11:02:27 +01:00
Matthias Grob ce4da9af8f refactor(failure_detector): run the tilt trigger time on the attitude timestamp
This allows for easy time abstracted unit testing.
2026-11-18 11:02:27 +01:00
Matthias Grob 15abdd0946 feat(failure_detector)!: check tilt error against the attitude setpoint
Checking the absolute tilt from level conflicts with the vehicle's own
tilt limits: the threshold can be set below the maximum tilt, and
external modes that tilt further than the autopilot's limits trip the
check, so they can't benefit from its crash detection.

Compare the tilt with the attitude setpoint's tilt instead, falling back
to level without a recent setpoint, e.g. on rovers. Before arming the
setpoint is level, so a vehicle lying on its side still can't arm. The
tailsitter transition exception is no longer needed because the
transition setpoint is in the multicopter frame. The default trigger
time goes from 0.3 s to 1 s so that fixed-wing stick reversals, which
pass through a large error at a limited roll rate, don't trigger it.

Also reset the tilt hysteresis while attitude control is off, so a
pending trigger from before e.g. Acro can't skip the trigger time when
attitude control comes back on.
2026-11-18 11:02:27 +01:00
Matthias Grob 7f83c28400 feat(failure_detector)!: check tilt instead of roll and pitch separately
Checking roll and pitch against separate limits misses a combined
tilt: 45° roll with 45° pitch is a 60° tilt but stays below both
default 60° limits. Euler angles are also unreliable near 90° pitch
and when inverted.

FD_FAIL_R and FD_FAIL_R_TTRI now set the maximum tilt and its trigger
time. FD_FAIL_P and FD_FAIL_P_TTRI are removed without migration
(see the Upgrade Guide). The check is disabled with -1; 0 still
disables it for existing setups. In FailureDetectorStatus, fd_roll
and fd_pitch are replaced by fd_tilt.
2026-11-18 11:02:27 +01:00
Federico MagriandSilvan Fuhrer f1dae4865c fix(fw): disable deflection scaling when landed (#29842)
* fix(fw): disable deflection scaling when landed

* Update src/modules/fw_rate_control/FixedwingRateControl.cpp

Co-authored-by: Silvan Fuhrer <silvan@auterion.com>

---------

Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
2026-11-18 10:17:52 +01:00
PX4BuildBot 9db647d5d3 docs: auto-sync metadata [skip ci]
Co-Authored-By: PX4 BuildBot <bot@px4.io>
2026-11-18 09:12:00 +00:00
Jonas Perolini bab12fc267 fix(navigator): RTL type 6 keeps Home over a farther rally point (#29812)
When the battery estimate did not reach Home, type 6 took the closest
rally point even when it was farther away than Home. Return compares
destinations only by straight-line distance, so it has no reason to
prefer a rally point that is farther away than Home, and return.md says
type 6 falls back to Home unless a rally point is closer. Returns
started by the distance-aware battery failsafe hit this case.

Compare the rally points with the distance to Home, as type 6 already
does without a battery estimate.

Assisted-by: Claude:claude-opus-5-5

Signed-off-by: jonas <jonspero@me.com>
2026-11-18 10:05:33 +01:00