An Offboard vehicle without manual control, the companion computer
setup that NAV_RCL_ACT 7 "Hold mode (no failsafe)" was added for,
stayed in Offboard when its companion stopped. #26289 made the
Offboard loss fallback into Position mode use the NAV_RCL_ACT action
instead when manual control is lost, since Position mode needs it.
Value 7 maps that action to None, because Commander switches to Hold
on its own, but that switch only fires while a manual mode is flown.
So the vehicle kept flying its last setpoint, with a velocity
setpoint that means flying off, and nothing was reported.
The replacement now maps None to Hold, which is what value 7 promises,
and the action cascade escalates to Return and Land from there when
Hold cannot run. The manual control loss trigger itself is untouched
and still takes no failsafe action for value 7.
In SITL with the sih quadcopter, no manual control and a velocity
setpoint stream that stops, main kept flying at 0.9 m/s for the whole
12 s watched. With this change the vehicle is in Hold 1.4 s after the
stream stopped. Both changes are in v1.18.0-rc1.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
The page still described the old fixed 99-vertex limit, which since #28929
is set by GF_AVOID_NODES. The mission path return warning also contradicted
the geofence awareness table: RTL_TYPE 2 is not wired to the avoidance
planner. List the user-facing messages so returns can be diagnosed from logs.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Silvan <silvan@auterion.com>
This avoids non-linear beahvior around the 2% mark, especially when the motor
has a slew rate defined (as it is the case for IC engines).
Signed-off-by: Silvan <silvan@auterion.com>
Underspeed mitigation used to ramp in from tas_min - 0.15*trim and only
reached full effect at tas_min - 0.30*trim. On typical airframes this was
below stall, so in practice the protection never kicked in.
- Start the ramp at tas_min. It reaches full effect at 90% of tas_min, or
halfway to tas_stall if that is higher (a step if stall >= min). The
stall airspeed comes from FW_AIRSPD_STALL via the performance model and
is load-factor and flaps compensated, like the minimum airspeed. Drop
the hardcoded tas_error_percentage.
- While the underspeed ratio is above 0.5, reset the altitude reference to
the current state. This stops altitude error from building up and then
commanding a hard pitch-up (and a possible secondary stall) on recovery.
- Blend the roll limit from FW_R_LIM down to min(20 deg, FW_R_LIM) as the
underspeed ratio rises, ahead of the roll slew-rate limit, to reduce load
factor during recovery.
- Add TECS unit tests for the ramp, the stall handling and the altitude
reference hold.
Takeoff and landing turn underspeed protection off, so none of this
applies there.
---------
Signed-off-by: RomanBapst <bapstroman@gmail.com>
Co-authored-by: RomanBapst <bapstroman@gmail.com>
Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
* fix(tecs): don't trade altitude for speed above trim airspeed
With an airspeed setpoint above trim and the throttle at `FW_THR_MAX`, TECS pitches down to
keep chasing the setpoint and settles below the altitude setpoint.
Accelerating above trim should be the throttle's job; losing altitude at high speed is not wanted.
The pitch loop now sees the airspeed setpoint capped at max(trim, current airspeed);
the throttle loop still tracks the full setpoint. Below trim, pitch still trades height for speed, up to trim.
Overspeed above the setpoint is still corrected with pitch.
The cap fades out as the effective `FW_T_SPDWEIGHT` goes from 1 to 2, so gliders (weight 2),
fast descend and underspeed recovery keep using pitch to reach their airspeed.
The behaviour is documented in the TECS docs and the `FW_T_SPDWEIGHT` description.
Signed-off-by: Silvan <silvan@auterion.com>
* fix(tecs): use tas and not tas_sp for the pitch loop
Signed-off-by: Silvan <silvan@auterion.com>
* fix(tecs): don't counter throttle acceleration with pitch above trim
Capping the pitch loop's airspeed setpoint at max(trim, airspeed) keeps
pitch from diving to gain speed, but between trim and the setpoint the
throttle's acceleration still shows up in the kinetic energy rate
estimate. Against a kinetic energy rate setpoint of zero, the pitch loop
then pitches up and turns the throttle's energy into height. At a speed
weight of 1 this halves the acceleration and lifts the vehicle above the
altitude setpoint while accelerating.
Remove the kinetic term, setpoint and estimate, from the pitch loop
between trim and the setpoint, so pitch controls height only there. As
for the cap, this fades out with speed priority.
Point-mass simulation with the TECS defaults, speed step from 15 m/s:
- to 20 m/s: 95% of the step in 21 s instead of 37 s, 1.2 m instead of
2.4 m above the altitude setpoint
- to 28 m/s, above the 24.7 m/s the vehicle can reach: 2.2 m instead of
5.2 m above the altitude setpoint, still no altitude loss
- deceleration, climbs, a speed weight of 2 and cruise at trim are
unchanged; in turbulent cruise above trim the pitch rate RMS is 6%
higher, as the kinetic term switches when the airspeed crosses the
setpoint
The remaining rise comes from the lift gained with speed at constant
pitch, which only altitude feedback corrects.
Assisted-by: Claude:claude-opus-5-5
* fix(tecs): fade the pitch loop's kinetic setpoint only once
Between trim airspeed and the airspeed setpoint, the capped pitch loop
setpoint already fades the kinetic energy rate setpoint in with the
speed weight between 1 and 2. Scaling it by the same fade factor again
faded the setpoint quadratically but the estimate only linearly, so at a
speed weight of 1.5 the pitch loop countered acceleration it should only
half ignore. Scale only the estimate.
Speed weights up to 1 and of 2 are unaffected. In a point-mass
simulation at a speed weight of 1.5, a step from 15 to 20 m/s now takes
30 s instead of 37 s and rises 1.6 m instead of 2.4 m, between the
results at weights 1 and 2 instead of worse than both.
Assisted-by: Claude:claude-opus-5-5
* docs(tecs): show the pitch and throttle speed roles in a diagram
The paragraph on how pitch and throttle share speed control above trim
was hard to follow. Show the three regions of measured airspeed (below
trim, between trim and the setpoint, above the setpoint) with what the
pitch and throttle loops do in each, and describe each region in its own
bullet. Also state that there is no middle region with a setpoint at or
below trim.
Assisted-by: Claude:claude-opus-5-5
---------
Signed-off-by: Silvan <silvan@auterion.com>
* fix(dataman_client): keep request topic advertised on client teardown
* fix(uorb): keep shared topics advertised on publisher teardown
Single-instance publications share one advertised flag, so destroying one
publisher must not hide updates from the others.
Keep automatic unadvertising in PublicationMultiBase and remove the
DatamanClient workaround. Cover surviving publishers and instance reuse,
and reset retained input samples between test cases.
Tested: make tests (215/215), make format.
Signed-off-by: jonas <jonas.perolini@rigi.tech>
Assisted-by: Codex
* docs(uorb): correct unadvertise comments and document teardown
The unadvertise comment claimed it has no effect on single-instance
topics, which is how one publisher's teardown came to hide the others.
State what clearing the shared flag does, and document that only
PublicationMulti releases its instance on destruction.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonas.perolini@rigi.tech>
* test(uorb): keep test cases independent of retained samples
A destroyed single-instance publication now leaves its last sample
visible, so ManualControlTest, test_prec_takeoff and mixer_module_tests
passed only in declaration order and failed under --gtest_shuffle.
Reset with an inert sample where one exists, otherwise unadvertise the
test's own publications, and drop module outputs left over from a
previous case.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: jonas <jonas.perolini@rigi.tech>
* fix(boards): drop the PublicationBase destructor from the ITCM lists
The destructor is now trivial and no longer emitted, so itcm_check.py
fails on the missing section.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
---------
Signed-off-by: jonas <jonas.perolini@rigi.tech>
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: jonas <jonas.perolini@rigi.tech>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* docs: replace GNSS blending text with receiver selection
GNSS blending and SENS_GNSS_MASK were removed in #28921, but the dual
receiver section of the EKF tuning guide and three ARK DroneCAN pages
still told users to configure it, through links to a parameter that no
longer exists.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* Apply suggestion from @hamishwillee
---------
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* feat(commander): let COM_GNSSLOSS_ACT decide whether GNSS loss blocks arming
The GNSS redundancy check blocked arming whenever fewer receivers than
SYS_HAS_NUM_GNSS were healthy, regardless of COM_GNSSLOSS_ACT. Setups that
want a warning only had no way to arm. Arming is now blocked only when
COM_GNSSLOSS_ACT is above Warning, and the new value 4 (Block arming +
In-flight warning) keeps the previous on-ground behavior without an in-flight
failsafe action.
Receivers can report an optimistic eph, which made the divergence gate fire
on receivers that agree within their real accuracy. The reported eph is now
floored with EKF2_GPS_P_NOISE, looked up at runtime so commander does not
depend on EKF2 being part of the build.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
* fix(commander): Avoid param_get() log spam when EKF2 parameter is unavailable
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* fix(commander): Fix formatting issue
* fix(gnssRedundancyCheck): shorten parameter option string for blocked arming
* fix(gnssRedundancyCheck): simplify logic to decide when to block arming
---------
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
* Refactor rover failsafe: Replace Parked mode with mode_req_not_possible flag
* Rename unsupported flag and restrict from ground station UI
* Complete global rename of mode_not_supported flag
* Apply PX4 CI code formatting
* Apply PX4 CI code formatting for ui.hpp
* Restrict VTOL/Descend on rovers and reroute fallback to disarm
* docs(rover): add failsafe fallback cascade to manual modes
* fix(failsafe): update rover fallback docs, honor COM_POS_FS_ACT, and add unit test
* style: fix indentation for CI
* docs: move rover failsafe sequence to end of page and format
* docs(rover): move failsafe fallback sequence to drive modes overview
The fallback cascade applies across rover drive modes rather than to
Manual mode specifically, so it belongs on the parent overview page.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
---------
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
The page said the driver is usually present in firmware and gave its key
as drivers/ll40ls. That is only true for the I2C driver: the PWM
connection uses a separate driver, ll40ls_pwm, which is not in the
common distance sensor set.
Add a Firmware Support section covering both drivers, a supported models
table, specifications, pinout and I2C wiring from the Garmin v3 manual,
new I2C and PWM wiring diagrams, per-connection configuration with the
range PX4 uses, and testing instructions. Use Garmin's "LIDAR-Lite"
casing throughout.
Update the rangefinder index entry to match.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
MAV_CMD_DO_FOLLOW, MAV_CMD_DO_FOLLOW_REPOSITION and
MAV_CMD_DO_PAUSE_CONTINUE have no handler in the tree (the first two are
not defined in VehicleCommand.msg at all), so the page listed commands
that PX4 rejects as unsupported.
The docs called the energy rate divided by m*g*V "specific", while the
code and its comments use "specific" for per unit mass (m^2/s^3). Define
both, and say which one TECS uses where.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Silvan <silvan@auterion.com>
PX4 never said in which frame fixed-wing pitch angles are given, and
FW_PSP_OFF was described as an offset added to the pitch setpoint and as
the angle of attack, which holds only for TECS and Stabilized mode, and
only in level flight measured from the body x-axis.
- Trimming guide: a side-view diagram of the body frame, the pitch angle
and FW_PSP_OFF, and where FW_PSP_OFF is used.
- Messages: state that pitch setpoints and limits are absolute, drop the
FRD frame tag on an Euler angle, correct the pitch range to +-pi/2,
and describe the TECS pitch integrator as a correction term.
Comment-only, so no message version change.
- Parameters: describe FW_PSP_OFF as the level-flight pitch, mark the
absolute pitch parameters as such, and describe the asymmetric
FW_MAN_P_MAX range with a non-zero FW_PSP_OFF.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Silvan <silvan@auterion.com>
* docs(msg_docs): sync uORB summary and remove stale pages
The link checker reported SensorsStatusGnss and VehicleGnssHeading as
missing from the table of contents, and SensorGps as an orphan.
SensorGps and EstimatorGpsStatus document messages that no longer exist
(renamed to SensorGnss in #24399 and removed in #28520), so the pages
are deleted. The uORB block in SUMMARY.md now matches the output of
Tools/msg/generate_msg_docs.py.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* docs: fix external links reported by the link checker
Updates permanently redirected links to their targets, and points the
discontinued Bitcraze Crazyradio PA and Z-ranger deck v2 links at pages
that still exist.
The 3DR Control N1 link is ignored for 6 months: the site serves a
certificate that does not cover its hostname, which only the vendor can
fix.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* docs: remove orphaned images
The two ICE control diagrams were superseded by SVG versions, and the
jMAVSim screenshot was left behind when the jMAVSim docs were replaced
with SIH and Hawkeye. No page in any language references them.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
---------
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* docs(releases): add three notes lines, move the mag voter line to 1.18
DroneCAN batteries report a charging state since PX4/PX4-Autopilot#28422,
which is not in 1.18, and PX4/PX4-Autopilot#29012 keeps that state out of
the battery level failsafe and the arming checks.
PX4/PX4-Autopilot#29058 caps the GNSS height noise only when no other
height source is fused. PX4/PX4-Autopilot#28811 hands over from a
disabled IMU without a failure report.
The magnetometer voter line moves from main.md to the Estimation section
of 1.18.md, since PX4/PX4-Autopilot#29057 put that fix on release/1.18.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* docs(releases): clarify two notes lines, fix the GNSS_CHECK link
The charging-state line read as either a condition or a contrast, and
the IMU line left "while armed" without a subject.
EKF2_GPS_CHECK was renamed to GNSS_CHECK in PX4/PX4-Autopilot#28520, so
its parameter reference anchor no longer existed and the link check
failed on this page.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
---------
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
* docs(ci): document the AI pull request review
Adds an "AI Pull Request Review" page under Platform Testing and CI:
who can use it, the !ai-review command and its options, what a review
contains, cost, how it works and its trust model, and where to change
it. It is marked as a trial. The maintainers page lists the new
permission during onboarding, and the AI coding assistants page tells
contributors how to treat an AI review on their PR.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
* docs(ci): mention the AI review check on the PR
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
* docs(ci): correct the AI review options and re-run behaviour
The model and effort options only change the first pass; the confirming pass always runs Opus at high. A re-run collapses the old summary but leaves its inline comments, and the command only works on open PRs.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
---------
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
The Pixhawk Autopilot Bus standard (DS-010), the ARK FMU modules' datasheets and the ARK store all give the second board-to-board connector as a 50-pin Hirose DF40.
Assisted-by: Claude:claude-opus-5-5
* fix(mc_att_control): ignore invalid attitude setpoints in the reference model
Since the reference model (2a0e048171, PR #27255) the controller tracks _q_ref,
which is integrated from its previous value and only snapped to the setpoint on
the first call. A single attitude setpoint with a zero or non-finite quaternion
(normalizing a zero quaternion gives NaN) therefore makes _q_ref NaN for the rest
of the boot: every later setpoint is ignored, the rate setpoint stays NaN and the
vehicle has no attitude control, even after a mode switch. Before the reference
model the controller used q_d directly, so a bad sample only lasted one cycle.
One MAVLink SET_ATTITUDE_TARGET with q = [0, 0, 0, 0] in Offboard reproduces it
in SIH: vehicle_rates_setpoint stays NaN and the vehicle no longer responds to
the sticks after switching to Position mode.
Ignore setpoints and heading-reset deltas that are zero or non-finite, keeping
the last valid reference, and snap the reference to the next valid setpoint if
it ever becomes non-finite.
Signed-off-by: Isak Åslund <isak.aslund@airolit.com>
* fix(mc_att_control): drop the whole attitude setpoint when its quaternion is invalid
When the controller rejects an invalid quaternion, the thrust and timestamp
from the same message were still applied. The vehicle then flew the last
valid attitude with thrust from a message that cannot be trusted.
setAttitudeSetpoint() now returns whether the setpoint was accepted. The
thrust and the setpoint timestamp are only updated when it was. Keeping the
timestamp also gives the next valid setpoint the true dt since the last
accepted one.
Signed-off-by: Isak Åslund <isak.aslund@airolit.com>
* fix(mc_att_control): reject overflowing quaternions and drop invalid SET_ATTITUDE_TARGET
Review follow-ups:
- Validate the setpoint through its norm. A quaternion with a finite component
above ~1.8e19 (e.g. q = (1e20, 0, 0, 0)) passed isAllFinite(), its norm
overflowed to inf and normalizing it gave a zero quaternion. As the first
setpoint this made the reference NaN for the next setpoint. One finite norm
check rejects NaN, inf, zero and overflow.
- Drop the ref_valid / dt finiteness recovery branch: with every input of the
reference model validated it cannot be reached, and it costs flash.
- Drop the adaptAttitudeSetpoint() guard: no estimator publishes an invalid
delta with a changed reset counter, and it only protected the reference,
not the yaw setpoint and StickYaw that use the same delta.
- MAVLink SET_ATTITUDE_TARGET: drop a message with an unusable q before
publishing offboard_control_mode. Otherwise a companion streaming only
invalid quaternions keeps the offboard heartbeat alive and the vehicle holds
the last valid tilt and thrust indefinitely without triggering
COM_OF_LOSS_T.
Signed-off-by: Isak Åslund <isak.aslund@airolit.com>
* docs(offboard): note that SET_ATTITUDE_TARGET with an invalid q is dropped
Since the previous commit, such a message no longer counts as the offboard
signal, which is a behavior change MAVLink users can see. Also name the 1e-3
norm threshold in the setAttitudeSetpoint() doc, and point the MAVLink and
controller checks at each other: if the MAVLink threshold were lowered below
the controller's, messages the controller drops would keep offboard alive.
Signed-off-by: Isak Åslund <isak.aslund@airolit.com>
---------
Signed-off-by: Isak Åslund <isak.aslund@airolit.com>
GPS_YAW_OFFSET isn't migrated to SENS_GNSSn_HDG and the antenna positions, and the only sign of a dropped heading was a console line that said to set SENS_GNSSn_HDG even when only the positions were missing. A receiver reporting a valid heading was set up for one, so a QGC warning naming the missing setting reaches the people who upgraded.
Assisted-by: Claude:claude-opus-5-5
* feat(commander): only report safety button as available when it is available and configured to be used via COM_PREARM_MODE
* feat(commander): add a new option to COM_PREARM_MODE to explicitly and exclusively allow prearming via VEHICLE_CMD_DO_SET_SAFETY_SWITCH_STATE
* feat(commander): explicit dedicated safety-button-only and mavlink-only prearm modes
* fix(commander): also accept VEHICLE_CMD_DO_SET_SAFETY_SWITCH_STATE on Always and Disarmed pre-arm profiles to match documentation
* docs(prearm): update docs with new prearm mode behaviour
* fix(commander): fix syntax for bool
* docs(prearm): revert last param table, as COM_FORCE_SAFETY is already mentioned in a table above.
* docs(prearm): fix MAVLink spelling, grammar and parameter table
Make the pre-arm docs consistent with the COM_PREARM_MODE parameter and
the docs style guide: MAVLink is spelled consistently (page and option
labels), selectable option names are shown in code style, the parameter
table lists all five COM_PREARM_MODE options with the correct default,
and sentences are fixed and put one per line.
Question for the author: the COM_PREARM_MODE option labels say "Safety
button", while the docs say "safety switch". Are these synonyms? If so,
which term should we use in both places? If not, what is the difference?
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
* fix(commander): clean up _button_disabled logic: button still needs to be enabled in Disabled and Always prearmed modes to switch safety off.
* docs(prearm): adjust COM_PREARM_MODE description and clarify/fix/improve prearm docs
* chore(VehicleCommand.msg): improved comments
* chore(msg): v0->v1 translation for VehicleCommand.msg
* Revert "chore(msg): v0->v1 translation for VehicleCommand.msg"
This reverts commit 50ea14fc76310ba7b53ebcd1c6ee8cf4e1c0776b.
* feat(commander): deny VEHICLE_CMD_DO_SET_SAFETY_SWITCH_STATE when not accepted
* feat(commander): COM_SAFETY_MODE replaces CBRK_IO_SAFETY
* docs(prearm): update docs with new COM_SAFETY_MODE behaviour
* docs(prearm): minor cleanup
* fix(commander): migrate CBRK_IO_SAFETY and correct safety ACKs
A stored CBRK_IO_SAFETY=0 was dropped on import, so upgraded vehicles booted with COM_SAFETY_MODE=0 and safety off. The CAN GPS nodes have no commander, so setting COM_SAFETY_MODE there only logged an error at boot. A SAFETY_SAFE command in mode 0 and ESC calibration with safety on were ACKed ACCEPTED while doing nothing.
Assisted-by: Claude:claude-opus-5-5
---------
Signed-off-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
* feat(bl_update): pet the watchdog during erase and program
CAN nodes start the IWDG in the bootloader, and nothing else pets it
while bl_update holds the scheduler lock.
Assisted-by: Claude:claude-opus-5-5
* feat(nuttx): emit canbootloader to board extras and build bootloader+app image
canbootloader builds now write extras/<vendor>_<board>_bootloader.bin
like FMU bootloader builds do, which plugs CAN nodes into the existing
ROMFS / rc.board_bootloader_upgrade / jlink wiring. CAN node app builds
with that file also emit <config>_with_bootloader.bin (bootloader padded
to the app's ELF load address, followed by the CRC'd image) so a bare
board is flashed in one SWD step instead of two.
Assisted-by: Claude:claude-opus-5-5
* feat(cannode): run rc.board_bootloader_upgrade at startup
The hook was only wired into the FMU rcS, so SYS_BL_UPDATE did nothing
on CAN nodes even with bl_update built in.
* feat(ark): enable bootloader update on CAN nodes
Ships the CAN bootloader in the app ROMFS so a node can rewrite it via
SYS_BL_UPDATE without SWD.
Assisted-by: Claude:claude-opus-5-5
* docs(dronecan): bootloader update and combined image for CAN nodes
Assisted-by: Claude:claude-opus-5-5
* build(ark): rebuild CAN node bootloaders from current main
The committed binaries predated the F412 chip-selection and linker fixes
and the NuttX 12.12 upgrade, so they no longer matched the source.
Assisted-by: Claude:claude-opus-5-5
* feat(uavcannode): update the bootloader as soon as SYS_BL_UPDATE is set
Same approach as AP_Periph. Running the update on the next boot needed
two reboots and reported nothing over CAN: it ran before uavcannode
started, and the boot script printed "done" even when bl_update failed.
The node now flashes while running, skips an identical bootloader, and
the result reaches the flight controller through the existing log
message forwarding. A value left set from before boot is cleared rather
than acted on.
The flash routine moves into a library so uavcannode can call it.
Assisted-by: Claude:claude-opus-5-5
* docs(dronecan): note that the combined CAN node image resets parameters
Found on the bench: the padding between bootloader and app covers the
parameter sectors, so every SWD flash of the combined image erases them.
Assisted-by: Claude:claude-opus-5-5
* fix(nuttx): limit CAN bootloader extras and combined image to STM32
Every canbootloader build wrote its binary to the board's extras, so a
later nxp_ucans32k146 default or cyphal configure picked it up and failed
in prepend_bootloader.py: the S32K application loads at 0x6000, below
the 0x08000000 base the script and bl_update assume. CI only passed
because the canbootloader was built after both had configured.
Assisted-by: Claude:claude-fable-5-1
* fix(bl_update): pad the image before erasing and warn on every flash failure
The STM32F4 up_progmem_write() returns -EINVAL for an odd byte count,
which was only found out after sector 0 had been erased. An erase or
program failure also leaves the board without a bootloader, but only a
verify failure told the user to retry before rebooting.
Assisted-by: Claude:claude-fable-5-1
* fix(romfs): pack rc.board_bootloader_upgrade only where rcS runs it
CAN nodes with bl_update carried the script in their ROMFS although the
cannode rcS never sources it: uavcannode flashes the bootloader itself.
Assisted-by: Claude:claude-fable-5-1
* refactor(bl_update): move the flash routine to src/lib
The library lived under systemcmds, which is configured after drivers,
so uavcannode could only link it through a forward reference. The
watchdog is now selected by chip because the platform targets do not
exist yet when src/lib is configured.
Assisted-by: Claude:claude-fable-5-1
* docs(dronecan): the CAN bootloader is written to extras on STM32 only
Assisted-by: Claude:claude-fable-5-1
* fix(mc_nn_control): reject a model the module cannot feed
The documentation tells users to swap the model array in control_net.cpp,
and the module then wrote 15 floats into whatever input tensor came back
and read 4 outputs from whatever output tensor came back, with no check
of either. A model with a different input width would write past the
tensor in the arena with no diagnostic. Reported in #28417.
Check the schema version before the interpreter is built on the model,
then the number of input and output tensors and the element count and
type of each, and refuse to start with the reason in the log when they
do not match. The checks live in a header without module dependencies so
they can be unit tested, and the operator registration moves to a header
so a test can load the shipped model through the real interpreter.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* fix(mc_nn_control): guard the observations and the network output
The network was fed whatever the position and attitude topics last held,
with no check of the validity flags, the age or finiteness, and its
output went to the motors with any non finite channel mapped to a stopped
motor while the other three kept thrusting. Reported in #28417.
Check the observations on every cycle, in the mode or not: the position
validity flags, the age of position, attitude and angular velocity
against the same limits the raptor module uses, and finiteness. The
network is not run on observations that fail, and a non finite output is
not sent. In both cases the last command of this session is repeated,
which is what the mixer would apply anyway, and the arming check reply
says the mode cannot run, so the commander leaves it through its own
fallback within one of its external check intervals. The repeat keeps
the actuator topic and the lockstep simulators going, which wait for an
output on every step. The first fault of an outage is reported once. A
non finite output is reported once and the network is not trusted again
until the mode has been left.
The module runs on angular velocity updates, so a lost angular velocity
stream would never have woken it. It is now a scheduled work item that
re-arms a delayed run on every cycle, which keeps it registering,
checking and answering the commander when the updates stop.
The trajectory setpoint starts unset and is reset to the current
position when the mode is entered without one. Before, the member was
never initialized and the reset only happened when a position update
landed on the same cycle as the first angular velocity update.
In SIH, a GPS loss while flying the neural mode produced the fault event
the same instant the position validity dropped, inference stopped, and
the commander was in Descend within its next check. A gyro loss on a
real time build produced the fault event 20 ms after the last sample and
the commander was in failsafe 150 ms later.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* test(mc_nn_control): cover the model, observation and output checks
Eleven cases on the checks the module runs before trusting its model,
its observations and its output: every position validity flag, each
staleness limit at its boundary and pinned to the raptor module's
values, never set and future stamps, non finite values in each
observation, the order in which faults are reported, every channel of
the output, and every way a model can fail the layout check.
One more loads the shipped model through the real interpreter and runs
the module's layout check on it, so a swapped model array the module
cannot feed fails here before it fails on a vehicle.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* fix(mc_nn_control): start the observation caches empty
The three cached observations were plain members, so the first
observation check read whatever the memory held before any of the
topics had published, and a stream that had not arrived could pass
that first check by chance.
They start empty now, which the first check reports as an invalid
position. A functional test builds the module in storage filled
beforehand and runs the check with nothing published.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
* ci(tests): run every mc_nn_control test in tests_neural
The default filter of the target only matched the first test of the
module. It now selects every test of the module, and it is quoted so
the shell does not read the alternation as a pipe.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>
---------
Signed-off-by: Saibernard Yogendran <bernie97@seas.upenn.edu>