1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

OP-199 Flight/Stabilization: Increment a counter in actuatorDesired whenever an

update takes longer than 15 ms

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2109 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-11-12 04:36:04 +00:00 committed by peabody124
parent c74c9cc08e
commit 5850c1804d
6 changed files with 23 additions and 3 deletions

View File

@ -212,6 +212,8 @@ static void stabilizationTask(void* parameters)
if(shouldUpdate)
{
actuatorDesired.Throttle = attitudeDesired.Throttle;
if(dT > 15)
actuatorDesired.NumLongUpdates++;
ActuatorDesiredSet(&actuatorDesired);
}

View File

@ -41,7 +41,7 @@
#define ACTUATORDESIRED_H
// Object constants
#define ACTUATORDESIRED_OBJID 2919796710U
#define ACTUATORDESIRED_OBJID 3562104706U
#define ACTUATORDESIRED_NAME "ActuatorDesired"
#define ACTUATORDESIRED_METANAME "ActuatorDesiredMeta"
#define ACTUATORDESIRED_ISSINGLEINST 1
@ -76,6 +76,7 @@ typedef struct {
float Yaw;
float Throttle;
float UpdateTime;
float NumLongUpdates;
} __attribute__((packed)) ActuatorDesiredData;
@ -85,6 +86,7 @@ typedef struct {
// Field Yaw information
// Field Throttle information
// Field UpdateTime information
// Field NumLongUpdates information
// Generic interface functions

View File

@ -57,6 +57,9 @@ ActuatorDesired::ActuatorDesired(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTING
QStringList UpdateTimeElemNames;
UpdateTimeElemNames.append("0");
fields.append( new UAVObjectField(QString("UpdateTime"), QString("ms"), UAVObjectField::FLOAT32, UpdateTimeElemNames, QStringList()) );
QStringList NumLongUpdatesElemNames;
NumLongUpdatesElemNames.append("0");
fields.append( new UAVObjectField(QString("NumLongUpdates"), QString("ms"), UAVObjectField::FLOAT32, NumLongUpdatesElemNames, QStringList()) );
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);

View File

@ -48,6 +48,7 @@ public:
float Yaw;
float Throttle;
float UpdateTime;
float NumLongUpdates;
} __attribute__((packed)) DataFields;
@ -57,10 +58,11 @@ public:
// Field Yaw information
// Field Throttle information
// Field UpdateTime information
// Field NumLongUpdates information
// Constants
static const quint32 OBJID = 2919796710U;
static const quint32 OBJID = 3562104706U;
static const QString NAME;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0;

View File

@ -87,12 +87,22 @@ _fields = [ \
{
}
),
uavobject.UAVObjectField(
'NumLongUpdates',
'f',
1,
[
'0',
],
{
}
),
]
class ActuatorDesired(uavobject.UAVObject):
## Object constants
OBJID = 2919796710
OBJID = 3562104706
NAME = "ActuatorDesired"
METANAME = "ActuatorDesiredMeta"
ISSINGLEINST = 1

View File

@ -6,6 +6,7 @@
<field name="Yaw" units="%" type="float" elements="1"/>
<field name="Throttle" units="%" type="float" elements="1"/>
<field name="UpdateTime" units="ms" type="float" elements="1"/>
<field name="NumLongUpdates" units="ms" type="float" elements="1"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="false" updatemode="manual" period="0"/>
<telemetryflight acked="false" updatemode="periodic" period="1000"/>