mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
Adding mixerstatus/mixersetting uavobject files that were missed
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1701 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
5c9701753b
commit
f96654ace1
189
flight/OpenPilot/UAVObjects/inc/mixersettings.h
Normal file
189
flight/OpenPilot/UAVObjects/inc/mixersettings.h
Normal file
@ -0,0 +1,189 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup MixerSettings MixerSettings
|
||||
* @brief Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType
|
||||
*
|
||||
* Autogenerated files and functions for MixerSettings Object
|
||||
|
||||
* @{
|
||||
*
|
||||
* @file mixersettings.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the MixerSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: mixersettings.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 MIXERSETTINGS_H
|
||||
#define MIXERSETTINGS_H
|
||||
|
||||
// Object constants
|
||||
#define MIXERSETTINGS_OBJID 1614220618U
|
||||
#define MIXERSETTINGS_NAME "MixerSettings"
|
||||
#define MIXERSETTINGS_METANAME "MixerSettingsMeta"
|
||||
#define MIXERSETTINGS_ISSINGLEINST 1
|
||||
#define MIXERSETTINGS_ISSETTINGS 1
|
||||
#define MIXERSETTINGS_NUMBYTES sizeof(MixerSettingsData)
|
||||
|
||||
// Object access macros
|
||||
/**
|
||||
* @function MixerSettingsGet(dataOut)
|
||||
* @brief Populate a MixerSettingsData object
|
||||
* @param[out] dataOut
|
||||
*/
|
||||
#define MixerSettingsGet(dataOut) UAVObjGetData(MixerSettingsHandle(), dataOut)
|
||||
#define MixerSettingsSet(dataIn) UAVObjSetData(MixerSettingsHandle(), dataIn)
|
||||
#define MixerSettingsInstGet(instId, dataOut) UAVObjGetInstanceData(MixerSettingsHandle(), instId, dataOut)
|
||||
#define MixerSettingsInstSet(instId, dataIn) UAVObjSetInstanceData(MixerSettingsHandle(), instId, dataIn)
|
||||
#define MixerSettingsConnectQueue(queue) UAVObjConnectQueue(MixerSettingsHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define MixerSettingsConnectCallback(cb) UAVObjConnectCallback(MixerSettingsHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define MixerSettingsCreateInstance() UAVObjCreateInstance(MixerSettingsHandle())
|
||||
#define MixerSettingsRequestUpdate() UAVObjRequestUpdate(MixerSettingsHandle())
|
||||
#define MixerSettingsRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(MixerSettingsHandle(), instId)
|
||||
#define MixerSettingsUpdated() UAVObjUpdated(MixerSettingsHandle())
|
||||
#define MixerSettingsInstUpdated(instId) UAVObjUpdated(MixerSettingsHandle(), instId)
|
||||
#define MixerSettingsGetMetadata(dataOut) UAVObjGetMetadata(MixerSettingsHandle(), dataOut)
|
||||
#define MixerSettingsSetMetadata(dataIn) UAVObjSetMetadata(MixerSettingsHandle(), dataIn)
|
||||
#define MixerSettingsReadOnly(dataIn) UAVObjReadOnly(MixerSettingsHandle())
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
float MaxAccel;
|
||||
float FeedForward;
|
||||
float AccelTime;
|
||||
float DecelTime;
|
||||
float ThrottleCurve1[5];
|
||||
float ThrottleCurve2[5];
|
||||
uint8_t Mixer0Type;
|
||||
float Mixer0Matrix[5];
|
||||
uint8_t Mixer1Type;
|
||||
float Mixer1Matrix[5];
|
||||
uint8_t Mixer2Type;
|
||||
float Mixer2Matrix[5];
|
||||
uint8_t Mixer3Type;
|
||||
float Mixer3Matrix[5];
|
||||
uint8_t Mixer4Type;
|
||||
float Mixer4Matrix[5];
|
||||
uint8_t Mixer5Type;
|
||||
float Mixer5Matrix[5];
|
||||
uint8_t Mixer6Type;
|
||||
float Mixer6Matrix[5];
|
||||
uint8_t Mixer7Type;
|
||||
float Mixer7Matrix[5];
|
||||
|
||||
} __attribute__((packed)) MixerSettingsData;
|
||||
|
||||
// Field information
|
||||
// Field MaxAccel information
|
||||
// Field FeedForward information
|
||||
// Field AccelTime information
|
||||
// Field DecelTime information
|
||||
// Field ThrottleCurve1 information
|
||||
/* Array element names for field ThrottleCurve1 */
|
||||
typedef enum { MIXERSETTINGS_THROTTLECURVE1_0=0, MIXERSETTINGS_THROTTLECURVE1_25=1, MIXERSETTINGS_THROTTLECURVE1_50=2, MIXERSETTINGS_THROTTLECURVE1_75=3, MIXERSETTINGS_THROTTLECURVE1_100=4 } MixerSettingsThrottleCurve1Elem;
|
||||
/* Number of elements for field ThrottleCurve1 */
|
||||
#define MIXERSETTINGS_THROTTLECURVE1_NUMELEM 5
|
||||
// Field ThrottleCurve2 information
|
||||
/* Array element names for field ThrottleCurve2 */
|
||||
typedef enum { MIXERSETTINGS_THROTTLECURVE2_0=0, MIXERSETTINGS_THROTTLECURVE2_25=1, MIXERSETTINGS_THROTTLECURVE2_50=2, MIXERSETTINGS_THROTTLECURVE2_75=3, MIXERSETTINGS_THROTTLECURVE2_100=4 } MixerSettingsThrottleCurve2Elem;
|
||||
/* Number of elements for field ThrottleCurve2 */
|
||||
#define MIXERSETTINGS_THROTTLECURVE2_NUMELEM 5
|
||||
// Field Mixer0Type information
|
||||
/* Enumeration options for field Mixer0Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER0TYPE_DISABLED=0, MIXERSETTINGS_MIXER0TYPE_MOTOR=1, MIXERSETTINGS_MIXER0TYPE_SERVO=2 } MixerSettingsMixer0TypeOptions;
|
||||
// Field Mixer0Matrix information
|
||||
/* Array element names for field Mixer0Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER0MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER0MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER0MATRIX_ROLL=2, MIXERSETTINGS_MIXER0MATRIX_PITCH=3, MIXERSETTINGS_MIXER0MATRIX_YAW=4 } MixerSettingsMixer0MatrixElem;
|
||||
/* Number of elements for field Mixer0Matrix */
|
||||
#define MIXERSETTINGS_MIXER0MATRIX_NUMELEM 5
|
||||
// Field Mixer1Type information
|
||||
/* Enumeration options for field Mixer1Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER1TYPE_DISABLED=0, MIXERSETTINGS_MIXER1TYPE_MOTOR=1, MIXERSETTINGS_MIXER1TYPE_SERVO=2 } MixerSettingsMixer1TypeOptions;
|
||||
// Field Mixer1Matrix information
|
||||
/* Array element names for field Mixer1Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER1MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER1MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER1MATRIX_ROLL=2, MIXERSETTINGS_MIXER1MATRIX_PITCH=3, MIXERSETTINGS_MIXER1MATRIX_YAW=4 } MixerSettingsMixer1MatrixElem;
|
||||
/* Number of elements for field Mixer1Matrix */
|
||||
#define MIXERSETTINGS_MIXER1MATRIX_NUMELEM 5
|
||||
// Field Mixer2Type information
|
||||
/* Enumeration options for field Mixer2Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER2TYPE_DISABLED=0, MIXERSETTINGS_MIXER2TYPE_MOTOR=1, MIXERSETTINGS_MIXER2TYPE_SERVO=2 } MixerSettingsMixer2TypeOptions;
|
||||
// Field Mixer2Matrix information
|
||||
/* Array element names for field Mixer2Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER2MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER2MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER2MATRIX_ROLL=2, MIXERSETTINGS_MIXER2MATRIX_PITCH=3, MIXERSETTINGS_MIXER2MATRIX_YAW=4 } MixerSettingsMixer2MatrixElem;
|
||||
/* Number of elements for field Mixer2Matrix */
|
||||
#define MIXERSETTINGS_MIXER2MATRIX_NUMELEM 5
|
||||
// Field Mixer3Type information
|
||||
/* Enumeration options for field Mixer3Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER3TYPE_DISABLED=0, MIXERSETTINGS_MIXER3TYPE_MOTOR=1, MIXERSETTINGS_MIXER3TYPE_SERVO=2 } MixerSettingsMixer3TypeOptions;
|
||||
// Field Mixer3Matrix information
|
||||
/* Array element names for field Mixer3Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER3MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER3MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER3MATRIX_ROLL=2, MIXERSETTINGS_MIXER3MATRIX_PITCH=3, MIXERSETTINGS_MIXER3MATRIX_YAW=4 } MixerSettingsMixer3MatrixElem;
|
||||
/* Number of elements for field Mixer3Matrix */
|
||||
#define MIXERSETTINGS_MIXER3MATRIX_NUMELEM 5
|
||||
// Field Mixer4Type information
|
||||
/* Enumeration options for field Mixer4Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER4TYPE_DISABLED=0, MIXERSETTINGS_MIXER4TYPE_MOTOR=1, MIXERSETTINGS_MIXER4TYPE_SERVO=2 } MixerSettingsMixer4TypeOptions;
|
||||
// Field Mixer4Matrix information
|
||||
/* Array element names for field Mixer4Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER4MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER4MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER4MATRIX_ROLL=2, MIXERSETTINGS_MIXER4MATRIX_PITCH=3, MIXERSETTINGS_MIXER4MATRIX_YAW=4 } MixerSettingsMixer4MatrixElem;
|
||||
/* Number of elements for field Mixer4Matrix */
|
||||
#define MIXERSETTINGS_MIXER4MATRIX_NUMELEM 5
|
||||
// Field Mixer5Type information
|
||||
/* Enumeration options for field Mixer5Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER5TYPE_DISABLED=0, MIXERSETTINGS_MIXER5TYPE_MOTOR=1, MIXERSETTINGS_MIXER5TYPE_SERVO=2 } MixerSettingsMixer5TypeOptions;
|
||||
// Field Mixer5Matrix information
|
||||
/* Array element names for field Mixer5Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER5MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER5MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER5MATRIX_ROLL=2, MIXERSETTINGS_MIXER5MATRIX_PITCH=3, MIXERSETTINGS_MIXER5MATRIX_YAW=4 } MixerSettingsMixer5MatrixElem;
|
||||
/* Number of elements for field Mixer5Matrix */
|
||||
#define MIXERSETTINGS_MIXER5MATRIX_NUMELEM 5
|
||||
// Field Mixer6Type information
|
||||
/* Enumeration options for field Mixer6Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER6TYPE_DISABLED=0, MIXERSETTINGS_MIXER6TYPE_MOTOR=1, MIXERSETTINGS_MIXER6TYPE_SERVO=2 } MixerSettingsMixer6TypeOptions;
|
||||
// Field Mixer6Matrix information
|
||||
/* Array element names for field Mixer6Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER6MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER6MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER6MATRIX_ROLL=2, MIXERSETTINGS_MIXER6MATRIX_PITCH=3, MIXERSETTINGS_MIXER6MATRIX_YAW=4 } MixerSettingsMixer6MatrixElem;
|
||||
/* Number of elements for field Mixer6Matrix */
|
||||
#define MIXERSETTINGS_MIXER6MATRIX_NUMELEM 5
|
||||
// Field Mixer7Type information
|
||||
/* Enumeration options for field Mixer7Type */
|
||||
typedef enum { MIXERSETTINGS_MIXER7TYPE_DISABLED=0, MIXERSETTINGS_MIXER7TYPE_MOTOR=1, MIXERSETTINGS_MIXER7TYPE_SERVO=2 } MixerSettingsMixer7TypeOptions;
|
||||
// Field Mixer7Matrix information
|
||||
/* Array element names for field Mixer7Matrix */
|
||||
typedef enum { MIXERSETTINGS_MIXER7MATRIX_THROTTLECURVE1=0, MIXERSETTINGS_MIXER7MATRIX_THROTTLECURVE2=1, MIXERSETTINGS_MIXER7MATRIX_ROLL=2, MIXERSETTINGS_MIXER7MATRIX_PITCH=3, MIXERSETTINGS_MIXER7MATRIX_YAW=4 } MixerSettingsMixer7MatrixElem;
|
||||
/* Number of elements for field Mixer7Matrix */
|
||||
#define MIXERSETTINGS_MIXER7MATRIX_NUMELEM 5
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t MixerSettingsInitialize();
|
||||
UAVObjHandle MixerSettingsHandle();
|
||||
|
||||
#endif // MIXERSETTINGS_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
105
flight/OpenPilot/UAVObjects/inc/mixerstatus.h
Normal file
105
flight/OpenPilot/UAVObjects/inc/mixerstatus.h
Normal file
@ -0,0 +1,105 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup MixerStatus MixerStatus
|
||||
* @brief Status for the matrix mixer showing the output of each mixer after all scaling
|
||||
*
|
||||
* Autogenerated files and functions for MixerStatus Object
|
||||
|
||||
* @{
|
||||
*
|
||||
* @file mixerstatus.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the MixerStatus object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: mixerstatus.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 MIXERSTATUS_H
|
||||
#define MIXERSTATUS_H
|
||||
|
||||
// Object constants
|
||||
#define MIXERSTATUS_OBJID 2468388390U
|
||||
#define MIXERSTATUS_NAME "MixerStatus"
|
||||
#define MIXERSTATUS_METANAME "MixerStatusMeta"
|
||||
#define MIXERSTATUS_ISSINGLEINST 1
|
||||
#define MIXERSTATUS_ISSETTINGS 0
|
||||
#define MIXERSTATUS_NUMBYTES sizeof(MixerStatusData)
|
||||
|
||||
// Object access macros
|
||||
/**
|
||||
* @function MixerStatusGet(dataOut)
|
||||
* @brief Populate a MixerStatusData object
|
||||
* @param[out] dataOut
|
||||
*/
|
||||
#define MixerStatusGet(dataOut) UAVObjGetData(MixerStatusHandle(), dataOut)
|
||||
#define MixerStatusSet(dataIn) UAVObjSetData(MixerStatusHandle(), dataIn)
|
||||
#define MixerStatusInstGet(instId, dataOut) UAVObjGetInstanceData(MixerStatusHandle(), instId, dataOut)
|
||||
#define MixerStatusInstSet(instId, dataIn) UAVObjSetInstanceData(MixerStatusHandle(), instId, dataIn)
|
||||
#define MixerStatusConnectQueue(queue) UAVObjConnectQueue(MixerStatusHandle(), queue, EV_MASK_ALL_UPDATES)
|
||||
#define MixerStatusConnectCallback(cb) UAVObjConnectCallback(MixerStatusHandle(), cb, EV_MASK_ALL_UPDATES)
|
||||
#define MixerStatusCreateInstance() UAVObjCreateInstance(MixerStatusHandle())
|
||||
#define MixerStatusRequestUpdate() UAVObjRequestUpdate(MixerStatusHandle())
|
||||
#define MixerStatusRequestInstUpdate(instId) UAVObjRequestInstanceUpdate(MixerStatusHandle(), instId)
|
||||
#define MixerStatusUpdated() UAVObjUpdated(MixerStatusHandle())
|
||||
#define MixerStatusInstUpdated(instId) UAVObjUpdated(MixerStatusHandle(), instId)
|
||||
#define MixerStatusGetMetadata(dataOut) UAVObjGetMetadata(MixerStatusHandle(), dataOut)
|
||||
#define MixerStatusSetMetadata(dataIn) UAVObjSetMetadata(MixerStatusHandle(), dataIn)
|
||||
#define MixerStatusReadOnly(dataIn) UAVObjReadOnly(MixerStatusHandle())
|
||||
|
||||
// Object data
|
||||
typedef struct {
|
||||
float Mixer0;
|
||||
float Mixer1;
|
||||
float Mixer2;
|
||||
float Mixer3;
|
||||
float Mixer4;
|
||||
float Mixer5;
|
||||
float Mixer6;
|
||||
float Mixer7;
|
||||
|
||||
} __attribute__((packed)) MixerStatusData;
|
||||
|
||||
// Field information
|
||||
// Field Mixer0 information
|
||||
// Field Mixer1 information
|
||||
// Field Mixer2 information
|
||||
// Field Mixer3 information
|
||||
// Field Mixer4 information
|
||||
// Field Mixer5 information
|
||||
// Field Mixer6 information
|
||||
// Field Mixer7 information
|
||||
|
||||
|
||||
// Generic interface functions
|
||||
int32_t MixerStatusInitialize();
|
||||
UAVObjHandle MixerStatusHandle();
|
||||
|
||||
#endif // MIXERSTATUS_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
173
flight/OpenPilot/UAVObjects/mixersettings.c
Normal file
173
flight/OpenPilot/UAVObjects/mixersettings.c
Normal file
@ -0,0 +1,173 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup MixerSettings MixerSettings
|
||||
* @brief Settings for the @ref ActuatorModule that controls the channel assignments for the mixer based on AircraftType
|
||||
*
|
||||
* Autogenerated files and functions for MixerSettings Object
|
||||
* @{
|
||||
*
|
||||
* @file mixersettings.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the MixerSettings object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: mixersettings.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 "mixersettings.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 MixerSettingsInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(MIXERSETTINGS_OBJID, MIXERSETTINGS_NAME, MIXERSETTINGS_METANAME, 0,
|
||||
MIXERSETTINGS_ISSINGLEINST, MIXERSETTINGS_ISSETTINGS, MIXERSETTINGS_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)
|
||||
{
|
||||
MixerSettingsData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(MixerSettingsData));
|
||||
data.MaxAccel = 1000;
|
||||
data.FeedForward = 0;
|
||||
data.AccelTime = 0;
|
||||
data.DecelTime = 0;
|
||||
data.ThrottleCurve1[0] = -10;
|
||||
data.ThrottleCurve1[1] = -10;
|
||||
data.ThrottleCurve1[2] = -10;
|
||||
data.ThrottleCurve1[3] = -10;
|
||||
data.ThrottleCurve1[4] = -10;
|
||||
data.ThrottleCurve2[0] = -10;
|
||||
data.ThrottleCurve2[1] = -10;
|
||||
data.ThrottleCurve2[2] = -10;
|
||||
data.ThrottleCurve2[3] = -10;
|
||||
data.ThrottleCurve2[4] = -10;
|
||||
data.Mixer0Type = 0;
|
||||
data.Mixer0Matrix[0] = 0;
|
||||
data.Mixer0Matrix[1] = 0;
|
||||
data.Mixer0Matrix[2] = 0;
|
||||
data.Mixer0Matrix[3] = 0;
|
||||
data.Mixer0Matrix[4] = 0;
|
||||
data.Mixer1Type = 0;
|
||||
data.Mixer1Matrix[0] = 0;
|
||||
data.Mixer1Matrix[1] = 0;
|
||||
data.Mixer1Matrix[2] = 0;
|
||||
data.Mixer1Matrix[3] = 0;
|
||||
data.Mixer1Matrix[4] = 0;
|
||||
data.Mixer2Type = 0;
|
||||
data.Mixer2Matrix[0] = 0;
|
||||
data.Mixer2Matrix[1] = 0;
|
||||
data.Mixer2Matrix[2] = 0;
|
||||
data.Mixer2Matrix[3] = 0;
|
||||
data.Mixer2Matrix[4] = 0;
|
||||
data.Mixer3Type = 0;
|
||||
data.Mixer3Matrix[0] = 0;
|
||||
data.Mixer3Matrix[1] = 0;
|
||||
data.Mixer3Matrix[2] = 0;
|
||||
data.Mixer3Matrix[3] = 0;
|
||||
data.Mixer3Matrix[4] = 0;
|
||||
data.Mixer4Type = 0;
|
||||
data.Mixer4Matrix[0] = 0;
|
||||
data.Mixer4Matrix[1] = 0;
|
||||
data.Mixer4Matrix[2] = 0;
|
||||
data.Mixer4Matrix[3] = 0;
|
||||
data.Mixer4Matrix[4] = 0;
|
||||
data.Mixer5Type = 0;
|
||||
data.Mixer5Matrix[0] = 0;
|
||||
data.Mixer5Matrix[1] = 0;
|
||||
data.Mixer5Matrix[2] = 0;
|
||||
data.Mixer5Matrix[3] = 0;
|
||||
data.Mixer5Matrix[4] = 0;
|
||||
data.Mixer6Type = 0;
|
||||
data.Mixer6Matrix[0] = 0;
|
||||
data.Mixer6Matrix[1] = 0;
|
||||
data.Mixer6Matrix[2] = 0;
|
||||
data.Mixer6Matrix[3] = 0;
|
||||
data.Mixer6Matrix[4] = 0;
|
||||
data.Mixer7Type = 0;
|
||||
data.Mixer7Matrix[0] = 0;
|
||||
data.Mixer7Matrix[1] = 0;
|
||||
data.Mixer7Matrix[2] = 0;
|
||||
data.Mixer7Matrix[3] = 0;
|
||||
data.Mixer7Matrix[4] = 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 MixerSettingsHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
111
flight/OpenPilot/UAVObjects/mixerstatus.c
Normal file
111
flight/OpenPilot/UAVObjects/mixerstatus.c
Normal file
@ -0,0 +1,111 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup UAVObjects OpenPilot UAVObjects
|
||||
* @{
|
||||
* @addtogroup MixerStatus MixerStatus
|
||||
* @brief Status for the matrix mixer showing the output of each mixer after all scaling
|
||||
*
|
||||
* Autogenerated files and functions for MixerStatus Object
|
||||
* @{
|
||||
*
|
||||
* @file mixerstatus.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Implementation of the MixerStatus object. This file has been
|
||||
* automatically generated by the UAVObjectGenerator.
|
||||
*
|
||||
* @note Object definition file: mixerstatus.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 "mixerstatus.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 MixerStatusInitialize()
|
||||
{
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister(MIXERSTATUS_OBJID, MIXERSTATUS_NAME, MIXERSTATUS_METANAME, 0,
|
||||
MIXERSTATUS_ISSINGLEINST, MIXERSTATUS_ISSETTINGS, MIXERSTATUS_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)
|
||||
{
|
||||
MixerStatusData data;
|
||||
UAVObjMetadata metadata;
|
||||
|
||||
// Initialize object fields to their default values
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof(MixerStatusData));
|
||||
|
||||
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 MixerStatusHandle()
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
325
ground/src/plugins/uavobjects/mixersettings.cpp
Normal file
325
ground/src/plugins/uavobjects/mixersettings.cpp
Normal file
@ -0,0 +1,325 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file mixersettings.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: mixersettings.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 "mixersettings.h"
|
||||
#include "uavobjectfield.h"
|
||||
|
||||
const QString MixerSettings::NAME = QString("MixerSettings");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
MixerSettings::MixerSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
QStringList MaxAccelElemNames;
|
||||
MaxAccelElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("MaxAccel"), QString("units/sec"), UAVObjectField::FLOAT32, MaxAccelElemNames, QStringList()) );
|
||||
QStringList FeedForwardElemNames;
|
||||
FeedForwardElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("FeedForward"), QString(""), UAVObjectField::FLOAT32, FeedForwardElemNames, QStringList()) );
|
||||
QStringList AccelTimeElemNames;
|
||||
AccelTimeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("AccelTime"), QString("ms"), UAVObjectField::FLOAT32, AccelTimeElemNames, QStringList()) );
|
||||
QStringList DecelTimeElemNames;
|
||||
DecelTimeElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("DecelTime"), QString("ms"), UAVObjectField::FLOAT32, DecelTimeElemNames, QStringList()) );
|
||||
QStringList ThrottleCurve1ElemNames;
|
||||
ThrottleCurve1ElemNames.append("0");
|
||||
ThrottleCurve1ElemNames.append("25");
|
||||
ThrottleCurve1ElemNames.append("50");
|
||||
ThrottleCurve1ElemNames.append("75");
|
||||
ThrottleCurve1ElemNames.append("100");
|
||||
fields.append( new UAVObjectField(QString("ThrottleCurve1"), QString("percent"), UAVObjectField::FLOAT32, ThrottleCurve1ElemNames, QStringList()) );
|
||||
QStringList ThrottleCurve2ElemNames;
|
||||
ThrottleCurve2ElemNames.append("0");
|
||||
ThrottleCurve2ElemNames.append("25");
|
||||
ThrottleCurve2ElemNames.append("50");
|
||||
ThrottleCurve2ElemNames.append("75");
|
||||
ThrottleCurve2ElemNames.append("100");
|
||||
fields.append( new UAVObjectField(QString("ThrottleCurve2"), QString("percent"), UAVObjectField::FLOAT32, ThrottleCurve2ElemNames, QStringList()) );
|
||||
QStringList Mixer0TypeElemNames;
|
||||
Mixer0TypeElemNames.append("0");
|
||||
QStringList Mixer0TypeEnumOptions;
|
||||
Mixer0TypeEnumOptions.append("Disabled");
|
||||
Mixer0TypeEnumOptions.append("Motor");
|
||||
Mixer0TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer0Type"), QString(""), UAVObjectField::ENUM, Mixer0TypeElemNames, Mixer0TypeEnumOptions) );
|
||||
QStringList Mixer0MatrixElemNames;
|
||||
Mixer0MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer0MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer0MatrixElemNames.append("Roll");
|
||||
Mixer0MatrixElemNames.append("Pitch");
|
||||
Mixer0MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer0Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer0MatrixElemNames, QStringList()) );
|
||||
QStringList Mixer1TypeElemNames;
|
||||
Mixer1TypeElemNames.append("0");
|
||||
QStringList Mixer1TypeEnumOptions;
|
||||
Mixer1TypeEnumOptions.append("Disabled");
|
||||
Mixer1TypeEnumOptions.append("Motor");
|
||||
Mixer1TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer1Type"), QString(""), UAVObjectField::ENUM, Mixer1TypeElemNames, Mixer1TypeEnumOptions) );
|
||||
QStringList Mixer1MatrixElemNames;
|
||||
Mixer1MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer1MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer1MatrixElemNames.append("Roll");
|
||||
Mixer1MatrixElemNames.append("Pitch");
|
||||
Mixer1MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer1Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer1MatrixElemNames, QStringList()) );
|
||||
QStringList Mixer2TypeElemNames;
|
||||
Mixer2TypeElemNames.append("0");
|
||||
QStringList Mixer2TypeEnumOptions;
|
||||
Mixer2TypeEnumOptions.append("Disabled");
|
||||
Mixer2TypeEnumOptions.append("Motor");
|
||||
Mixer2TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer2Type"), QString(""), UAVObjectField::ENUM, Mixer2TypeElemNames, Mixer2TypeEnumOptions) );
|
||||
QStringList Mixer2MatrixElemNames;
|
||||
Mixer2MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer2MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer2MatrixElemNames.append("Roll");
|
||||
Mixer2MatrixElemNames.append("Pitch");
|
||||
Mixer2MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer2Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer2MatrixElemNames, QStringList()) );
|
||||
QStringList Mixer3TypeElemNames;
|
||||
Mixer3TypeElemNames.append("0");
|
||||
QStringList Mixer3TypeEnumOptions;
|
||||
Mixer3TypeEnumOptions.append("Disabled");
|
||||
Mixer3TypeEnumOptions.append("Motor");
|
||||
Mixer3TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer3Type"), QString(""), UAVObjectField::ENUM, Mixer3TypeElemNames, Mixer3TypeEnumOptions) );
|
||||
QStringList Mixer3MatrixElemNames;
|
||||
Mixer3MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer3MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer3MatrixElemNames.append("Roll");
|
||||
Mixer3MatrixElemNames.append("Pitch");
|
||||
Mixer3MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer3Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer3MatrixElemNames, QStringList()) );
|
||||
QStringList Mixer4TypeElemNames;
|
||||
Mixer4TypeElemNames.append("0");
|
||||
QStringList Mixer4TypeEnumOptions;
|
||||
Mixer4TypeEnumOptions.append("Disabled");
|
||||
Mixer4TypeEnumOptions.append("Motor");
|
||||
Mixer4TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer4Type"), QString(""), UAVObjectField::ENUM, Mixer4TypeElemNames, Mixer4TypeEnumOptions) );
|
||||
QStringList Mixer4MatrixElemNames;
|
||||
Mixer4MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer4MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer4MatrixElemNames.append("Roll");
|
||||
Mixer4MatrixElemNames.append("Pitch");
|
||||
Mixer4MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer4Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer4MatrixElemNames, QStringList()) );
|
||||
QStringList Mixer5TypeElemNames;
|
||||
Mixer5TypeElemNames.append("0");
|
||||
QStringList Mixer5TypeEnumOptions;
|
||||
Mixer5TypeEnumOptions.append("Disabled");
|
||||
Mixer5TypeEnumOptions.append("Motor");
|
||||
Mixer5TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer5Type"), QString(""), UAVObjectField::ENUM, Mixer5TypeElemNames, Mixer5TypeEnumOptions) );
|
||||
QStringList Mixer5MatrixElemNames;
|
||||
Mixer5MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer5MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer5MatrixElemNames.append("Roll");
|
||||
Mixer5MatrixElemNames.append("Pitch");
|
||||
Mixer5MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer5Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer5MatrixElemNames, QStringList()) );
|
||||
QStringList Mixer6TypeElemNames;
|
||||
Mixer6TypeElemNames.append("0");
|
||||
QStringList Mixer6TypeEnumOptions;
|
||||
Mixer6TypeEnumOptions.append("Disabled");
|
||||
Mixer6TypeEnumOptions.append("Motor");
|
||||
Mixer6TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer6Type"), QString(""), UAVObjectField::ENUM, Mixer6TypeElemNames, Mixer6TypeEnumOptions) );
|
||||
QStringList Mixer6MatrixElemNames;
|
||||
Mixer6MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer6MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer6MatrixElemNames.append("Roll");
|
||||
Mixer6MatrixElemNames.append("Pitch");
|
||||
Mixer6MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer6Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer6MatrixElemNames, QStringList()) );
|
||||
QStringList Mixer7TypeElemNames;
|
||||
Mixer7TypeElemNames.append("0");
|
||||
QStringList Mixer7TypeEnumOptions;
|
||||
Mixer7TypeEnumOptions.append("Disabled");
|
||||
Mixer7TypeEnumOptions.append("Motor");
|
||||
Mixer7TypeEnumOptions.append("Servo");
|
||||
fields.append( new UAVObjectField(QString("Mixer7Type"), QString(""), UAVObjectField::ENUM, Mixer7TypeElemNames, Mixer7TypeEnumOptions) );
|
||||
QStringList Mixer7MatrixElemNames;
|
||||
Mixer7MatrixElemNames.append("ThrottleCurve1");
|
||||
Mixer7MatrixElemNames.append("ThrottleCurve2");
|
||||
Mixer7MatrixElemNames.append("Roll");
|
||||
Mixer7MatrixElemNames.append("Pitch");
|
||||
Mixer7MatrixElemNames.append("Yaw");
|
||||
fields.append( new UAVObjectField(QString("Mixer7Matrix"), QString(""), UAVObjectField::FLOAT32, Mixer7MatrixElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default metadata for this object
|
||||
*/
|
||||
UAVObject::Metadata MixerSettings::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 MixerSettings::setDefaultFieldValues()
|
||||
{
|
||||
data.MaxAccel = 1000;
|
||||
data.FeedForward = 0;
|
||||
data.AccelTime = 0;
|
||||
data.DecelTime = 0;
|
||||
data.ThrottleCurve1[0] = -10;
|
||||
data.ThrottleCurve1[1] = -10;
|
||||
data.ThrottleCurve1[2] = -10;
|
||||
data.ThrottleCurve1[3] = -10;
|
||||
data.ThrottleCurve1[4] = -10;
|
||||
data.ThrottleCurve2[0] = -10;
|
||||
data.ThrottleCurve2[1] = -10;
|
||||
data.ThrottleCurve2[2] = -10;
|
||||
data.ThrottleCurve2[3] = -10;
|
||||
data.ThrottleCurve2[4] = -10;
|
||||
data.Mixer0Type = 0;
|
||||
data.Mixer0Matrix[0] = 0;
|
||||
data.Mixer0Matrix[1] = 0;
|
||||
data.Mixer0Matrix[2] = 0;
|
||||
data.Mixer0Matrix[3] = 0;
|
||||
data.Mixer0Matrix[4] = 0;
|
||||
data.Mixer1Type = 0;
|
||||
data.Mixer1Matrix[0] = 0;
|
||||
data.Mixer1Matrix[1] = 0;
|
||||
data.Mixer1Matrix[2] = 0;
|
||||
data.Mixer1Matrix[3] = 0;
|
||||
data.Mixer1Matrix[4] = 0;
|
||||
data.Mixer2Type = 0;
|
||||
data.Mixer2Matrix[0] = 0;
|
||||
data.Mixer2Matrix[1] = 0;
|
||||
data.Mixer2Matrix[2] = 0;
|
||||
data.Mixer2Matrix[3] = 0;
|
||||
data.Mixer2Matrix[4] = 0;
|
||||
data.Mixer3Type = 0;
|
||||
data.Mixer3Matrix[0] = 0;
|
||||
data.Mixer3Matrix[1] = 0;
|
||||
data.Mixer3Matrix[2] = 0;
|
||||
data.Mixer3Matrix[3] = 0;
|
||||
data.Mixer3Matrix[4] = 0;
|
||||
data.Mixer4Type = 0;
|
||||
data.Mixer4Matrix[0] = 0;
|
||||
data.Mixer4Matrix[1] = 0;
|
||||
data.Mixer4Matrix[2] = 0;
|
||||
data.Mixer4Matrix[3] = 0;
|
||||
data.Mixer4Matrix[4] = 0;
|
||||
data.Mixer5Type = 0;
|
||||
data.Mixer5Matrix[0] = 0;
|
||||
data.Mixer5Matrix[1] = 0;
|
||||
data.Mixer5Matrix[2] = 0;
|
||||
data.Mixer5Matrix[3] = 0;
|
||||
data.Mixer5Matrix[4] = 0;
|
||||
data.Mixer6Type = 0;
|
||||
data.Mixer6Matrix[0] = 0;
|
||||
data.Mixer6Matrix[1] = 0;
|
||||
data.Mixer6Matrix[2] = 0;
|
||||
data.Mixer6Matrix[3] = 0;
|
||||
data.Mixer6Matrix[4] = 0;
|
||||
data.Mixer7Type = 0;
|
||||
data.Mixer7Matrix[0] = 0;
|
||||
data.Mixer7Matrix[1] = 0;
|
||||
data.Mixer7Matrix[2] = 0;
|
||||
data.Mixer7Matrix[3] = 0;
|
||||
data.Mixer7Matrix[4] = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object data fields
|
||||
*/
|
||||
MixerSettings::DataFields MixerSettings::getData()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
*/
|
||||
void MixerSettings::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* MixerSettings::clone(quint32 instID)
|
||||
{
|
||||
MixerSettings* obj = new MixerSettings();
|
||||
obj->initialize(instID, this->getMetaObject());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
MixerSettings* MixerSettings::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
||||
{
|
||||
return dynamic_cast<MixerSettings*>(objMngr->getObject(MixerSettings::OBJID, instID));
|
||||
}
|
176
ground/src/plugins/uavobjects/mixersettings.h
Normal file
176
ground/src/plugins/uavobjects/mixersettings.h
Normal file
@ -0,0 +1,176 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file mixersettings.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: mixersettings.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 MIXERSETTINGS_H
|
||||
#define MIXERSETTINGS_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT MixerSettings: public UAVDataObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Field structure
|
||||
typedef struct {
|
||||
float MaxAccel;
|
||||
float FeedForward;
|
||||
float AccelTime;
|
||||
float DecelTime;
|
||||
float ThrottleCurve1[5];
|
||||
float ThrottleCurve2[5];
|
||||
quint8 Mixer0Type;
|
||||
float Mixer0Matrix[5];
|
||||
quint8 Mixer1Type;
|
||||
float Mixer1Matrix[5];
|
||||
quint8 Mixer2Type;
|
||||
float Mixer2Matrix[5];
|
||||
quint8 Mixer3Type;
|
||||
float Mixer3Matrix[5];
|
||||
quint8 Mixer4Type;
|
||||
float Mixer4Matrix[5];
|
||||
quint8 Mixer5Type;
|
||||
float Mixer5Matrix[5];
|
||||
quint8 Mixer6Type;
|
||||
float Mixer6Matrix[5];
|
||||
quint8 Mixer7Type;
|
||||
float Mixer7Matrix[5];
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Field information
|
||||
// Field MaxAccel information
|
||||
// Field FeedForward information
|
||||
// Field AccelTime information
|
||||
// Field DecelTime information
|
||||
// Field ThrottleCurve1 information
|
||||
/* Array element names for field ThrottleCurve1 */
|
||||
typedef enum { THROTTLECURVE1_0=0, THROTTLECURVE1_25=1, THROTTLECURVE1_50=2, THROTTLECURVE1_75=3, THROTTLECURVE1_100=4 } ThrottleCurve1Elem;
|
||||
/* Number of elements for field ThrottleCurve1 */
|
||||
static const quint32 THROTTLECURVE1_NUMELEM = 5;
|
||||
// Field ThrottleCurve2 information
|
||||
/* Array element names for field ThrottleCurve2 */
|
||||
typedef enum { THROTTLECURVE2_0=0, THROTTLECURVE2_25=1, THROTTLECURVE2_50=2, THROTTLECURVE2_75=3, THROTTLECURVE2_100=4 } ThrottleCurve2Elem;
|
||||
/* Number of elements for field ThrottleCurve2 */
|
||||
static const quint32 THROTTLECURVE2_NUMELEM = 5;
|
||||
// Field Mixer0Type information
|
||||
/* Enumeration options for field Mixer0Type */
|
||||
typedef enum { MIXER0TYPE_DISABLED=0, MIXER0TYPE_MOTOR=1, MIXER0TYPE_SERVO=2 } Mixer0TypeOptions;
|
||||
// Field Mixer0Matrix information
|
||||
/* Array element names for field Mixer0Matrix */
|
||||
typedef enum { MIXER0MATRIX_THROTTLECURVE1=0, MIXER0MATRIX_THROTTLECURVE2=1, MIXER0MATRIX_ROLL=2, MIXER0MATRIX_PITCH=3, MIXER0MATRIX_YAW=4 } Mixer0MatrixElem;
|
||||
/* Number of elements for field Mixer0Matrix */
|
||||
static const quint32 MIXER0MATRIX_NUMELEM = 5;
|
||||
// Field Mixer1Type information
|
||||
/* Enumeration options for field Mixer1Type */
|
||||
typedef enum { MIXER1TYPE_DISABLED=0, MIXER1TYPE_MOTOR=1, MIXER1TYPE_SERVO=2 } Mixer1TypeOptions;
|
||||
// Field Mixer1Matrix information
|
||||
/* Array element names for field Mixer1Matrix */
|
||||
typedef enum { MIXER1MATRIX_THROTTLECURVE1=0, MIXER1MATRIX_THROTTLECURVE2=1, MIXER1MATRIX_ROLL=2, MIXER1MATRIX_PITCH=3, MIXER1MATRIX_YAW=4 } Mixer1MatrixElem;
|
||||
/* Number of elements for field Mixer1Matrix */
|
||||
static const quint32 MIXER1MATRIX_NUMELEM = 5;
|
||||
// Field Mixer2Type information
|
||||
/* Enumeration options for field Mixer2Type */
|
||||
typedef enum { MIXER2TYPE_DISABLED=0, MIXER2TYPE_MOTOR=1, MIXER2TYPE_SERVO=2 } Mixer2TypeOptions;
|
||||
// Field Mixer2Matrix information
|
||||
/* Array element names for field Mixer2Matrix */
|
||||
typedef enum { MIXER2MATRIX_THROTTLECURVE1=0, MIXER2MATRIX_THROTTLECURVE2=1, MIXER2MATRIX_ROLL=2, MIXER2MATRIX_PITCH=3, MIXER2MATRIX_YAW=4 } Mixer2MatrixElem;
|
||||
/* Number of elements for field Mixer2Matrix */
|
||||
static const quint32 MIXER2MATRIX_NUMELEM = 5;
|
||||
// Field Mixer3Type information
|
||||
/* Enumeration options for field Mixer3Type */
|
||||
typedef enum { MIXER3TYPE_DISABLED=0, MIXER3TYPE_MOTOR=1, MIXER3TYPE_SERVO=2 } Mixer3TypeOptions;
|
||||
// Field Mixer3Matrix information
|
||||
/* Array element names for field Mixer3Matrix */
|
||||
typedef enum { MIXER3MATRIX_THROTTLECURVE1=0, MIXER3MATRIX_THROTTLECURVE2=1, MIXER3MATRIX_ROLL=2, MIXER3MATRIX_PITCH=3, MIXER3MATRIX_YAW=4 } Mixer3MatrixElem;
|
||||
/* Number of elements for field Mixer3Matrix */
|
||||
static const quint32 MIXER3MATRIX_NUMELEM = 5;
|
||||
// Field Mixer4Type information
|
||||
/* Enumeration options for field Mixer4Type */
|
||||
typedef enum { MIXER4TYPE_DISABLED=0, MIXER4TYPE_MOTOR=1, MIXER4TYPE_SERVO=2 } Mixer4TypeOptions;
|
||||
// Field Mixer4Matrix information
|
||||
/* Array element names for field Mixer4Matrix */
|
||||
typedef enum { MIXER4MATRIX_THROTTLECURVE1=0, MIXER4MATRIX_THROTTLECURVE2=1, MIXER4MATRIX_ROLL=2, MIXER4MATRIX_PITCH=3, MIXER4MATRIX_YAW=4 } Mixer4MatrixElem;
|
||||
/* Number of elements for field Mixer4Matrix */
|
||||
static const quint32 MIXER4MATRIX_NUMELEM = 5;
|
||||
// Field Mixer5Type information
|
||||
/* Enumeration options for field Mixer5Type */
|
||||
typedef enum { MIXER5TYPE_DISABLED=0, MIXER5TYPE_MOTOR=1, MIXER5TYPE_SERVO=2 } Mixer5TypeOptions;
|
||||
// Field Mixer5Matrix information
|
||||
/* Array element names for field Mixer5Matrix */
|
||||
typedef enum { MIXER5MATRIX_THROTTLECURVE1=0, MIXER5MATRIX_THROTTLECURVE2=1, MIXER5MATRIX_ROLL=2, MIXER5MATRIX_PITCH=3, MIXER5MATRIX_YAW=4 } Mixer5MatrixElem;
|
||||
/* Number of elements for field Mixer5Matrix */
|
||||
static const quint32 MIXER5MATRIX_NUMELEM = 5;
|
||||
// Field Mixer6Type information
|
||||
/* Enumeration options for field Mixer6Type */
|
||||
typedef enum { MIXER6TYPE_DISABLED=0, MIXER6TYPE_MOTOR=1, MIXER6TYPE_SERVO=2 } Mixer6TypeOptions;
|
||||
// Field Mixer6Matrix information
|
||||
/* Array element names for field Mixer6Matrix */
|
||||
typedef enum { MIXER6MATRIX_THROTTLECURVE1=0, MIXER6MATRIX_THROTTLECURVE2=1, MIXER6MATRIX_ROLL=2, MIXER6MATRIX_PITCH=3, MIXER6MATRIX_YAW=4 } Mixer6MatrixElem;
|
||||
/* Number of elements for field Mixer6Matrix */
|
||||
static const quint32 MIXER6MATRIX_NUMELEM = 5;
|
||||
// Field Mixer7Type information
|
||||
/* Enumeration options for field Mixer7Type */
|
||||
typedef enum { MIXER7TYPE_DISABLED=0, MIXER7TYPE_MOTOR=1, MIXER7TYPE_SERVO=2 } Mixer7TypeOptions;
|
||||
// Field Mixer7Matrix information
|
||||
/* Array element names for field Mixer7Matrix */
|
||||
typedef enum { MIXER7MATRIX_THROTTLECURVE1=0, MIXER7MATRIX_THROTTLECURVE2=1, MIXER7MATRIX_ROLL=2, MIXER7MATRIX_PITCH=3, MIXER7MATRIX_YAW=4 } Mixer7MatrixElem;
|
||||
/* Number of elements for field Mixer7Matrix */
|
||||
static const quint32 MIXER7MATRIX_NUMELEM = 5;
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 1614220618U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 1;
|
||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
||||
|
||||
// Functions
|
||||
MixerSettings();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
|
||||
static MixerSettings* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
||||
|
||||
private:
|
||||
DataFields data;
|
||||
|
||||
void setDefaultFieldValues();
|
||||
|
||||
};
|
||||
|
||||
#endif // MIXERSETTINGS_H
|
360
ground/src/plugins/uavobjects/mixersettings.py
Normal file
360
ground/src/plugins/uavobjects/mixersettings.py
Normal file
@ -0,0 +1,360 @@
|
||||
##
|
||||
##############################################################################
|
||||
#
|
||||
# @file mixersettings.py
|
||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
# @brief Implementation of the MixerSettings object. This file has been
|
||||
# automatically generated by the UAVObjectGenerator.
|
||||
#
|
||||
# @note Object definition file: mixersettings.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(
|
||||
'MaxAccel',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'FeedForward',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'AccelTime',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'DecelTime',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'ThrottleCurve1',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'0',
|
||||
'25',
|
||||
'50',
|
||||
'75',
|
||||
'100',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'ThrottleCurve2',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'0',
|
||||
'25',
|
||||
'50',
|
||||
'75',
|
||||
'100',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer0Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer0Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer1Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer1Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer2Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer2Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer3Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer3Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer4Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer4Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer5Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer5Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer6Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer6Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer7Type',
|
||||
'b',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
'0' : 'Disabled',
|
||||
'1' : 'Motor',
|
||||
'2' : 'Servo',
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer7Matrix',
|
||||
'f',
|
||||
5,
|
||||
[
|
||||
'ThrottleCurve1',
|
||||
'ThrottleCurve2',
|
||||
'Roll',
|
||||
'Pitch',
|
||||
'Yaw',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class MixerSettings(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 1614220618
|
||||
NAME = "MixerSettings"
|
||||
METANAME = "MixerSettingsMeta"
|
||||
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 = MixerSettings()
|
||||
print (x)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#import pdb ; pdb.run('main()')
|
||||
main()
|
149
ground/src/plugins/uavobjects/mixerstatus.cpp
Normal file
149
ground/src/plugins/uavobjects/mixerstatus.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file mixerstatus.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: mixerstatus.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 "mixerstatus.h"
|
||||
#include "uavobjectfield.h"
|
||||
|
||||
const QString MixerStatus::NAME = QString("MixerStatus");
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
MixerStatus::MixerStatus(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
QStringList Mixer0ElemNames;
|
||||
Mixer0ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer0"), QString("us"), UAVObjectField::FLOAT32, Mixer0ElemNames, QStringList()) );
|
||||
QStringList Mixer1ElemNames;
|
||||
Mixer1ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer1"), QString("us"), UAVObjectField::FLOAT32, Mixer1ElemNames, QStringList()) );
|
||||
QStringList Mixer2ElemNames;
|
||||
Mixer2ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer2"), QString("us"), UAVObjectField::FLOAT32, Mixer2ElemNames, QStringList()) );
|
||||
QStringList Mixer3ElemNames;
|
||||
Mixer3ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer3"), QString("us"), UAVObjectField::FLOAT32, Mixer3ElemNames, QStringList()) );
|
||||
QStringList Mixer4ElemNames;
|
||||
Mixer4ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer4"), QString("us"), UAVObjectField::FLOAT32, Mixer4ElemNames, QStringList()) );
|
||||
QStringList Mixer5ElemNames;
|
||||
Mixer5ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer5"), QString("us"), UAVObjectField::FLOAT32, Mixer5ElemNames, QStringList()) );
|
||||
QStringList Mixer6ElemNames;
|
||||
Mixer6ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer6"), QString("us"), UAVObjectField::FLOAT32, Mixer6ElemNames, QStringList()) );
|
||||
QStringList Mixer7ElemNames;
|
||||
Mixer7ElemNames.append("0");
|
||||
fields.append( new UAVObjectField(QString("Mixer7"), QString("us"), UAVObjectField::FLOAT32, Mixer7ElemNames, QStringList()) );
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default metadata for this object
|
||||
*/
|
||||
UAVObject::Metadata MixerStatus::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 MixerStatus::setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the object data fields
|
||||
*/
|
||||
MixerStatus::DataFields MixerStatus::getData()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object data fields
|
||||
*/
|
||||
void MixerStatus::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* MixerStatus::clone(quint32 instID)
|
||||
{
|
||||
MixerStatus* obj = new MixerStatus();
|
||||
obj->initialize(instID, this->getMetaObject());
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
MixerStatus* MixerStatus::GetInstance(UAVObjectManager* objMngr, quint32 instID)
|
||||
{
|
||||
return dynamic_cast<MixerStatus*>(objMngr->getObject(MixerStatus::OBJID, instID));
|
||||
}
|
92
ground/src/plugins/uavobjects/mixerstatus.h
Normal file
92
ground/src/plugins/uavobjects/mixerstatus.h
Normal file
@ -0,0 +1,92 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file mixerstatus.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: mixerstatus.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 MIXERSTATUS_H
|
||||
#define MIXERSTATUS_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectmanager.h"
|
||||
|
||||
class UAVOBJECTS_EXPORT MixerStatus: public UAVDataObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Field structure
|
||||
typedef struct {
|
||||
float Mixer0;
|
||||
float Mixer1;
|
||||
float Mixer2;
|
||||
float Mixer3;
|
||||
float Mixer4;
|
||||
float Mixer5;
|
||||
float Mixer6;
|
||||
float Mixer7;
|
||||
|
||||
} __attribute__((packed)) DataFields;
|
||||
|
||||
// Field information
|
||||
// Field Mixer0 information
|
||||
// Field Mixer1 information
|
||||
// Field Mixer2 information
|
||||
// Field Mixer3 information
|
||||
// Field Mixer4 information
|
||||
// Field Mixer5 information
|
||||
// Field Mixer6 information
|
||||
// Field Mixer7 information
|
||||
|
||||
|
||||
// Constants
|
||||
static const quint32 OBJID = 2468388390U;
|
||||
static const QString NAME;
|
||||
static const bool ISSINGLEINST = 1;
|
||||
static const bool ISSETTINGS = 0;
|
||||
static const quint32 NUMBYTES = sizeof(DataFields);
|
||||
|
||||
// Functions
|
||||
MixerStatus();
|
||||
|
||||
DataFields getData();
|
||||
void setData(const DataFields& data);
|
||||
Metadata getDefaultMetadata();
|
||||
UAVDataObject* clone(quint32 instID);
|
||||
|
||||
static MixerStatus* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
|
||||
|
||||
private:
|
||||
DataFields data;
|
||||
|
||||
void setDefaultFieldValues();
|
||||
|
||||
};
|
||||
|
||||
#endif // MIXERSTATUS_H
|
156
ground/src/plugins/uavobjects/mixerstatus.py
Normal file
156
ground/src/plugins/uavobjects/mixerstatus.py
Normal file
@ -0,0 +1,156 @@
|
||||
##
|
||||
##############################################################################
|
||||
#
|
||||
# @file mixerstatus.py
|
||||
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
# @brief Implementation of the MixerStatus object. This file has been
|
||||
# automatically generated by the UAVObjectGenerator.
|
||||
#
|
||||
# @note Object definition file: mixerstatus.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(
|
||||
'Mixer0',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer1',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer2',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer3',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer4',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer5',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer6',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
uavobject.UAVObjectField(
|
||||
'Mixer7',
|
||||
'f',
|
||||
1,
|
||||
[
|
||||
'0',
|
||||
],
|
||||
{
|
||||
}
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
class MixerStatus(uavobject.UAVObject):
|
||||
## Object constants
|
||||
OBJID = 2468388390
|
||||
NAME = "MixerStatus"
|
||||
METANAME = "MixerStatusMeta"
|
||||
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 = MixerStatus()
|
||||
print (x)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#import pdb ; pdb.run('main()')
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user