606 Commits

Author SHA1 Message Date
Claudio Chies
5a4c13fc23
fix(commander): ADSB timeout modification and cosmetics (#26878)
* fix(commander): add tab character to critical system loss messages

* fix(commander): extend timeout for traffic avoidance system heartbeat check

* Commander: Only Warn the user about traffic avoidance system loss if COM_ARM_TRAFF is set

Signed-off-by: Claudio Micheli <claudio@auterion.com>

---------

Signed-off-by: Claudio Micheli <claudio@auterion.com>
Co-authored-by: Claudio Micheli <claudio@auterion.com>
2026-03-26 18:41:33 -07:00
mahima-yoga
873ee61d57 commander: enable arming on boot 2026-03-24 15:01:15 +00:00
Jacob Dahl
7d56582915
refactor(commander): remove duplicate failure_detector_status from vehicle_status (#26754)
The failure_detector_status bitmask in vehicle_status duplicates the
separate FailureDetectorStatus topic. Remove it and read directly from
the dedicated topic in failureDetectorCheck and HIGH_LATENCY2.
2026-03-19 11:31:12 -08:00
Jacob Dahl
75a51c19c7
fix(commander): arm throttle check for all vehicle types (#26683)
Extend the arm throttle safety check to all vehicle types including
rovers, which were previously excluded. Unify the two separate throttle
checks into a single evaluation at arm-time that accounts for vehicle
type and control mode: rovers require centered stick, climb-rate modes
require stick at or below center, and manual/stab/acro modes require
stick at bottom.
2026-03-19 11:24:37 -08:00
Matthias Grob
4e2f3e7600
refactor(commander): remove unused parameter COM_HLDL_REG_T (#26809) 2026-03-19 11:01:32 -08:00
Jacob Dahl
f00e46f618
feat(dshot): Extended Telemetry and EEPROM support
Overhauls the DShot driver with per-timer BDShot selection, multi-timer                                                                                                                                  
sequential capture, Extended DShot Telemetry (EDT), and AM32 ESC EEPROM                                                                                                                                  
read/write via MAVLink. Expands ESC support from 8 to 12 channels.                                                                                                                                       
                                                                                                                                                                                                   
BDShot:                                                                                                                                                                                                  
- Per-timer BDShot protocol selection via actuator config UI                                                                                                                                             
- Multi-timer sequential burst/capture on any DMA-capable timer                                                                                                                                          
- Adaptive per-channel GCR bitstream decoding                                                                                                                                                            
- Per-channel online/offline detection with hysteresis                                                                                                                                                   
                                                                                                                                                                                                   
Extended DShot Telemetry (EDT):                                                                                                                                                                          
- Temperature, voltage, current from BDShot frames (no serial wire)                                                                                                                                      
- New DSHOT_BIDIR_EDT parameter                                                                                                                                     
- EDT data merged with serial telemetry when both available                                                                                                                                              
                                                                                                                                                                                                   
AM32 EEPROM:                                                                                                                                                                                             
- Read/write AM32 ESC settings via MAVLink ESC_EEPROM message                                                                                                                                            
- ESCSettingsInterface abstraction for future ESC firmware types                                                                                                                                         
- New DSHOT_ESC_TYPE parameter                                                                                                                                                                           
                                                                                                                                                                                                   
Other changes:                                                                                                                                                                                           
- Per-motor pole count params DSHOT_MOT_POL1–12 (replaces MOT_POLE_COUNT)                                                                                                                              
- EscStatus/EscReport expanded to 12 ESCs with uint16 bitmasks                                                                                                                                           
- Numerous bounds-check, overflow, and concurrency fixes                                                                                                                                                 
- Updated DShot documentation
2026-03-17 16:38:33 -08:00
Matthias Grob
09cb22f799 refactor(commander): remove unused parameter COM_MOT_TEST_EN 2026-03-17 12:56:18 -08:00
Matthias Grob
6b5147110b
refactor(commander): remove needless parameter COM_KILL_DISARM (#26736) 2026-03-14 01:09:28 -08:00
Matthias Grob
7207c34c5b Commander: avoid leaking health checks into failure detector 2026-03-12 18:30:51 +01:00
Jeff Katz
5cdf5ac482
fix(commander): calibration CPU starvation on linux (#26608)
On Linux targets with high-rate external sensor data (>1000Hz), all
sensor calibrations (gyro, accel, mag) can freeze PX4 by starving
other threads of CPU. Normal flight is unaffected — only calibration
triggers the problem.

Two compounding issues in the calibration worker threads:

1. calibrate_cancel_check() creates a new uORB::Subscription on every
   call, which triggers getDeviceNodeLocked() — an O(n) linear strcmp
   scan through all uORB nodes. In gyro/mag calibration this was called
   on every sensor sample, consuming the majority of CPU in strcmp alone.

2. SubscriptionBlocking::updatedBlocking() returns immediately when data
   is already available (it only blocks when no data is pending). With
   continuous high-rate sensor data, the calibration loops never yield,
   spinning at 100% CPU.

These problems are addressed with this patch as follows:

- Throttle calibrate_cancel_check() to once per 200ms in gyro
  and mag calibration loops.

- Add 1ms px4_usleep() yield before updatedBlocking()/updateBlocking()
  in all calibration loops (gyro, accel, mag, orientation detection).
  This caps the effective loop rate at ~1000Hz — still far above what
  calibration needs (250-750 samples).

- Force Commander main loop to sleep during calibration so it does not
  compete with calibration worker threads for CPU.

Tested under Linux (x64, aarch64) both with RT and non-RT scheduling,
with sensor data arriving at ~3600Hz. Calibration completes normally
and no longer results in a deadlocked process.
2026-03-06 10:11:24 -09:00
Ege Kural
a5c67b90a9
CI: enable clang-tidy bugprone-incorrect-roundings (#26574)
switched to lroundf and included cmath in all



removed std namespace - quick tested

Signed-off-by: kuralme <kuralme@protonmail.com>
2026-02-24 13:16:33 -09:00
Jacob Dahl
ce3e62841f
module_base: remove CRTP template pattern to reduce flash bloat (#26476)
* module_base: claude rewrite to remove CRTP bloat

* module_base: apply to all drivers/modules

* format

* fix build errors

* fix missing syntax

* remove reference to module.h in files that need module_base.h

* remove old ModuleBase<T>

* add module_base.cpp to px4_protected_layers.cmake

* fix IridiumSBD can_stop()

* fix IridiumSBD.cpp

* clang-tidy: downcast static cast

* get_instance() template accessor, revert clang-tidy global

* rename module_base.h to module.h

* revert changes in zenoh/Kconfig.topics
2026-02-19 15:17:17 +13:00
Claudio Chies
05de941399 Add Traffic Avoidance System (ADSB/FLARM) Arming Check (#26390)
* Add traffic avoidance system checks

* Update msg/px4_msgs_old/msg/VehicleStatusV1.msg

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* docs: add arming check for traffic avoidance systems in ADS-B/FLARM documentation

* fix formating

* trafficAvoidanceCheck: switch case for configuration options

---------

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
2026-02-18 17:37:03 +01:00
Matthias Grob
adc9a6d35d Report nav_state of mission executor via MAVLink 2026-02-18 17:37:03 +01:00
Loic Fernau
b7d9876cd9
Added missing Defaults to VEHICLE_CMD_DO_SET_MODE (#26291)
* Added missing Defaults to VEHICLE_CMD_DO_SET_MODE

* Made Format
2026-01-29 05:36:21 +13:00
Brandon W. Banks
1345b3500a
Vehicle command for Prearm Safety button (#26079)
* added vehicle command and support to remotely activate/deactivate the safety system (#26078)

* added print_status support for prearm safety status

* updated safety button to map to MAV_CMD_DO_SET_SAFETY_SWITCH_STATE = '5300'

* safety switch cmd: fixed incorrect catch-all and added commanded_state variable for easier reading
2025-12-15 11:25:32 -09:00
mahima-yoga
ca83b8330d autotune: enable autotune in mission mode
When operating fully autonomously (i.e., without manual control or a guaranteed link to the ground station), tuning a vehicle can be difficult since the current autotune process requires either RC input or a GCS command. For these scenarios, it it useful to be able to start autotune inside a mission.
2025-12-05 14:03:10 +01:00
Michael Schaeuble
d97a8d7d3b mode: control auto set home from an external mode
The mode executor can run land mode which updates the home position to the landing location. This
can be not the desirable behavior and the home position should stay at the original location.

A flag is added to the configuration overrides to control if the home position is updated or not.
2025-11-26 10:16:54 +01:00
Matthias Grob
540e80eb77 FilaureDetector: publish failure_detector_status in class and call that from commander 2025-10-23 09:23:45 +02:00
Matthias Grob
65c5bd6906
Fix (dis)arm reason enumeration (#25766) 2025-10-20 09:12:36 -04:00
Matthias Grob
e59afce5db Enable directly injecting motor failures using e.g. failure motor off -i 1
Only if SYS_FAILURE_EN is enabled and CA_FAILURE_MODE is > 0.
2025-09-30 11:23:09 +02:00
Parkhb1106
3925562ce6
commander: fix tune_control timestamp on initial publication 2025-09-24 10:55:32 -08:00
Beat Küng
9670eb69b3 commander: use double literals to avoid implicit conversion
Fixes a CI failure for fuzzing and macos:
https://github.com/PX4/PX4-Autopilot/actions/runs/17906277709/job/50907922642

/__w/PX4-Autopilot/PX4-Autopilot/src/modules/commander/Commander.cpp:471:37: fatal error: implicit conversion increases floating-point precision: 'float' to 'double' [-Wdouble-promotion]
  470 |                         bool ret = send_vehicle_command(vehicle_command_s::VEHICLE_CMD_EXTERNAL_ATTITUDE_ESTIMATE,
      |                                    ~~~~~~~~~~~~~~~~~~~~
  471 |                                                         0.f, 0.f, heading, 0.f, 0.f, 0.f, heading_accuracy);
      |                                                                                      ^~~
1 error generated.
2025-09-22 09:31:26 -07:00
bresch
82308da18d ekf2: support heading external update from MAV_CMD_EXTERNAL_ATTITUDE_ESTIMATE 2025-09-18 17:00:16 +02:00
Silvan Fuhrer
d2e4d85bce Add Altitude Cruise mode
-add new NAVIGATION_STATE_ALTITUDE_VOYAGER
-this mode does require manual control to enter
-but you can disable the manual control loss failsafe to continue
flying in case of manual control loss
-for MC: in throttle and yaw are controlled like in Altitude mode,
the tilt is controlled via integrated rate input (similar to Acro,
but with tilt limit)

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2025-09-18 15:50:10 +02:00
mahima-yoga
dd09cdf986 Commander: remove HIL_STATE_ON from arming lockdown
Removing this from the boolean allows users to send pwm values in SIH.
2025-08-25 09:28:43 +02:00
Matthias Grob
79b46e08a8 Rename manual_lockdown to kill for clarity 2025-07-28 17:07:08 +02:00
Matthias Grob
200be07021 action_request: rename ACTION_TERMINATE to ACTION_TERMINATION for clarity 2025-07-25 13:01:25 -06:00
Matthias Grob
7fe78e184e Rename force_failsafe to termination for clarity 2025-07-25 13:01:25 -06:00
Matthias Grob
34dacffc4a Commander: shell command commander termination instead of lockdown on for clarity 2025-07-25 13:01:25 -06:00
Pedro Roque
e14eea5615
feat: BlueROV2 Heavy updated control (attitude and position) and model (#25052)
* rft: clean merge to PX4

* fix: formatting

* fix: extra line

* fix: moved submarine out of "is_ground_vehicle", added proper check for center-throttle

* feat: updated gazebo models to include bluerov update

* fix: use 'is_uuv_vehicle', remove FW_MM/LLC from uuv build

* fix: added saturation to thrust and torque messages via param

* doc: updated parameters documentation for uuv

* fix: formatting

* feat: matching hardware reference

* fix: thrusters kg

* rft: removed commented lines

* fix: update gz reference given hw setup

* fix: hardware references

* fix: recommendations

* fix: updated settings to match hardware

* rft: check only for fixed and rotary wing for high throttle

Co-authored-by: Daniel Agar <daniel@agar.ca>

* fix: commit oupsie

* fix: format

* rft: remove is_uuv

* fix: hw parameters, uuv build target for v6x

* feat: added support for D-pad attitude changes in stabilized position control

* fix: position setpoint update and parametrized trajectory age and att change

* fix: format

* fix: removed duplicated call to check_validity_setpoint

* fix: setpoint update on arming logic

* fix: setpoint initialization for stabilized mode

---------

Co-authored-by: Daniel Agar <daniel@agar.ca>
2025-07-23 10:29:22 -07:00
Matthias Grob
6c5c88f72e Commander: only trigger MAVLink parachute on termination
This can now be tested using the new termination RC switch.
2025-07-23 11:13:11 +02:00
Matthias Grob
52e8a0a0db Add RC termination switch 2025-07-23 11:13:11 +02:00
Julian Oes
2c97a875bf commander/mavlink: use home attitude, not only yaw
According to the mavlink spec we should be publishing the home attitude
as a quaternion rather than just the yaw/heading.

Additionally, this allows setting the landing roll and pitch angle using
DO_SET_HOME (this yet needs to go into the MAVLink spec though).

This time including the message versioning and translation.
2025-07-20 07:51:14 +12:00
Beat Küng
f0ecd9e757 fix commander: set failsafe action state immediately after failsafe update
There was a race condition: for example when an external mode disabled
failsafe deferring, that then triggered a failsafe, while the mode executor
immediately sends a command (to e.g. switch modes).
In that case the failsafe got triggered but the mode switch was still
allowed.
This was because of the processing ordering:
- mode updates (and propagating the failsafe_action_active state)
- failsafe updates
- command handling

This patch makes sure failsafe_action_active is set immediately after
updating the failsafes.
2025-07-15 17:18:54 +02:00
Silvan Fuhrer
35a3f519f2 Revert "commander: publish full home attitude, not only yaw (#19717)"
This reverts commit 6855aa57c4879bb5c67298f3ce1f738118fbafa0.
2025-07-15 09:24:55 +02:00
Silvan Fuhrer
bdf1895145 Commander: on completion of takeoff, force state transition to Loiter
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2025-07-14 14:29:59 +02:00
Julian Oes
6855aa57c4
commander: publish full home attitude, not only yaw (#19717)
According to the mavlink spec we should be publishing the home attitude
as a quaternion rather than just the yaw/heading.

Additionally, this allows setting the landing roll and pitch angle using
DO_SET_HOME (this yet needs to go into the MAVLink spec though).
2025-07-09 14:43:31 -08:00
Julian Oes
e46e4dc80e commander: prevent race condition after mission
When a mission finishes with an RTL command, there's a race condition
between:
1. RTL command setting user_mode_intention RTL
2. Mission completion logic forcing LOITER

The auto-loiter transition was checking current nav_state (which is
still AUTO_MISSION) instead of any pending user_mode_intention,
causing it to override the RTL request.

Fix: Only auto-transition to loiter if no mode change is already
pending.
2025-06-30 09:20:44 -07:00
Marco Hauswirth
6604c52c98
Commander: Adjust home position altitude after GNSS altitude correction (#25003)
Within the first 2min of a flight, check if the integrated GNSS vertical velocity and the baro
measurements disagree with the reported GNSS altitude, and in that case update the 
set home position altitude to cancel out GNSS altitude drift.

* prevent re-init when reaching negative altitudes

* only allow correction during the first 120 second after takeoff

* add dependency to COM_HOME_EN parameter. reset vel-integral for multiple takeoffs
2025-06-18 13:26:45 +02:00
Pedro Roque
6d15019717
feat: spacecraft tooling for commander and VehicleStatus (#24716)
* feat: spacecraft tooling for commander and VehicleStatus

* fix: format

* fix: remove iostream

* feat: mavlink compliant spacecraft definition

* feat: add orbiter to define

feat: spacecraft tooling for commander and VehicleStatus

fix: format

fix: remove iostream

feat: mavlink compliant spacecraft definition

* feat: add orbiter to define

* feat: update mavlink to latest

* fix: get away without specifying spacecraft vehicle

* fix: removed unnecessary definition

* fix: format
2025-06-12 21:48:48 +02:00
Mahima Yoga
c9658f28e9
commander: use existing class state to track mission progress (#24947)
Replaced the local variable landed_amid_mission with the class member _mission_in_progress for consistency and to reduce redundancy.
No functional change.
2025-06-09 18:17:13 -08:00
Mahima Yoga
2110da73ad
Commander: don't reset Home position if landed during a (uncompleted) mission. (#24902) 2025-06-02 10:50:03 +02:00
Silvan Fuhrer
d857a278ff Commander: use is_ground_vehicle() consistently instead of checking vehicle_type
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2025-03-04 12:15:01 +00:00
Silvan Fuhrer
7cb6464cfb VehicleStatus.msg: remove VEHICLE_TYPE_UNKNOWN
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2025-03-04 12:15:01 +00:00
bresch
2d1652f499 Commander: fix parachute trigger
Setting "lockdown" disables the actuators. In this mode,
"force_failsafe" has no effect as the actuators are disabled, so the
parachute is not getting released as it requires the output to change to
its failsafe value.
2025-03-03 15:41:39 +01:00
Sebastian Domoszlai
b5f37c9fa6
Simplify Battery-related Enum Naming (#24265)
* Simplify battery-related enum naming

* Fix mistakenly removed string in enum names

* Fix missing renamings

* Update outdated file

* msg: Increase battery_status version since the enum naming was changed

* Revert message version increase

---------

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2025-02-28 11:42:40 -09:00
Silvan
14941bc270 Commander: handle mode change rejection the same for RC and MAVLink
Previously, when requesting a mode switch to Position without a valid
position estimate through an RC button, the mode change to Position mode
was not rejected if COM_POSCTL_NAVL was set to 1 and instead the system
switched to Altitude mode.
If the mode request instead came in through MAVLink it was rejected.
This commit aligns the two ways of changing a flight mode.

Signed-off-by: Silvan <silvan@auterion.com>
2025-02-28 14:22:36 +01:00
Silvan
1f2dba68d2 remove avoidance library and logic
Signed-off-by: Silvan <silvan@auterion.com>
2025-02-18 14:33:16 +01:00
Hamish Willee
9e5cfa330a Commander: Quick calibration supports mag too 2025-02-04 21:58:03 -05:00