mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
UAVObjects/VTOLStatus: Remove unused object. Also added update time to
indicate stabilization loop time. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1837 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
0fd9fda7a6
commit
2050864e59
@ -177,7 +177,6 @@ SRC += $(OPUAVOBJ)/attituderaw.c
|
|||||||
SRC += $(OPUAVOBJ)/homelocation.c
|
SRC += $(OPUAVOBJ)/homelocation.c
|
||||||
SRC += $(OPUAVOBJ)/attitudesettings.c
|
SRC += $(OPUAVOBJ)/attitudesettings.c
|
||||||
SRC += $(OPUAVOBJ)/vtolsettings.c
|
SRC += $(OPUAVOBJ)/vtolsettings.c
|
||||||
SRC += $(OPUAVOBJ)/vtolstatus.c
|
|
||||||
SRC += $(OPUAVOBJ)/mixersettings.c
|
SRC += $(OPUAVOBJ)/mixersettings.c
|
||||||
SRC += $(OPUAVOBJ)/mixerstatus.c
|
SRC += $(OPUAVOBJ)/mixerstatus.c
|
||||||
#SRC += $(OPUAVOBJ)/lesstabilizationsettings.c
|
#SRC += $(OPUAVOBJ)/lesstabilizationsettings.c
|
||||||
|
@ -182,6 +182,9 @@ static void stabilizationTask(void* parameters)
|
|||||||
// Setup throttle
|
// Setup throttle
|
||||||
actuatorDesired.Throttle = bound(attitudeDesired.Throttle, stabSettings.ThrottleMin, stabSettings.ThrottleMax);
|
actuatorDesired.Throttle = bound(attitudeDesired.Throttle, stabSettings.ThrottleMin, stabSettings.ThrottleMax);
|
||||||
|
|
||||||
|
// Save dT
|
||||||
|
actuatorDesired.UpdateTime = dT;
|
||||||
|
|
||||||
// Write actuator desired (if not in manual mode)
|
// Write actuator desired (if not in manual mode)
|
||||||
if ( manualControl.FlightMode != MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL )
|
if ( manualControl.FlightMode != MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL )
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#define ACTUATORDESIRED_H
|
#define ACTUATORDESIRED_H
|
||||||
|
|
||||||
// Object constants
|
// Object constants
|
||||||
#define ACTUATORDESIRED_OBJID 123085850U
|
#define ACTUATORDESIRED_OBJID 2919796710U
|
||||||
#define ACTUATORDESIRED_NAME "ActuatorDesired"
|
#define ACTUATORDESIRED_NAME "ActuatorDesired"
|
||||||
#define ACTUATORDESIRED_METANAME "ActuatorDesiredMeta"
|
#define ACTUATORDESIRED_METANAME "ActuatorDesiredMeta"
|
||||||
#define ACTUATORDESIRED_ISSINGLEINST 1
|
#define ACTUATORDESIRED_ISSINGLEINST 1
|
||||||
@ -75,6 +75,7 @@ typedef struct {
|
|||||||
float Pitch;
|
float Pitch;
|
||||||
float Yaw;
|
float Yaw;
|
||||||
float Throttle;
|
float Throttle;
|
||||||
|
float UpdateTime;
|
||||||
|
|
||||||
} __attribute__((packed)) ActuatorDesiredData;
|
} __attribute__((packed)) ActuatorDesiredData;
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ typedef struct {
|
|||||||
// Field Pitch information
|
// Field Pitch information
|
||||||
// Field Yaw information
|
// Field Yaw information
|
||||||
// Field Throttle information
|
// Field Throttle information
|
||||||
|
// Field UpdateTime information
|
||||||
|
|
||||||
|
|
||||||
// Generic interface functions
|
// Generic interface functions
|
||||||
|
@ -1,105 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
|
||||||
* @{
|
|
||||||
* @addtogroup VTOLStatus VTOLStatus
|
|
||||||
* @brief Status for VTOL crafts showing the thrust from each engine
|
|
||||||
*
|
|
||||||
* Autogenerated files and functions for VTOLStatus Object
|
|
||||||
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* @file vtolstatus.h
|
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
||||||
* @brief Implementation of the VTOLStatus object. This file has been
|
|
||||||
* automatically generated by the UAVObjectGenerator.
|
|
||||||
*
|
|
||||||
* @note Object definition file: vtolstatus.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 VTOLSTATUS_H
|
|
||||||
#define VTOLSTATUS_H
|
|
||||||
|
|
||||||
// Object constants
|
|
||||||
#define VTOLSTATUS_OBJID 957086004U
|
|
||||||
#define VTOLSTATUS_NAME "VTOLStatus"
|
|
||||||
#define VTOLSTATUS_METANAME "VTOLStatusMeta"
|
|
||||||
#define VTOLSTATUS_ISSINGLEINST 1
|
|
||||||
#define VTOLSTATUS_ISSETTINGS 0
|
|
||||||
#define VTOLSTATUS_NUMBYTES sizeof(VTOLStatusData)
|
|
||||||
|
|
||||||
// Object access macros
|
|
||||||
/**
|
|
||||||
* @function VTOLStatusGet(dataOut)
|
|
||||||
* @brief Populate a VTOLStatusData object
|
|
||||||
* @param[out] dataOut
|
|
||||||
*/
|
|
||||||
#define VTOLStatusGet(dataOut) UAVObjGetData(VTOLStatusHandle(), dataOut)
|
|
||||||
#define VTOLStatusSet(dataIn) UAVObjSetData(VTOLStatusHandle(), dataIn)
|
|
||||||
#define VTOLStatusInstGet(instId, dataOut) UAVObjGetInstanceData(VTOLStatusHandle(), instId, dataOut)
|
|
||||||
#define VTOLStatusInstSet(instId, dataIn) UAVObjSetInstanceData(VTOLStatusHandle(), instId, dataIn)
|
|
||||||
#define VTOLStatusConnectQueue(queue) UAVObjConnectQueue(VTOLStatusHandle(), queue, EV_MASK_ALL_UPDATES)
|
|
||||||
#define VTOLStatusConnectCallback(cb) UAVObjConnectCallback(VTOLStatusHandle(), cb, EV_MASK_ALL_UPDATES)
|
|
||||||
#define VTOLStatusCreateInstance() UAVObjCreateInstance(VTOLStatusHandle())
|
|
||||||
#define VTOLStatusRequestUpdate() UAVObjRequestUpdate(VTOLStatusHandle())
|
|
||||||
#define VTOLStatusRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(VTOLStatusHandle(), instId)
|
|
||||||
#define VTOLStatusUpdated() UAVObjUpdated(VTOLStatusHandle())
|
|
||||||
#define VTOLStatusInstUpdated(instId) UAVObjUpdated(VTOLStatusHandle(), instId)
|
|
||||||
#define VTOLStatusGetMetadata(dataOut) UAVObjGetMetadata(VTOLStatusHandle(), dataOut)
|
|
||||||
#define VTOLStatusSetMetadata(dataIn) UAVObjSetMetadata(VTOLStatusHandle(), dataIn)
|
|
||||||
#define VTOLStatusReadOnly(dataIn) UAVObjReadOnly(VTOLStatusHandle())
|
|
||||||
|
|
||||||
// Object data
|
|
||||||
typedef struct {
|
|
||||||
float MotorN;
|
|
||||||
float MotorNE;
|
|
||||||
float MotorE;
|
|
||||||
float MotorSE;
|
|
||||||
float MotorS;
|
|
||||||
float MotorSW;
|
|
||||||
float MotorW;
|
|
||||||
float MotorNW;
|
|
||||||
|
|
||||||
} __attribute__((packed)) VTOLStatusData;
|
|
||||||
|
|
||||||
// Field information
|
|
||||||
// Field MotorN information
|
|
||||||
// Field MotorNE information
|
|
||||||
// Field MotorE information
|
|
||||||
// Field MotorSE information
|
|
||||||
// Field MotorS information
|
|
||||||
// Field MotorSW information
|
|
||||||
// Field MotorW information
|
|
||||||
// Field MotorNW information
|
|
||||||
|
|
||||||
|
|
||||||
// Generic interface functions
|
|
||||||
int32_t VTOLStatusInitialize();
|
|
||||||
UAVObjHandle VTOLStatusHandle();
|
|
||||||
|
|
||||||
#endif // VTOLSTATUS_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
* @}
|
|
||||||
*/
|
|
@ -65,7 +65,6 @@
|
|||||||
#include "velocityactual.h"
|
#include "velocityactual.h"
|
||||||
#include "velocitydesired.h"
|
#include "velocitydesired.h"
|
||||||
#include "vtolsettings.h"
|
#include "vtolsettings.h"
|
||||||
#include "vtolstatus.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,6 +110,5 @@ void UAVObjectsInitializeAll()
|
|||||||
VelocityActualInitialize();
|
VelocityActualInitialize();
|
||||||
VelocityDesiredInitialize();
|
VelocityDesiredInitialize();
|
||||||
VTOLSettingsInitialize();
|
VTOLSettingsInitialize();
|
||||||
VTOLStatusInitialize();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,111 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
|
||||||
* @{
|
|
||||||
* @addtogroup VTOLStatus VTOLStatus
|
|
||||||
* @brief Status for VTOL crafts showing the thrust from each engine
|
|
||||||
*
|
|
||||||
* Autogenerated files and functions for VTOLStatus Object
|
|
||||||
* @{
|
|
||||||
*
|
|
||||||
* @file vtolstatus.c
|
|
||||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
||||||
* @brief Implementation of the VTOLStatus object. This file has been
|
|
||||||
* automatically generated by the UAVObjectGenerator.
|
|
||||||
*
|
|
||||||
* @note Object definition file: vtolstatus.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 "vtolstatus.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 VTOLStatusInitialize()
|
|
||||||
{
|
|
||||||
// Register object with the object manager
|
|
||||||
handle = UAVObjRegister(VTOLSTATUS_OBJID, VTOLSTATUS_NAME, VTOLSTATUS_METANAME, 0,
|
|
||||||
VTOLSTATUS_ISSINGLEINST, VTOLSTATUS_ISSETTINGS, VTOLSTATUS_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)
|
|
||||||
{
|
|
||||||
VTOLStatusData data;
|
|
||||||
UAVObjMetadata metadata;
|
|
||||||
|
|
||||||
// Initialize object fields to their default values
|
|
||||||
UAVObjGetInstanceData(obj, instId, &data);
|
|
||||||
memset(&data, 0, sizeof(VTOLStatusData));
|
|
||||||
|
|
||||||
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 VTOLStatusHandle()
|
|
||||||
{
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @}
|
|
||||||
*/
|
|
||||||
|
|
@ -54,6 +54,9 @@ ActuatorDesired::ActuatorDesired(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTING
|
|||||||
QStringList ThrottleElemNames;
|
QStringList ThrottleElemNames;
|
||||||
ThrottleElemNames.append("0");
|
ThrottleElemNames.append("0");
|
||||||
fields.append( new UAVObjectField(QString("Throttle"), QString("%"), UAVObjectField::FLOAT32, ThrottleElemNames, QStringList()) );
|
fields.append( new UAVObjectField(QString("Throttle"), QString("%"), UAVObjectField::FLOAT32, ThrottleElemNames, QStringList()) );
|
||||||
|
QStringList UpdateTimeElemNames;
|
||||||
|
UpdateTimeElemNames.append("0");
|
||||||
|
fields.append( new UAVObjectField(QString("UpdateTime"), QString("ms"), UAVObjectField::FLOAT32, UpdateTimeElemNames, QStringList()) );
|
||||||
|
|
||||||
// Initialize object
|
// Initialize object
|
||||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||||
|
@ -47,6 +47,7 @@ public:
|
|||||||
float Pitch;
|
float Pitch;
|
||||||
float Yaw;
|
float Yaw;
|
||||||
float Throttle;
|
float Throttle;
|
||||||
|
float UpdateTime;
|
||||||
|
|
||||||
} __attribute__((packed)) DataFields;
|
} __attribute__((packed)) DataFields;
|
||||||
|
|
||||||
@ -55,10 +56,11 @@ public:
|
|||||||
// Field Pitch information
|
// Field Pitch information
|
||||||
// Field Yaw information
|
// Field Yaw information
|
||||||
// Field Throttle information
|
// Field Throttle information
|
||||||
|
// Field UpdateTime information
|
||||||
|
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const quint32 OBJID = 123085850U;
|
static const quint32 OBJID = 2919796710U;
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
static const bool ISSINGLEINST = 1;
|
static const bool ISSINGLEINST = 1;
|
||||||
static const bool ISSETTINGS = 0;
|
static const bool ISSETTINGS = 0;
|
||||||
|
@ -77,12 +77,22 @@ _fields = [ \
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
uavobject.UAVObjectField(
|
||||||
|
'UpdateTime',
|
||||||
|
'f',
|
||||||
|
1,
|
||||||
|
[
|
||||||
|
'0',
|
||||||
|
],
|
||||||
|
{
|
||||||
|
}
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ActuatorDesired(uavobject.UAVObject):
|
class ActuatorDesired(uavobject.UAVObject):
|
||||||
## Object constants
|
## Object constants
|
||||||
OBJID = 123085850
|
OBJID = 2919796710
|
||||||
NAME = "ActuatorDesired"
|
NAME = "ActuatorDesired"
|
||||||
METANAME = "ActuatorDesiredMeta"
|
METANAME = "ActuatorDesiredMeta"
|
||||||
ISSINGLEINST = 1
|
ISSINGLEINST = 1
|
||||||
|
@ -41,7 +41,6 @@ HEADERS += uavobjects_global.h \
|
|||||||
flightbatterystate.h \
|
flightbatterystate.h \
|
||||||
homelocation.h \
|
homelocation.h \
|
||||||
vtolsettings.h \
|
vtolsettings.h \
|
||||||
vtolstatus.h \
|
|
||||||
mixersettings.h \
|
mixersettings.h \
|
||||||
mixerstatus.h \
|
mixerstatus.h \
|
||||||
velocitydesired.h \
|
velocitydesired.h \
|
||||||
@ -87,7 +86,6 @@ SOURCES += uavobject.cpp \
|
|||||||
flightbatterystate.cpp \
|
flightbatterystate.cpp \
|
||||||
homelocation.cpp \
|
homelocation.cpp \
|
||||||
vtolsettings.cpp \
|
vtolsettings.cpp \
|
||||||
vtolstatus.cpp \
|
|
||||||
mixersettings.cpp \
|
mixersettings.cpp \
|
||||||
mixerstatus.cpp \
|
mixerstatus.cpp \
|
||||||
velocitydesired.cpp \
|
velocitydesired.cpp \
|
||||||
|
@ -67,7 +67,6 @@
|
|||||||
#include "velocityactual.h"
|
#include "velocityactual.h"
|
||||||
#include "velocitydesired.h"
|
#include "velocitydesired.h"
|
||||||
#include "vtolsettings.h"
|
#include "vtolsettings.h"
|
||||||
#include "vtolstatus.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,6 +112,5 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
|
|||||||
objMngr->registerObject( new VelocityActual() );
|
objMngr->registerObject( new VelocityActual() );
|
||||||
objMngr->registerObject( new VelocityDesired() );
|
objMngr->registerObject( new VelocityDesired() );
|
||||||
objMngr->registerObject( new VTOLSettings() );
|
objMngr->registerObject( new VTOLSettings() );
|
||||||
objMngr->registerObject( new VTOLStatus() );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,149 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
*
|
|
||||||
* @file vtolstatus.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: vtolstatus.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 "vtolstatus.h"
|
|
||||||
#include "uavobjectfield.h"
|
|
||||||
|
|
||||||
const QString VTOLStatus::NAME = QString("VTOLStatus");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
VTOLStatus::VTOLStatus(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
|
||||||
{
|
|
||||||
// Create fields
|
|
||||||
QList<UAVObjectField*> fields;
|
|
||||||
QStringList MotorNElemNames;
|
|
||||||
MotorNElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorN"), QString(""), UAVObjectField::FLOAT32, MotorNElemNames, QStringList()) );
|
|
||||||
QStringList MotorNEElemNames;
|
|
||||||
MotorNEElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorNE"), QString(""), UAVObjectField::FLOAT32, MotorNEElemNames, QStringList()) );
|
|
||||||
QStringList MotorEElemNames;
|
|
||||||
MotorEElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorE"), QString(""), UAVObjectField::FLOAT32, MotorEElemNames, QStringList()) );
|
|
||||||
QStringList MotorSEElemNames;
|
|
||||||
MotorSEElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorSE"), QString(""), UAVObjectField::FLOAT32, MotorSEElemNames, QStringList()) );
|
|
||||||
QStringList MotorSElemNames;
|
|
||||||
MotorSElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorS"), QString(""), UAVObjectField::FLOAT32, MotorSElemNames, QStringList()) );
|
|
||||||
QStringList MotorSWElemNames;
|
|
||||||
MotorSWElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorSW"), QString(""), UAVObjectField::FLOAT32, MotorSWElemNames, QStringList()) );
|
|
||||||
QStringList MotorWElemNames;
|
|
||||||
MotorWElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorW"), QString(""), UAVObjectField::FLOAT32, MotorWElemNames, QStringList()) );
|
|
||||||
QStringList MotorNWElemNames;
|
|
||||||
MotorNWElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("MotorNW"), QString(""), UAVObjectField::FLOAT32, MotorNWElemNames, QStringList()) );
|
|
||||||
|
|
||||||
// Initialize object
|
|
||||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
|
||||||
// Set the default field values
|
|
||||||
setDefaultFieldValues();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the default metadata for this object
|
|
||||||
*/
|
|
||||||
UAVObject::Metadata VTOLStatus::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 VTOLStatus::setDefaultFieldValues()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the object data fields
|
|
||||||
*/
|
|
||||||
VTOLStatus::DataFields VTOLStatus::getData()
|
|
||||||
{
|
|
||||||
QMutexLocker locker(mutex);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the object data fields
|
|
||||||
*/
|
|
||||||
void VTOLStatus::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* VTOLStatus::clone(quint32 instID)
|
|
||||||
{
|
|
||||||
VTOLStatus* obj = new VTOLStatus();
|
|
||||||
obj->initialize(instID, this->getMetaObject());
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Static function to retrieve an instance of the object.
|
|
||||||
*/
|
|
||||||
VTOLStatus* VTOLStatus::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
|
||||||
{
|
|
||||||
return dynamic_cast<VTOLStatus*>(objMngr->getObject(VTOLStatus::OBJID, instID));
|
|
||||||
}
|
|
@ -1,92 +0,0 @@
|
|||||||
/**
|
|
||||||
******************************************************************************
|
|
||||||
*
|
|
||||||
* @file vtolstatus.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: vtolstatus.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 VTOLSTATUS_H
|
|
||||||
#define VTOLSTATUS_H
|
|
||||||
|
|
||||||
#include "uavdataobject.h"
|
|
||||||
#include "uavobjectmanager.h"
|
|
||||||
|
|
||||||
class UAVOBJECTS_EXPORT VTOLStatus: public UAVDataObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
// Field structure
|
|
||||||
typedef struct {
|
|
||||||
float MotorN;
|
|
||||||
float MotorNE;
|
|
||||||
float MotorE;
|
|
||||||
float MotorSE;
|
|
||||||
float MotorS;
|
|
||||||
float MotorSW;
|
|
||||||
float MotorW;
|
|
||||||
float MotorNW;
|
|
||||||
|
|
||||||
} __attribute__((packed)) DataFields;
|
|
||||||
|
|
||||||
// Field information
|
|
||||||
// Field MotorN information
|
|
||||||
// Field MotorNE information
|
|
||||||
// Field MotorE information
|
|
||||||
// Field MotorSE information
|
|
||||||
// Field MotorS information
|
|
||||||
// Field MotorSW information
|
|
||||||
// Field MotorW information
|
|
||||||
// Field MotorNW information
|
|
||||||
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
static const quint32 OBJID = 957086004U;
|
|
||||||
static const QString NAME;
|
|
||||||
static const bool ISSINGLEINST = 1;
|
|
||||||
static const bool ISSETTINGS = 0;
|
|
||||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
|
||||||
|
|
||||||
// Functions
|
|
||||||
VTOLStatus();
|
|
||||||
|
|
||||||
DataFields getData();
|
|
||||||
void setData(const DataFields& data);
|
|
||||||
Metadata getDefaultMetadata();
|
|
||||||
UAVDataObject* clone(quint32 instID);
|
|
||||||
|
|
||||||
static VTOLStatus* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
|
||||||
|
|
||||||
private:
|
|
||||||
DataFields data;
|
|
||||||
|
|
||||||
void setDefaultFieldValues();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // VTOLSTATUS_H
|
|
@ -1,156 +0,0 @@
|
|||||||
##
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# @file vtolstatus.py
|
|
||||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
||||||
# @brief Implementation of the VTOLStatus object. This file has been
|
|
||||||
# automatically generated by the UAVObjectGenerator.
|
|
||||||
#
|
|
||||||
# @note Object definition file: vtolstatus.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(
|
|
||||||
'MotorN',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'MotorNE',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'MotorE',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'MotorSE',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'MotorS',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'MotorSW',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'MotorW',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'MotorNW',
|
|
||||||
'f',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
}
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class VTOLStatus(uavobject.UAVObject):
|
|
||||||
## Object constants
|
|
||||||
OBJID = 957086004
|
|
||||||
NAME = "VTOLStatus"
|
|
||||||
METANAME = "VTOLStatusMeta"
|
|
||||||
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 = VTOLStatus()
|
|
||||||
print (x)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
#import pdb ; pdb.run('main()')
|
|
||||||
main()
|
|
@ -5,6 +5,7 @@
|
|||||||
<field name="Pitch" units="%" type="float" elements="1"/>
|
<field name="Pitch" units="%" type="float" elements="1"/>
|
||||||
<field name="Yaw" units="%" type="float" elements="1"/>
|
<field name="Yaw" units="%" type="float" elements="1"/>
|
||||||
<field name="Throttle" units="%" type="float" elements="1"/>
|
<field name="Throttle" units="%" type="float" elements="1"/>
|
||||||
|
<field name="UpdateTime" units="ms" type="float" elements="1"/>
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
<telemetrygcs acked="false" updatemode="manual" period="0"/>
|
||||||
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
<telemetryflight acked="false" updatemode="periodic" period="1000"/>
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
<xml>
|
|
||||||
<object name="VTOLStatus" singleinstance="true" settings="false">
|
|
||||||
<description>Status for VTOL crafts showing the thrust from each engine</description>
|
|
||||||
<field name="MotorN" units="" type="float" elements="1"/>
|
|
||||||
<field name="MotorNE" units="" type="float" elements="1"/>
|
|
||||||
<field name="MotorE" units="" type="float" elements="1"/>
|
|
||||||
<field name="MotorSE" units="" type="float" elements="1"/>
|
|
||||||
<field name="MotorS" units="" type="float" elements="1"/>
|
|
||||||
<field name="MotorSW" units="" type="float" elements="1"/>
|
|
||||||
<field name="MotorW" units="" type="float" elements="1"/>
|
|
||||||
<field name="MotorNW" 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