Skip to content

Commit

Permalink
Merge pull request #634 from Dronecode/fix-landed-detection
Browse files Browse the repository at this point in the history
Cherry-picked #571 onto develop
  • Loading branch information
julianoes authored Jan 9, 2019
2 parents 3672877 + a5d1e16 commit c2eefe8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 9 additions & 2 deletions example/offboard_velocity/offboard_velocity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,16 @@ int main(int argc, char **argv)
const Action::Result land_result = action->land();
action_error_exit(land_result, "Landing failed");

// Check if vehicle is still in air
while (telemetry->in_air()) {
std::cout << "Vehicle is landing..." << std::endl;
sleep_for(seconds(1));
}
std::cout << "Landed!" << std::endl;

// We are relying on auto-disarming but let's keep watching the telemetry for a bit longer.
sleep_for(seconds(10));
std::cout << "Landed" << std::endl;
sleep_for(seconds(3));
std::cout << "Finished..." << std::endl;

return EXIT_SUCCESS;
}
10 changes: 9 additions & 1 deletion example/takeoff_land/takeoff_and_land.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,16 @@ int main(int argc, char **argv)
return 1;
}

// Check if vehicle is still in air
while (telemetry->in_air()) {
std::cout << "Vehicle is landing..." << std::endl;
sleep_for(seconds(1));
}
std::cout << "Landed!" << std::endl;

// We are relying on auto-disarming but let's keep watching the telemetry for a bit longer.
sleep_for(seconds(5));
sleep_for(seconds(3));
std::cout << "Finished..." << std::endl;

return 0;
}

0 comments on commit c2eefe8

Please sign in to comment.