PX4 / PX4/PX4-Autopilot

[RFC] Enforce parameter constraints at param::get()

Open
#28,126 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:needs-triage
Dominant language
C++
Stars
12.7k
Forks
16k
Avg merge
2d 12m
Merged PRs (30d)
225

Description

Not all parameters are validated at runtime, and values that make no physical sense (negative magnitudes) can produce unexpected behavior. PX4 policy has generally been to leave proper configuration to the user, and for most parameters that is the right call.

We've seen five reports in two weeks, each a different parameter, and #28104 was closed rather than add two more guards to MulticopterPositionControl::parameters_update().

Tracking the general fix @dakejahl proposed in [#28094 (comment)] — enforce the constraints once at the parameter accessor rather than per consumer.

Reports of this shape:

  • #27890
  • #27909
  • #27889
  • #27978
  • #28094

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the parameter accessor param::get() and the proposal linked from #28094; compare it with the existing per-consumer handling in MulticopterPositionControl::parameters_update(). Determine the intended constraints from reports #27890, #27909, #27889, #27978, and #28094, then verify that enforcement is centralized at access time rather than duplicated in consumers.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
embedded-iot, robotics
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.