Added check how many MAVSDK systems are available.

This commit is contained in:
Your Name
2024-07-04 11:24:07 +03:00
committed by Tuomas Järvinen
parent c69a7628c2
commit ad58ac34b8
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -73,6 +73,14 @@ bool AzDroneController::stateConnect(void)
bool AzDroneController::stateAutopilot(void)
{
std::vector<std::shared_ptr<System>> systems = mMavsdk.systems();
qDebug() << "AzDroneController::stateAutopilot() Found" << systems.size() << "systems";
if (systems.size() == 0) {
std::cerr << "No system found." << std::endl;
return 1;
}
std::optional<std::shared_ptr<System>> autopilot = mMavsdk.first_autopilot(AZ_GET_AUTOPILOT_TIMEOUT);
if (autopilot.has_value()) {