mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
Flight/RateDesired: UAVObject for monitoring the desired rate out of
stabilization for diagnostics git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2004 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
acc6df4c2d
commit
9944cdfcb0
@ -181,6 +181,7 @@ SRC += $(OPUAVOBJ)/velocitydesired.c
|
||||
SRC += $(OPUAVOBJ)/velocityactual.c
|
||||
SRC += $(OPUAVOBJ)/guidancesettings.c
|
||||
SRC += $(OPUAVOBJ)/firmwareiapobj.c
|
||||
SRC += $(OPUAVOBJ)/ratedesired.c
|
||||
endif
|
||||
|
||||
## PIOS Hardware (STM32F10x)
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "stabilization.h"
|
||||
#include "stabilizationsettings.h"
|
||||
#include "actuatordesired.h"
|
||||
#include "ratedesired.h"
|
||||
#include "attitudedesired.h"
|
||||
#include "attitudeactual.h"
|
||||
#include "attituderaw.h"
|
||||
@ -114,6 +115,7 @@ static void stabilizationTask(void* parameters)
|
||||
|
||||
ActuatorDesiredData actuatorDesired;
|
||||
AttitudeDesiredData attitudeDesired;
|
||||
RateDesiredData rateDesired;
|
||||
AttitudeActualData attitudeActual;
|
||||
AttitudeRawData attitudeRaw;
|
||||
SystemSettingsData systemSettings;
|
||||
@ -141,6 +143,7 @@ static void stabilizationTask(void* parameters)
|
||||
AttitudeDesiredGet(&attitudeDesired);
|
||||
AttitudeActualGet(&attitudeActual);
|
||||
AttitudeRawGet(&attitudeRaw);
|
||||
RateDesiredGet(&rateDesired);
|
||||
SystemSettingsGet(&systemSettings);
|
||||
|
||||
|
||||
@ -148,36 +151,37 @@ static void stabilizationTask(void* parameters)
|
||||
float *attitudeDesiredAxis = &attitudeDesired.Roll;
|
||||
float *attitudeActualAxis = &attitudeActual.Roll;
|
||||
float *actuatorDesiredAxis = &actuatorDesired.Roll;
|
||||
float *rateDesiredAxis = &rateDesired.Roll;
|
||||
|
||||
//Calculate desired rate
|
||||
float rates[MAX_AXES]= {0,0,0};
|
||||
for(int8_t ct=0; ct< MAX_AXES; ct++)
|
||||
{
|
||||
switch(manualControl.StabilizationSettings[ct])
|
||||
{
|
||||
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE:
|
||||
rates[ct] = manualAxis[ct] * settings.ManualRate[ct];
|
||||
rateDesiredAxis[ct] = manualAxis[ct] * settings.ManualRate[ct];
|
||||
break;
|
||||
|
||||
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE:
|
||||
rates[ct] = ApplyPid(&pids[PID_ROLL + ct], attitudeDesiredAxis[ct], attitudeActualAxis[ct], 1);
|
||||
rateDesiredAxis[ct] = ApplyPid(&pids[PID_ROLL + ct], attitudeDesiredAxis[ct], attitudeActualAxis[ct], 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t shouldUpdate = 0;
|
||||
RateDesiredSet(&rateDesired);
|
||||
ActuatorDesiredGet(&actuatorDesired);
|
||||
//Calculate desired command
|
||||
for(int8_t ct=0; ct< MAX_AXES; ct++)
|
||||
{
|
||||
if(fabs(rates[ct]) > settings.MaximumRate[ct])
|
||||
if(fabs(rateDesiredAxis[ct]) > settings.MaximumRate[ct])
|
||||
{
|
||||
if(rates[ct] > 0)
|
||||
if(rateDesiredAxis[ct] > 0)
|
||||
{
|
||||
rates[ct] = settings.MaximumRate[ct];
|
||||
rateDesiredAxis[ct] = settings.MaximumRate[ct];
|
||||
}else
|
||||
{
|
||||
rates[ct] = -settings.MaximumRate[ct];
|
||||
rateDesiredAxis[ct] = -settings.MaximumRate[ct];
|
||||
}
|
||||
|
||||
}
|
||||
@ -186,7 +190,7 @@ static void stabilizationTask(void* parameters)
|
||||
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE:
|
||||
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE:
|
||||
{
|
||||
float command = ApplyPid(&pids[PID_RATE_ROLL + ct], rates[ct], attitudeRaw.gyros_filtered[ct], 0);
|
||||
float command = ApplyPid(&pids[PID_RATE_ROLL + ct], rateDesiredAxis[ct], attitudeRaw.gyros_filtered[ct], 0);
|
||||
actuatorDesiredAxis[ct] = bound(command);
|
||||
shouldUpdate = 1;
|
||||
break;
|
||||
|
95
flight/OpenPilot/UAVObjects/inc/ratedesired.h
Normal file
95
flight/OpenPilot/UAVObjects/inc/ratedesired.h
Normal file
@ -0,0 +1,95 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup RateDesired RateDesired
|
||||
* @brief Status for the matrix mixer showing the output of each mixer after all scaling
|
||||
*
|
||||
* Autogenerated files and functions for RateDesired Object
|
||||
|
||||
* @{
|
||||
*
|
||||
* @file ratedesired.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the RateDesired object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: ratedesired.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 RATEDESIRED_H
|
||||
#define RATEDESIRED_H
|
||||
|
||||
// Object constants
|
||||
#define RATEDESIRED_OBJID 3124868380U
|
||||
#define RATEDESIRED_NAME "RateDesired"
|
||||
#define RATEDESIRED_METANAME "RateDesiredMeta"
|
||||
#define RATEDESIRED_ISSINGLEINST 1
|
||||
#define RATEDESIRED_ISSETTINGS 0
|
||||
#define RATEDESIRED_NUMBYTES sizeof(RateDesiredData)
|
||||
|
||||
// Object access macros
|
||||
/**
|
||||
* @function RateDesiredGet(dataOut)
|
||||
* @brief Populate a RateDesiredData object
|
||||
* @param[out] dataOut
|
||||
*/
|
||||
#define RateDesiredGet(dataOut) UAVObjGetData(RateDesiredHandle(), dataOut)
|
||||
#define RateDesiredSet(dataIn) UAVObjSetData(RateDesiredHandle(), dataIn)
|
||||
#define RateDesiredInstGet(instId, dataOut) UAVObjGetInstanceData(RateDesiredHandle(), instId, dataOut)
|
||||
#define RateDesiredInstSet(instId, dataIn) UAVObjSetInstanceData(RateDesiredHandle(), instId, dataIn)
|
||||
#define RateDesiredConnectQueue(queue) UAVObjConnectQueue(RateDesiredHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define RateDesiredConnectCallback(cb) UAVObjConnectCallback(RateDesiredHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define RateDesiredCreateInstance() UAVObjCreateInstance(RateDesiredHandle())
|
||||
#define RateDesiredRequestUpdate() UAVObjRequestUpdate(RateDesiredHandle())
|
||||
#define RateDesiredRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(RateDesiredHandle(), instId)
|
||||
#define RateDesiredUpdated() UAVObjUpdated(RateDesiredHandle())
|
||||
#define RateDesiredInstUpdated(instId) UAVObjUpdated(RateDesiredHandle(), instId)
|
||||
#define RateDesiredGetMetadata(dataOut) UAVObjGetMetadata(RateDesiredHandle(), dataOut)
|
||||
#define RateDesiredSetMetadata(dataIn) UAVObjSetMetadata(RateDesiredHandle(), dataIn)
|
||||
#define RateDesiredReadOnly(dataIn) UAVObjReadOnly(RateDesiredHandle())
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
float Roll;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
|
||||
} __attribute__((packed)) RateDesiredData;
|
||||
|
||||
// Field information
|
||||
// Field Roll information
|
||||
// Field Pitch information
|
||||
// Field Yaw information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t RateDesiredInitialize();
|
||||
UAVObjHandle RateDesiredHandle();
|
||||
|
||||
#endif // RATEDESIRED_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
111
flight/OpenPilot/UAVObjects/ratedesired.c
Normal file
111
flight/OpenPilot/UAVObjects/ratedesired.c
Normal file
@ -0,0 +1,111 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup RateDesired RateDesired
|
||||
* @brief Status for the matrix mixer showing the output of each mixer after all scaling
|
||||
*
|
||||
* Autogenerated files and functions for RateDesired Object
|
||||
* @{
|
||||
*
|
||||
* @file ratedesired.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the RateDesired object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: ratedesired.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 "ratedesired.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 RateDesiredInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(RATEDESIRED_OBJID, RATEDESIRED_NAME, RATEDESIRED_METANAME, 0,
|
||||
RATEDESIRED_ISSINGLEINST, RATEDESIRED_ISSETTINGS, RATEDESIRED_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)
|
||||
{
|
||||
RateDesiredData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(RateDesiredData));
|
||||
|
||||
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 RateDesiredHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include "objectpersistence.h"
|
||||
#include "positionactual.h"
|
||||
#include "positiondesired.h"
|
||||
#include "ratedesired.h"
|
||||
#include "stabilizationsettings.h"
|
||||
#include "systemalarms.h"
|
||||
#include "systemsettings.h"
|
||||
@ -95,6 +96,7 @@ void UAVObjectsInitializeAll()
|
||||
ObjectPersistenceInitialize();
|
||||
PositionActualInitialize();
|
||||
PositionDesiredInitialize();
|
||||
RateDesiredInitialize();
|
||||
StabilizationSettingsInitialize();
|
||||
SystemAlarmsInitialize();
|
||||
SystemSettingsInitialize();
|
||||
|
@ -2873,6 +2873,9 @@
|
||||
65E8F0ED11EFF25C00BBF654 /* pios_usb_hid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pios_usb_hid.c; path = ../../PiOS/STM32F10x/pios_usb_hid.c; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0EE11EFF25C00BBF654 /* startup_stm32f10x_HD.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = startup_stm32f10x_HD.S; path = ../../PiOS/STM32F10x/startup_stm32f10x_HD.S; sourceTree = SOURCE_ROOT; };
|
||||
65E8F0F111EFF25C00BBF654 /* startup_stm32f10x_MD.S */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; name = startup_stm32f10x_MD.S; path = ../../PiOS/STM32F10x/startup_stm32f10x_MD.S; sourceTree = SOURCE_ROOT; };
|
||||
65EA2E171273C55200636061 /* ratedesired.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = ratedesired.xml; sourceTree = "<group>"; };
|
||||
65EA2E1D1273C6E900636061 /* ratedesired.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ratedesired.c; sourceTree = "<group>"; };
|
||||
65EA2E1E1273C73000636061 /* ratedesired.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ratedesired.h; sourceTree = "<group>"; };
|
||||
65EF3930123AF97D00D1B036 /* gpssatellites.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gpssatellites.c; sourceTree = "<group>"; };
|
||||
65EF3931123AF97D00D1B036 /* gpstime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gpstime.c; sourceTree = "<group>"; };
|
||||
65FC65BE123F209400B04F74 /* ahrs_adc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ahrs_adc.c; path = ../../AHRS/ahrs_adc.c; sourceTree = SOURCE_ROOT; };
|
||||
@ -6776,6 +6779,7 @@
|
||||
65B367F5121C2620003EAD18 /* manualcontrolsettings.xml */,
|
||||
65B367F8121C2620003EAD18 /* objectpersistence.xml */,
|
||||
65B367F9121C2620003EAD18 /* positionactual.xml */,
|
||||
65EA2E171273C55200636061 /* ratedesired.xml */,
|
||||
65B367FA121C2620003EAD18 /* stabilizationsettings.xml */,
|
||||
65B367FB121C2620003EAD18 /* systemalarms.xml */,
|
||||
65B367FC121C2620003EAD18 /* systemsettings.xml */,
|
||||
@ -7147,6 +7151,7 @@
|
||||
65E8EF6E11EEA61E00BBF654 /* UAVObjects */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65EA2E1D1273C6E900636061 /* ratedesired.c */,
|
||||
65D38AAC125F6B8200112AEB /* firmwareiapobj.c */,
|
||||
65D38AAD125F6B8200112AEB /* guidancesettings.c */,
|
||||
65D38AAE125F6B8200112AEB /* mixersettings.c */,
|
||||
@ -7194,6 +7199,7 @@
|
||||
65E8EF8011EEA61E00BBF654 /* inc */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65EA2E1E1273C73000636061 /* ratedesired.h */,
|
||||
65D38A9E125F6B6B00112AEB /* ahrscalibration.h */,
|
||||
65D38A9F125F6B6B00112AEB /* attituderaw.h */,
|
||||
65D38AA0125F6B6B00112AEB /* baroaltitude.h */,
|
||||
|
134
ground/src/plugins/uavobjects/ratedesired.cpp
Normal file
134
ground/src/plugins/uavobjects/ratedesired.cpp
Normal file
@ -0,0 +1,134 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file ratedesired.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: ratedesired.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 "ratedesired.h"
|
||||
#include "uavobjectfield.h"
|
||||
|
||||
const QString RateDesired::NAME = QString("RateDesired");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
RateDesired::RateDesired(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
QStringList RollElemNames;
|
||||
RollElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Roll"), QString("deg/s"), UAVObjectField::FLOAT32, RollElemNames, QStringList()) );
|
||||
QStringList PitchElemNames;
|
||||
PitchElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Pitch"), QString("deg/s"), UAVObjectField::FLOAT32, PitchElemNames, QStringList()) );
|
||||
QStringList YawElemNames;
|
||||
YawElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Yaw"), QString("deg/s"), UAVObjectField::FLOAT32, YawElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default metadata for this object
|
||||
*/
|
||||
UAVObject::Metadata RateDesired::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 RateDesired::setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object data fields
|
||||
*/
|
||||
RateDesired::DataFields RateDesired::getData()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
*/
|
||||
void RateDesired::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* RateDesired::clone(quint32 instID)
|
||||
{
|
||||
RateDesired* obj = new RateDesired();
|
||||
obj->initialize(instID, this->getMetaObject());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
RateDesired* RateDesired::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
||||
{
|
||||
return dynamic_cast<RateDesired*>(objMngr->getObject(RateDesired::OBJID, instID));
|
||||
}
|
82
ground/src/plugins/uavobjects/ratedesired.h
Normal file
82
ground/src/plugins/uavobjects/ratedesired.h
Normal file
@ -0,0 +1,82 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file ratedesired.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: ratedesired.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 RATEDESIRED_H
|
||||
#define RATEDESIRED_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT RateDesired: public UAVDataObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Field structure
|
||||
typedef struct {
|
||||
float Roll;
|
||||
float Pitch;
|
||||
float Yaw;
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Field information
|
||||
// Field Roll information
|
||||
// Field Pitch information
|
||||
// Field Yaw information
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 3124868380U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 0;
|
||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
||||
|
||||
// Functions
|
||||
RateDesired();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
|
||||
static RateDesired* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
||||
|
||||
private:
|
||||
DataFields data;
|
||||
|
||||
void setDefaultFieldValues();
|
||||
|
||||
};
|
||||
|
||||
#endif // RATEDESIRED_H
|
@ -1,12 +1,12 @@
|
||||
##
|
||||
##############################################################################
|
||||
#
|
||||
# @file attitudesettings.py
|
||||
# @file ratedesired.py
|
||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
# @brief Implementation of the AttitudeSettings object. This file has been
|
||||
# @brief Implementation of the RateDesired object. This file has been
|
||||
# automatically generated by the UAVObjectGenerator.
|
||||
#
|
||||
# @note Object definition file: attitudesettings.xml.
|
||||
# @note Object definition file: ratedesired.xml.
|
||||
# This is an automatically generated file.
|
||||
# DO NOT modify manually.
|
||||
#
|
||||
@ -38,8 +38,28 @@ from collections import namedtuple
|
||||
# This is a list of instances of the data fields contained in this object
|
||||
_fields = [ \
|
||||
uavobject.UAVObjectField(
|
||||
'UpdatePeriod',
|
||||
'i',
|
||||
'Roll',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Pitch',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Yaw',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
@ -50,13 +70,13 @@ _fields = [ \
|
||||
]
|
||||
|
||||
|
||||
class AttitudeSettings(uavobject.UAVObject):
|
||||
class RateDesired(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 3446368842
|
||||
NAME = "AttitudeSettings"
|
||||
METANAME = "AttitudeSettingsMeta"
|
||||
OBJID = 3124868380
|
||||
NAME = "RateDesired"
|
||||
METANAME = "RateDesiredMeta"
|
||||
ISSINGLEINST = 1
|
||||
ISSETTINGS = 1
|
||||
ISSETTINGS = 0
|
||||
|
||||
def __init__(self):
|
||||
uavobject.UAVObject.__init__(self,
|
||||
@ -78,7 +98,7 @@ class AttitudeSettings(uavobject.UAVObject):
|
||||
|
||||
def main():
|
||||
# Instantiate the object and dump out some interesting info
|
||||
x = AttitudeSettings()
|
||||
x = RateDesired()
|
||||
print (x)
|
||||
|
||||
if __name__ == "__main__":
|
@ -43,6 +43,7 @@ HEADERS += uavobjects_global.h \
|
||||
velocityactual.h \
|
||||
guidancesettings.h \
|
||||
positiondesired.h \
|
||||
ratedesired.h \
|
||||
firmwareiapobj.h
|
||||
|
||||
SOURCES += uavobject.cpp \
|
||||
@ -84,5 +85,6 @@ SOURCES += uavobject.cpp \
|
||||
velocityactual.cpp \
|
||||
guidancesettings.cpp \
|
||||
positiondesired.cpp \
|
||||
ratedesired.cpp \
|
||||
firmwareiapobj.cpp
|
||||
OTHER_FILES += UAVObjects.pluginspec
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "objectpersistence.h"
|
||||
#include "positionactual.h"
|
||||
#include "positiondesired.h"
|
||||
#include "ratedesired.h"
|
||||
#include "stabilizationsettings.h"
|
||||
#include "systemalarms.h"
|
||||
#include "systemsettings.h"
|
||||
@ -97,6 +98,7 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
|
||||
objMngr->registerObject( new ObjectPersistence() );
|
||||
objMngr->registerObject( new PositionActual() );
|
||||
objMngr->registerObject( new PositionDesired() );
|
||||
objMngr->registerObject( new RateDesired() );
|
||||
objMngr->registerObject( new StabilizationSettings() );
|
||||
objMngr->registerObject( new SystemAlarms() );
|
||||
objMngr->registerObject( new SystemSettings() );
|
||||
|
12
ground/src/shared/uavobjectdefinition/ratedesired.xml
Normal file
12
ground/src/shared/uavobjectdefinition/ratedesired.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<xml>
|
||||
<object name="RateDesired" singleinstance="true" settings="false">
|
||||
<description>Status for the matrix mixer showing the output of each mixer after all scaling</description>
|
||||
<field name="Roll" units="deg/s" type="float" elements="1"/>
|
||||
<field name="Pitch" units="deg/s" type="float" elements="1"/>
|
||||
<field name="Yaw" units="deg/s" 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…
x
Reference in New Issue
Block a user