Commit Graph
100 Commits
Author SHA1 Message Date
Thomas Watson d317bfaf2e AP_NavEKF3: mark covariance matrix mutation in PosVelFusion
Change the mutations to use `Pmut` and change the define to keep the
non-mutations from accidentally mutating.

All these mutations only touched the diagonals, so no risk of them
having broken symmetry.
2026-09-22 11:56:43 +10:00
Thomas Watson 2125137117 AP_NavEKF3: pin P references in non-writing files to const
Change their define so they don't use the mutable original, only the
name through a const-cast pointer. There are no writes to the covariance
matrix in these files, so nothing else needs changing.
2026-09-22 11:56:43 +10:00
Thomas Watson c114fb1254 AP_NavEKF3: name covariance matrix as mutable
In preparation for changing the regular `P` name to const, in
preparation for auditing the code so that writes to the matrix keep its
necessary numeric properties.

Sadly there is not a better way than a per-file `#define` to make the
switch. Making `P` a reference to `Pmut` substantially changes the
compiler output. Defining `P` in the header file conflicts with other
includes. Doing the rename at the top of each file allows each file to
be fixed independently.
2026-09-22 11:56:43 +10:00
Thomas Watson af0282d4ef AP_NavEKF: make stack frame size check specific to ChibiOS
It is the only HAL that sets `-Wframe-larger-than` so it is the only one
where the limit needs modification to fit the EKF.

ChibiOS additionally does not use Clang, so that check can be dropped.
2026-09-22 11:56:43 +10:00
Thomas Watson d25c1668e3 Tools: fix size_compare_branches.py jobs argument
waf does not persist `-j` in the configuration, it's only used for the
command it's specified on. So specifying `-j` to this script never did
anything to limit the number of build processes because the job limit
was only given to configure commands.

Now the script passes the appropriate number of jobs to build as well
as configure commands, so the limit is actually applied.

It's unclear if passing the number of jobs to the configure command
accomplishes a lot, but it doesn't hurt so it's kept.
2026-09-21 10:23:57 +10:00
Thomas Watson 720771a723 AP_Scripting: Revert "Reduce lua stack usage"
This reverts commit 6e7367b86f.

These reductions reduce the usage of the Lua stack, which is stored in
the heap. This reverts back to the stock Lua values; some complex
scripts may desire extra locals. There is some increased risk of memory
fragmentation and so forth but presumably such scripts are prepared.

The actual C stack depth can be limited by `LUAI_MAXCCALLS`.
2026-09-08 09:26:50 +10:00
Thomas Watson db27c446c3 Tools: remove references to removed synthetic clock flag 2026-06-21 20:02:26 -05:00
Thomas Watson 95b729cc44 AP_HAL_SITL: remove references to removed synthetic clock flag 2026-06-21 20:02:26 -05:00
Thomas Watson 7c7604552a SITL: clarify synthetic clock parameter warning message
Explain why it isn't needed and give both of its forms.

Also add a newline so it doesn't screw up fomatting.
2026-06-21 20:02:26 -05:00
Thomas Watson 4df77a363d Tools/ros2: fix colcon exec issues more thoroughly
The launch scripts use shell mode to launch all components of the test,
excluding for whatever reason the micro ROS agent, which means the
command is executed as `/bin/sh -c <command>`.

This causes the shutdown signals to go to the shell process, which dies
and leaves the actual component orphaned as `sh` does not do job
control. Therefore each test leaves a copy of the components running.
Future tests then end up talking to past components and the tests hang
up and die.

A previous commit recognized and fixed this problem on the SITL binary,
but it just made the overall failures worse as the past mavproxy and
socat would then be more likely to reconnect to future instances.

Fix by making mavproxy and socat also exec so that there is only ever
one process for them. mavproxy does technically launch subprocesses
which may be left hanging but they should be killed by mavproxy itself
on a clean shutdown.

