mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
@@ -1,6 +0,0 @@
|
||||
FILE(GLOB SRC *.cpp)
|
||||
|
||||
ADD_EXECUTABLE(sample_interpolator ${SRC})
|
||||
|
||||
TARGET_LINK_LIBRARIES(sample_interpolator blackmisc blackcore ${QT_LIBRARIES})
|
||||
SET_TARGET_PROPERTIES(sample_interpolator PROPERTIES PROJECT_LABEL "Samples - Interpolator")
|
||||
@@ -1,81 +0,0 @@
|
||||
/* Copyright (C) 2013 VATSIM Community / contributors
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "blackmisc/coordinatetransformation.h"
|
||||
#include "blackmisc/pqangle.h"
|
||||
#include "blackcore/interpolator.h"
|
||||
#include "blackmisc/context.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QElapsedTimer>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace BlackCore;
|
||||
using namespace BlackMisc::Geo;
|
||||
using namespace BlackMisc::Math;
|
||||
using namespace BlackMisc::PhysicalQuantities;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
BlackMisc::CApplicationContext ctx;
|
||||
BlackMisc::IContext::setInstance(ctx);
|
||||
|
||||
QElapsedTimer timer;
|
||||
|
||||
// CCoordinateGeodetic myGeo(48.123, 11.75, 400);
|
||||
// CVector3D vecNed(1, 0, 0);
|
||||
// CVector3D vecEcef;
|
||||
|
||||
CInterpolator interpolator;
|
||||
interpolator.initialize();
|
||||
|
||||
CCoordinateGeodetic vecGeo(48.340733, 11.750565, 100);
|
||||
CCoordinateGeodetic vecGeo2(48.344727, 11.805153, 100);
|
||||
|
||||
cout << "Start position: " << vecGeo << endl;
|
||||
cout << "End position: " << vecGeo2 << endl;
|
||||
|
||||
timer.start();
|
||||
|
||||
// CVectorGeo pos, double groundVelocity, double heading, double pitch, double bank
|
||||
CAngle zeroAngle(0, CAngleUnit::deg());
|
||||
CSpeed speed(20, CSpeedUnit::kts());
|
||||
CCoordinateNed ned;
|
||||
|
||||
ned = interpolator.pushUpdate(vecGeo, speed, CHeading(80, CHeading::True, CAngleUnit::deg()), zeroAngle, zeroAngle);
|
||||
cout << "Interpolator NED 1: " << ned << endl;
|
||||
ned = interpolator.pushUpdate(vecGeo2, speed, CHeading(250, CHeading::True, CAngleUnit::deg()), zeroAngle, zeroAngle);
|
||||
cout << "Interpolator NED 2: " << ned << endl;
|
||||
|
||||
double duration = timer.nsecsElapsed();
|
||||
TPlaneState teststate;
|
||||
timer.restart();
|
||||
interpolator.stateNow(&teststate);
|
||||
|
||||
CCoordinateEcef pos = teststate.position;
|
||||
CVector3D vel = teststate.velocity;
|
||||
ned = teststate.velNED;
|
||||
|
||||
duration = timer.nsecsElapsed();
|
||||
|
||||
CCoordinateTransformation::toGeodetic(pos);
|
||||
timer.restart();
|
||||
|
||||
CCoordinateGeodetic resultGeo = CCoordinateTransformation::toGeodetic(pos);
|
||||
duration = timer.nsecsElapsed();
|
||||
|
||||
cout << "End position: " << resultGeo << endl;
|
||||
cout << "End velocity: " << vel << endl;
|
||||
cout << "End " << ned << endl;
|
||||
cout << "Heading: ";
|
||||
cout << teststate.orientation.heading.switchUnit(CAngleUnit::deg()) << endl;
|
||||
cout << endl;
|
||||
cout << duration << " nanoseconds" << endl;
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
include (../../config.pri)
|
||||
include (../../build.pri)
|
||||
|
||||
QT += core dbus network
|
||||
|
||||
TARGET = sample_interpolator
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
CONFIG += blackmisc blackcore
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
CONFIG += console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
DEPENDPATH += . ../../src
|
||||
INCLUDEPATH += . ../../src
|
||||
|
||||
SOURCES += *.cpp
|
||||
|
||||
win32:!win32-g++*: PRE_TARGETDEPS += ../../lib/blackmisc.lib \
|
||||
../../lib/blackcore.lib
|
||||
else: PRE_TARGETDEPS += ../../lib/libblackmisc.a \
|
||||
../../lib/libblackcore.a
|
||||
|
||||
DESTDIR = ../../bin
|
||||
|
||||
include (../../libraries.pri)
|
||||
Reference in New Issue
Block a user