The vehicle can silently reject a SET_POSITION_TARGET_GLOBAL_INT - the
synthetic seafloor simulation deliberately injects low-signal-quality
rangefinder outliers, and one of those landing in the wrong ~50ms makes
the terrain frame momentarily invalid, failing the frame conversion in
wp_nav. There is no acknowledgement for the message, so the test sailed
on oblivious and timed out 80 seconds later ("Frame 10 took too long to
reach the destination", seen in CI).
Send the target until NAV_CONTROLLER_OUTPUT.wp_dist shows it has become
wp_nav's current destination. The distance report is used rather than
the POSITION_TARGET_GLOBAL_INT echo because the latter is never emitted
for terrain-altitude destinations on Sub (the alt cannot be converted
to AMSL without a terrain database). Blindly streaming the target is
also no good; each resend of an identical target re-initialises the
wpnav leg from a stopping point, slowing the vehicle enough to miss the
test's timeout.
The leg timer now starts only once the target is accepted, and the
message-rate request is made before the dive as there is no depth hold
between the dive and GUIDED, so sim time spent there is spent floating
back up.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MagcalController advanced calibration poses using wall-clock timers
(time.time()): 24 wall-seconds maximum dwell per pose and 4
wall-seconds of unchanged-progress before rotating. The vehicle
rotation and the calibrator's sample consumption are both simulation
time, so at SITL speedup the sphere coverage for a pose completes in a
fraction of a wall second and the controller then sat idle for the
rest of the wall-clock dwell. This made SITLCompassCalibration the
second most expensive test in CI at ~370 wall-seconds.
Clock the controller from ATTITUDE.time_boot_ms instead so every
quantity in the controller is in the simulation time domain; the
existing constants keep their values, now correctly denominated in
simulation seconds (a full turn at pi/4 rad/s genuinely takes 8
simulation seconds). Locally the test drops from ~370 to ~80-90
seconds.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
need to take runup timestamp before we send the interlock change otherwise we really can go before the timer has run for long enough to pass the TARGET_RUNUP_TIME
The throttle deterministically takes 2.4-2.6s of sim time to slew down
from its saturated 2000us (THR_SLEWRATE 100%/s) after soaring is
re-enabled, so the 3s timeout left almost no margin and flaked on
loaded CI machines.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Some editors strip the final newline by default, which shows up as
"No newline at end of file" noise in GitHub review. Fail the branch
conventions check when a PR adds a source file without a trailing
newline or removes one from a file which had it. Pre-existing
violations do not block unrelated edits.
With no GPS configured the EKF adopts the recorded origin early in
the boot, so 'AHRS: using recorded origin' can be emitted while the
test framework is still waiting for the reboot to complete - before
the test started collecting statustexts - and the wait for it then
times out. Timing changes in the preceding logging tests exposed
the race in CI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MAV_mgs connected to a hard-coded "tcp:localhost:5763". SITL offsets its
serial/telemetry TCP ports by 10*instance, so this only worked at instance
0; at any non-zero instance (parallel worker or "-I N") the connection was
refused. Use self.adjust_ardupilot_port(5763) instead.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
test scripts / build (astyle-cleanliness) (push) Canceled after 0s
test scripts / build (check_autotest_options) (push) Canceled after 0s
test scripts / build (logger_metadata) (push) Canceled after 0s
test scripts / build (param-file-validation) (push) Canceled after 0s
test scripts / build (param_parse) (push) Canceled after 0s
test scripts / build (python-cleanliness) (push) Canceled after 0s
test scripts / build (shellcheck) (push) Canceled after 0s
test scripts / build (validate_board_list) (push) Canceled after 0s
HomeCircleInclusionFence_Avoidance_SetHome sets speedup 1 for its
RC-driven avoidance holds and never restored it, so the whole RTL
descent also ran in real time, roughly 35 wall-seconds proving
nothing the test had not already proven. End the test with a forced
reboot instead: set_home requires a post-test reboot anyway, and
speedup restoration happens at the usual context teardown.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Each GPS-ordering case waited the full default timeout for the
detection statustext of a GPS deliberately configured absent, at
SIM_SPEEDUP 2. Both detection statustexts are emitted together
shortly after boot, so wait for expected-present GPSs first (absorbing
boot latency) and confirm expected-absent ones with a short timeout
from the already-collected context.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The continue-in-guided subtest enabled GCS failsafe (which drops
SIM_SPEEDUP to 4) before takeoffAndMoveAway, so the whole climb ran
slowly. The failsafe only needs to be armed before SIM_RC_FAIL is
raised, so enable it after the climb.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The flat 'terrain altitude to settle' delays immediately preceded a
wait_altitude with minimum_duration=10, which already proves settled
terrain-relative altitude. Remove the flat delays and grow the wait
timeouts by the same amount so the total allowance is unchanged and
the wait exits as soon as altitude has genuinely settled.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The reboot after each ExternalAHRS backend's context_pop() only
existed to apply the restored parameters, but the next backend's
customise_SITL_commandline (or the non-ExternalAHRS section's initial
reboot) restarts SITL anyway. Eight SITL restarts saved per AHRSTrim
run.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
setGCSfailsafe(0) hardcoded SIM_SPEEDUP 10 rather than restoring the
suite default (100 for Copter, 30 for Rover), so every test phase
following a disable ran slower than necessary. The wall-paced GCS
heartbeat coupling that justifies a reduced speedup only exists while
FS_GCS_ENABLE is set.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
BatteryFailsafe pins SIM_SPEEDUP to 4 for its entire duration, making
it the fourth most expensive test in all of CI at ~320 wall-seconds
per run. The override has been carried through several refactors with
no recorded rationale; the original 2013 test did not set it.
Battery failsafe timing is entirely simulation-time: the voltage comes
from SIM_BATT_VOLTAGE and BATT_LOW_TIMER counts simulation seconds, so
there is no wall-clock coupling that would require a reduced speedup
(unlike the GCS failsafe tests, where the test framework's wall-paced
heartbeats justify one). Remove the override so the test runs at the
suite default.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Current-position reads become get_location(). wait_location()
targets keep their original explicit altitudes, now tagged ABSOLUTE,
so the vertical check behaviour is untouched; locations whose
altitude was never consumed (fence corners, stopping-point distance
checks) become Location.latlon_only(). One line of commented-out
code is removed rather than converted.
Tests which do not currently run (gated-off or in disabled_tests) are
left untouched, as conversions there cannot be regression-tested.
The vehicle reports zero lat/lng until it has a position estimate,
and several tests sample their position before any readiness wait.
mav.location() blocked indefinitely for a 3D fix with non-zero latitude
via wait_gps_fix(); match that contract, but bounded by a timeout and
raising a named exception instead of hanging until the test watchdog
fires.
mavutil.location has no altitude frame field; its alt is AMSL only by
convention and the suite routinely stuffs relative-to-home and terrain
altitudes into it, leading to silent frame-mixing bugs.
Add a Location class mirroring AP_Common's Location: meters altitude
tagged with an AltFrame (ABSOLUTE/ABOVE_HOME/ABOVE_ORIGIN/
ABOVE_TERRAIN). It deliberately has no alt attribute. Altitude is
only reachable via get_alt_m(frame), and asking in the wrong frame is
an error, not a conversion: code that assumes a frame fails loudly
instead of silently misreading the altitude. Converting is its own
explicit step, TestSuite.change_alt_frame(), which polls home, origin
or terrain data from the vehicle as required.
The effective default tolerance was accidentally 100m instead of 1m.
Fixing that broke several tests, which needed their target location
altitudes specified correctly or the altitude check disabled
The logged length of a replay message is offsetof(_end), which
excludes any tail padding in the in-memory struct, so copying
sizeof(msg) read up to 4 bytes past the end of the log record buffer
(a stack-buffer-overflow under AddressSanitizer for RGPI, RGPJ and
RGPK records). Copy the logged length so the padding is deterministic.