2.在同步时间时现在会将起飞点的海拔高度写回到配置文件/home/data/Settings/MainSettings.ini键值为WBACK/HeightOfHomePoint 3.现在的高度回调函数以及获取函数调整为了DJI_FC_SUBSCRIPTION_TOPIC_ALTITUDE_FUSED。
204 lines
6.8 KiB
C++
204 lines
6.8 KiB
C++
// Project_Grixis.cpp: 定义应用程序的入口点。
|
|
//
|
|
|
|
#include "Project_Grixis.h"
|
|
#include <dji_logger.h>
|
|
#include "pch.h"
|
|
#include "dji_waypoint_v2.h"
|
|
#include "dji_fc_subscription.h"
|
|
#include "dji_logger.h"
|
|
#include "dji_platform.h"
|
|
#include "math.h"
|
|
#include "ConfigParser_M300RTK.h"
|
|
#include "VehicleController.h"
|
|
#include "Widget_M300RTK.h"
|
|
#include "MainAcqThread.h"
|
|
#include "DataFileManager.h"
|
|
#include "Logger.h"
|
|
#include "EGM96/EGM96.h"
|
|
|
|
using namespace std;
|
|
|
|
int main()
|
|
{
|
|
int argc = 0;
|
|
QCoreApplication Grixis(argc, NULL);
|
|
|
|
QEventLoop qeLoop;
|
|
QTimer::singleShot(15000, &qeLoop, SLOT(quit()));
|
|
qeLoop.exec();
|
|
|
|
|
|
QT_LOG::ZZ_InitLogger("/home/data/Log/");
|
|
|
|
CMainAcqThread MainCtrl;
|
|
|
|
MainCtrl.SetupContext();
|
|
MainCtrl.StartUp();
|
|
|
|
Grixis.exec();
|
|
|
|
//////////////////////////////////////////////////////////////////////////test EGM96
|
|
// qDebug() << "entering time:" << QTime::currentTime();
|
|
// QTime currentTime;
|
|
// QTime lastTime;
|
|
// int elapsed = 0;
|
|
//
|
|
// if (lastTime == QTime())
|
|
// {
|
|
// lastTime = QTime::currentTime();
|
|
// }
|
|
// else
|
|
// {
|
|
// currentTime = QTime::currentTime();
|
|
// elapsed = lastTime.msecsTo(currentTime);
|
|
// lastTime = QTime::currentTime();
|
|
// }
|
|
//
|
|
// qDebug() << "Run.elapsed =" << elapsed << "ms";
|
|
//
|
|
// for (int i=0;i<10;i++)
|
|
// {
|
|
//
|
|
// double a = egm96_compute_altitude_offset(32.34116099116942, 87.55318631548599);
|
|
// qDebug() << a;
|
|
// }
|
|
//
|
|
//
|
|
// qDebug() << "leave time:" << QTime::currentTime();
|
|
//////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////Gas test
|
|
// IrisSensor_Gas_P0 m_testgas;
|
|
// unsigned long ulco2, ulh20;
|
|
// float f1, f2, f3;
|
|
// m_testgas.Initialize("/dev/ttyS1");
|
|
// while (1)
|
|
// {
|
|
// m_testgas.GetMeasuredData(ulco2, ulh20, f1, f2, f3);
|
|
// qDebug() << ulco2 << ulh20;
|
|
// qDebug() << f1 << f2 << f3;
|
|
// QEventLoop qeLoop;
|
|
// QTimer::singleShot(1000, &qeLoop, SLOT(quit()));
|
|
// qeLoop.exec();
|
|
// }
|
|
////////////////////////////////////////////////////WDA test
|
|
// IrisSensor_WDA_P0 test1;
|
|
// test1.Initialize("/dev/ttyS0");
|
|
// float a, b;
|
|
// for (int i=0;i<3;i++)
|
|
// {
|
|
// int iRes = test1.GetSA_NChk(a, b);
|
|
// if (iRes==0)
|
|
// {
|
|
// break;
|
|
// }
|
|
// a = -1;
|
|
// b = -1;
|
|
// }
|
|
////////////////////////////////////////////////////VehicleController test
|
|
//VehicleController vhTest;
|
|
//vhTest.SetupEnvironment_M300RTK();
|
|
//vhTest.StartupPSDK_M300RTK();
|
|
//vhTest.InitSystemDateTime();
|
|
//vhTest.SetupSubscriptions();
|
|
//
|
|
//ZZ_ConfigParser_M300RTK test;
|
|
//test.Initialize("/home/DJI/Settings/");
|
|
//using namespace ZZ::Device::DJI::M300RTK;
|
|
//AppRegInfo reg;
|
|
//HardwareInfo hwi;
|
|
//test.GetParams(reg,hwi);
|
|
//Application application(argc, NULL);
|
|
////////////////////////////////////////////////////VehicleController test
|
|
////////////////////////////////////////////////////Main Acqtest
|
|
////////////////////////////////////////////////////Main Acqtest
|
|
////////////////////////////////////////////////////widget test
|
|
//DjiCore_SetAlias("LICA_IRIS");
|
|
//osalHandler->TaskSleepMs(5000);
|
|
//ZZ_Widget_M300RTK test_Widget;
|
|
//QString qstrUIFilePath();
|
|
//test_Widget.SetUIFilePath("/home/DJI/Widget/",100);
|
|
//test_Widget.PreparteEnvironment();
|
|
//test_Widget.test_UpdatePSDKFloatMessage("this is a test message");
|
|
////////////////////////////////////////////////////widget test
|
|
////////////////////////////////////////////////////FcSubscription test
|
|
// T_DjiReturnCode djiStat = DjiFcSubscription_Init();
|
|
// if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
|
// {
|
|
// qDebug() <<"init data subscription module error.";
|
|
// return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
|
// }
|
|
//
|
|
// djiStat = DjiFcSubscription_SubscribeTopic(DJI_FC_SUBSCRIPTION_TOPIC_GPS_TIME, DJI_DATA_SUBSCRIPTION_TOPIC_1_HZ,NULL);
|
|
// if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
|
// {
|
|
//
|
|
// qDebug() << "Subscribe topic DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT error.";
|
|
// return DJI_ERROR_SYSTEM_MODULE_CODE_UNKNOWN;
|
|
// }
|
|
// osalHandler->TaskSleepMs(1000);
|
|
//
|
|
// T_DjiFcSubscriptionFlightStatus tDjiFlightStatus = { 0 };
|
|
// T_DjiFcSubscriptionGpsTime tGpsTime = {0};
|
|
// T_DjiDataTimestamp timestamp = { 0 };
|
|
// while (1)
|
|
// {
|
|
// osalHandler->TaskSleepMs(2000);
|
|
// djiStat = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GPS_TIME,(uint8_t*)&tGpsTime,sizeof(T_DjiFcSubscriptionGpsTime),×tamp);
|
|
// if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
|
// {
|
|
// qDebug() << "get value of topic DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT error";
|
|
// //USER_LOG_ERROR("get value of topic battery single info index1 error.");
|
|
// }
|
|
// else
|
|
// {
|
|
// qDebug() << "DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT " << tDjiFlightStatus;
|
|
// }
|
|
//
|
|
// djiStat = DjiFcSubscription_GetLatestValueOfTopic(DJI_FC_SUBSCRIPTION_TOPIC_GPS_TIME, (uint8_t*)&tGpsTime, sizeof(T_DjiFcSubscriptionGpsTime), ×tamp);
|
|
// if (djiStat != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS)
|
|
// {
|
|
// qDebug() << "get value of topic DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT error";
|
|
// //USER_LOG_ERROR("get value of topic battery single info index1 error.");
|
|
// }
|
|
// else
|
|
// {
|
|
// qDebug() << "DJI_FC_SUBSCRIPTION_TOPIC_STATUS_FLIGHT " << tGpsTime;
|
|
// }
|
|
// }
|
|
////////////////////////////////////////////////////FcSubscription test
|
|
////////////////////////////////////////////////////other
|
|
// QThread* m_pqDataGrabberThreadHolder = new QThread();
|
|
// CMainAcqThread test;
|
|
// test.moveToThread(m_pqDataGrabberThreadHolder);
|
|
// m_pqDataGrabberThreadHolder->start();
|
|
// test.Slot_StartCapture();
|
|
//
|
|
// QEventLoop qeLoop;
|
|
// QTimer::singleShot(10000, &qeLoop, SLOT(quit()));
|
|
// qeLoop.exec();
|
|
//
|
|
// test.Slot_StopCapture();
|
|
////////////////////////////////////////////////////other
|
|
// while (1)
|
|
// {
|
|
// }
|
|
//osalHandler->TaskSleepMs(50000);
|
|
////////////////////////////////////////////////////waypoint_cb
|
|
// returnCode = DjiWaypointV2_Init();
|
|
// if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
|
// USER_LOG_ERROR("Init waypoint V2 module error, stat:0x%08llX", returnCode);
|
|
// return returnCode;
|
|
// }
|
|
//
|
|
// returnCode = DjiWaypointV2_RegisterMissionEventCallback(DjiTest_WaypointV2EventCallback);
|
|
// if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
|
// USER_LOG_ERROR("Register waypoint V2 event failed, error code: 0x%08X", returnCode);
|
|
// }
|
|
////////////////////////////////////////////////////waypoint_cb
|
|
// DjiTest_WidgetInteractionStartService();
|
|
//cout << "Hello CMake." << endl;
|
|
//return 0;
|
|
|
|
}
|