1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

AHRS: Added a tracker for number of ADC updates the EKF misses. Also updated the Telemetry autogenerated files to accomodate the 11500 baud rate.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1652 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-09-16 02:59:00 +00:00 committed by peabody124
parent ff1b303083
commit 885c966e53
12 changed files with 40 additions and 19 deletions

View File

@ -190,7 +190,7 @@ float Rne[3][3];
//! Indicates the communications are requesting a calibration
uint8_t calibration_pending = FALSE;
//! The oversampling rate, ekf is 2k / this
static uint8_t adc_oversampling = 15;
static uint8_t adc_oversampling = 25;
/**
* @}
*/
@ -795,7 +795,7 @@ void process_spi_request(void)
user_tx_v1.payload.user.v.rsp.update.load = ((float) running_counts / (float) (idle_counts+running_counts)) * 100;
user_tx_v1.payload.user.v.rsp.update.idle_time = idle_counts / (TIMER_RATE / 10000);
user_tx_v1.payload.user.v.rsp.update.run_time = running_counts / (TIMER_RATE / 10000);
user_tx_v1.payload.user.v.rsp.update.dropped_updates = ekf_too_slow;
lfsm_user_set_tx_v1 (&user_tx_v1);
break;
default:

View File

@ -482,6 +482,7 @@ static void process_update(struct opahrs_msg_v1_rsp_update * update)
status.CPULoad = update->load;
status.IdleTimePerCyle = update->idle_time;
status.RunningTimePerCyle = update->run_time;
status.DroppedUpdates = update->dropped_updates;
AhrsStatusSet(&status);
}

View File

