Land drone safely

- improved landing
- navigate to the return point defined in JSON file
- land drone safely without timeouts

Issue: https://denyspopov.atlassian.net/browse/AZ-24
Type: New Feature
This commit is contained in:
Tuomas Järvinen
2024-05-23 20:17:54 +02:00
parent 542ca96d3e
commit a8ba701138
5 changed files with 51 additions and 33 deletions
+6 -13
View File
@@ -168,20 +168,13 @@ bool AzDroneController::stateFlyMission(void)
void AzDroneController::missionFinishedSlot(void)
{
qDebug() << "AzDroneController::missionFinishedSlot() Landing the drone.";
// TODO!! Check return value and print warnings and errors.
mAction->land();
// TODO!! This must be improved a lot. Disarming should be done when drone lands.
QTimer::singleShot(20000, this, &AzDroneController::disarmDroneSlot);
}
// TODO!! Maybe use Telemetry::subscribe_landed_state() later to get the state of the landing.
qDebug() << "AzDroneController::missionFinishedSlot() Mission finished. Landing the drone.";
Action::Result result = mAction->land();
void AzDroneController::disarmDroneSlot(void)
{
qDebug() << "AzDroneController::disarmDroneSlot() Disarming the drone and quit.";
// TODO!! Check return value and print warnings and errors.
mAction->disarm();
// TODO!! Check with the team what to do after the landing.
QCoreApplication::instance()->quit();
if (result != Action::Result::Success) {
std::cerr << "mAction->land() failed. Reason: " << result << endl;
}
}
void AzDroneController::droneStateMachineSlot(void)