mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
UAVObjects/AttitudeSettings: Remove unused object, moving data to AHRSettings.
Added attitude bias to AHRSSettings. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1855 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
754200f9cf
commit
a9495e2cbb
@ -35,11 +35,9 @@
|
||||
#include "ahrs.h"
|
||||
#include "ahrs_adc.h"
|
||||
#include "ahrs_timer.h"
|
||||
#include "pios_opahrs_proto.h"
|
||||
//#include "ahrs_fsm.h" /* lfsm_state */
|
||||
#include "ahrs_spi_comm.h"
|
||||
#include "insgps.h"
|
||||
#include "CoordinateConversions.h"
|
||||
#include "ahrs_spi_comm.h"
|
||||
|
||||
#define MAX_OVERSAMPLING 50
|
||||
// For debugging the raw sensors
|
||||
@ -198,7 +196,7 @@ int main()
|
||||
float vel[3] = { 0, 0, 0 };
|
||||
gps_data.quality = -1;
|
||||
|
||||
ahrs_algorithm = INSGPS_Algo;
|
||||
ahrs_algorithm = AHRSSETTINGS_ALGORITHM_SIMPLE;
|
||||
|
||||
/* Brings up System using CMSIS functions, enables the LEDs. */
|
||||
PIOS_SYS_Init();
|
||||
@ -245,6 +243,7 @@ int main()
|
||||
}
|
||||
/* we didn't connect the callbacks before because we have to wait
|
||||
for all data to be up to date before doing anything*/
|
||||
|
||||
AHRSCalibrationConnectCallback(calibration_callback);
|
||||
GPSPositionConnectCallback(gps_callback);
|
||||
BaroAltitudeConnectCallback(altitude_callback);
|
||||
@ -412,7 +411,7 @@ for all data to be up to date before doing anything*/
|
||||
attitude_data.quaternion.q2 = Nav.q[1];
|
||||
attitude_data.quaternion.q3 = Nav.q[2];
|
||||
attitude_data.quaternion.q4 = Nav.q[3];
|
||||
} else if (ahrs_algorithm == SIMPLE_Algo) {
|
||||
} else if (ahrs_algorithm == AHRSSETTINGS_ALGORITHM_SIMPLE) {
|
||||
float q[4];
|
||||
float rpy[3];
|
||||
/***************** SIMPLE ATTITUDE FROM NORTH AND ACCEL ************/
|
||||
@ -728,15 +727,20 @@ void reset_values() {
|
||||
void send_attitude(void)
|
||||
{
|
||||
AttitudeActualData attitude;
|
||||
AHRSSettingsData settings;
|
||||
AHRSSettingsGet(&settings);
|
||||
|
||||
attitude.q1 = attitude_data.quaternion.q1;
|
||||
attitude.q2 = attitude_data.quaternion.q2;
|
||||
attitude.q3 = attitude_data.quaternion.q3;
|
||||
attitude.q4 = attitude_data.quaternion.q4;
|
||||
float rpy[3];
|
||||
Quaternion2RPY(&attitude_data.quaternion.q1, rpy);
|
||||
attitude.Roll = rpy[0];
|
||||
attitude.Pitch = rpy[1];
|
||||
attitude.Yaw = rpy[2];
|
||||
attitude.Roll = rpy[0] + settings.RollBias;
|
||||
attitude.Pitch = rpy[1] + settings.PitchBias;
|
||||
attitude.Yaw = rpy[2] + settings.YawBias;
|
||||
if(attitude.Yaw > 360)
|
||||
attitude.Yaw -= 360;
|
||||
AttitudeActualSet(&attitude);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
static AttitudeRawData AttitudeRaw;
|
||||
static AttitudeActualData AttitudeActual;
|
||||
static AHRSCalibrationData AHRSCalibration;
|
||||
static AttitudeSettingsData AttitudeSettings;
|
||||
static AhrsStatusData AhrsStatus;
|
||||
static BaroAltitudeData BaroAltitude;
|
||||
static GPSPositionData GPSPosition;
|
||||
@ -27,15 +26,14 @@ AhrsSharedObject objectHandles[MAX_AHRS_OBJECTS];
|
||||
CREATEHANDLE(0, AttitudeRaw);
|
||||
CREATEHANDLE(1, AttitudeActual);
|
||||
CREATEHANDLE(2, AHRSCalibration);
|
||||
CREATEHANDLE(3, AttitudeSettings);
|
||||
CREATEHANDLE(4, AhrsStatus);
|
||||
CREATEHANDLE(5, BaroAltitude);
|
||||
CREATEHANDLE(6, GPSPosition);
|
||||
CREATEHANDLE(7, PositionActual);
|
||||
CREATEHANDLE(8, HomeLocation);
|
||||
CREATEHANDLE(9, AHRSSettings);
|
||||
CREATEHANDLE(3, AhrsStatus);
|
||||
CREATEHANDLE(4, BaroAltitude);
|
||||
CREATEHANDLE(5, GPSPosition);
|
||||
CREATEHANDLE(6, PositionActual);
|
||||
CREATEHANDLE(7, HomeLocation);
|
||||
CREATEHANDLE(8, AHRSSettings);
|
||||
|
||||
#if 10 != MAX_AHRS_OBJECTS //sanity check
|
||||
#if 9 != MAX_AHRS_OBJECTS //sanity check
|
||||
#error We did not create the correct number of xxxHandle() functions
|
||||
#endif
|
||||
|
||||
@ -68,7 +66,6 @@ void AhrsInitHandles(void)
|
||||
ADDHANDLE(idx++, AttitudeRaw);
|
||||
ADDHANDLE(idx++, AttitudeActual);
|
||||
ADDHANDLE(idx++, AHRSCalibration);
|
||||
ADDHANDLE(idx++, AttitudeSettings);
|
||||
ADDHANDLE(idx++, AhrsStatus);
|
||||
ADDHANDLE(idx++, BaroAltitude);
|
||||
ADDHANDLE(idx++, GPSPosition);
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include "attitudeactual.h"
|
||||
#include "attituderaw.h"
|
||||
#include "attitudesettings.h"
|
||||
#include "ahrsstatus.h"
|
||||
#include "baroaltitude.h"
|
||||
#include "gpsposition.h"
|
||||
@ -19,7 +18,6 @@ typedef union {
|
||||
AttitudeRawData AttitudeRaw;
|
||||
AttitudeActualData AttitudeActual;
|
||||
AHRSCalibrationData AHRSCalibration;
|
||||
AttitudeSettingsData AttitudeSettings;
|
||||
AhrsStatusData AhrsStatus;
|
||||
BaroAltitudeData BaroAltitude;
|
||||
GPSPositionData GPSPosition;
|
||||
@ -30,7 +28,7 @@ typedef union {
|
||||
|
||||
/** The number of UAVObjects we will be dealing with.
|
||||
*/
|
||||
#define MAX_AHRS_OBJECTS 10
|
||||
#define MAX_AHRS_OBJECTS 9
|
||||
|
||||
/** Our own version of a UAVObject.
|
||||
*/
|
||||
|
@ -175,7 +175,6 @@ SRC += $(OPUAVOBJ)/ahrssettings.c
|
||||
SRC += $(OPUAVOBJ)/flightbatterystate.c
|
||||
SRC += $(OPUAVOBJ)/attituderaw.c
|
||||
SRC += $(OPUAVOBJ)/homelocation.c
|
||||
SRC += $(OPUAVOBJ)/attitudesettings.c
|
||||
SRC += $(OPUAVOBJ)/mixersettings.c
|
||||
SRC += $(OPUAVOBJ)/mixerstatus.c
|
||||
#SRC += $(OPUAVOBJ)/lesstabilizationsettings.c
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "manualcontrolcommand.h"
|
||||
#include "actuatordesired.h"
|
||||
#include "attitudedesired.h"
|
||||
#include "attitudesettings.h"
|
||||
#include "ahrssettings.h"
|
||||
|
||||
// Private constants
|
||||
#define STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
@ -260,12 +260,12 @@ static void manualControlTask(void *parameters)
|
||||
}
|
||||
|
||||
if (cmd.Accessory3 < -.5) { //TODO: Make what happens here depend on GCS
|
||||
AttitudeSettingsData attitudeSettings;
|
||||
AttitudeSettingsGet(&attitudeSettings);
|
||||
AHRSSettingsData attitudeSettings;
|
||||
AHRSSettingsGet(&attitudeSettings);
|
||||
// Hard coding a maximum bias of 15 for now... maybe mistake
|
||||
attitudeSettings.PitchBias = cmd.Accessory1 * 15;
|
||||
attitudeSettings.RollBias = cmd.Accessory2 * 15;
|
||||
AttitudeSettingsSet(&attitudeSettings);
|
||||
AHRSSettingsSet(&attitudeSettings);
|
||||
} else if (cmd.Accessory3 > .9) {
|
||||
// REALLY don't want to end up here accidentally. I've also saved by meta for Stabilization setting to be
|
||||
// flight read only by default
|
||||
|
@ -82,9 +82,10 @@ static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
memset(&data, 0, sizeof(AHRSSettingsData));
|
||||
data.Algorithm = 1;
|
||||
data.Downsampling = 20;
|
||||
data.UpdateRaw = 0;
|
||||
data.UpdateFiltered = 1;
|
||||
data.UpdatePeriod = 20;
|
||||
data.UpdatePeriod = 1;
|
||||
data.YawBias = 0;
|
||||
data.PitchBias = 0;
|
||||
data.RollBias = 0;
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
|
@ -1,113 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup AttitudeSettings AttitudeSettings
|
||||
* @brief Sets correction between airframe attitude and AHRS attitude
|
||||
*
|
||||
* Autogenerated files and functions for AttitudeSettings Object
|
||||
* @{
|
||||
*
|
||||
* @file attitudesettings.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the AttitudeSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: attitudesettings.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 "attitudesettings.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 AttitudeSettingsInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(ATTITUDESETTINGS_OBJID, ATTITUDESETTINGS_NAME, ATTITUDESETTINGS_METANAME, 0,
|
||||
ATTITUDESETTINGS_ISSINGLEINST, ATTITUDESETTINGS_ISSETTINGS, ATTITUDESETTINGS_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)
|
||||
{
|
||||
AttitudeSettingsData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(AttitudeSettingsData));
|
||||
data.PitchBias = 0;
|
||||
data.RollBias = 0;
|
||||
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
metadata.access = ACCESS_READWRITE;
|
||||
metadata.gcsAccess = ACCESS_READWRITE;
|
||||
metadata.telemetryAcked = 1;
|
||||
metadata.telemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.telemetryUpdatePeriod = 0;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
UAVObjSetMetadata(obj, &metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object handle
|
||||
*/
|
||||
UAVObjHandle AttitudeSettingsHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@
|
||||
#define AHRSSETTINGS_H
|
||||
|
||||
// Object constants
|
||||
#define AHRSSETTINGS_OBJID 4141274898U
|
||||
#define AHRSSETTINGS_OBJID 1456050280U
|
||||
#define AHRSSETTINGS_NAME "AHRSSettings"
|
||||
#define AHRSSETTINGS_METANAME "AHRSSettingsMeta"
|
||||
#define AHRSSETTINGS_ISSINGLEINST 1
|
||||
@ -73,9 +73,10 @@
|
||||
typedef struct {
|
||||
uint8_t Algorithm;
|
||||
uint8_t Downsampling;
|
||||
uint8_t UpdateRaw;
|
||||
uint8_t UpdateFiltered;
|
||||
int32_t UpdatePeriod;
|
||||
uint8_t UpdatePeriod;
|
||||
float YawBias;
|
||||
float PitchBias;
|
||||
float RollBias;
|
||||
|
||||
} __attribute__((packed)) AHRSSettingsData;
|
||||
|
||||
@ -84,13 +85,10 @@ typedef struct {
|
||||
/* Enumeration options for field Algorithm */
|
||||
typedef enum { AHRSSETTINGS_ALGORITHM_SIMPLE=0, AHRSSETTINGS_ALGORITHM_INSGPS_INDOOR_NOMAG=1, AHRSSETTINGS_ALGORITHM_INSGPS_INDOOR=2, AHRSSETTINGS_ALGORITHM_INSGPS_OUTDOOR=3 } AHRSSettingsAlgorithmOptions;
|
||||
// Field Downsampling information
|
||||
// Field UpdateRaw information
|
||||
/* Enumeration options for field UpdateRaw */
|
||||
typedef enum { AHRSSETTINGS_UPDATERAW_FALSE=0, AHRSSETTINGS_UPDATERAW_TRUE=1 } AHRSSettingsUpdateRawOptions;
|
||||
// Field UpdateFiltered information
|
||||
/* Enumeration options for field UpdateFiltered */
|
||||
typedef enum { AHRSSETTINGS_UPDATEFILTERED_FALSE=0, AHRSSETTINGS_UPDATEFILTERED_TRUE=1 } AHRSSettingsUpdateFilteredOptions;
|
||||
// Field UpdatePeriod information
|
||||
// Field YawBias information
|
||||
// Field PitchBias information
|
||||
// Field RollBias information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
|
@ -1,93 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup AttitudeSettings AttitudeSettings
|
||||
* @brief Sets correction between airframe attitude and AHRS attitude
|
||||
*
|
||||
* Autogenerated files and functions for AttitudeSettings Object
|
||||
|
||||
* @{
|
||||
*
|
||||
* @file attitudesettings.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the AttitudeSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: attitudesettings.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 ATTITUDESETTINGS_H
|
||||
#define ATTITUDESETTINGS_H
|
||||
|
||||
// Object constants
|
||||
#define ATTITUDESETTINGS_OBJID 1065705802U
|
||||
#define ATTITUDESETTINGS_NAME "AttitudeSettings"
|
||||
#define ATTITUDESETTINGS_METANAME "AttitudeSettingsMeta"
|
||||
#define ATTITUDESETTINGS_ISSINGLEINST 1
|
||||
#define ATTITUDESETTINGS_ISSETTINGS 1
|
||||
#define ATTITUDESETTINGS_NUMBYTES sizeof(AttitudeSettingsData)
|
||||
|
||||
// Object access macros
|
||||
/**
|
||||
* @function AttitudeSettingsGet(dataOut)
|
||||
* @brief Populate a AttitudeSettingsData object
|
||||
* @param[out] dataOut
|
||||
*/
|
||||
#define AttitudeSettingsGet(dataOut) UAVObjGetData(AttitudeSettingsHandle(), dataOut)
|
||||
#define AttitudeSettingsSet(dataIn) UAVObjSetData(AttitudeSettingsHandle(), dataIn)
|
||||
#define AttitudeSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(AttitudeSettingsHandle(), instId, dataOut)
|
||||
#define AttitudeSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(AttitudeSettingsHandle(), instId, dataIn)
|
||||
#define AttitudeSettingsConnectQueue(queue) UAVObjConnectQueue(AttitudeSettingsHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define AttitudeSettingsConnectCallback(cb) UAVObjConnectCallback(AttitudeSettingsHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define AttitudeSettingsCreateInstance() UAVObjCreateInstance(AttitudeSettingsHandle())
|
||||
#define AttitudeSettingsRequestUpdate() UAVObjRequestUpdate(AttitudeSettingsHandle())
|
||||
#define AttitudeSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(AttitudeSettingsHandle(), instId)
|
||||
#define AttitudeSettingsUpdated() UAVObjUpdated(AttitudeSettingsHandle())
|
||||
#define AttitudeSettingsInstUpdated(instId) UAVObjUpdated(AttitudeSettingsHandle(), instId)
|
||||
#define AttitudeSettingsGetMetadata(dataOut) UAVObjGetMetadata(AttitudeSettingsHandle(), dataOut)
|
||||
#define AttitudeSettingsSetMetadata(dataIn) UAVObjSetMetadata(AttitudeSettingsHandle(), dataIn)
|
||||
#define AttitudeSettingsReadOnly(dataIn) UAVObjReadOnly(AttitudeSettingsHandle())
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
float PitchBias;
|
||||
float RollBias;
|
||||
|
||||
} __attribute__((packed)) AttitudeSettingsData;
|
||||
|
||||
// Field information
|
||||
// Field PitchBias information
|
||||
// Field RollBias information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t AttitudeSettingsInitialize();
|
||||
UAVObjHandle AttitudeSettingsHandle();
|
||||
|
||||
#endif // ATTITUDESETTINGS_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -37,7 +37,6 @@
|
||||
#include "attitudeactual.h"
|
||||
#include "attitudedesired.h"
|
||||
#include "attituderaw.h"
|
||||
#include "attitudesettings.h"
|
||||
#include "baroaltitude.h"
|
||||
#include "exampleobject1.h"
|
||||
#include "exampleobject2.h"
|
||||
@ -81,7 +80,6 @@ void UAVObjectsInitializeAll()
|
||||
AttitudeActualInitialize();
|
||||
AttitudeDesiredInitialize();
|
||||
AttitudeRawInitialize();
|
||||
AttitudeSettingsInitialize();
|
||||
BaroAltitudeInitialize();
|
||||
ExampleObject1Initialize();
|
||||
ExampleObject2Initialize();
|
||||
|
@ -53,21 +53,18 @@ AHRSSettings::AHRSSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAM
|
||||
QStringList DownsamplingElemNames;
|
||||
DownsamplingElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Downsampling"), QString(""), UAVObjectField::UINT8, DownsamplingElemNames, QStringList()) );
|
||||
QStringList UpdateRawElemNames;
|
||||
UpdateRawElemNames.append("0");
|
||||
QStringList UpdateRawEnumOptions;
|
||||
UpdateRawEnumOptions.append("FALSE");
|
||||
UpdateRawEnumOptions.append("TRUE");
|
||||
fields.append( new UAVObjectField(QString("UpdateRaw"), QString("raw"), UAVObjectField::ENUM, UpdateRawElemNames, UpdateRawEnumOptions) );
|
||||
QStringList UpdateFilteredElemNames;
|
||||
UpdateFilteredElemNames.append("0");
|
||||
QStringList UpdateFilteredEnumOptions;
|
||||
UpdateFilteredEnumOptions.append("FALSE");
|
||||
UpdateFilteredEnumOptions.append("TRUE");
|
||||
fields.append( new UAVObjectField(QString("UpdateFiltered"), QString("raw"), UAVObjectField::ENUM, UpdateFilteredElemNames, UpdateFilteredEnumOptions) );
|
||||
QStringList UpdatePeriodElemNames;
|
||||
UpdatePeriodElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("UpdatePeriod"), QString("ms"), UAVObjectField::INT32, UpdatePeriodElemNames, QStringList()) );
|
||||
fields.append( new UAVObjectField(QString("UpdatePeriod"), QString("ms"), UAVObjectField::UINT8, UpdatePeriodElemNames, QStringList()) );
|
||||
QStringList YawBiasElemNames;
|
||||
YawBiasElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("YawBias"), QString(""), UAVObjectField::FLOAT32, YawBiasElemNames, QStringList()) );
|
||||
QStringList PitchBiasElemNames;
|
||||
PitchBiasElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("PitchBias"), QString(""), UAVObjectField::FLOAT32, PitchBiasElemNames, QStringList()) );
|
||||
QStringList RollBiasElemNames;
|
||||
RollBiasElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("RollBias"), QString(""), UAVObjectField::FLOAT32, RollBiasElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
@ -103,9 +100,10 @@ void AHRSSettings::setDefaultFieldValues()
|
||||
{
|
||||
data.Algorithm = 1;
|
||||
data.Downsampling = 20;
|
||||
data.UpdateRaw = 0;
|
||||
data.UpdateFiltered = 1;
|
||||
data.UpdatePeriod = 20;
|
||||
data.UpdatePeriod = 1;
|
||||
data.YawBias = 0;
|
||||
data.PitchBias = 0;
|
||||
data.RollBias = 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,10 @@ public:
|
||||
typedef struct {
|
||||
quint8 Algorithm;
|
||||
quint8 Downsampling;
|
||||
quint8 UpdateRaw;
|
||||
quint8 UpdateFiltered;
|
||||
qint32 UpdatePeriod;
|
||||
quint8 UpdatePeriod;
|
||||
float YawBias;
|
||||
float PitchBias;
|
||||
float RollBias;
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
@ -56,17 +57,14 @@ public:
|
||||
/* Enumeration options for field Algorithm */
|
||||
typedef enum { ALGORITHM_SIMPLE=0, ALGORITHM_INSGPS_INDOOR_NOMAG=1, ALGORITHM_INSGPS_INDOOR=2, ALGORITHM_INSGPS_OUTDOOR=3 } AlgorithmOptions;
|
||||
// Field Downsampling information
|
||||
// Field UpdateRaw information
|
||||
/* Enumeration options for field UpdateRaw */
|
||||
typedef enum { UPDATERAW_FALSE=0, UPDATERAW_TRUE=1 } UpdateRawOptions;
|
||||
// Field UpdateFiltered information
|
||||
/* Enumeration options for field UpdateFiltered */
|
||||
typedef enum { UPDATEFILTERED_FALSE=0, UPDATEFILTERED_TRUE=1 } UpdateFilteredOptions;
|
||||
// Field UpdatePeriod information
|
||||
// Field YawBias information
|
||||
// Field PitchBias information
|
||||
// Field RollBias information
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 4141274898U;
|
||||
static const quint32 OBJID = 1456050280U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 1;
|
||||
|
@ -61,33 +61,39 @@ _fields = [ \
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'UpdateRaw',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'FALSE',
|
||||
'1' : 'TRUE',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'UpdateFiltered',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'FALSE',
|
||||
'1' : 'TRUE',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'UpdatePeriod',
|
||||
'i',
|
||||
'B',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'YawBias',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'PitchBias',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'RollBias',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
@ -100,7 +106,7 @@ _fields = [ \
|
||||
|
||||
class AHRSSettings(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 4141274898
|
||||
OBJID = 1456050280
|
||||
NAME = "AHRSSettings"
|
||||
METANAME = "AHRSSettingsMeta"
|
||||
ISSINGLEINST = 1
|
||||
|
@ -1,133 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file attitudesettings.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: attitudesettings.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 "attitudesettings.h"
|
||||
#include "uavobjectfield.h"
|
||||
|
||||
const QString AttitudeSettings::NAME = QString("AttitudeSettings");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
AttitudeSettings::AttitudeSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
QStringList PitchBiasElemNames;
|
||||
PitchBiasElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("PitchBias"), QString(""), UAVObjectField::FLOAT32, PitchBiasElemNames, QStringList()) );
|
||||
QStringList RollBiasElemNames;
|
||||
RollBiasElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("RollBias"), QString(""), UAVObjectField::FLOAT32, RollBiasElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default metadata for this object
|
||||
*/
|
||||
UAVObject::Metadata AttitudeSettings::getDefaultMetadata()
|
||||
{
|
||||
UAVObject::Metadata metadata;
|
||||
metadata.flightAccess = ACCESS_READWRITE;
|
||||
metadata.gcsAccess = ACCESS_READWRITE;
|
||||
metadata.gcsTelemetryAcked = 1;
|
||||
metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.flightTelemetryAcked = 1;
|
||||
metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
|
||||
metadata.flightTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
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 AttitudeSettings::setDefaultFieldValues()
|
||||
{
|
||||
data.PitchBias = 0;
|
||||
data.RollBias = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object data fields
|
||||
*/
|
||||
AttitudeSettings::DataFields AttitudeSettings::getData()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
*/
|
||||
void AttitudeSettings::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* AttitudeSettings::clone(quint32 instID)
|
||||
{
|
||||
AttitudeSettings* obj = new AttitudeSettings();
|
||||
obj->initialize(instID, this->getMetaObject());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
AttitudeSettings* AttitudeSettings::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
||||
{
|
||||
return dynamic_cast<AttitudeSettings*>(objMngr->getObject(AttitudeSettings::OBJID, instID));
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file attitudesettings.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: attitudesettings.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 ATTITUDESETTINGS_H
|
||||
#define ATTITUDESETTINGS_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT AttitudeSettings: public UAVDataObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Field structure
|
||||
typedef struct {
|
||||
float PitchBias;
|
||||
float RollBias;
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Field information
|
||||
// Field PitchBias information
|
||||
// Field RollBias information
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 1065705802U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 1;
|
||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
||||
|
||||
// Functions
|
||||
AttitudeSettings();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
|
||||
static AttitudeSettings* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
||||
|
||||
private:
|
||||
DataFields data;
|
||||
|
||||
void setDefaultFieldValues();
|
||||
|
||||
};
|
||||
|
||||
#endif // ATTITUDESETTINGS_H
|
@ -1,96 +0,0 @@
|
||||
##
|
||||
##############################################################################
|
||||
#
|
||||
# @file attitudesettings.py
|
||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
# @brief Implementation of the AttitudeSettings object. This file has been
|
||||
# automatically generated by the UAVObjectGenerator.
|
||||
#
|
||||
# @note Object definition file: attitudesettings.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(
|
||||
'PitchBias',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'RollBias',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class AttitudeSettings(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 1065705802
|
||||
NAME = "AttitudeSettings"
|
||||
METANAME = "AttitudeSettingsMeta"
|
||||
ISSINGLEINST = 1
|
||||
ISSETTINGS = 1
|
||||
|
||||
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 = AttitudeSettings()
|
||||
print (x)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#import pdb ; pdb.run('main()')
|
||||
main()
|
@ -45,8 +45,7 @@ HEADERS += uavobjects_global.h \
|
||||
velocitydesired.h \
|
||||
velocityactual.h \
|
||||
guidancesettings.h \
|
||||
positiondesired.h \
|
||||
attitudesettings.h
|
||||
positiondesired.h
|
||||
|
||||
SOURCES += uavobject.cpp \
|
||||
uavmetaobject.cpp \
|
||||
@ -89,6 +88,5 @@ SOURCES += uavobject.cpp \
|
||||
velocitydesired.cpp \
|
||||
velocityactual.cpp \
|
||||
guidancesettings.cpp \
|
||||
positiondesired.cpp \
|
||||
attitudesettings.cpp
|
||||
positiondesired.cpp
|
||||
OTHER_FILES += UAVObjects.pluginspec
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "attitudeactual.h"
|
||||
#include "attitudedesired.h"
|
||||
#include "attituderaw.h"
|
||||
#include "attitudesettings.h"
|
||||
#include "baroaltitude.h"
|
||||
#include "exampleobject1.h"
|
||||
#include "exampleobject2.h"
|
||||
@ -83,7 +82,6 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
|
||||
objMngr->registerObject( new AttitudeActual() );
|
||||
objMngr->registerObject( new AttitudeDesired() );
|
||||
objMngr->registerObject( new AttitudeRaw() );
|
||||
objMngr->registerObject( new AttitudeSettings() );
|
||||
objMngr->registerObject( new BaroAltitude() );
|
||||
objMngr->registerObject( new ExampleObject1() );
|
||||
objMngr->registerObject( new ExampleObject2() );
|
||||
|
@ -3,9 +3,10 @@
|
||||
<description>Settings for the @ref AHRSCommsModule to control the algorithm and what is updated</description>
|
||||
<field name="Algorithm" units="" type="enum" elements="1" options="SIMPLE,INSGPS_INDOOR_NOMAG,INSGPS_INDOOR,INSGPS_OUTDOOR" defaultvalue="INSGPS_INDOOR_NOMAG"/>
|
||||
<field name="Downsampling" units="" type="uint8" elements="1" defaultvalue="20"/>
|
||||
<field name="UpdateRaw" units="raw" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="FALSE"/>
|
||||
<field name="UpdateFiltered" units="raw" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
|
||||
<field name="UpdatePeriod" units="ms" type="int32" elements="1" defaultvalue="20"/>
|
||||
<field name="UpdatePeriod" units="ms" type="uint8" elements="1" defaultvalue="1"/>
|
||||
<field name="YawBias" units="" type="float" elements="1" defaultvalue="0"/>
|
||||
<field name="PitchBias" units="" type="float" elements="1" defaultvalue="0"/>
|
||||
<field name="RollBias" units="" type="float" elements="1" defaultvalue="0"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||
|
@ -1,11 +0,0 @@
|
||||
<xml>
|
||||
<object name="AttitudeSettings" singleinstance="true" settings="true">
|
||||
<description>Sets correction between airframe attitude and AHRS attitude</description>
|
||||
<field name="PitchBias" units="" type="float" elements="1" defaultvalue="0"/>
|
||||
<field name="RollBias" units="" type="float" elements="1" defaultvalue="0"/>
|
||||
<access gcs="readwrite" flight="readwrite"/>
|
||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||
<telemetryflight acked="true" updatemode="onchange" period="0"/>
|
||||
<logging updatemode="never" period="0"/>
|
||||
</object>
|
||||
</xml>
|
Loading…
x
Reference in New Issue
Block a user