@ -41,7 +41,7 @@
#define AHRSSTATUS_H
// Object constants
#define AHRSSTATUS_OBJID 1854089084U
#define AHRSSTATUS_OBJID 1789860144U
#define AHRSSTATUS_NAME "AhrsStatus"
#define AHRSSTATUS_METANAME "AhrsStatusMeta"
#define AHRSSTATUS_ISSINGLEINST 1
@ -75,6 +75,7 @@ typedef struct {
uint8_t CPULoad;
uint8_t IdleTimePerCyle;
uint8_t RunningTimePerCyle;
uint8_t DroppedUpdates;
uint8_t CommErrors[5];
uint8_t AlgorithmSet;
uint8_t CalibrationSet;
@ -89,6 +90,7 @@ typedef struct {
// Field CPULoad information
// Field IdleTimePerCyle information
// Field RunningTimePerCyle information
// Field DroppedUpdates information
// Field CommErrors information
/* Array element names for field CommErrors */
typedef enum { AHRSSTATUS_COMMERRORS_ALGORITHM=0, AHRSSTATUS_COMMERRORS_UPDATE=1, AHRSSTATUS_COMMERRORS_ATTITUDERAW=2, AHRSSTATUS_COMMERRORS_HOMELOCATION=3, AHRSSTATUS_COMMERRORS_CALIBRATION=4 } AhrsStatusCommErrorsElem;

View File

@ -78,7 +78,7 @@ typedef struct {
// Field information
// Field Speed information
/* Enumeration options for field Speed */
typedef enum { TELEMETRYSETTINGS_SPEED_9600=0, TELEMETRYSETTINGS_SPEED_38400=1, TELEMETRYSETTINGS_SPEED_57600=2, TELEMETRYSETTINGS_SPEED_115200=3 } TelemetrySettingsSpeedOptions;
typedef enum { TELEMETRYSETTINGS_SPEED_9600=0, TELEMETRYSETTINGS_SPEED_38400=1, TELEMETRYSETTINGS_SPEED_57600=2, TELEMETRYSETTINGS_SPEED_115200=3 } TelemetrySettingsSpeedOptions;
// Generic interface functions

View File

@ -306,6 +306,7 @@ struct opahrs_msg_v1_rsp_update {
uint8_t load;
uint8_t idle_time;
uint8_t run_time;
uint8_t dropped_updates;
} __attribute__((__packed__));
struct opahrs_msg_v1_rsp_calibration {

View File

@ -78,6 +78,9 @@ AhrsStatus::AhrsStatus(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
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 CommErrorsElemNames;
CommErrorsElemNames.append("Algorithm");
CommErrorsElemNames.append("Update");

View File

@ -47,6 +47,7 @@ public:
quint8 CPULoad;
quint8 IdleTimePerCyle;
quint8 RunningTimePerCyle;
quint8 DroppedUpdates;
quint8 CommErrors[5];
quint8 AlgorithmSet;
quint8 CalibrationSet;
@ -61,6 +62,7 @@ public:
// Field CPULoad information
// Field IdleTimePerCyle information
// Field RunningTimePerCyle information
// Field DroppedUpdates information
// Field CommErrors information
/* Array element names for field CommErrors */
typedef enum { COMMERRORS_ALGORITHM=0, COMMERRORS_UPDATE=1, COMMERRORS_ATTITUDERAW=2, COMMERRORS_HOMELOCATION=3, COMMERRORS_CALIBRATION=4 } CommErrorsElem;
@ -78,7 +80,7 @@ public:
// Constants
static const quint32 OBJID = 1854089084U;
static const quint32 OBJID = 1789860144U;
static const QString NAME;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0;

View File

@ -101,6 +101,16 @@ _fields = [ \
{
}
),
uavobject.UAVObjectField(
'DroppedUpdates',
'B',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'CommErrors',
'B',
@ -156,7 +166,7 @@ _fields = [ \
class AhrsStatus(uavobject.UAVObject):
## Object constants
OBJID = 1854089084
OBJID = 1789860144
NAME = "AhrsStatus"
METANAME = "AhrsStatusMeta"
ISSINGLEINST = 1

View File

@ -42,14 +42,14 @@ TelemetrySettings::TelemetrySettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSET
{
// Create fields
QList<UAVObjectField*> fields;
QStringList SpeedElemNames;
SpeedElemNames.append("0");
QStringList SpeedEnumOptions;
SpeedEnumOptions.append("9600");
SpeedEnumOptions.append("38400");
SpeedEnumOptions.append("57600");
SpeedEnumOptions.append("115200");
fields.append( new UAVObjectField(QString("Speed"), QString(""), UAVObjectField::ENUM, SpeedElemNames, SpeedEnumOptions) );
QStringList SpeedElemNames;
SpeedElemNames.append("0");
QStringList SpeedEnumOptions;
SpeedEnumOptions.append("9600");
SpeedEnumOptions.append("38400");
SpeedEnumOptions.append("57600");
SpeedEnumOptions.append("115200");
fields.append( new UAVObjectField(QString("Speed"), QString(""), UAVObjectField::ENUM, SpeedElemNames, SpeedEnumOptions) );
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);
@ -83,7 +83,7 @@ UAVObject::Metadata TelemetrySettings::getDefaultMetadata()
*/
void TelemetrySettings::setDefaultFieldValues()
{
data.Speed = 2;
data.Speed = 2;
}

View File

@ -43,14 +43,14 @@ class UAVOBJECTS_EXPORT TelemetrySettings: public UAVDataObject
public:
// Field structure
typedef struct {
quint8 Speed;
quint8 Speed;
} __attribute__((packed)) DataFields;
// Field information
// Field Speed information
/* Enumeration options for field Speed */
typedef enum { SPEED_9600=0, SPEED_38400=1, SPEED_57600=2, SPEED_115200=3 } SpeedOptions;
// Field Speed information
/* Enumeration options for field Speed */
typedef enum { SPEED_9600=0, SPEED_38400=1, SPEED_57600=2, SPEED_115200=3 } SpeedOptions;
// Constants

View File

@ -48,6 +48,7 @@ _fields = [ \
'0' : '9600',
'1' : '38400',
'2' : '57600',
'3' : '115200',
}
),
]

View File

@ -5,6 +5,7 @@
<field name="CPULoad" units="count" type="uint8" elements="1"/>
<field name="IdleTimePerCyle" units="10x ms" type="uint8" elements="1"/>
<field name="RunningTimePerCyle" units="10x ms" type="uint8" elements="1"/>
<field name="DroppedUpdates" units="count" type="uint8" elements="1"/>
<field name="CommErrors" units="count" type="uint8" elementnames="Algorithm,Update,AttitudeRaw,HomeLocation,Calibration"/>
<field name="AlgorithmSet" units="" type="enum" elements="1" options="FALSE,TRUE"/>
<field name="CalibrationSet" units="" type="enum" elements="1" options="FALSE,TRUE"/>