Future work will disable shell mode so there is no need for the extra
step, and arguments are better handled. This could also set up a
session/process group for mavproxy, assuming it is supported by the ROS
framework, to reduce the chances of its children giving problems.
2026-06-21 18:47:31 -05:00
Thomas Watson 528e010c53 AP_NavEKF3: merge zeroRows and zeroCols into P-specific form
These are always called together and always called with `P` as the first
argument. `P` must remain symmetric, so merging them removes chances for
bugs and saves flash.
2026-05-26 10:43:15 +10:00
Thomas Watson 49dc80af7a AP_NavEKF3: remove unused zeroAttCovOnly function
Evidently left over from EKF2.
2026-05-26 10:43:15 +10:00
Thomas Watson 268583425d AP_HAL: add ftoa_engine infinity/NaN tests 2026-05-21 12:57:08 -05:00
Thomas Watson 0d7122a84c AP_HAL: fix ftoa_engine hang on infinities
A previous fix to avoid corrupting prints of subnormal floats slightly
changed the setup logic in a way that caused a hang when handling
infinities.

Originally, the implicit mantissa bit was made explicit in the fraction
whenever the number was not subnormal. The previous fix changed it to be
set only when the number was normal, causing different behavior for
infinities and NaNs.

Unfortunately, as an infinity has a fractional component of zero, this
led to entering the main formatting loop with a 0 `prod` to format. This
caues `decimal` to eventually end up at 0, then the digit increment loop
to run forever as subtracting 0 from 0 will never result in a value less
than 0.

Doubly unfortunately, the previous fix for a similar hang to exit when
`decimal` became 0 was not crossed as the 0 `prod` would not allow the
code to proceed past the step to find a nonzero digit and run the check.

Fix by restoring the old mantissa bit explicitization behavior.
2026-05-21 12:57:08 -05:00
Thomas Watson 0acec1da17 AP_CANManager: drop problematic log_text method
This functionality was approximately never used when it existed as an
`@SYS` file, and has been a source of dangerous bugs.

Remove it completely to avoid future problems and save the flash.

The parameter must stay to control handling of `LogMessage` from
peripherals, which were always sent to the GCS.
2026-05-18 20:58:47 -05:00
Thomas Watson b983b894f2 AP_RCProtocol: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson 0e85bec23f AP_PiccoloCAN: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson 051de9d1f4 AP_Mount: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson ac8587e07e AP_HAL_SITL: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson 23d20dd8ba AP_HAL_Linux: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson f4ae5d7901 AP_HAL_ChibiOS: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson ba1007d7de AP_GPS: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson bd0bf4c92e AP_DroneCAN: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson 78736986d3 AP_Compass: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson 9b5f6243bd AP_CANManager: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson bb827ba6a6 AP_BattMonitor: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson bfa8dd76a5 AP_Baro: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson 2f28b41984 AP_Airspeed: drop CAN log message calls
The infrastructure for these has been continually buggy and rarely used.

Delete calls in preparation for ripping it out entirely.
2026-05-18 20:58:47 -05:00
Thomas Watson 6afd09dd62 AP_CANManager: disable log_text by default
This functionality was approximately never used when it existed as an
`@SYS` file, so compile it out so it does not suddenly appear.

The parameter must stay to control handling of `LogMessage` from
peripherals, which were always sent to the GCS.
2026-05-18 20:58:47 -05:00
Thomas Watson edca856684 AP_CANManager: fix heap corruption when CAN log buffer fills
Once the CAN log buffer gets near to full, the check for remaining space
can pass even though there is insufficient space left in the buffer
for the actual log message after formatting.

The space for the tag is correctly measured, so the `snprintf` will
never perform a short write. However, the `vsnprintf` will. Though it
does not write too much, it pushes `_log_pos` past the end of the buffer
as it returns the amount that would be written, rather than the amount
that actually was written.

In this case, the test on the next call of the function aims to reset
`_log_pos` to the start. Unfortunately, as that variable is unsigned,
the subtraction from `LOG_BUFFER_SIZE` will result in a large positive
number, falsely stating that there is enough space. This will also then
give the `snprintf` and `vsnprintf` a large positive space for them to
write into, so they will write past the end of the buffer and corrupt
the heap and crash the system.

