Skip to content

fix(mc_pos_control): handle rejected velocity filter cutoffs [1.18] - #28534

Open
Saibernard wants to merge 1 commit into
PX4:release/1.18from
Saibernard:backport-1.18-mc-pos-control-filter
Open

fix(mc_pos_control): handle rejected velocity filter cutoffs [1.18]#28534
Saibernard wants to merge 1 commit into
PX4:release/1.18from
Saibernard:backport-1.18-mc-pos-control-filter

Conversation

@Saibernard

Copy link
Copy Markdown
Contributor

Backport of #28451 to release/1.18, the same commit as on main.

A rejected filter cutoff was silently accepted and degraded altitude hold on multicopters.

…rejected (PX4#28451)

setCutoffFreq refuses a cutoff at or above half the sample rate and
leaves the filter untouched, but all four velocity filter calls ignored
the return. With the filters at their initial alpha of zero this froze
the velocity feedback at zero, and the condition is reachable from a
permitted parameter value, MPC_VEL_LP allows up to 50 Hz while the
position loop commonly runs at 100 Hz or less. In SIH a hover with
MPC_VEL_LP=50 oscillates half a metre in altitude with vertical speed
peaks near 1 m/s, and holds 2.5 m within centimetres with this change.

Follow the pattern VehicleAngularVelocity already uses, check the
return and bypass the low pass stage when the requested cutoff is not
achievable. One deliberate behaviour change comes with that, a runtime
parameter change from a valid to an unachievable cutoff now bypasses
the stage instead of keeping the stale previous configuration.

Assisted-by: Claude:claude-fable-5

Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
(cherry picked from commit 71f8b37)
@github-actions github-actions Bot added kind:bug Something is broken or behaving incorrectly. vehicle:copter Copter-specific behavior. scope:control Rate, attitude, position, allocation, or actuator control. labels Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 48 byte (0 %)]
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +48  +0.0%     +48    .text
    +1.5%     +52  +1.5%     +52    MulticopterPositionControl::parameters_update()
    +3.0%      +8  +3.0%      +8    AlphaFilter<>::setCutoffFreq()
    +4.8%      +4  +4.8%      +4    FlightTask
     +44%      +4   +44%      +4    g_nullstring
    -2.1%      -2  -2.1%      -2    events::send<>()
    -0.6%      -2  -0.6%      -2    matrix::SliceT<>::operator=()
    -0.0%      -4  -0.0%      -4    g_cromfs_image
    -0.0%     -12  -0.0%     -12    [section .text]
  +0.0%     +55  [ = ]       0    .debug_abbrev
  +0.0%     +20  [ = ]       0    .debug_info
  +0.0%     +13  [ = ]       0    .debug_line
   -33.3%      -1  [ = ]       0    [Unmapped]
    +0.0%     +14  [ = ]       0    [section .debug_line]
  +0.0%     +84  [ = ]       0    .debug_loclists
  +0.8%      +2  [ = ]       0    .shstrtab
  -0.0%     -14  [ = ]       0    .strtab
   -12.8%     -14  [ = ]       0    AlphaFilter<>::setCutoffFreq()
     +76%     +16  [ = ]       0    __sq_addafter_veneer
   -37.2%     -16  [ = ]       0    __stm32_endtransfer_veneer
  -0.6%     -48  [ = ]       0    [Unmapped]
  +0.0%    +160  +0.0%     +48    TOTAL

px4_fmu-v6x [Total VM Diff: 40 byte (0 %)]
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +40  +0.0%     +40    .text
    +1.5%     +52  +1.5%     +52    MulticopterPositionControl::parameters_update()
    +3.0%      +8  +3.0%      +8    AlphaFilter<>::setCutoffFreq()
    +4.8%      +4  +4.8%      +4    FlightTask
    -2.1%      -2  -2.1%      -2    events::send<>()
    -0.6%      -2  -0.6%      -2    matrix::SliceT<>::operator=()
    -0.0%      -4  -0.0%      -4    g_cromfs_image
    -0.0%     -16  -0.0%     -16    [section .text]
  +0.0%     +55  [ = ]       0    .debug_abbrev
  +0.0%     +20  [ = ]       0    .debug_info
  +0.0%     +21  [ = ]       0    .debug_line
    [NEW]      +7  [ = ]       0    [Unmapped]
    +0.0%     +14  [ = ]       0    [section .debug_line]
  +0.0%     +84  [ = ]       0    .debug_loclists
  +0.9%      +2  [ = ]       0    .shstrtab
  -0.0%     -14  [ = ]       0    .strtab
   -12.8%     -14  [ = ]       0    AlphaFilter<>::setCutoffFreq()
  -0.7%     -40  [ = ]       0    [Unmapped]
  +0.0%    +168  +0.0%     +40    TOTAL

Updated: 2026-09-04T01:36:40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug Something is broken or behaving incorrectly. scope:control Rate, attitude, position, allocation, or actuator control. vehicle:copter Copter-specific behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants