mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Ground/UAVObjets: Add missing files for AHRSStatus2
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1833 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
2a93f35807
commit
3854541798
192
ground/src/plugins/uavobjects/ahrsstatus2.cpp
Normal file
192
ground/src/plugins/uavobjects/ahrsstatus2.cpp
Normal file
@ -0,0 +1,192 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file ahrsstatus2.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: ahrsstatus2.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 "ahrsstatus2.h"
|
||||
#include "uavobjectfield.h"
|
||||
|
||||
const QString AhrsStatus2::NAME = QString("AhrsStatus2");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
AhrsStatus2::AhrsStatus2(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
QStringList SerialNumberElemNames;
|
||||
SerialNumberElemNames.append("0");
|
||||
SerialNumberElemNames.append("1");
|
||||
SerialNumberElemNames.append("2");
|
||||
SerialNumberElemNames.append("3");
|
||||
SerialNumberElemNames.append("4");
|
||||
SerialNumberElemNames.append("5");
|
||||
SerialNumberElemNames.append("6");
|
||||
SerialNumberElemNames.append("7");
|
||||
fields.append( new UAVObjectField(QString("SerialNumber"), QString("n/a"), UAVObjectField::UINT8, SerialNumberElemNames, QStringList()) );
|
||||
QStringList CPULoadElemNames;
|
||||
CPULoadElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("CPULoad"), QString("count"), UAVObjectField::UINT8, CPULoadElemNames, QStringList()) );
|
||||
QStringList IdleTimePerCyleElemNames;
|
||||
IdleTimePerCyleElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("IdleTimePerCyle"), QString("10x ms"), UAVObjectField::UINT8, IdleTimePerCyleElemNames, QStringList()) );
|
||||
QStringList RunningTimePerCyleElemNames;
|
||||
RunningTimePerCyleElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("RunningTimePerCyle"), QString("10x ms"), UAVObjectField::UINT8, RunningTimePerCyleElemNames, QStringList()) );
|
||||
QStringList DroppedUpdatesElemNames;
|
||||
DroppedUpdatesElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("DroppedUpdates"), QString("count"), UAVObjectField::UINT8, DroppedUpdatesElemNames, QStringList()) );
|
||||
QStringList AlgorithmSetElemNames;
|
||||
AlgorithmSetElemNames.append("0");
|
||||
QStringList AlgorithmSetEnumOptions;
|
||||
AlgorithmSetEnumOptions.append("FALSE");
|
||||
AlgorithmSetEnumOptions.append("TRUE");
|
||||
fields.append( new UAVObjectField(QString("AlgorithmSet"), QString(""), UAVObjectField::ENUM, AlgorithmSetElemNames, AlgorithmSetEnumOptions) );
|
||||
QStringList CalibrationSetElemNames;
|
||||
CalibrationSetElemNames.append("0");
|
||||
QStringList CalibrationSetEnumOptions;
|
||||
CalibrationSetEnumOptions.append("FALSE");
|
||||
CalibrationSetEnumOptions.append("TRUE");
|
||||
fields.append( new UAVObjectField(QString("CalibrationSet"), QString(""), UAVObjectField::ENUM, CalibrationSetElemNames, CalibrationSetEnumOptions) );
|
||||
QStringList HomeSetElemNames;
|
||||
HomeSetElemNames.append("0");
|
||||
QStringList HomeSetEnumOptions;
|
||||
HomeSetEnumOptions.append("FALSE");
|
||||
HomeSetEnumOptions.append("TRUE");
|
||||
fields.append( new UAVObjectField(QString("HomeSet"), QString(""), UAVObjectField::ENUM, HomeSetElemNames, HomeSetEnumOptions) );
|
||||
QStringList LinkRunningElemNames;
|
||||
LinkRunningElemNames.append("0");
|
||||
QStringList LinkRunningEnumOptions;
|
||||
LinkRunningEnumOptions.append("FALSE");
|
||||
LinkRunningEnumOptions.append("TRUE");
|
||||
fields.append( new UAVObjectField(QString("LinkRunning"), QString(""), UAVObjectField::ENUM, LinkRunningElemNames, LinkRunningEnumOptions) );
|
||||
QStringList AhrsKickstartsElemNames;
|
||||
AhrsKickstartsElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("AhrsKickstarts"), QString("count"), UAVObjectField::UINT8, AhrsKickstartsElemNames, QStringList()) );
|
||||
QStringList AhrsCrcErrorsElemNames;
|
||||
AhrsCrcErrorsElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("AhrsCrcErrors"), QString("count"), UAVObjectField::UINT8, AhrsCrcErrorsElemNames, QStringList()) );
|
||||
QStringList AhrsRetriesElemNames;
|
||||
AhrsRetriesElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("AhrsRetries"), QString("count"), UAVObjectField::UINT8, AhrsRetriesElemNames, QStringList()) );
|
||||
QStringList AhrsInvalidPacketsElemNames;
|
||||
AhrsInvalidPacketsElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("AhrsInvalidPackets"), QString("count"), UAVObjectField::UINT8, AhrsInvalidPacketsElemNames, QStringList()) );
|
||||
QStringList OpCrcErrorsElemNames;
|
||||
OpCrcErrorsElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("OpCrcErrors"), QString("count"), UAVObjectField::UINT8, OpCrcErrorsElemNames, QStringList()) );
|
||||
QStringList OpRetriesElemNames;
|
||||
OpRetriesElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("OpRetries"), QString("count"), UAVObjectField::UINT8, OpRetriesElemNames, QStringList()) );
|
||||
QStringList OpInvalidPacketsElemNames;
|
||||
OpInvalidPacketsElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("OpInvalidPackets"), QString("count"), UAVObjectField::UINT8, OpInvalidPacketsElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default metadata for this object
|
||||
*/
|
||||
UAVObject::Metadata AhrsStatus2::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 AhrsStatus2::setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object data fields
|
||||
*/
|
||||
AhrsStatus2::DataFields AhrsStatus2::getData()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
*/
|
||||
void AhrsStatus2::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* AhrsStatus2::clone(quint32 instID)
|
||||
{
|
||||
AhrsStatus2* obj = new AhrsStatus2();
|
||||
obj->initialize(instID, this->getMetaObject());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
AhrsStatus2* AhrsStatus2::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
||||
{
|
||||
return dynamic_cast<AhrsStatus2*>(objMngr->getObject(AhrsStatus2::OBJID, instID));
|
||||
}
|
118
ground/src/plugins/uavobjects/ahrsstatus2.h
Normal file
118
ground/src/plugins/uavobjects/ahrsstatus2.h
Normal file
@ -0,0 +1,118 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file ahrsstatus2.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: ahrsstatus2.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 AHRSSTATUS2_H
|
||||
#define AHRSSTATUS2_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT AhrsStatus2: public UAVDataObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Field structure
|
||||
typedef struct {
|
||||
quint8 SerialNumber[8];
|
||||
quint8 CPULoad;
|
||||
quint8 IdleTimePerCyle;
|
||||
quint8 RunningTimePerCyle;
|
||||
quint8 DroppedUpdates;
|
||||
quint8 AlgorithmSet;
|
||||
quint8 CalibrationSet;
|
||||
quint8 HomeSet;
|
||||
quint8 LinkRunning;
|
||||
quint8 AhrsKickstarts;
|
||||
quint8 AhrsCrcErrors;
|
||||
quint8 AhrsRetries;
|
||||
quint8 AhrsInvalidPackets;
|
||||
quint8 OpCrcErrors;
|
||||
quint8 OpRetries;
|
||||
quint8 OpInvalidPackets;
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Field information
|
||||
// Field SerialNumber information
|
||||
/* Number of elements for field SerialNumber */
|
||||
static const quint32 SERIALNUMBER_NUMELEM = 8;
|
||||
// Field CPULoad information
|
||||
// Field IdleTimePerCyle information
|
||||
// Field RunningTimePerCyle information
|
||||
// Field DroppedUpdates information
|
||||
// Field AlgorithmSet information
|
||||
/* Enumeration options for field AlgorithmSet */
|
||||
typedef enum { ALGORITHMSET_FALSE=0, ALGORITHMSET_TRUE=1 } AlgorithmSetOptions;
|
||||
// Field CalibrationSet information
|
||||
/* Enumeration options for field CalibrationSet */
|
||||
typedef enum { CALIBRATIONSET_FALSE=0, CALIBRATIONSET_TRUE=1 } CalibrationSetOptions;
|
||||
// Field HomeSet information
|
||||
/* Enumeration options for field HomeSet */
|
||||
typedef enum { HOMESET_FALSE=0, HOMESET_TRUE=1 } HomeSetOptions;
|
||||
// Field LinkRunning information
|
||||
/* Enumeration options for field LinkRunning */
|
||||
typedef enum { LINKRUNNING_FALSE=0, LINKRUNNING_TRUE=1 } LinkRunningOptions;
|
||||
// Field AhrsKickstarts information
|
||||
// Field AhrsCrcErrors information
|
||||
// Field AhrsRetries information
|
||||
// Field AhrsInvalidPackets information
|
||||
// Field OpCrcErrors information
|
||||
// Field OpRetries information
|
||||
// Field OpInvalidPackets information
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 805003662U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 0;
|
||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
||||
|
||||
// Functions
|
||||
AhrsStatus2();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
|
||||
static AhrsStatus2* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
||||
|
||||
private:
|
||||
DataFields data;
|
||||
|
||||
void setDefaultFieldValues();
|
||||
|
||||
};
|
||||
|
||||
#endif // AHRSSTATUS2_H
|
251
ground/src/plugins/uavobjects/ahrsstatus2.py
Normal file
251
ground/src/plugins/uavobjects/ahrsstatus2.py
Normal file
@ -0,0 +1,251 @@
|
||||
##
|
||||
##############################################################################
|
||||
#
|
||||
# @file ahrsstatus2.py
|
||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
# @brief Implementation of the AhrsStatus2 object. This file has been
|
||||
# automatically generated by the UAVObjectGenerator.
|
||||
#
|
||||
# @note Object definition file: ahrsstatus2.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(
|
||||
'SerialNumber',
|
||||
'B',
|
||||
8,
|
||||
[
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'CPULoad',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'IdleTimePerCyle',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'RunningTimePerCyle',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'DroppedUpdates',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'AlgorithmSet',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'FALSE',
|
||||
'1' : 'TRUE',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'CalibrationSet',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'FALSE',
|
||||
'1' : 'TRUE',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'HomeSet',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'FALSE',
|
||||
'1' : 'TRUE',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'LinkRunning',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'FALSE',
|
||||
'1' : 'TRUE',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'AhrsKickstarts',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'AhrsCrcErrors',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'AhrsRetries',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'AhrsInvalidPackets',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'OpCrcErrors',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'OpRetries',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'OpInvalidPackets',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class AhrsStatus2(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 805003662
|
||||
NAME = "AhrsStatus2"
|
||||
METANAME = "AhrsStatus2Meta"
|
||||
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 = AhrsStatus2()
|
||||
print (x)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#import pdb ; pdb.run('main()')
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user