Fix by making the variable and comparison properly signed. This will
give a problem if log messages get into the billions of characters, but
this is unlikely to occur.
2026-05-18 20:58:47 -05:00
Thomas Watson 924a3e3860 AP_NavEKF3: make FuseVelPosNED KHP computation consistent
Now it looks like the other fusion functions, including an H term.

Note that the explicit H is optimized away so there is no penalty.
2026-05-19 10:36:49 +10:00
Thomas Watson b829d7f300 AP_NavEKF3: loop over states in FuseVelPosNED Kalman gain computation
Saves flash and now matches the other fusion functions.
2026-05-19 10:36:49 +10:00
Thomas Watson 7695157232 AP_NavEKF3: zero del vel bias states after covariance update
Avoids any risk of leaking state from the position variance reset, which
was formerly after this zeroing and would restore some non-zero states.
2026-05-12 09:37:00 +10:00
Thomas Watson 7420edcb43 AP_RCProtocol: bump min SUMD channels to 4 to avoid corruption
If the receiver sends less than four channels, the reordering step will
use unspecified data from the input buffer as valid RC input values. The
official minimum channel count from the protocol documentation is two.

There is no risk of a buffer overread or overwrite, it is hard to
believe a user would set up this configuration, and there is a
relatively strong checksum which protects the channel count too.
Therefore, an actual problem is unlikely.

Fix by rejecting packets claiming to have less than four channels. This
fix is zero-cost and removes any risk of garbage from such packets.
2026-05-05 11:12:26 +10:00
Thomas Watson 85c22e708f waf: put waf launch script guts into function
Avoids polluting module namespace and potential weirdness with
multiprocessing.
2026-05-05 11:11:18 +10:00
Thomas Watson 01a1fde7d6 AP_NavEKF3: optimize FinishFusion symmetry code
Restructuring the P -= KHP calculation to produce a symmetric result is
faster and smaller than forcing it after the fact. Here it is done to avoid
changing the result at all but this could be improved in the future.

Timing of P -= KHP (including forcing symmetry) on H7 is 17us, down from
23. On F4 it is 32us, down from 48.
2026-05-05 10:06:37 +10:00
Thomas Watson 92ec22985e AP_NavEKF3: inline ForceSymmetry into its only caller 2026-05-05 10:06:37 +10:00
Thomas Watson 23fb57aa53 AP_NavEKF3: use FinishFusion in FuseRngBcn 2026-05-05 10:06:37 +10:00
Thomas Watson 08e54b6c6b AP_NavEKF3: use FinishFusion in FuseBodyVel 2026-05-05 10:06:37 +10:00
Thomas Watson 63d84ee6f2 AP_NavEKF3: use FinishFusion in FuseVelPosNED 2026-05-05 10:06:37 +10:00
Thomas Watson 5964a0d113 AP_NavEKF3: use FinishFusion in FuseOptFlow 2026-05-05 10:06:37 +10:00
Thomas Watson 5495683d10 AP_NavEKF3: use FinishFusion in FuseDragForces 2026-05-05 10:06:37 +10:00
Thomas Watson 7f05246d8c AP_NavEKF3: use FinishFusion in FuseSideslip 2026-05-05 10:06:37 +10:00
Thomas Watson 1c270058ff AP_NavEKF3: use FinishFusion in FuseAirspeed 2026-05-05 10:06:37 +10:00
Thomas Watson 338fed1b20 AP_NavEKF3: use FinishFusion in FuseDeclination 2026-05-05 10:06:37 +10:00
Thomas Watson f6dc69ade2 AP_NavEKF3: use FinishFusion in FuseMagnetometer
Note that the MagTableConstrain call is fine.
2026-05-05 10:06:37 +10:00
Thomas Watson be06d5c01d AP_NavEKF3: use FinishFusion in fuseEulerYaw 2026-05-05 10:06:37 +10:00
Thomas Watson c1f2d56770 AP_NavEKF3: create FinishFusion function to perform final fusion steps 2026-05-05 10:06:37 +10:00
Thomas Watson 7d78a272e0 AP_NavEKF3: remove unnecessary zeroing from FuseSideslip
Missed as part of the kalman gain loop work. No change in behavior as
zeroing will be done in the gain calculation loop.
2026-05-04 09:33:51 -05:00
Thomas Watson 9bf88f3335 waf: Revert "add -Wno-digraphs"
This reverts commit 2105ede7b7.

