Skip to content

Commit

Permalink
fixed landing
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaingAnt committed Aug 27, 2023
1 parent 543b805 commit 968259e
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions modules/robot/src/real-robot/mavsdk/vpRobotMavsdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,36 +786,29 @@ class vpRobotMavsdk::vpRobotMavsdkImpl
}

sleep_for(seconds(10));
this->holdPosition();
sleep_for(seconds(1));
this->kill();
return true;

} else {
if (m_telemetry.get()->flight_mode() != mavsdk::Telemetry::FlightMode::Land) {
std::cout << "Landing...\n";
const mavsdk::Action::Result land_result = m_action.get()->land();
if (land_result != mavsdk::Action::Result::Success) {
std::cerr << "Land failed: " << land_result << std::endl;
return false;
}
}

// Check if vehicle is still in air
while (m_telemetry.get()->in_air()) {
std::cout << "Vehicle is landing..." << std::endl;
sleep_for(seconds(1));
}
if (m_telemetry.get()->flight_mode() != mavsdk::Telemetry::FlightMode::Land) {
std::cout << "Landing...\n";
const mavsdk::Action::Result land_result = m_action.get()->land();
if (land_result != mavsdk::Action::Result::Success) {
std::cerr << "Land failed: " << land_result << std::endl;
return false;
}

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));
std::cout << "Finished..." << std::endl;
return true;
// Check if vehicle is still in air
while (m_telemetry.get()->in_air()) {
std::cout << "Vehicle is landing..." << std::endl;
sleep_for(seconds(1));
}
}

return false;
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));
std::cout << "Finished..." << std::endl;
return true;
}

bool setPosition(float ned_north, float ned_east, float ned_down, float ned_yaw, bool blocking, int timeout_sec)
Expand Down

0 comments on commit 968259e

Please sign in to comment.