Added initial support for the ArduPlane. Added mandatory command line options.

How to use ArduCopter:
  Launch simulator with command: "./Tools/autotest/sim_vehicle.py --map --console -v ArduCopter"
  Launch autopilot with command: "./autopilot mission.json quadcopter udp"

How to use ArduPlane:
  Launch simulator with command: "./Tools/autotest/sim_vehicle.py --map --console -v ArduPlane"
  Wait 30 seconds and give following commands in the same terminal
    arm throttle
    mode takeoff
  Launch autopilot with command: "./autopilot mission.json plane udp"

Type: New Feature
This commit is contained in:
Tuomas Järvinen
2024-06-02 08:33:57 +02:00
parent 33399370f3
commit 05722c0e09
4 changed files with 55 additions and 14 deletions
+15 -4
View File
@@ -1,3 +1,4 @@
#include <QCoreApplication>
#include <QDebug>
#include <mavsdk/plugins/telemetry/telemetry.h>
@@ -82,9 +83,8 @@ void AzMissionController::newPosition(Telemetry::Position pos)
}
if (mFlyingToReturnPoint == true) {
const AzCoordinate &coordinate = mMission.getReturnPoint();
float distance
= AzUtils::distance(pos.latitude_deg, pos.longitude_deg, coordinate.latitude, coordinate.longitude);
const AzCoordinate &point = mMission.getReturnPoint();
float distance = AzUtils::distance(pos.latitude_deg, pos.longitude_deg, point.latitude, point.longitude);
qDebug() << "AzMissionController::newPosition() distance to return point:" << distance << " km.";
@@ -102,9 +102,20 @@ void AzMissionController::newPosition(Telemetry::Position pos)
qDebug() << "AzMissionController::newPosition() distance to target:" << distance << "km.";
// TODO!! In final application we need to use the camera to find the target.
if (distance <= 0.01) {
if (QCoreApplication::arguments().contains("drone") && distance <= 0.01) {
qDebug() << "AzMissionController::newPosition() target reached. Continuing to the next item.";
flyToNextMissionItem();
}
else if (QCoreApplication::arguments().contains("plane")) {
if (mPlaneCirclingTime.isValid() == false && distance <= 0.1) {
qDebug() << "AzMissionController::newPosition() target reached. Starting circling.";
mPlaneCirclingTime.restart();
}
else if (mPlaneCirclingTime.elapsed() > 35000) {
qDebug() << "AzMissionController::newPosition() target reached. Ending circling.";
mPlaneCirclingTime.invalidate();
flyToNextMissionItem();
}
}
}
}