This warning does not exist and never existed!
2026-05-02 19:13:33 -05:00
Thomas Watson c9e98bac60 waf: Revert "make -Wno-digraphs non-clang-only"
This reverts commit 2f7ba11ff4.

This warning does not exist and never existed!
2026-05-02 19:13:33 -05:00
Thomas Watson 39d2c1cab4 AP_HAL: remove unused RC parsers
These have not been used since at least the removal of their callers
from AP_HAL_Linux.
2026-05-03 10:04:33 +10:00
Thomas Watson a2d3acdd0e AP_HAL_Linux: remove includes of unused RC parsers
Nobody has called these in years.
2026-05-03 10:04:33 +10:00
Thomas Watson b38ab873ae AP_NavEKF3: FuseRngBcn: make fusion update more consistent
Update `stateStruct` before calling `ConstrainVariances` as the latter
can change `stateStruct` in rare cases.
2026-04-14 21:03:14 +10:00
Thomas Watson 76c003cf27 AP_NavEKF3: FuseBodyVel: make fusion update more consistent
Update `stateStruct` before calling `ConstrainVariances` as the latter
can change `stateStruct` in rare cases.
2026-04-14 21:03:14 +10:00
Thomas Watson 22b82af370 AP_NavEKF3: FuseVelPosNED: make fusion update more consistent
Update `stateStruct` before calling `ConstrainVariances` as the latter
can change `stateStruct` in rare cases.
2026-04-14 21:03:14 +10:00
Thomas Watson edec204f69 AP_NavEKF3: FuseOptFlow: make fusion update more consistent
Update `stateStruct` before calling `ConstrainVariances` as the latter
can change `stateStruct` in rare cases.
2026-04-14 21:03:14 +10:00
Thomas Watson 707f21de45 AP_NavEKF3: FuseDeclination: make fusion update more consistent
Update `stateStruct` before calling `ConstrainVariances` as the latter
can change `stateStruct` in rare cases.
2026-04-14 21:03:14 +10:00
Thomas Watson b6f1664bea AP_NavEKF3: FuseMagnetometer: make fusion update more consistent
Update `stateStruct` before calling `ConstrainVariances` as the latter
can change `stateStruct` in rare cases.

The `MagTableConstrain` call will further constrain the states but not
in a way that interacts with `ConstrainVariances`.
2026-04-14 21:03:14 +10:00
Thomas Watson ec229e9efa AP_NavEKF3: fuseEulerYaw: make fusion update more consistent
Update `stateStruct` before calling `ConstrainVariances` as the latter
can change `stateStruct` in rare cases.
2026-04-14 21:03:14 +10:00
Thomas Watson 94d58a3f0b Rover: make mode parameters into array
This removes the need for the pointer to the first mode, and removes the
undefined behavior resulting from indexing past that first mode and
hoping the others follow (though this is unlikely to pose a problem in
practice).

Saves a few bytes of RAM and flash as the pointer is no longer needed
and code is no longer necessary to set it up.

Also fixes the bounds check condition of that array to match its size so
there is no longer the possibility of indexing one past it.
2026-04-13 12:50:48 +01:00
Thomas Watson 96e5a474f5 Blimp: make flight mode parameters into array
This removes the need for the pointer to the first flight mode, and
removes the undefined behavior resulting from indexing past that first
flight mode and hoping the others follow (though this is unlikely to
pose a problem in practice).

