Files
autopilot/misc/camera/a8/main.cpp
T
Nffj84 2b9bda1ff0 Added new target location algorithm.
Fixed issue with target altitude calculation.
2024-07-16 18:15:10 +03:00

52 lines
1.6 KiB
C++

#include <QCommandLineParser>
#include <QCoreApplication>
#include <QThread>
#include "config.hpp"
#include "localControl.hpp"
#include "remoteControl.hpp"
#include "serialCommand.hpp"
#include "serialPort.hpp"
#include "utilsTargetLocation.hpp"
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption lOption(QStringList() << "l", "Use local mode");
parser.addOption(lOption);
QCommandLineOption pOption(QStringList() << "p", "Use serial port", "value");
parser.addOption(pOption);
parser.process(app);
bool useRemoteMode = true;
if (parser.isSet(lOption)) {
useRemoteMode = false;
}
QString useSerialPort;
if (parser.isSet(pOption)) {
useSerialPort = parser.value(pOption);
}
SerialPort serialPort(useSerialPort);
SerialCommand serialCommand;
Config::setInitalValues(&serialPort, &serialCommand);
GPSData test = UtilsTargetLocation::getLocation(100.0f, 49.8397, 24.0319, 180.0f, 0.0f, 0.0f);
qInfo().noquote().nospace() << "altitude: " << test.altitude;
qInfo().noquote().nospace() << "latitude: " << test.latitude;
qInfo().noquote().nospace() << "longitude: " << test.longitude;
// Remote mode will read commands from pipe
if (useRemoteMode == true) {
qDebug() << "Creating new RemoteControl object";
new RemoteControl();
}
else {
qDebug() << "Creating new LocalControl object";
new LocalControl();
}
return app.exec();
}