* fix(logger): hold the writer lock while starting a log file
LogFileBuffer::start_log() resets _fd, _buffer, _head, _count and
_should_run without the lock, while the writer thread reads them under it
(it can already be running for the other log type). TSan flags this on
log start in SITL CI.
The PX4_CRYPTO failure path had the same problem, and could additionally
let the writer thread write to a file that is being closed.
init_logfile_encryption() also sets _min_blocksize, which the writer
reads under the lock, so it moves into the locked section as well.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* fix(logger): make the log buffer run flag atomic
is_started() reads _should_run without the writer lock, from the logger
thread and from print_status() on the shell thread. The writer thread
clears it on a write error.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* refactor(logger): use LockGuard instead of manual lock/unlock
- Create extra scope in which to define the LockGuard
- Replace return logic with early-return to avoid deepening scopes
---------
Signed-off-by: Balduin <balduin@auterion.com>
RTL_TYPE 6 estimated Home without the VTOL land approach to decide
whether Home is within reach, while the Return flies the approach and
the published estimate includes it. Home could count as reachable while
the published estimate already exceeded the battery. Estimate Home with
the land approach applyReturn() configures.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonspero@me.com>
Co-authored-by: Anil Kircaliali <anil.kircaliali@auterion.com>
RtlDirect::calc_rtl_time_estimate() only estimates the configured
Return, so RTL_TYPE 6 configured RtlDirect for Home to estimate it and
relied on applyReturn() to configure the selected destination again
right after. estimateReturnTo() takes the target as input instead. The
Home estimate keeps the same inputs, so its result does not change.
on_inactive() writes out select, apply and publish, so the 2 s cycle
can pass a value from the selection to the publisher.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonspero@me.com>
* fix(timesync): replace double exponential filter with time-based Kalman filter
The double exponential filter had per-sample gains and a per-sample skew.
Its dynamics therefore depended on how often the caller exchanged timesync
packets: tuned for MAVLink at 10 Hz, the uXRCE-DDS client at 1 Hz got a
10x slower, underdamped filter (~40 min ringing period). Moreover, the skew
learned during the fast initial sync burst (~70 Hz) was applied per second
afterwards, so it was off by the ratio of the two intervals.
As a result any remote clock correction below the 100 ms reset threshold,
for example from chrony right after the companion boots, kept the estimate
more than 10 ms off the observed offset for 10-20 minutes.
A two-state Kalman filter (offset, skew in us/s) predicts with the actual
time between samples, so its behaviour no longer depends on the sample
rate, and it replaces the sample-count gain schedule. In replays of startup
clock slews and steps of 20-90 ms, the time with more than 10 ms between
observed and estimated offset drops from 11-20 min to under 2 min. The
steady-state estimate noise rises from ~65 to ~130 us RMS at 1 Hz.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* refactor(timesync): express the filter state in seconds
Keep the offset in s and the skew in s/s so all tuning constants share
SI units instead of mixing us and s. offset() is the only conversion
back to us for the interface. The estimate is unchanged.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* refactor(timesync): document the Kalman filter prediction
Explain where the process noise terms come from and write the
covariance prediction in Horner form. Shorten the tuning comments.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* test(timesync): add convergence tests for remote clock corrections
Simulate a drifting remote clock with uXRCE-DDS-like sampling (fast
initial exchange, then 1 Hz) and check steady-state accuracy and the
recovery from steps and ramps, plus the same at a constant 10 Hz.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* fix(timesync): add offset process noise to damp clock step response
With process noise only on the skew, the filter settles to a damping
ratio of 1/sqrt(2) regardless of tuning, so a step of the remote clock
overshoots by ~20%. Adding a random walk on the offset raises the
damping to ~0.9. The skew random walk is lowered so the steady-state
noise stays the same.
On a Skynode with a +60 ms companion clock step the overshoot drops
from 12.3 to 9.2 ms and the error is back within 10 ms after 0.4
instead of 1.5 min.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* fix(timesync): raise offset process noise to reduce step overshoot
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* docs(timesync): document the Kalman filter model and Q derivation
Define the state, the continuous-time model and the measurement model,
and show why the discrete process noise Q_d is the exact solution of
the hybrid Kalman filter prediction. The tuning constants and the
comments in the code use the same symbols, so they can be checked
against the linked references.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* refactor(timesync): Make test more strict
* refactor(timesync): simplify Kalman update and reset
---------
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
* fix(sensor_airspeed_sim): use vehicle_attitude_groudtruth
Don't use the EKF estimated attitude.
Use the groundtruth one like with the other inputs:
- local pos
- global pos
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>
* chore(sih): rename SensorAirspeedSim groundtruth subscribers
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>
---------
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@auterion.com>
Around a geofence, the direct Return flies a detour: to the first
corner, along the corners, then from the last corner to the
destination. The time estimate added the legs up to the last corner,
then the straight distance from the vehicle to the destination instead
of the distance from the last corner. For a destination close behind a
wide exclusion zone the estimate was too low, so the distance-aware
return failsafe could trigger too late.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonspero@me.com>
check_format requires parameter members to be named
_param_<lower case parameter name>. It fails on main since the
DEFINE_PARAMETERS table test added this member.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonspero@me.com>
* fix(cmake): link the functional gtest libraries as a group
px4_platform, parameters and uorb_msgs all reference uORB, but uORB is
listed before them, so a test only linked when something earlier
happened to pull in px4_log.o. Inlined param_get() type checks did that
for any test using DEFINE_PARAMETERS; without them PerformanceModel and
StickYaw failed with undefined orb_advertise and orb_publish.
Assisted-by: Claude:claude-opus-5-5
* refactor(platform): load DEFINE_PARAMETERS members from a table
Every parameter cost a param_get_mark_used() call in its class
constructor and a param_get() call in updateParamsImpl(), about 12 bytes
each, for roughly 2000 parameters. Each Param now takes one
pointer-sized slot, so the members a DEFINE_PARAMETERS list declares
form an array. A ParamTable member declared right after them holds the
handles and loads them all with one call, in the constructor and on
update. External parameters keep a pointer instead of a reference so
the loader can follow it.
Assisted-by: Claude:claude-opus-5-5
* refactor(platform): use param_t for parameter table entries
Each entry is a parameter handle with the storage kind in its top bits,
so it takes the handle's type.
Assisted-by: Claude:claude-opus-5-5
* refactor(platform): keep each Param at its natural size
Padding every Param to a pointer-sized slot doubled float and int32
members on 64-bit targets and grew ParamBool from 1 to 4 bytes. The
macro now passes the first parameter's address to the table, and the
loader steps through the members at each kind's own size and alignment.
A table placed before the parameters would instead load through the
external parameters before their pointers are set.
Assisted-by: Claude:claude-opus-5-5
* refactor(platform): drop the parameter table end marker
APPLY_ALL leaves a comma after every entry, so the template argument
list needed a closing element, which every class then stored in its
entry array. The entries are now a static array of the class, whose
braced initializer accepts the trailing comma.
Assisted-by: Claude:claude-opus-5-5
* refactor(platform): check the parameter layout at compile time
The language leaves padding between members to the compiler, so the
table loader relies on the ABI placing each member at the next address
its alignment allows. Each class's updateParamsImpl() now checks every
parameter's offsetof against where the loader steps, so a compiler that
pads differently fails the build instead of loading into the wrong
members.
Assisted-by: Claude:claude-opus-5-5
* docs(platform): describe how DEFINE_PARAMETERS loads parameters
The table loader walks the members of a class from the first parameter's
address, which is not obvious from the macros or the loader alone. A
block above the macros now states the flash cost it removes, what the
macro adds to a class, how the loader steps, and which static_asserts
guard the layout it relies on.
The namespace comment said a Param does not depend on the macro. That
stopped being true when the constructors stopped loading.
Assisted-by: Claude:claude-fable-5-2
* docs(platform): drop the flash figure from the parameter table comment
A measured saving for one board goes stale as parameters are added. The
comment now states what the table replaces the per-parameter calls with.
Assisted-by: Claude:claude-fable-5-2
* fix(platform): build the parameter layout check on GCC before 9
GCC 7 and 8 ignore _Pragma diagnostics inside a macro expansion, so the
offsetof warning in the DEFINE_PARAMETERS layout check stays an error on
the VOXL 2 toolchain. Those compilers now build with
-Wno-invalid-offsetof. The static_assert still runs there.
Assisted-by: Claude:claude-opus-5-5
ubuntu.sh installs clang with --no-install-recommends. Since Ubuntu
24.04 the sanitizer runtimes (libclang_rt.asan and friends) are a
separate package that clang only recommends, so a host or px4-dev image
set up by this script cannot link anything built with -fsanitize.
The fuzz tests build that way. With clang, fuzzing mode turns on ASan,
the abseil configure checks fail to link, and CMake reports a misleading
"Could NOT find Threads". clang-tidy.yml installs the runtime by hand
for this reason, and the nightly fuzzing job needs the same workaround
to move off its old image.
Install libclang-rt-dev, the unversioned package that follows the
default clang, on both amd64 and arm64. Skip it on 22.04, where clang 14
still carries the runtimes and the package does not exist.
Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Pulls in PX4/NuttX#454. The STM32 and AT32 I2C drivers left NACKIE
enabled after a transfer ended. A late NACK from a timed-out transfer
could then fire the ISR while the next transfer was being set up, set
priv->msgv to NULL and hard fault in stm32_i2c_sendstart().
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: danielbuleandra <daniel.buleandra@auterion.com>
* fix(commander): check the mapped rover sticks before arming
Since rovers map their sticks with RO_STICK_MAP, the throttle stick is no
longer always the one that drives them. With RO_STICK_MAP=2 commander
still checked the left vertical stick, so a rover could be armed with
the right stick pushed fully forward.
Run the sticks through the rover stick mapping and deny arming when the
forward stick, or the lateral stick on a mecanum rover, is off center.
Assisted-by: Claude:claude-opus-5-5
* fix(commander): check the rover's tank sticks in manual parking
Manual parking on differential and mecanum rovers drives the left and
right wheels with the vertical sticks and ignores RO_STICK_MAP, so the
mapped check could still let the rover arm with a wheel stick pushed.
Assisted-by: Claude:claude-opus-5-5
* style(rover): wrap the sticksCommandMotion signature for astyle
Assisted-by: Claude:claude-opus-5-5
* fix(commander): check each tank stick on its own in manual parking
In manual parking each vertical stick drives one side of wheels, so averaging them let a rover arm while turning on the spot or with one stick partly pushed.
Assisted-by: Claude:claude-opus-5-5
* refactor(rover): rename tank_sticks to tank_style_sticks
Review feedback.
Assisted-by: Claude:claude-opus-5-5
---------
Co-authored-by: Vishal Kotak <22182951+vishalkotak@users.noreply.github.com>
The dispatch to px4-ros2-interface-lib needs an account with write
access to that repository, and the one time it fired, for release/1.18,
it was refused. The library will pick up new PX4 release branches with
a daily check of its own instead, which needs no access from our side.
What is left of the workflow only creates the px4_msgs branch, so rename
it to say that, and describe both paths in the release process.
Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
The release process still told the release manager to create the
px4_msgs and px4-ros2-interface-lib branches by hand, and to edit a
git clone line in ros_integration_tests.yml that no longer exists.
Describe what the workflows do for a new release branch and for a stable
tag, how to run them again, and where the library pin lives now.
Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
The px4_msgs sync only runs when msg/ or srv/ change, so a new PX4
release branch gets no px4_msgs branch until the first message change
lands on it. For release/1.18 the branch was pushed by hand.
Let sync_to_px4_msgs.yml be called with a branch name, and call it from
the workflow that already runs when a release branch is created. The
dispatch to px4-ros2-interface-lib now waits for it, so the px4_msgs
branch exists by the time the library creates its own.
The dispatch goes through gh api instead of curl -s -f, which hid the
HTTP status when the request was refused for release/1.18.
Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
v1.18.0 was the first stable tag this workflow ran on, and it failed with
"PX4 branch release/1.18 not found". The check looked for a local
refs/heads/release/1.18, but actions/checkout only creates remote-tracking
refs for branches it does not check out, so on a tag push that ref never
exists. The push further down would have failed too: it still put the
token in the clone URL, which stopped working for sync_to_px4_msgs.yml in
October.
Move the logic into Tools/ci/px4_msgs_tag.sh so it can be run outside of
Actions. The script fetches the PX4 tag and px4_msgs into a scratch
directory instead of relying on the refs of the checkout, so it no longer
needs the PX4 release branch at all, and it authenticates through gh's
credential helper like the sync workflow does.
Two things behave differently:
- The definitions are compared against the PX4 tag instead of the tip of
the PX4 release branch, and a file missing from px4_msgs now fails the
check. git diff did not report those because they were untracked.
- The package.xml version in px4_msgs is set to the release version
before tagging. release/1.18 still says 1.17.0, and a package built
from the tag takes its version from that file.
Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
PX4 v1.18.0 is published and the stable branch points at it, so the
docs should present it as the current stable release.
Following the v1.16 and v1.17 stable switches, the v1.18 notes get the
Stable badge and lose the beta testing warning, v1.17 drops its Stable
badge, the sidebar labels move "(stable)" from 1.17 to v1.18, and the
docs version menu gains a v1.18 (stable) entry ahead of v1.17.
Two stale warnings go as well: main.md no longer says v1.18 is in beta
testing, and 1.17.md drops the note that v1.17 is documented on an
alpha/beta branch, matching the older stable release pages.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
The three Return fixes, the IO firmware rebuild, the home republish fix and the LOG_ERASE crash fix went to release/1.18 for v1.18.0-rc3, but main's 1.18.md had none of them.
- 1.18.md gains the move to the mission landing after the climb (#29688), moved from main.md, plus #29911, #29831 and #29857.
- main.md drops #29484 and #29684. Both fixed regressions from the v1.18 pre-releases that never reached a stable release, so neither belongs in the notes for the next one.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
Boards with a px4io took the IO firmware from a binary committed under
boards/<vendor>/io-v2/extras/. It had to be regenerated by hand with
"make px4io_update" whenever px4iofirmware, lib/rc, the IO board or
NuttX changed, and a CI job failed until it was.
Build it from source instead. A target with CONFIG_BOARD_IO set now
builds that IO target as part of its own build and puts the result in
its ROMFS. NuttX builds inside its source tree, so the IO build gets its
own copy of the NuttX sources in build/px4io/<BOARD_IO>/, shared by
every target built in the checkout. The IO build runs on every build of
the embedding target, so an IO source change reaches the ROMFS without
a clean.
PX4_NUTTX_TREE_DIR points a NuttX build at such a copy, and the
hardcoded platforms/nuttx/NuttX/{nuttx,apps} paths now go through
NUTTX_DIR and NUTTX_APPS_DIR.
Remove the two committed binaries, the px4io_update and check_px4io
make targets, and the CI job that compared them.
Assisted-by: Claude:claude-fable-5-2
build_all published every target it built, including variants that
exist for compile coverage, analysis or testing and that nobody should
flash: flash-analysis, allyes, performance-test, bench, lto, the
secureboot and cryptotest builds signed with the test keys kept in the
tree, a unit test configuration and the NuttX debug build of fmu-v5.
List them in build_all_config.yml with the reason for each, and publish
nothing from them. They are still built. A test fails when an entry no
longer matches a target in the tree.
Also stop publishing files nothing consumes:
- the .px4 of the px4io firmware, where the raw .bin is published
- component metadata of targets without MAVLink, which is the only way
a ground station learns where to fetch it
- the second copy of all_events.json.xz under <target>/events/, a path
the firmware does not advertise
- toc.elf, an intermediate link product
Assisted-by: Claude:claude-fable-5-2
package_build_artifacts.sh decides what build_all publishes to S3,
GitHub Releases and pull request artifacts. It has grown a special case
per kind of target, and it is the only build_all tool without a test.
Port it to Python as is. The published files do not change: both
versions produce identical paths and contents from the same build
trees.
Assisted-by: Claude:claude-fable-5-2
cubepilot_io-v2 is carried by the three Cube boards only, and is built
from the same px4iofirmware, lib/rc and NuttX sources as px4_io-v2, so
a change to any of those already shows on the px4_io-v2 row. A change
to the cubepilot IO board configuration alone is not reported.
Assisted-by: Claude:claude-fable-5-2
The px4io firmware is flashed to the IO coprocessor by every FMU that
carries one, and the IO has 8 KB of RAM, yet a pull request shows
nothing about what it does to that image.
Analyse px4_io-v2 and cubepilot_io-v2 next to the FMU targets, so the
comment reports their flash and static RAM. Both are analysed as they
ship, not as a flash-analysis variant.
The IO image holds no commit hash, so the same sources always build the
same bytes. firmware_size.py can now compare the image itself
(--reproducible-image), and the comment says whether a pull request
changes what gets flashed to the IO, also when no size moves.
Assisted-by: Claude:claude-fable-5-2
feat(boards/cyberx): add CyberX-v10 flight controller
Add board support for the CyberX-v10 flight controller with an
STM32F103 IO processor.
Board:
- Configure SPI6 without DRDY and comment out unused GPIO and SPI
definitions.
- Add the UAVCAN interface configuration (DroneCAN is off by
default).
- Remove Timer1 Channel2 capture (no camera capture support).
- Describe ADC_RC_RSSI_CHANNEL.
- Use UART7 as the serial (debug) console.
- Remove Spektrum/DSM support.
- Keep ADC battery monitoring on PWR1 as the only default power
monitor (the INA228 is not started in rc.board_sensors).
- Use the external PX4IO firmware through CONFIG_BOARD_IO instead of
bundling px4_io-v2_default.bin in extras.
Docs:
- Add the CyberX-v10 board page following the flight controller
template: specifications with linked processors and sensors,
dimensions, input voltage range and power monitoring; voltage
ratings including absolute maximum ratings; connectors with pin
counts, pinout, block diagram and wiring diagram.
- Describe Radio Control: the IO processor S.Bin input, and the FMU
path through rc_input on Uart8, single-wire on RX as set by
RC_SERIAL_SINGLEWIRE and RC_SERIAL_SWAP_RXTX, with RC_PORT_CONFIG.
Spektrum/DSM is not supported.
- Document the serial port mapping (EXT2 for Uart5, UART7 as the
debug console, I2C3 also on PWR2), the bootloader UART, that GPS2
needs GPS_2_CONFIG, and that DroneCAN is off by default.
- Explain that PWR1 and PWR2 monitor a single power source rather
than being redundant inputs.
- Use COM_SAFETY_MODE for the safety switch.
- Add OSD (built-in MSP OSD driver) and Further Information sections.
- Add a quick start guide with the manufacturer warning, wiring
diagram, RC receiver connections and links to RTK, SWD and
parameter setup.
- Add product and top-view photos as WebP, plus the block diagram,
connector and pinout images.
- List the board in the FC-specific assembly guides, the main release
notes, and the Ethernet setup and SWD debug port pages.
Assisted-by: Claude:claude-opus-5-5
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* docs(tfmini): add safety ratings, series note and release notes entry
Benewake specifies photobiological safety rather than a laser class
for these sensors: Class 1 (EN 60825) for the TFmini-S, exemption
level (EN 62471) for the LED-based TFmini Plus. State each rating per
its datasheet in place of the single "Laser class" line.
Record that the original TFmini has left Benewake's current product
lineup while the TFMINI/TFMINI-S setting remains for compatibility,
and that the current TFmini-i (RS-485 or CAN, 7-30 V supply) is not
supported by this UART driver.
Add the release notes entry that #29575 was missing.
Assisted-by: GLM:glm-5.3-flash
Signed-off-by: jiakun <53556221+ddwolf87@users.noreply.github.com>
* docs(sensor): list original TFmini as discontinued, keep laser class label
Move the original TFmini into a Discontinued block on the TFmini page and
list it in the rangefinder table, as other discontinued rangefinders are.
Keep the template's "Laser class" spec label: the TFmini Plus is an LED
source with no laser class, so say that and give Benewake's EN 62471
rating after it.
Say the TFmini-i is not supported by PX4 rather than "this driver", and
in the release notes give the old FoV of the shared TFMINI / TFMINI-S
setting.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* docs(sensor): remove space between values and unit symbols
Bring the TFmini page and the release notes to the docs style guide's
unit convention (12m, not 12 m), and realign the tables this narrows.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
---------
Signed-off-by: jiakun <53556221+ddwolf87@users.noreply.github.com>
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
build_all already builds the px4io targets and publishes their .px4,
.elf and SBOM, but not the raw .bin. The .bin is the image the FMU
carries in its ROMFS and flashes to the IO coprocessor with
"px4io update", so it is the one worth having next to the other
firmware.
Copy it into the build artifacts so it is synced to S3 with everything
else, and attach it to the GitHub Release on tags.
Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
* feat(nuttx): bump submodule for the STM32 pre-clock hook
Brings in the backport of apache/nuttx#22076, a weak
stm32_preclock_hook() that every STM32 __start calls before the clock
setup. The bootloader needs it to hand over to the ROM's DFU
bootloader for reboot -i.
Assisted-by: Claude:claude-opus-5-5
* build(px4io): regenerate the IO firmware for the NuttX bump
The STM32F1 __start now calls the pre-clock hook, which grows both IO
binaries by 12 bytes, and check_px4io compares against them.
Assisted-by: Claude:claude-opus-5-5
BMI055_Accelerometer clamped samples * sizeof(FIFO::DATA) + 1 to FIFO::SIZE (192) rather than sizeof(buffer) (193), truncating the last byte of the 32nd sample. BMI055_Gyroscope clamped against FIFO::SIZE (600) instead of the 193-byte stack buffer, risking an over-read if a caller ever passed more than 32 samples.
Assisted-by: Antigravity
Signed-off-by: DuoYuWang <thirteenking.wang@gmail.com>
* feat(boards/ark_fmu-v6x): add the LSM6DSV32X revision
The ARKV6X-32X is the ARKV6X with three LSM6DSV32X in place of the
IIM-42653s, on the same pads and at the same orientations. It reports
FMUM ID 2, which matched no sensor set, so no IMU started.
Assisted-by: Claude:claude-fable-5-2
* docs(releases): note the ARKV6X-32X
Assisted-by: Claude:claude-fable-5-2
* refactor(boards/ark_fmu-v6x): drop the SPI4 stub from the LSM6DSV32X entry
The commented-out SPI4 bus is a leftover from px4/fmu-v6x, where SPI4 is
a sensor bus powered from PG8. This board has no SPI4 and uses PG8 as a
plain GPIO.
Assisted-by: Claude:claude-fable-5-2
* docs(releases): list the ARKV6X-32X under v1.18
The board support is being backported to release/1.18.
Assisted-by: Claude:claude-fable-5-2
Since the seed stage became conditional (#28278), it is skipped on every
push where all chip family caches are already warm, which is almost
every push to main. The artifacts job had no status function in its
condition, so GitHub applied an implicit success(), which is false when
any upstream job was skipped. Since then Upload Artifacts has only run
on main when a seeder happened to run (once, on 2026-11-06, when the
imx9 cache was cold).
Version tags cut from main are affected the same way.
filter_cold_seeders.py probes the main cache scope for every ref, so
such a tag skips the seeders and loses both the S3 upload and the draft
GitHub Release, which is a step of the same job.
Check the build result explicitly, as the deploy job in
dev_container.yml already does.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: YoungjuKim <fjvbn2003@gmail.com>
* fix(logger): use selected device_id to choose sensor in fifo logging
* fix(logger): keep logger_topics.txt fifo instances and skip profile fifo without a matching selected imu
* docs(logger): describe fifo logging of the selected imu
* fix(tecs): low-pass the throttle energy rate error, not the estimate
The throttle feedback compared an unfiltered total energy rate setpoint
with an estimate low-passed by FW_T_STE_R_TC. On a setpoint change the
lag between the two showed up as a phantom error that the proportional
and integral paths acted on, pushing the throttle beyond what the
feedforward already demanded. Filter the error instead: setpoint and
estimate then see the same lag and only true tracking errors reach the
feedback, while the feedforward keeps acting on the unfiltered setpoint.
The airspeed-less altitude step test no longer needs to disable the
filter: on the step up the phantom error sped the vehicle up by 3 cm/s,
beyond the test's airspeed tolerance, and now it stays within it.
Assisted-by: Claude Fable 5.1
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): enable the altitude step again
The throttle filter lag inconsistency introduced some small airspeed
errors. Now after the fix we can enable these cases again.
- AltitudeStepUp: enable, was completely disabled
- AltitudeStepUpDefaultTuningPitchOffset: uncomment the low airspeed
error assertion
* test(tecs): tighten overall tolerance
- MAX_NUMERICAL_ERR: halve it, most tests improved due to the filter
lag fix
- Airspeedless: Allow twice the default tolerance (same as before...)
as there we don't have feedback constantly reducing the error and it
instead accumulates.
---------
Signed-off-by: RomanBapst <bapstroman@gmail.com>
Co-authored-by: Balduin <balduin@auterion.com>
* fix(mavlink): publish mission state under the shared-state lock
All Mavlink instances share one static copy of the active mission.
Writers updated it under _shared_state_mutex but published the mission
topic only after releasing the lock, and check_active_mission() copied
the topic before taking it. An instance could therefore copy the
previous mission while another instance had already stored a new
upload, then roll the shared state back to it. The next geofence/rally
count update republished the rolled-back state and the navigator
dropped the new mission.
Publish while holding the lock and copy the topic under it, so the copy
always matches or is newer than the shared state it is compared with.
update_active_mission() now publishes before persisting the mission
state to dataman, so the lock is not held across the dataman write.
Add a functional test that runs two instances concurrently and checks
that a stored mission is never rolled back to an older upload.
Signed-off-by: Alessandro Ferraioli <alessandro.ferraioli@auterion.com>
* fix(mavlink): persist mission state before publishing it
Publishing the mission before writing DM_KEY_MISSION_STATE lets
navigator act on the new mission before it is persisted. If the new
mission fails the feasibility check, navigator restores the previous
mission and writes DM_KEY_MISSION_STATE itself. If the mavlink write
lands after that, it overwrites the restored state with the infeasible
mission: the vehicle keeps flying the previous mission, but after a
reboot it loads the infeasible one, fails the check again, and the
previous mission is lost.
The window is small because dataman serializes requests, but the order
is not guaranteed, e.g. if the mavlink thread is preempted between the
publish and the write.
Keep the original persist-then-publish order and hold
_shared_state_mutex across both, consistent with
update_geofence_count() and update_safepoint_count(), which already
hold the lock across their dataman write. Other instances'
check_active_mission() and send() now wait for the
DM_KEY_MISSION_STATE write during a mission upload, as they already do
for fence and rally uploads.
---------
Signed-off-by: Alessandro Ferraioli <alessandro.ferraioli@auterion.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
* fix(zenoh): retry a failed session or topic setup
A failed setup stopped the module for good, e.g. when the session is
lost right after it opened. Clean up and set the session up again
after 5 s instead.
The cleanup also closes the topic mapping that a failed setup leaves
open, so the retry reads the config from its start.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Leonardo Cencetti <cencetti.leonardo@gmail.com>
* fix(zenoh): release the topic resources on a cleanup
Signed-off-by: Leonardo Cencetti <cencetti.leonardo@gmail.com>
---------
Signed-off-by: Leonardo Cencetti <cencetti.leonardo@gmail.com>
* test(tecs): add closed-loop unit tests for TECSControl
Couple TECSControl to a minimal aircraft model built from the energy
model TECS assumes internally: a piecewise linear throttle to total
energy rate map, climb rate from pitch and airspeed, and the remainder
of the energy rate into airspeed. With perfect state knowledge and no
model mismatch any tracking error is the controller's own, so the suite
exposes consistency errors between the pitch and throttle loops that
the unit tests on single updates cannot see.
Only the cases the current controller passes are included: steady
cruise, airspeed steps, a slow altitude step down, plant pitch offset,
gliding, fast descend and airspeed-less cruise. The altitude steps at
the default vertical acceleration, with a speed weight below 1 and
without airspeed fail today and come with the fixes they test.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): explain why the airspeed step down is not first order
The step down is not first order because the SEB rate to pitch
conversion ignores the total energy rate: the pitch feedforward climbs
with the kinetic energy the throttle is already removing, and the pitch
integrator takes it out again. The loops interacting is not the cause;
with a consistent conversion the response is first order.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): use the current year in the closed-loop test copyright
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): drop the altitude reference model from the closed-loop test
The closed-loop harness is meant to test TECSControl on its own, but the
altitude setpoint went through TECSAltitudeReferenceModel first, so the
altitude step results also depended on how the reference model shapes
the setpoint. Feed TECSControl the raw altitude setpoint instead.
A raw step drops the throttle to idle at once, so the altitude step only
keeps airspeed exact if the pitch can follow just as fast. In TECSControl
the vertical acceleration limit only rate limits the pitch, so the step
test now disables it, and sizes the step so that the demanded sink rate
stays within FW_T_SINK_MIN, the sink rate flown at idle without speeding
up.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): show the airspeed-less altitude step with half the SEB feedforward
Without airspeed the speed weight is 0, so the SEB rate is twice the
potential energy rate, while the pitch feedforward converts it to a climb
angle as if they were equal and asks for twice the climb rate. With the
feedforward gain at 0.5 the vehicle flies the demanded climb rate exactly
and the altitude error decays first order with FW_T_ALT_TC, which the
test checks for a step down and a step up. At the default gain of 1 the
same checks miss by up to 1.8 m.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): disable the STE rate filter in the airspeed-less altitude step
The low-pass filter on the total energy rate estimate lags the step, so
the throttle damping briefly overfunds the climb on the step up and the
open loop airspeed rose by 3 cm/s, which the test allowed for with a
looser bound. Disable the filter instead and hold the airspeed to the
numerical tolerance like the other exact cases.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): disable vert_accel_limit generally
* test(tecs): count closed-loop simulation steps as an integer
Accumulating the simulation time in float drifts (the second altitude step
of a test landed at 40.0007 s) and the float loop condition could run one
step more than the requested duration. Count steps instead and derive the
time from the step count.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* test(tecs): unify error tolerance
Replace various hardcoded tracking tolerances:
- Add a second general constant for the tolerance of tracking errors
which do NOT scale down with smaller DT
- Adjust settling times so all tests reasonably reach this threshold
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* test(tecs): add a make target to plot the closed-loop test cases
The closed-loop test writes one CSV per test case when TECS_TEST_LOG_DIR
is set, but reading the step responses from numbers is tedious. Add the
plotting script back and a tecs_closed_loop_plots target that runs all
test cases with logging and plots them into
build/px4_sitl_test/tecs_closed_loop/png, also when test cases fail.
It is a separate target so that make tests and CI do not depend on
matplotlib.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): rename the closed-loop test to TECSControlClosedLoopTest
The test drives TECSControl, not the outer TECS class, so name it after
the class under test like TECSTest.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* test(tecs): clean up logging & variable names
Stop mixing up previous and current steps:
- _pitch and _throttle hold the last TECS command, which the plant
applies until the next update (drop the _prev naming)
- reorder logging, so each row pairs a state with the command
computed from it:
- find control input
- sim stats, csv output
- advance simulation
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* docs(test): document the TECS closed-loop test logging and plots
The closed-loop TECS test can log every test case to CSV and plot them
with the tecs_closed_loop_plots target, but neither is discoverable from
the docs. Describe both next to the other make tests options.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RomanBapst <bapstroman@gmail.com>
* test(tecs): standardise step sizes
Use one altitude and one airspeed step size for all step tests, so the
tests are easier to compare:
- ALT_STEP chosen to not saturate throttle while sinking or climbing
- Altitude step up test added (disabled, see comment)
- AIRSPEED_STEP = 1 m/s
- Only effective change is gliding (previously 2 m/s steps)
- FastDescend drops the altitude setpoint, which does not affect it, and
checks the throttle is exactly at its minimum
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* test(tecs): comment polishing
* test(tecs): tighten bounds for the weird airspeed response
* test(tecs): disable pitch damping
Removes the ringing artifacts. I think pitch damping makes no sense in
this sim, see comment for details.
* test(tecs): Require low errors after integrator
And add another future test (altitude step up currently still gives a
bit too much airspeed error)
---------
Signed-off-by: RomanBapst <bapstroman@gmail.com>
Signed-off-by: Balduin <balduin@auterion.com>
Co-authored-by: Balduin <balduin@auterion.com>
* refactor(vtol_att_control): move the transition state machine into VtolType
Standard, tiltrotor and tailsitter each kept a private vtol_mode enum and
a 100-line update_vtol_state() that walked the same four-state graph
(hover, transition to FW, transition to MC, FW) and then mapped it onto
the common mode enum. The only type-specific parts were the completion
predicates and a handful of entry side effects, so fixes to the graph
(like the 2016 "restart the front transition instead of jumping to FW
from a back transition" change in c6e4926d4e) reached one type and not
the others.
VtolType::update_vtol_state() now runs the graph on _common_vtol_mode
directly, and the types override only:
- isBackTransitionCompleted(): speed/time (standard, with on-ground),
tilt and speed/time (tiltrotor), pitch or time (tailsitter). The shared
speed/time check is isBackTransitionSpeedOrTimeExitConditionMet().
- canSwitchToFixedWingDuringBackTransition(): true for tiltrotor and
tailsitter to keep their current instant switch, false (restart the
front transition) for standard.
- onTransitionStart(): tailsitter resets its start-attitude latch,
tiltrotor resets its phase-2 flag.
- onFrontTransitionCompleted() / onFrontTransitionAborted() /
onFixedWingSystemFailure(): standard pusher throttle and transition
pitch latch, tailsitter thrust-bridging timestamp.
The tiltrotor's TRANSITION_FRONT_P2 becomes a private sub-phase of
TRANSITION_TO_FW, entered from update_transition_state() when the common
front-transition check passes and left when the tilt reaches VT_TILT_FW.
Deliberate small deviations from the previous per-type code:
- _trans_finished_ts is set on every switch into FW mode, including the
tiltrotor's phase-2 completion and the tiltrotor's instant switch from
a back transition (previously only at the tiltrotor's P1->P2 handoff).
- the standard VTOL set its MC weights every loop in hover and FW mode;
they are now set in update_mc_state()/update_fw_state(), i.e. on the
next attitude-setpoint update.
- the standard VTOL zeroed its pusher throttle on every loop while
fixed_wing_system_failure was set; it now does so once on the switch
to hover and update_mc_state() takes over as in any hover flight.
Rebased onto the tailsitter and tiltrotor back transition fixes. The
canSwitchToFixedWingDuringBackTransition() bullet above describes the
code before them. The hook now returns false for the tailsitter, which
restarts the front transition like the standard VTOL, and the
VT_TILT_TRANS check for the tiltrotor.
Also rebased onto the change that stops treating a commanded quad-chute
as a fixed-wing failure. The state machine now reads
is_quadchute_active() instead of fixed_wing_system_failure, and
onFixedWingSystemFailure() is now onQuadchute(), called on every update
while a quad-chute holds the vehicle in hover. Each type keeps the
condition its own update_vtol_state() had: the tailsitter sets its
thrust-bridging timestamp only on the switch to hover, and the standard
VTOL zeroes its pusher on the switch and, while the quad-chute is a
detected one, on every update. The onFixedWingSystemFailure() name in
the bullets and the last deviation above describe the code before that
change.
Signed-off-by: Balduin <balduin@auterion.com>
Assisted-by: Claude:claude-fable-5-2
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* refactor(vtol_att_control): drop the redundant tailsitter hook override
Since the rebase onto the back transition fixes the tailsitter's
canSwitchToFixedWingDuringBackTransition() returns the base class
default, so drop the override. The tailsitter restarts the front
transition through the shared state machine like the standard VTOL.
Give the tiltrotor check the reason it had in its update_vtol_state()
and remove the blank lines left where the per-type enums were. No
behaviour change.
Assisted-by: Claude:claude-fable-5-2
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* style(tiltrotor): remove stale comment
This comment was added in 02fda7a0f5 (2015) describing a
`rear_motor_state` enum. The enum has then been moved to a general
`motor_state` in 744f806214 (2018) which has then been completely
removed in ce337a3d80 (2022).
* refactor(vtol_att_control): rename the shared front transition check
For the tiltrotor the shared VtolType::isFrontTransitionCompleted() only
meant that phase 2 of the front transition can start, while
Tiltrotor::isFrontTransitionCompleted() means the rotors have reached
VT_TILT_FW and the vehicle can switch to fixed-wing. Two functions with
the same name answered different questions.
Rename the shared one to isFrontTransitionSpeedOrTimeReached() and make
isFrontTransitionCompleted() pure virtual. The tiltrotor keeps its
override and starts phase 2 from the renamed check. Standard and
tailsitter return the renamed check, which is what they used before.
No functional change. Suggested by Balduin in review.
Assisted-by: Claude:claude-fable-5-2
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* refactor(vtol_att_control): rename the shared back transition check
Match the name of isFrontTransitionSpeedOrTimeReached. I also find it
clearer to not label it 'ExitConditionMet' because for the tiltrotor the
exit condition is literally not already met, because of the added
* refactor(vtol_att_control): default isFrontTransitionCompleted to the shared check
This way we only have to override it if it is different from the current
default (completed = speed or time reached), i.e. only for tailsitter.
* refactor(vtol_att_control): drop isFrontTransitionCompletedBase
Types now override isFrontTransitionCompleted() directly, mirroring the
back transition: a non-virtual speed/time helper plus one virtual
completion check. The on-ground bypass is spelled out where needed.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
* refactor(vtol_att_control): test the fixed-wing request positively in the state machine
Slightly more readable than the other version IMO
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Balduin <balduin@auterion.com>
---------
Signed-off-by: Balduin <balduin@auterion.com>
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
Co-authored-by: Balduin <balduin@auterion.com>
* feat(uxrce_dds_client): bridge the topics of out-of-tree messages
Out-of-tree uORB messages build into PX4 like any other, but the
bridge reads only dds_topics.yaml, so bridging one means editing that
file and carrying the change through every PX4 update.
When $EXTERNAL_MODULES_LOCATION/msg/dds_topics.yaml exists, the build
passes it to the generator after dds_topics.yaml, and the generator
appends each file's lists to those before it. A topic declared twice
in the same list stops the build, since it would be bridged twice.
A single file, as Zenoh's build passes, yields its lists unchanged.
Assisted-by: Claude-Code:claude-opus-5-5
* test(uxrce_dds_client): test the topic generator in the Python checks
The generator runs only inside a firmware build, so a change that
breaks joining topic files, or the check for repeated topics, would
first show up as a broken build. The tests run it on its own: a second
file appends its topics to each list, lists split across files give
the same header as one file, files without topics add nothing, and a
repeated topic stops it. The Python checks job installs empy for the
generator, in the range PX4's requirements.txt gives.
Assisted-by: Claude-Code:claude-opus-5-5
* feat(scripts): copy out-of-tree messages into px4_msgs
ROS 2 needs every bridged message in px4_msgs, and copy_to_ros_ws.sh
copies only PX4's own. An optional second argument, the external
modules location, adds the messages of its msg directory, if it has
any. A message with the name of a PX4 message would replace PX4's
definition in px4_msgs, so the script refuses it before copying
anything.
A test in the Python checks runs the script on throwaway workspaces:
PX4's messages alone, a location's messages added, a location without
messages, and the refusals of a PX4 message name and of a location
without a msg directory.
Assisted-by: Claude-Code:claude-opus-5-5
* docs(uxrce_dds): document bridging out-of-tree messages
The uXRCE-DDS page covers dds_topics.yaml but not the topics of
out-of-tree messages. Describe their topics file and the copy into
px4_msgs there, and point to it from the External Modules page.
Assisted-by: Claude-Code:claude-opus-5-5
The session open retry slept 5 s with sleep() and never checked for a
stop request, so `zenoh stop` timed out and force-deleted the task.
Wait in 100 ms steps instead and return as soon as a stop is requested.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Leonardo Cencetti <cencetti.leonardo@gmail.com>
A subscriber that could not be declared called exit(-1). That ended the
module task but left the zenoh-pico tasks running, so the session
stayed up with nothing bridged and `zenoh status` still reported it as
connected.
Return the error instead, and fail the topic setup when a subscriber or
publisher declaration fails.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Leonardo Cencetti <cencetti.leonardo@gmail.com>