* 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>
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>
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>
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.
* 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
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.
* 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
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>
- 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
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
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.
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.
* 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
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.
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.
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.
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>
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>