SITL: save the shove duration when the shove finishes

add_shove_forces() clears SIM_SHOVE_TIME when the shove has run for its
duration, so it does not fire again.  It cleared the live value only,
leaving storage still holding the duration which asked for the shove.

Nothing notices until a reboot.  A GCS - or the test suite putting
parameters back at the end of a test - reads the live value, finds the
zero it wanted, and has no reason to write anything; storage keeps the
old duration, and the next reboot loads it and shoves again.

In autotest this crossed between tests: ThrowDoubleDrop asks for a 30s
shove, and GainBackoffTakeoff, the next test to reboot, came up with
SIM_SHOVE_TIME back at 30000 without having touched it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Peter Barker
2026-08-19 11:15:19 +10:00
committed by Peter Barker
co-authored by Claude Opus 5
parent a5e1fd2b43
commit ccd8eaacec
+7 -1
View File
@@ -1266,7 +1266,13 @@ void Aircraft::add_shove_forces(Vector3f &rot_accel, Vector3f &body_accel)
body_accel.z += sitl->shove.z;
} else {
sitl->shove.start_ms = 0;
sitl->shove.t.set(0);
// save as well as set: the parameter was written to storage to
// ask for the shove, so clearing only the live value leaves
// storage still asking for one. A GCS - or the test suite
// putting parameters back after a test - then sees the live
// value already at zero and has no reason to write, and the
// next reboot loads the old duration and shoves again.
sitl->shove.t.set_and_save(0);
}
}