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
+22 -3
View File
@@ -1,5 +1,6 @@
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include "az_drone_controller.h"
#include "az_mission.h"
@@ -9,9 +10,27 @@ int main(int argc, char *argv[])
// This is needed to have main event loop and signal-slot events in the AzDroneController.
QCoreApplication a(argc, argv);
if (argc < 2) {
qCritical() << "\nPass the mission JSON file as the first argument.";
qCritical() << "A serial port connection can be enabled with \"serial\" as the second argument.\n";
if (a.arguments().size() != 4) {
qCritical() << "\nProgram needs three command line parameters.";
qCritical() << "\tFirst argument: mission JSON file.";
qCritical() << "\tSecond argument: \"quadcopter\" or \"plane\".";
qCritical() << "\tThird argument: \"udp\" or \"serial\" for connection type.";
qCritical() << "\tFor example ./autopilot mission.json plane udp";
return 1;
}
if (QFile::exists(a.arguments().at(1)) == false) {
qCritical() << "\nMission file doesn't exist";
return 1;
}
if (a.arguments().at(2) != "plane" && a.arguments().at(2) != "quadcopter") {
qCritical() << "\nPass \"quadcopter\" or \"plane\" for drone type as second argument";
return 1;
}
if (a.arguments().at(3) != "udp" && a.arguments().at(3) != "serial") {
qCritical() << "Pass \"udp\" or \"serial\" for connection type as third argument";
return 1;
}