1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Added a home location utility

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2825 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2011-02-21 11:08:56 +00:00 committed by pip
parent 5f2c502172
commit 7a34e25956
3 changed files with 127 additions and 4 deletions

View File

@ -0,0 +1,60 @@
/**
******************************************************************************
*
* @file homelocationutil.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Utilities to find the location of openpilot GCS files:
* - Plugins Share directory path
*
* @brief Home location utility functions
*
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "homelocationutil.h"
#include <stdint.h>
#include <QDebug>
#include <QDateTime>
#include "coordinateconversions.h"
#include "worldmagmodel.h"
namespace Utils {
HomeLocationUtil::HomeLocationUtil()
{
// Initialize();
}
int HomeLocationUtil::getDetails(double LLA[3], double ECEF[3], double RNE[9], double Be[3])
{
QDateTime dt = QDateTime::currentDateTime().toUTC();
// double current_altitude = obj->getField("Altitude")->getDouble();
CoordinateConversions().LLA2ECEF(LLA, ECEF);
CoordinateConversions().RneFromLLA(LLA, (double (*)[3])RNE);
if (WorldMagModel().GetMagVector(LLA, dt.date().month(), dt.date().day(), dt.date().year(), Be) < 0)
return -1;
return 0; // OK
}
}

View File

@ -0,0 +1,53 @@
/**
******************************************************************************
*
* @file homelocationutil.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
* @brief
* @see The GNU Public License (GPL) Version 3
* @defgroup
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef HOMELOCATIONUTIL_H
#define HOMELOCATIONUTIL_H
#include "utils_global.h"
// ******************************
namespace Utils {
class QTCREATOR_UTILS_EXPORT HomeLocationUtil
{
public:
HomeLocationUtil();
int getDetails(double LLA[3], double ECEF[3], double RNE[9], double Be[3]);
private:
};
}
// ******************************
#endif

View File

@ -1,9 +1,13 @@
TEMPLATE = lib
TARGET = Utils
QT += gui \
network
DEFINES += QTCREATOR_UTILS_LIB
include(../../openpilotgcslibrary.pri)
SOURCES += reloadpromptutils.cpp \
settingsutils.cpp \
filesearch.cpp \
@ -39,14 +43,17 @@ SOURCES += reloadpromptutils.cpp \
detailswidget.cpp \
coordinateconversions.cpp \
pathutils.cpp \
worldmagmodel.cpp
win32 {
worldmagmodel.cpp \
homelocationutil.cpp
win32 {
SOURCES += abstractprocess_win.cpp \
consoleprocess_win.cpp \
winutils.cpp
HEADERS += winutils.h
}
else:SOURCES += consoleprocess_unix.cpp
HEADERS += utils_global.h \
reloadpromptutils.h \
settingsutils.h \
@ -86,10 +93,13 @@ HEADERS += utils_global.h \
detailswidget.h \
coordinateconversions.h \
pathutils.h \
worldmagmodel.h
worldmagmodel.h \
homelocationutil.h
FORMS += filewizardpage.ui \
projectintropage.ui \
newclasswidget.ui \
submiteditorwidget.ui \
checkablemessagebox.ui
checkablemessagebox.ui
RESOURCES += utils.qrc