mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
GPSPosition: Add new UAVObject for GPSPosition
This object is not yet populated or used. This will soon hold the raw position data from the GPS receiver. PositionActual will be converted to hold the computed position from the AHRS. Contents of this object are still subject to change. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1355 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
7f85143bd2
commit
635df28c34
@ -148,6 +148,7 @@ SRC += $(OPUAVOBJ)/exampleobject2.c
|
||||
SRC += $(OPUAVOBJ)/examplesettings.c
|
||||
SRC += $(OPUAVOBJ)/objectpersistence.c
|
||||
SRC += $(OPUAVOBJ)/positionactual.c
|
||||
SRC += $(OPUAVOBJ)/gpsposition.c
|
||||
SRC += $(OPUAVOBJ)/gcstelemetrystats.c
|
||||
SRC += $(OPUAVOBJ)/flighttelemetrystats.c
|
||||
SRC += $(OPUAVOBJ)/systemstats.c
|
||||
|
102
flight/OpenPilot/UAVObjects/gpsposition.c
Normal file
102
flight/OpenPilot/UAVObjects/gpsposition.c
Normal file
@ -0,0 +1,102 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsposition.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the GPSPosition object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: gpsposition.xml.
|
||||
* This is an automatically generated file.
|
||||
* DO NOT modify manually.
|
||||
*
|
||||
* @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 "openpilot.h"
|
||||
#include "gpsposition.h"
|
||||
|
||||
// Private variables
|
||||
static UAVObjHandle handle;
|
||||
|
||||
// Private functions
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId);
|
||||
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
*/
|
||||
int32_t GPSPositionInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(GPSPOSITION_OBJID, GPSPOSITION_NAME, GPSPOSITION_METANAME, 0,
|
||||
GPSPOSITION_ISSINGLEINST, GPSPOSITION_ISSETTINGS, GPSPOSITION_NUMBYTES, &setDefaults);
|
||||
|
||||
// Done
|
||||
if (handle != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
{
|
||||
GPSPositionData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(GPSPositionData));
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.access = ACCESS_READWRITE;
|
||||
metadata.gcsAccess = ACCESS_READWRITE;
|
||||
metadata.telemetryAcked = 0;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.telemetryUpdatePeriod = 1000;
|
||||
metadata.gcsTelemetryAcked = 0;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_PERIODIC;
|
||||
metadata.loggingUpdatePeriod = 1000;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle GPSPositionHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
|
94
flight/OpenPilot/UAVObjects/inc/gpsposition.h
Normal file
94
flight/OpenPilot/UAVObjects/inc/gpsposition.h
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsposition.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the GPSPosition object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: gpsposition.xml.
|
||||
* This is an automatically generated file.
|
||||
* DO NOT modify manually.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
|
||||
#ifndef GPSPOSITION_H
|
||||
#define GPSPOSITION_H
|
||||
|
||||
// Object constants
|
||||
#define GPSPOSITION_OBJID 3041480770U
|
||||
#define GPSPOSITION_NAME "GPSPosition"
|
||||
#define GPSPOSITION_METANAME "GPSPositionMeta"
|
||||
#define GPSPOSITION_ISSINGLEINST 1
|
||||
#define GPSPOSITION_ISSETTINGS 0
|
||||
#define GPSPOSITION_NUMBYTES sizeof(GPSPositionData)
|
||||
|
||||
// Object access macros
|
||||
#define GPSPositionGet(dataOut) UAVObjGetData(GPSPositionHandle(), dataOut)
|
||||
#define GPSPositionSet(dataIn) UAVObjSetData(GPSPositionHandle(), dataIn)
|
||||
#define GPSPositionInstGet(instId, dataOut) UAVObjGetInstanceData(GPSPositionHandle(), instId, dataOut)
|
||||
#define GPSPositionInstSet(instId, dataIn) UAVObjSetInstanceData(GPSPositionHandle(), instId, dataIn)
|
||||
#define GPSPositionConnectQueue(queue) UAVObjConnectQueue(GPSPositionHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define GPSPositionConnectCallback(cb) UAVObjConnectCallback(GPSPositionHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define GPSPositionCreateInstance() UAVObjCreateInstance(GPSPositionHandle())
|
||||
#define GPSPositionRequestUpdate() UAVObjRequestUpdate(GPSPositionHandle())
|
||||
#define GPSPositionRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(GPSPositionHandle(), instId)
|
||||
#define GPSPositionUpdated() UAVObjUpdated(GPSPositionHandle())
|
||||
#define GPSPositionInstUpdated(instId) UAVObjUpdated(GPSPositionHandle(), instId)
|
||||
#define GPSPositionGetMetadata(dataOut) UAVObjGetMetadata(GPSPositionHandle(), dataOut)
|
||||
#define GPSPositionSetMetadata(dataIn) UAVObjSetMetadata(GPSPositionHandle(), dataIn)
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
uint8_t Status;
|
||||
int32_t Latitude;
|
||||
int32_t Longitude;
|
||||
float Altitude;
|
||||
float GeoidSeparation;
|
||||
float Heading;
|
||||
float Groundspeed;
|
||||
int8_t Satellites;
|
||||
float PDOP;
|
||||
float HDOP;
|
||||
float VDOP;
|
||||
|
||||
} __attribute__((packed)) GPSPositionData;
|
||||
|
||||
// Field information
|
||||
// Field Status information
|
||||
/* Enumeration options for field Status */
|
||||
typedef enum { GPSPOSITION_STATUS_NOGPS=0, GPSPOSITION_STATUS_NOFIX=1, GPSPOSITION_STATUS_FIX2D=2, GPSPOSITION_STATUS_FIX3D=3 } GPSPositionStatusOptions;
|
||||
// Field Latitude information
|
||||
// Field Longitude information
|
||||
// Field Altitude information
|
||||
// Field GeoidSeparation information
|
||||
// Field Heading information
|
||||
// Field Groundspeed information
|
||||
// Field Satellites information
|
||||
// Field PDOP information
|
||||
// Field HDOP information
|
||||
// Field VDOP information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t GPSPositionInitialize();
|
||||
UAVObjHandle GPSPositionHandle();
|
||||
|
||||
#endif // GPSPOSITION_H
|
@ -44,6 +44,7 @@
|
||||
#include "flightsituationactual.h"
|
||||
#include "flighttelemetrystats.h"
|
||||
#include "gcstelemetrystats.h"
|
||||
#include "gpsposition.h"
|
||||
#include "homelocation.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "manualcontrolsettings.h"
|
||||
@ -80,6 +81,7 @@ void UAVObjectsInitializeAll()
|
||||
FlightSituationActualInitialize();
|
||||
FlightTelemetryStatsInitialize();
|
||||
GCSTelemetryStatsInitialize();
|
||||
GPSPositionInitialize();
|
||||
HomeLocationInitialize();
|
||||
ManualControlCommandInitialize();
|
||||
ManualControlSettingsInitialize();
|
||||
|
163
ground/src/plugins/uavobjects/gpsposition.cpp
Normal file
163
ground/src/plugins/uavobjects/gpsposition.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsposition.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
|
||||
* @{
|
||||
*
|
||||
* @note Object definition file: gpsposition.xml.
|
||||
* This is an automatically generated file.
|
||||
* DO NOT modify manually.
|
||||
*
|
||||
* @brief The UAVUObjects GCS plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "gpsposition.h"
|
||||
#include "uavobjectfield.h"
|
||||
|
||||
const QString GPSPosition::NAME = QString("GPSPosition");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
GPSPosition::GPSPosition(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
QStringList StatusElemNames;
|
||||
StatusElemNames.append("0");
|
||||
QStringList StatusEnumOptions;
|
||||
StatusEnumOptions.append("NoGPS");
|
||||
StatusEnumOptions.append("NoFix");
|
||||
StatusEnumOptions.append("Fix2D");
|
||||
StatusEnumOptions.append("Fix3D");
|
||||
fields.append( new UAVObjectField(QString("Status"), QString(""), UAVObjectField::ENUM, StatusElemNames, StatusEnumOptions) );
|
||||
QStringList LatitudeElemNames;
|
||||
LatitudeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Latitude"), QString("degrees x 10^-7"), UAVObjectField::INT32, LatitudeElemNames, QStringList()) );
|
||||
QStringList LongitudeElemNames;
|
||||
LongitudeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Longitude"), QString("degrees x 10^-7"), UAVObjectField::INT32, LongitudeElemNames, QStringList()) );
|
||||
QStringList AltitudeElemNames;
|
||||
AltitudeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Altitude"), QString("meters"), UAVObjectField::FLOAT32, AltitudeElemNames, QStringList()) );
|
||||
QStringList GeoidSeparationElemNames;
|
||||
GeoidSeparationElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("GeoidSeparation"), QString("meters"), UAVObjectField::FLOAT32, GeoidSeparationElemNames, QStringList()) );
|
||||
QStringList HeadingElemNames;
|
||||
HeadingElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Heading"), QString("degrees"), UAVObjectField::FLOAT32, HeadingElemNames, QStringList()) );
|
||||
QStringList GroundspeedElemNames;
|
||||
GroundspeedElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Groundspeed"), QString("m/s"), UAVObjectField::FLOAT32, GroundspeedElemNames, QStringList()) );
|
||||
QStringList SatellitesElemNames;
|
||||
SatellitesElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Satellites"), QString(""), UAVObjectField::INT8, SatellitesElemNames, QStringList()) );
|
||||
QStringList PDOPElemNames;
|
||||
PDOPElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("PDOP"), QString(""), UAVObjectField::FLOAT32, PDOPElemNames, QStringList()) );
|
||||
QStringList HDOPElemNames;
|
||||
HDOPElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("HDOP"), QString(""), UAVObjectField::FLOAT32, HDOPElemNames, QStringList()) );
|
||||
QStringList VDOPElemNames;
|
||||
VDOPElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("VDOP"), QString(""), UAVObjectField::FLOAT32, VDOPElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default metadata for this object
|
||||
*/
|
||||
UAVObject::Metadata GPSPosition::getDefaultMetadata()
|
||||
{
|
||||
UAVObject::Metadata metadata;
|
||||
metadata.flightAccess = ACCESS_READWRITE;
|
||||
metadata.gcsAccess = ACCESS_READWRITE;
|
||||
metadata.gcsTelemetryAcked = 0;
|
||||
metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_MANUAL;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.flightTelemetryAcked = 0;
|
||||
metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||
metadata.flightTelemetryUpdatePeriod = 1000;
|
||||
metadata.loggingUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||
metadata.loggingUpdatePeriod = 1000;
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
void GPSPosition::setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object data fields
|
||||
*/
|
||||
GPSPosition::DataFields GPSPosition::getData()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
*/
|
||||
void GPSPosition::setData(const DataFields& data)
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
// Get metadata
|
||||
Metadata mdata = getMetadata();
|
||||
// Update object if the access mode permits
|
||||
if ( mdata.gcsAccess == ACCESS_READWRITE )
|
||||
{
|
||||
this->data = data;
|
||||
emit objectUpdatedAuto(this); // trigger object updated event
|
||||
emit objectUpdated(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of this object, a new instance ID must be specified.
|
||||
* Do not use this function directly to create new instances, the
|
||||
* UAVObjectManager should be used instead.
|
||||
*/
|
||||
UAVDataObject* GPSPosition::clone(quint32 instID)
|
||||
{
|
||||
GPSPosition* obj = new GPSPosition();
|
||||
obj->initialize(instID, this->getMetaObject());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
GPSPosition* GPSPosition::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
||||
{
|
||||
return dynamic_cast<GPSPosition*>(objMngr->getObject(GPSPosition::OBJID, instID));
|
||||
}
|
100
ground/src/plugins/uavobjects/gpsposition.h
Normal file
100
ground/src/plugins/uavobjects/gpsposition.h
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file gpsposition.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup UAVObjectsPlugin UAVObjects Plugin
|
||||
* @{
|
||||
*
|
||||
* @note Object definition file: gpsposition.xml.
|
||||
* This is an automatically generated file.
|
||||
* DO NOT modify manually.
|
||||
*
|
||||
* @brief The UAVUObjects GCS plugin
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 GPSPOSITION_H
|
||||
#define GPSPOSITION_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT GPSPosition: public UAVDataObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Field structure
|
||||
typedef struct {
|
||||
quint8 Status;
|
||||
qint32 Latitude;
|
||||
qint32 Longitude;
|
||||
float Altitude;
|
||||
float GeoidSeparation;
|
||||
float Heading;
|
||||
float Groundspeed;
|
||||
qint8 Satellites;
|
||||
float PDOP;
|
||||
float HDOP;
|
||||
float VDOP;
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Field information
|
||||
// Field Status information
|
||||
/* Enumeration options for field Status */
|
||||
typedef enum { STATUS_NOGPS=0, STATUS_NOFIX=1, STATUS_FIX2D=2, STATUS_FIX3D=3 } StatusOptions;
|
||||
// Field Latitude information
|
||||
// Field Longitude information
|
||||
// Field Altitude information
|
||||
// Field GeoidSeparation information
|
||||
// Field Heading information
|
||||
// Field Groundspeed information
|
||||
// Field Satellites information
|
||||
// Field PDOP information
|
||||
// Field HDOP information
|
||||
// Field VDOP information
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 3041480770U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 0;
|
||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
||||
|
||||
// Functions
|
||||
GPSPosition();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
|
||||
static GPSPosition* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
||||
|
||||
private:
|
||||
DataFields data;
|
||||
|
||||
void setDefaultFieldValues();
|
||||
|
||||
};
|
||||
|
||||
#endif // GPSPOSITION_H
|
190
ground/src/plugins/uavobjects/gpsposition.py
Normal file
190
ground/src/plugins/uavobjects/gpsposition.py
Normal file
@ -0,0 +1,190 @@
|
||||
##
|
||||
##############################################################################
|
||||
#
|
||||
# @file gpsposition.py
|
||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
# @brief Implementation of the GPSPosition object. This file has been
|
||||
# automatically generated by the UAVObjectGenerator.
|
||||
#
|
||||
# @note Object definition file: gpsposition.xml.
|
||||
# This is an automatically generated file.
|
||||
# DO NOT modify manually.
|
||||
#
|
||||
# @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
|
||||
#
|
||||
|
||||
|
||||
import uavobject
|
||||
|
||||
import struct
|
||||
from collections import namedtuple
|
||||
|
||||
# This is a list of instances of the data fields contained in this object
|
||||
_fields = [ \
|
||||
uavobject.UAVObjectField(
|
||||
'Status',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'NoGPS',
|
||||
'1' : 'NoFix',
|
||||
'2' : 'Fix2D',
|
||||
'3' : 'Fix3D',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Latitude',
|
||||
'i',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Longitude',
|
||||
'i',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Altitude',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'GeoidSeparation',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Heading',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Groundspeed',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Satellites',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'PDOP',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'HDOP',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'VDOP',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class GPSPosition(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 3041480770
|
||||
NAME = "GPSPosition"
|
||||
METANAME = "GPSPositionMeta"
|
||||
ISSINGLEINST = 1
|
||||
ISSETTINGS = 0
|
||||
|
||||
def __init__(self):
|
||||
uavobject.UAVObject.__init__(self,
|
||||
self.OBJID,
|
||||
self.NAME,
|
||||
self.METANAME,
|
||||
0,
|
||||
self.ISSINGLEINST)
|
||||
|
||||
for f in _fields:
|
||||
self.add_field(f)
|
||||
|
||||
def __str__(self):
|
||||
s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n"
|
||||
% (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format))
|
||||
for f in self.get_tuple()._fields:
|
||||
s += ("\t%s\n" % f)
|
||||
return (s)
|
||||
|
||||
def main():
|
||||
# Instantiate the object and dump out some interesting info
|
||||
x = GPSPosition()
|
||||
print (x)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#import pdb ; pdb.run('main()')
|
||||
main()
|
@ -36,6 +36,7 @@ HEADERS += uavobjects_global.h \
|
||||
actuatorcommand.h \
|
||||
navigationsettings.h \
|
||||
navigationdesired.h \
|
||||
gpsposition.h \
|
||||
positionactual.h \
|
||||
flightbatterystate.h \
|
||||
homelocation.h
|
||||
@ -71,6 +72,7 @@ SOURCES += uavobject.cpp \
|
||||
actuatorcommand.cpp \
|
||||
navigationsettings.cpp \
|
||||
navigationdesired.cpp \
|
||||
gpsposition.cpp \
|
||||
positionactual.cpp \
|
||||
flightbatterystate.cpp \
|
||||
homelocation.cpp
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "flightsituationactual.h"
|
||||
#include "flighttelemetrystats.h"
|
||||
#include "gcstelemetrystats.h"
|
||||
#include "gpsposition.h"
|
||||
#include "homelocation.h"
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "manualcontrolsettings.h"
|
||||
@ -82,6 +83,7 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
|
||||
objMngr->registerObject( new FlightSituationActual() );
|
||||
objMngr->registerObject( new FlightTelemetryStats() );
|
||||
objMngr->registerObject( new GCSTelemetryStats() );
|
||||
objMngr->registerObject( new GPSPosition() );
|
||||
objMngr->registerObject( new HomeLocation() );
|
||||
objMngr->registerObject( new ManualControlCommand() );
|
||||
objMngr->registerObject( new ManualControlSettings() );
|
||||
|
19
ground/src/shared/uavobjectdefinition/gpsposition.xml
Normal file
19
ground/src/shared/uavobjectdefinition/gpsposition.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<xml>
|
||||
<object name="GPSPosition" singleinstance="true" settings="false">
|
||||
<field name="Status" units="" type="enum" elements="1" options="NoGPS,NoFix,Fix2D,Fix3D"/>
|
||||
<field name="Latitude" units="degrees x 10^-7" type="int32" elements="1"/>
|
||||
<field name="Longitude" units="degrees x 10^-7" type="int32" elements="1"/>
|
||||
<field name="Altitude" units="meters" type="float" elements="1"/>
|
||||
<field name="GeoidSeparation" units="meters" type="float" elements="1"/>
|
||||
<field name="Heading" units="degrees" type="float" elements="1"/>
|
||||
<field name="Groundspeed" units="m/s" type="float" elements="1"/>
|
||||
<field name="Satellites" units="" type="int8" elements="1"/>
|
||||
<field name="PDOP" units="" type="float" elements="1"/>
|
||||
<field name="HDOP" units="" type="float" elements="1"/>
|
||||
<field name="VDOP" units="" type="float" elements="1"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
||||
<logging updatemode="periodic" period="1000"/>
|
||||
</object>
|
||||
</xml>
|
Loading…
Reference in New Issue
Block a user