Saves a few bytes of RAM and flash as the pointer is no longer needed
and code is no longer necessary to set it up.

Also fixes the bounds check condition of that array to match its size so
there is no longer the possibility of indexing one past it.
2026-04-13 12:50:48 +01:00
Thomas Watson c6a9d385bd Sub: make flight mode parameters into array
This removes the need for the pointer to the first flight mode, and
removes the undefined behavior resulting from indexing past that first
flight mode and hoping the others follow (though this is unlikely to
pose a problem in practice).

Saves a few bytes of RAM and flash as the pointer is no longer needed
and code is no longer necessary to set it up.

Also fixes the bounds check condition of that array to match its size so
there is no longer the possibility of indexing one past it.
2026-04-13 12:50:48 +01:00
Thomas Watson 0bf55084a6 Plane: make flight mode parameters into array
This removes the need for the pointer to the first flight mode, and
removes the undefined behavior resulting from indexing past that first
flight mode and hoping the others follow (though this is unlikely to
pose a problem in practice).

Saves a few bytes of RAM and flash as the pointer is no longer needed
and code is no longer necessary to set it up.
2026-04-13 12:50:48 +01:00
Thomas Watson 7e921e4ab1 Copter: make flight mode parameters into array
This removes the need for the pointer to the first flight mode, and
removes the undefined behavior resulting from indexing past that first
flight mode and hoping the others follow (though this is unlikely to
pose a problem in practice).

Saves a few bytes of RAM and flash as the pointer is no longer needed
and code is no longer necessary to set it up.

Also fixes the bounds check condition of that array to match its size so
there is no longer the possibility of indexing one past it.
2026-04-13 12:50:48 +01:00
Thomas Watson 85d417ee1a AP_NavEKF3: add missing constraints to FuseDragForces
Unsure if this is a major issue since the next EKF loop would likely call
some fusion function which would do the same things. But better safe than
sorry, and consistency is good.
2026-04-06 23:04:58 -05:00
Thomas Watson 0e5ef261b2 AP_NavEKF3: FuseSideslip: slightly optimize
Only force symmetry and constrain variances if we've actually touched
the covariance matrix.
2026-04-07 12:42:27 +10:00
Thomas Watson 19a2d31024 AP_NavEKF3: FuseAirspeed: slightly optimize
Only force symmetry and constrain variances if we've actually touched
the covariance matrix.
2026-04-07 12:42:27 +10:00
Thomas Watson 6ff4c5fcff AP_NavEKF3: add missing state normalization to RngBcnFusion
All other fusion functions normalize the quaternion.
2026-04-07 10:56:31 +10:00
Thomas Watson dd9bd7a08a Tools: fix build_bootloaders debug symbol flag
The debug flag, contrary to its documentation, enables a debug build,
increasing the size of the binary and changing its contents. Fix the
documentation to describe what it actually does.

Then add the same flag as waf to just add symbols without changing the
actual binary.
2026-04-04 14:34:44 -05:00
Thomas Watson 44bcefb1ed AP_NavEKF3: loop over states in FuseBodyVel Kalman gain computation
Same form and coefficients for most elements. Saves lots of flash.
2026-04-01 08:48:20 +11:00
Thomas Watson a7fcef384a .github: update Cygwin to use Python 3.12
Might need to use native Windows Python in the future, or cross-compile
from Linux.
2026-03-31 11:46:06 +11:00
Thomas Watson f7c7542c3f Tools/environment_install: update Cygwin to use Python 3.12
Python 3.9 is still installed as part of GDB, but 3.12 is the default.

