loiter: only accept reposition setpoint if commanded within last 0.5 sec

guards against left over reposition commands (potentially set via geofence) from previous flights
This commit is contained in:
Thomas Stastny 2023-09-13 19:14:50 +02:00 committed by Daniel Agar
parent 39351acbcb
commit 3e68e806b8
1 changed files with 4 additions and 2 deletions

View File

@ -57,7 +57,8 @@ Loiter::on_inactive()
void
Loiter::on_activation()
{
if (_navigator->get_reposition_triplet()->current.valid) {
if (_navigator->get_reposition_triplet()->current.valid
&& hrt_elapsed_time(&_navigator->get_reposition_triplet()->current.timestamp) < 500_ms) {
reposition();
} else {
@ -72,7 +73,8 @@ Loiter::on_activation()
void
Loiter::on_active()
{
if (_navigator->get_reposition_triplet()->current.valid) {
if (_navigator->get_reposition_triplet()->current.valid
&& hrt_elapsed_time(&_navigator->get_reposition_triplet()->current.timestamp) < 500_ms) {
reposition();
}