* feat(simulator_sih): add orient command to pose the vehicle for calibration
Accel and mag calibration need the vehicle held still on each side and
rotated, which SIH could not do, so neither could be tested in
simulation. `simulator_sih orient` sets the attitude kinematically,
keeping the IMU and the simulated mag consistent with it, and `orient
all` runs every side in turn so a calibration started from a GCS
completes on its own.
Assisted-by: Claude:claude-opus-5-5
* fix(commander): hand a calibration cancel to the running calibration
A cancel got TEMPORARILY_REJECTED from Commander and ACCEPTED from the
calibration, in either order. The calibration polled for it with a
fresh vehicle_command subscription that only saw the newest command,
filtered it by a per-side start time, and did not poll while waiting
for the vehicle to be still or while measuring a side. Baro and level
calibration never polled. A cancel could be lost or take until the
vehicle was held still.
Commander now hands the cancel to the running calibration, which acks
it once when it stops, or rejects it if it ends without stopping.
Every calibration loop checks for it, and accel calibration no longer
reports a failure after a cancel.
Fixes#29424
Assisted-by: Claude:claude-opus-5-5
* test(mavsdk_tests): run accel and mag calibration and cancels on SIH
Covers a full accel and mag calibration, and a cancel in each place it
used to be missed or delayed, checking it gets exactly one ack.
Assisted-by: Claude:claude-opus-5-5
* perf(simulator_sih): build the orient command for SITL only
Commander denies sensor calibration when SIH runs on flight controller
hardware, so orient was about 1.8 KB of unusable code on every NuttX
board that builds SIH.
Assisted-by: Claude:claude-opus-5-5
* fix(commander): open calibration cancels before the worker thread starts
Commander handles one command per loop and the worker thread runs at
low priority, so a cancel queued right behind the start could be
rejected before the worker opened it, and the calibration kept running.
Assisted-by: Claude:claude-opus-5-5
* fix(commander): stop reporting a cancelled gyro calibration as failed
A cancel broke out of the retry loop into the failure report, as accel
calibration did before.
Assisted-by: Claude:claude-opus-5-5
* test(mavsdk_tests): cover gyro cancel and remove two calibration races
A retried start is rejected once the calibration runs, and that late
ack could be counted against the cancel, so the start is sent once.
The baro cancel landed 1 s into a 3 s calibration, about 200 ms of
host time at speed factor 10; it is now sent right after the start.
Assisted-by: Claude:claude-opus-5-5
* style(mavsdk_tests): wrap the calibration start assert for flake8
The 104-character line failed the Python CI checks.
Assisted-by: Claude:claude-opus-5-5
* fix(commander): require param7 zero for a calibration cancel
An ESC calibration (param7 = 1) or baro temperature calibration
(param7 = 3) sent while a calibration ran matched the cancel test. It
stopped the running calibration and was acked ACCEPTED, though the
requested calibration never started. `commander calibrate esc` did the
same.
Assisted-by: Claude:claude-fable-5-2
* fix(commander): compile out airspeed calibration without airspeed processing
Without CONFIG_SENSORS_VEHICLE_AIRSPEED nothing turns differential
pressure into airspeed, so the offset this calibration writes is never
applied. Gate it like the magnetometer calibration and answer the
command with UNSUPPORTED. This also covers px4_fmu-v2_fixedwing, which
inherits the option off from fmu-v2's default config, so its MS4525DO
readings already never reach the controllers.
main has not linked holybro_kakutef7 since #28764 (24 B over at
1c3c7e5a72). Flash with the CI compiler (GCC 13.2.1), main -> this
commit:
- holybro_kakutef7: 950,296 -> 947,448 B of 950,272 (99.70 %)
- diatone_mamba-f405-mk2: 1,013,721 -> 1,010,889 B (99.52 %)
- px4_fmu-v2: 1,028,624 -> 1,025,768 B (99.38 %)
- bitcraze_crazyflie: 1,022,720 -> 1,019,896 B (98.81 %)
Boards with airspeed processing are unchanged (px4_fmu-v6c is
byte-identical).
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonas.perolini@rigi.tech>
* fix(mavlink): drop MAG_CAL_REPORT from constrained builds without mag
Flash constrained builds without CONFIG_SENSORS_VEHICLE_MAGNETOMETER
have no magnetometer calibration, so there is nothing to report. Other
builds keep the stream: builds without the sensors module, such as the
VOXL2 apps side, still report the SLPI's calibration, and only
constrained builds may lack a stream that the mode tables list.
holybro_kakutef7: 947,448 -> 945,424 B of 950,272 (99.49 %).
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonas.perolini@rigi.tech>
---------
Signed-off-by: jonas <jonas.perolini@rigi.tech>
Co-authored-by: jonas <jonas.perolini@rigi.tech>
Boards that compile the magnetometer pipeline out still linked 8.6 KB of
calibration that could never run. holybro_kakutef7 is one of them and sits
at 100 % of flash on main. The calibration commands answer UNSUPPORTED
there.
* fix(commander): save parameters synchronously after parameter reset
ParamResetAll and ParamResetAllConfig relied on the deferred autosave (300 ms delay, 2 s rate limit) to persist the reset, so a reboot or power cycle right after the command ack could leave the old parameters in storage. Save synchronously like ParamResetSensorFactory already does.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* fix(rcS): only run caldata BSON size repair on boards with caldata
The bsondump docsize block from #23088 repairs a zeroed BSON document size field in /fs/mtd_caldata, but it ran unconditionally with a comment claiming it checks /fs/mtd_params, producing failed-bsondump boot noise on every board without a caldata partition. Move it inside the MTD_CALDATA gate next to the param load it exists to protect.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Flashing PX4 over another firmware (e.g. ArduPilot on an ARK FPV) or
first-booting a board with blank parameter storage played the error tune
on every boot: the param layer treated a blank store as corruption, and
the rcS recovery persisted with a file cp that is a no-op on
FLASH_BASED_PARAMS boards, so the store never became valid.
- param_import()/param_load() return 1 ("not yet stored") for a blank
source - empty file, zeroed FRAM, or erased flash - on both the file
and flash backends; a store that holds data but no valid entry (torn
write, bit-rot, foreign data) is still reported as corrupt (-EILSEQ).
The file backend detects a zero-length file via fstat (NuttX FAT
cannot read() a 0-byte file: no cluster chain returns an error, not
EOF) and otherwise inspects the leading BSON document length; the
flash backend scans the whole store
- new 'param load-or-init <backup>' command: loads from the default
storage; a blank store is seeded from the SD backup (or firmware
defaults) and persisted so the next boot loads normally. A corrupt
store, a backup that exists but cannot be opened or imported, or a
result that cannot be persisted returns failure. The three-way
loaded/blank/corrupt logic lives in C because nsh $? is a binary
success flag. A failed backup seed does not reset to defaults, which
preserves parameters loaded earlier in boot (e.g. factory calibration
from /fs/mtd_caldata)
- rcS uses 'param load-or-init' instead of 'param import', and the
corrupt-store recovery persists via 'param save' (works on
flash-backed boards) only when the backup actually imported, so a
corrupt backup keeps alerting the operator on the next boot
- commander ParamLoadDefault treats blank storage (1) as success and
warns the GCS that parameters were reset to defaults, instead of
reporting "Error loading settings"
- parameter_flashfs_init() in flashfs.c no longer reports a successful
erase byte count as a failure (parity with flashfs32.c)
Tested with new blankImport and corruptImport cases in 'tests
parameters' (empty/zeroed/erased sources import as "not yet stored",
garbage fails to import); the CustomDefaults test now restores the
firmware default so the suite is repeatable within one boot.
The STM32H7 flash-erase DCACHE invalidate fix this depends on
(PX4/NuttX#381) is already in main's NuttX submodule.
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
- sensor_baro.msg use SI (pressure in Pascals)
- update all barometer drivers to publish directly and remove PX4Barometer helper
- introduce baro cal (offset) mainly as a mechanism to adjust
relative priority
- commander: add simple baro cal that sets baro offsets to align with
GPS altitude (if available)
- create new sensors_status.msg to generalize sensor reporting