Might need to use native Windows Python in the future, or cross-compile
from Linux.
2026-03-31 11:46:06 +11:00
Thomas Watson aabbaaa550 Tools/environment_install: update Cygwin packages
Remove a bunch of old things which no longer worked properly or weren't
necessary. Also update to pin the actually used compiler like CI. And
add tmux as a way to get "run in terminal window" to work.
2026-03-31 11:46:06 +11:00
Thomas Watson a1a78c6791 .github: update Cygwin GCC pin
GCC 10.2 was removed from the Cygwin repos some time ago, so the
installer silently installed the latest stable version, which is
currently 13.4. Pin that properly so we know what we are getting, at
least until that too disappears.
2026-03-31 11:46:06 +11:00
Thomas Watson a392274160 .github: remove ignore references to removed files
At least the ones just removed.
2026-03-31 11:46:06 +11:00
Thomas Watson cdf575ea81 Tools: remove redundant Cygwin setup script
Does not do anything we don't already have documented, and it was never
used or linked to by e.g. the wiki. Remove as it's just more to become
desynchronized and outdated.
2026-03-31 11:46:06 +11:00
Thomas Watson 7fbcf7f955 autotest: add copter EKF FuseBodyVel Replay subtest
Unsure what the yaw misalignment is about but the log shows the copter
flies just fine during RTL.
2026-03-30 09:50:36 -05:00
Thomas Watson 57b7cf584d AP_DAL: fill missing fields in replay body odometry message
Inexplicably, the offset and delay fields were never filled in the RBOH
message, despite the fact they have always been available and read from
it. Filling these in is necessary for replay to work as the default
delay is not zero, so reading zero in replay causes a difference in the
replayed data. Also fix the comments which falsely say these fields are
not used.
2026-03-30 09:50:36 -05:00
Thomas Watson 5edfcd01c1 AP_Camera: fix RunCam param metadata names to match code 2026-03-30 10:39:45 +01:00
Thomas Watson e18941c525 autotest: make example runner code intent match behavior
The wait function could never return None. As the `Scheduler_test` is
apparently slightly longer than the timeout, just warn if the process
did not exit to preserve the current behavior. Also make a comment to
come back and fix up later.
2026-03-30 16:56:30 +11:00
Thomas Watson 6e816400f3 autotest: remove unnecessary busy loop from example runner
It never exited early in the normal case and just burned 100% CPU. It
will be slightly slower in an error case if there is an unexpected early
exit but that is probably worth the simplification.
2026-03-30 16:56:30 +11:00
Thomas Watson cec0df68ce autotest: simplify example runner subprocess call
Pass the documented `/dev/null` sentinel instead of improperly managing
the file handle ourselves.

Remove the `close_fds=True` as that is the default for all Pythons we
care about.
2026-03-30 16:56:30 +11:00
Thomas Watson 931030cf46 AP_DAL: correctly comment all fields of replay beacon data message
A replay log plainly shows these fields are not zero and are used. They
are filled in by `get_vehicle_position_ned` in
`AP_DAL_Beacon::start_frame`.

Some code sleuthing shows the estimates are the ones generated by the
beeacon system, rather than the vehicle itself.
2026-03-30 10:41:25 +11:00
Thomas Watsonandquart27219 ee7c410b14 GCS_MAVLink: fix buffer overread on invalid SERIAL_CONTROL write
Setting a count in the packet bigger than the data buffer size could
result in reading past the decoded packet and sending random junk off
the stack. Fix by capping the size to send at the buffer size, as there
is no ability for returning failure at this time. The recieve path is
already protected similarly.

Co-authored-by: quart27219 <nullquart@gmail.com>
2026-03-29 11:31:57 -05:00
Thomas Watson 2d14165ec5 Tools: remove now-unnecessary Python future dependency
Neither we nor our dependencies need it anymore.
2026-03-24 09:33:17 -05:00
Thomas Watson 4b39fe34ae .github: remove now-unnecessary Python future dependency
Neither we nor our dependencies need it anymore.
2026-03-24 09:33:17 -05:00
Thomas Watson 104af03005 AP_NavEKF3: loop over states in FuseRngBcn Kalman gain computation
Same form and coefficients for many elements. Saves lots of flash.
2026-03-24 12:53:11 +11:00
Thomas Watson 3121128acd AP_NavEKF3: loop over states in FuseOptFlow Kalman gain computation
Same form and coefficients for most elements. Saves lots of flash.
2026-03-24 12:53:11 +11:00
Thomas Watson 6faddb05dc AP_NavEKF3: loop over states in FuseSideslip Kalman gain computation
Same form and coefficients for each element. Saves lots of flash.
2026-03-24 12:53:11 +11:00
Thomas Watson 26a79bc9bc AP_NavEKF3: loop over states in FuseAirspeed Kalman gain computation
Same form and coefficients for each element. Saves lots of flash.
2026-03-24 12:53:11 +11:00
Thomas Watson 728b116908 AP_NavEKF3: loop over states in FuseDeclination Kalman gain computation
Same form and coefficients for each element. Saves lots of flash.
2026-03-24 12:53:11 +11:00
Thomas Watson f8073a6290 AP_NavEKF3: loop over states in FuseMagnetometer Kalman gain computation
Same form and coefficients for each element. Saves lots of flash.
2026-03-24 12:53:11 +11:00
Thomas Watson ca35793c38 modules/mavlink: update for sha256sum improvements
Includes pymavlink generator code improvements to save ~400 bytes of
stack on Cortex M when signing.
2026-03-01 16:59:06 +11:00
Thomas Watson df07de270d Tools/Replay: extend check_replay_branch.py for multiple vehicles
Allows vehicles other than Copter to have their own Replay tests.
Semantics are slightly wonky as the autotest program deletes logs at the
start of each given step, i.e. vehicle build or test.

Default to running all vehicles we have tests for now.
2026-02-16 09:16:01 -06:00
Thomas Watson 36eb2b0130 autotest: add Plane Replay test
Primary objective is to test EKF3 FuseSideslip as that is not testable
in Copter.
2026-02-16 09:16:01 -06:00
Thomas Watson 546880ccf7 ardupilotwaf: rerun mavgen if pymavlink sources change
If the C header files or the Python generator sources change, then this
causes the generator to rerun, fixed headers to get copied again, and
dependent files to be rebuilt.
2026-02-10 10:44:52 +11:00
Thomas Watson daf6fbfdfd AP_NavEKF3: fix incorrect delta velocity bias covariance inhibit
`inhibitDelVelBiasStates` becomes false once tilt alignment is complete,
which unlocks processing of states 13-15. If on the ground but tilted a
bit ("not aligned with the gravity vector") in some axis, then
`dvelBiasAxisInhibit[index]` becomes true to stop updates of variance in
that axis.

In this case, according to the comment, the covariances for that axis
state are zeroed to prevent interaction with other states, and the saved
variance from when the inhibit began is restored.

However, this zeroing was done incorrectly by only zeroing the columns
of `nextP`. As it is lower triangular, only covariances to states with a
higher index are in the same column; states with a lower index are
instead in the same row. This skipped zeroing the covariances to the
more important states and led to state divergence on the ground.

Fix by also zeroing the row to zero the lower covariances. Confirmed
that this fixes at least one replay log which showed ground divergence
while tilted. This is possibly a new feature of EKF3, or at least
implemented differently, so EKF2 does not need the same fix.
2026-02-05 10:15:42 +11:00
Thomas Watson 3b7558acb8 autotest: add Copter EKF Replay wind and airspeed subtest
Tests that fusion of wind estimation and airspeed data is correctly
replayed by the EKF. The test that wind estimation is working is already
handled by `BaroWindCorrection`.

Adding airspeed to Copter is easier than migrating everything to Plane.
Technically fusion of airspeed data is not supported on copters and the
`ARSPD_USE` parameter explicitly recommends against it. But it exists
and works, and this test includes a check that it has continued to work.
So if we break that later, the test will start to fail and we can decide
what to do.
2026-02-01 21:00:53 -06:00
Thomas Watson 4c4f426ecb autotest: reset throttle between Copter Replay tests
Some tests do throttle control and need it zeroed, and some others leave
it non-zeroed. Clear all the time for all tests for simplicity.
2026-02-01 21:00:53 -06:00