diff --git a/flight/OpenPilot/Modules/ManualControl/manualcontrol.c b/flight/OpenPilot/Modules/ManualControl/manualcontrol.c index 6ed7170ab..97ab6815b 100644 --- a/flight/OpenPilot/Modules/ManualControl/manualcontrol.c +++ b/flight/OpenPilot/Modules/ManualControl/manualcontrol.c @@ -166,12 +166,52 @@ static void manualControlTask(void *parameters) // Update flight mode flightMode = scaleChannel(cmd.Channel[settings.FlightMode], settings.ChannelMax[settings.FlightMode], settings.ChannelMin[settings.FlightMode], settings.ChannelNeutral[settings.FlightMode]); - if (flightMode < -FLIGHT_MODE_LIMIT) { - cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL; - } else if (flightMode > FLIGHT_MODE_LIMIT) { - cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO; - } else { - cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED; + + if (flightMode < -FLIGHT_MODE_LIMIT) { // Position 1 + for(int i = 0; i < 3; i++) { + if(settings.Pos1StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_NONE) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_NONE; + else if(settings.Pos1StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_RATE) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE; + else if(settings.Pos1StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_POSITION) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION; + } + if(settings.Pos1FlightMode == MANUALCONTROLSETTINGS_POS1FLIGHTMODE_MANUAL) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL; + else if(settings.Pos1FlightMode == MANUALCONTROLSETTINGS_POS1FLIGHTMODE_STABILIZED) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED; + else if(settings.Pos1FlightMode == MANUALCONTROLSETTINGS_POS1FLIGHTMODE_AUTO) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO; + } else if (flightMode > FLIGHT_MODE_LIMIT) { // Position 3 + for(int i = 0; i < 3; i++) { + if(settings.Pos3StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_NONE) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_NONE; + else if(settings.Pos3StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_RATE) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE; + else if(settings.Pos3StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_POSITION) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION; + } + if(settings.Pos3FlightMode == MANUALCONTROLSETTINGS_POS3FLIGHTMODE_MANUAL) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL; + else if(settings.Pos3FlightMode == MANUALCONTROLSETTINGS_POS3FLIGHTMODE_STABILIZED) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED; + else if(settings.Pos3FlightMode == MANUALCONTROLSETTINGS_POS3FLIGHTMODE_AUTO) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO; + } else { // Position 2 + for(int i = 0; i < 3; i++) { + if(settings.Pos2StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_NONE) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_NONE; + else if(settings.Pos2StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_RATE) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE; + else if(settings.Pos2StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_POSITION) + cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION; + } + if(settings.Pos2FlightMode == MANUALCONTROLSETTINGS_POS2FLIGHTMODE_MANUAL) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL; + else if(settings.Pos2FlightMode == MANUALCONTROLSETTINGS_POS2FLIGHTMODE_STABILIZED) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED; + else if(settings.Pos2FlightMode == MANUALCONTROLSETTINGS_POS2FLIGHTMODE_AUTO) + cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO; } // Update the ManualControlCommand object ManualControlCommandSet(&cmd); diff --git a/flight/OpenPilot/UAVObjects/inc/manualcontrolcommand.h b/flight/OpenPilot/UAVObjects/inc/manualcontrolcommand.h index d37bf30af..9e66ed7ac 100644 --- a/flight/OpenPilot/UAVObjects/inc/manualcontrolcommand.h +++ b/flight/OpenPilot/UAVObjects/inc/manualcontrolcommand.h @@ -41,7 +41,7 @@ #define MANUALCONTROLCOMMAND_H // Object constants -#define MANUALCONTROLCOMMAND_OBJID 9594768U +#define MANUALCONTROLCOMMAND_OBJID 2841592332U #define MANUALCONTROLCOMMAND_NAME "ManualControlCommand" #define MANUALCONTROLCOMMAND_METANAME "ManualControlCommandMeta" #define MANUALCONTROLCOMMAND_ISSINGLEINST 1 @@ -78,6 +78,7 @@ typedef struct { float Yaw; float Throttle; uint8_t FlightMode; + uint8_t StabilizationSettings[3]; float Accessory1; float Accessory2; float Accessory3; @@ -99,6 +100,13 @@ typedef enum { MANUALCONTROLCOMMAND_ARMED_FALSE=0, MANUALCONTROLCOMMAND_ARMED_TR // Field FlightMode information /* Enumeration options for field FlightMode */ typedef enum { MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL=0, MANUALCONTROLCOMMAND_FLIGHTMODE_STABILIZED=1, MANUALCONTROLCOMMAND_FLIGHTMODE_AUTO=2 } ManualControlCommandFlightModeOptions; +// Field StabilizationSettings information +/* Enumeration options for field StabilizationSettings */ +typedef enum { MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION=2 } ManualControlCommandStabilizationSettingsOptions; +/* Array element names for field StabilizationSettings */ +typedef enum { MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ROLL=0, MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_PITCH=1, MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_YAW=2 } ManualControlCommandStabilizationSettingsElem; +/* Number of elements for field StabilizationSettings */ +#define MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_NUMELEM 3 // Field Accessory1 information // Field Accessory2 information // Field Accessory3 information diff --git a/flight/OpenPilot/UAVObjects/inc/manualcontrolsettings.h b/flight/OpenPilot/UAVObjects/inc/manualcontrolsettings.h index 4466b4ff7..bd4be52bd 100644 --- a/flight/OpenPilot/UAVObjects/inc/manualcontrolsettings.h +++ b/flight/OpenPilot/UAVObjects/inc/manualcontrolsettings.h @@ -41,7 +41,7 @@ #define MANUALCONTROLSETTINGS_H // Object constants -#define MANUALCONTROLSETTINGS_OBJID 1845767664U +#define MANUALCONTROLSETTINGS_OBJID 3505967188U #define MANUALCONTROLSETTINGS_NAME "ManualControlSettings" #define MANUALCONTROLSETTINGS_METANAME "ManualControlSettingsMeta" #define MANUALCONTROLSETTINGS_ISSINGLEINST 1 @@ -80,6 +80,12 @@ typedef struct { uint8_t Accessory1; uint8_t Accessory2; uint8_t Accessory3; + uint8_t Pos1StabilizationSettings[3]; + uint8_t Pos2StabilizationSettings[3]; + uint8_t Pos3StabilizationSettings[3]; + uint8_t Pos1FlightMode; + uint8_t Pos2FlightMode; + uint8_t Pos3FlightMode; int16_t ChannelMax[8]; int16_t ChannelNeutral[8]; int16_t ChannelMin[8]; @@ -114,6 +120,36 @@ typedef enum { MANUALCONTROLSETTINGS_ACCESSORY2_CHANNEL0=0, MANUALCONTROLSETTING // Field Accessory3 information /* Enumeration options for field Accessory3 */ typedef enum { MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL0=0, MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL1=1, MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL2=2, MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL3=3, MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL4=4, MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL5=5, MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL6=6, MANUALCONTROLSETTINGS_ACCESSORY3_CHANNEL7=7, MANUALCONTROLSETTINGS_ACCESSORY3_NONE=8 } ManualControlSettingsAccessory3Options; +// Field Pos1StabilizationSettings information +/* Enumeration options for field Pos1StabilizationSettings */ +typedef enum { MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_POSITION=2 } ManualControlSettingsPos1StabilizationSettingsOptions; +/* Array element names for field Pos1StabilizationSettings */ +typedef enum { MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_ROLL=0, MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_PITCH=1, MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_YAW=2 } ManualControlSettingsPos1StabilizationSettingsElem; +/* Number of elements for field Pos1StabilizationSettings */ +#define MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_NUMELEM 3 +// Field Pos2StabilizationSettings information +/* Enumeration options for field Pos2StabilizationSettings */ +typedef enum { MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_POSITION=2 } ManualControlSettingsPos2StabilizationSettingsOptions; +/* Array element names for field Pos2StabilizationSettings */ +typedef enum { MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_ROLL=0, MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_PITCH=1, MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_YAW=2 } ManualControlSettingsPos2StabilizationSettingsElem; +/* Number of elements for field Pos2StabilizationSettings */ +#define MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_NUMELEM 3 +// Field Pos3StabilizationSettings information +/* Enumeration options for field Pos3StabilizationSettings */ +typedef enum { MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_POSITION=2 } ManualControlSettingsPos3StabilizationSettingsOptions; +/* Array element names for field Pos3StabilizationSettings */ +typedef enum { MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_ROLL=0, MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_PITCH=1, MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_YAW=2 } ManualControlSettingsPos3StabilizationSettingsElem; +/* Number of elements for field Pos3StabilizationSettings */ +#define MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_NUMELEM 3 +// Field Pos1FlightMode information +/* Enumeration options for field Pos1FlightMode */ +typedef enum { MANUALCONTROLSETTINGS_POS1FLIGHTMODE_MANUAL=0, MANUALCONTROLSETTINGS_POS1FLIGHTMODE_STABILIZED=1, MANUALCONTROLSETTINGS_POS1FLIGHTMODE_AUTO=2 } ManualControlSettingsPos1FlightModeOptions; +// Field Pos2FlightMode information +/* Enumeration options for field Pos2FlightMode */ +typedef enum { MANUALCONTROLSETTINGS_POS2FLIGHTMODE_MANUAL=0, MANUALCONTROLSETTINGS_POS2FLIGHTMODE_STABILIZED=1, MANUALCONTROLSETTINGS_POS2FLIGHTMODE_AUTO=2 } ManualControlSettingsPos2FlightModeOptions; +// Field Pos3FlightMode information +/* Enumeration options for field Pos3FlightMode */ +typedef enum { MANUALCONTROLSETTINGS_POS3FLIGHTMODE_MANUAL=0, MANUALCONTROLSETTINGS_POS3FLIGHTMODE_STABILIZED=1, MANUALCONTROLSETTINGS_POS3FLIGHTMODE_AUTO=2 } ManualControlSettingsPos3FlightModeOptions; // Field ChannelMax information /* Number of elements for field ChannelMax */ #define MANUALCONTROLSETTINGS_CHANNELMAX_NUMELEM 8 diff --git a/flight/OpenPilot/UAVObjects/manualcontrolsettings.c b/flight/OpenPilot/UAVObjects/manualcontrolsettings.c index 5bce854f2..fde2f28f4 100644 --- a/flight/OpenPilot/UAVObjects/manualcontrolsettings.c +++ b/flight/OpenPilot/UAVObjects/manualcontrolsettings.c @@ -89,6 +89,18 @@ static void setDefaults(UAVObjHandle obj, uint16_t instId) data.Accessory1 = 8; data.Accessory2 = 8; data.Accessory3 = 8; + data.Pos1StabilizationSettings[0] = 2; + data.Pos1StabilizationSettings[1] = 2; + data.Pos1StabilizationSettings[2] = 2; + data.Pos2StabilizationSettings[0] = 2; + data.Pos2StabilizationSettings[1] = 2; + data.Pos2StabilizationSettings[2] = 2; + data.Pos3StabilizationSettings[0] = 2; + data.Pos3StabilizationSettings[1] = 2; + data.Pos3StabilizationSettings[2] = 2; + data.Pos1FlightMode = 0; + data.Pos2FlightMode = 1; + data.Pos3FlightMode = 2; data.ChannelMax[0] = 2000; data.ChannelMax[1] = 2000; data.ChannelMax[2] = 2000; diff --git a/ground/src/plugins/uavobjects/manualcontrolcommand.cpp b/ground/src/plugins/uavobjects/manualcontrolcommand.cpp index fc4554495..da240da79 100644 --- a/ground/src/plugins/uavobjects/manualcontrolcommand.cpp +++ b/ground/src/plugins/uavobjects/manualcontrolcommand.cpp @@ -73,6 +73,15 @@ ManualControlCommand::ManualControlCommand(): UAVDataObject(OBJID, ISSINGLEINST, FlightModeEnumOptions.append("Stabilized"); FlightModeEnumOptions.append("Auto"); fields.append( new UAVObjectField(QString("FlightMode"), QString(""), UAVObjectField::ENUM, FlightModeElemNames, FlightModeEnumOptions) ); + QStringList StabilizationSettingsElemNames; + StabilizationSettingsElemNames.append("Roll"); + StabilizationSettingsElemNames.append("Pitch"); + StabilizationSettingsElemNames.append("Yaw"); + QStringList StabilizationSettingsEnumOptions; + StabilizationSettingsEnumOptions.append("None"); + StabilizationSettingsEnumOptions.append("Rate"); + StabilizationSettingsEnumOptions.append("Position"); + fields.append( new UAVObjectField(QString("StabilizationSettings"), QString(""), UAVObjectField::ENUM, StabilizationSettingsElemNames, StabilizationSettingsEnumOptions) ); QStringList Accessory1ElemNames; Accessory1ElemNames.append("0"); fields.append( new UAVObjectField(QString("Accessory1"), QString("%"), UAVObjectField::FLOAT32, Accessory1ElemNames, QStringList()) ); diff --git a/ground/src/plugins/uavobjects/manualcontrolcommand.h b/ground/src/plugins/uavobjects/manualcontrolcommand.h index 3dbe3b504..625d54afa 100644 --- a/ground/src/plugins/uavobjects/manualcontrolcommand.h +++ b/ground/src/plugins/uavobjects/manualcontrolcommand.h @@ -50,6 +50,7 @@ public: float Yaw; float Throttle; quint8 FlightMode; + quint8 StabilizationSettings[3]; float Accessory1; float Accessory2; float Accessory3; @@ -71,6 +72,13 @@ public: // Field FlightMode information /* Enumeration options for field FlightMode */ typedef enum { FLIGHTMODE_MANUAL=0, FLIGHTMODE_STABILIZED=1, FLIGHTMODE_AUTO=2 } FlightModeOptions; + // Field StabilizationSettings information + /* Enumeration options for field StabilizationSettings */ + typedef enum { STABILIZATIONSETTINGS_NONE=0, STABILIZATIONSETTINGS_RATE=1, STABILIZATIONSETTINGS_POSITION=2 } StabilizationSettingsOptions; + /* Array element names for field StabilizationSettings */ + typedef enum { STABILIZATIONSETTINGS_ROLL=0, STABILIZATIONSETTINGS_PITCH=1, STABILIZATIONSETTINGS_YAW=2 } StabilizationSettingsElem; + /* Number of elements for field StabilizationSettings */ + static const quint32 STABILIZATIONSETTINGS_NUMELEM = 3; // Field Accessory1 information // Field Accessory2 information // Field Accessory3 information @@ -80,7 +88,7 @@ public: // Constants - static const quint32 OBJID = 9594768U; + static const quint32 OBJID = 2841592332U; static const QString NAME; static const bool ISSINGLEINST = 1; static const bool ISSETTINGS = 0; diff --git a/ground/src/plugins/uavobjects/manualcontrolcommand.py b/ground/src/plugins/uavobjects/manualcontrolcommand.py index 066b9d43e..5ccddf2fd 100644 --- a/ground/src/plugins/uavobjects/manualcontrolcommand.py +++ b/ground/src/plugins/uavobjects/manualcontrolcommand.py @@ -114,6 +114,21 @@ _fields = [ \ '2' : 'Auto', } ), + uavobject.UAVObjectField( + 'StabilizationSettings', + 'b', + 3, + [ + 'Roll', + 'Pitch', + 'Yaw', + ], + { + '0' : 'None', + '1' : 'Rate', + '2' : 'Position', + } + ), uavobject.UAVObjectField( 'Accessory1', 'f', @@ -166,7 +181,7 @@ _fields = [ \ class ManualControlCommand(uavobject.UAVObject): ## Object constants - OBJID = 9594768 + OBJID = 2841592332 NAME = "ManualControlCommand" METANAME = "ManualControlCommandMeta" ISSINGLEINST = 1 diff --git a/ground/src/plugins/uavobjects/manualcontrolsettings.cpp b/ground/src/plugins/uavobjects/manualcontrolsettings.cpp index 61a9152d8..2a3913e02 100644 --- a/ground/src/plugins/uavobjects/manualcontrolsettings.cpp +++ b/ground/src/plugins/uavobjects/manualcontrolsettings.cpp @@ -153,6 +153,54 @@ ManualControlSettings::ManualControlSettings(): UAVDataObject(OBJID, ISSINGLEINS Accessory3EnumOptions.append("Channel7"); Accessory3EnumOptions.append("None"); fields.append( new UAVObjectField(QString("Accessory3"), QString("channel"), UAVObjectField::ENUM, Accessory3ElemNames, Accessory3EnumOptions) ); + QStringList Pos1StabilizationSettingsElemNames; + Pos1StabilizationSettingsElemNames.append("Roll"); + Pos1StabilizationSettingsElemNames.append("Pitch"); + Pos1StabilizationSettingsElemNames.append("Yaw"); + QStringList Pos1StabilizationSettingsEnumOptions; + Pos1StabilizationSettingsEnumOptions.append("None"); + Pos1StabilizationSettingsEnumOptions.append("Rate"); + Pos1StabilizationSettingsEnumOptions.append("Position"); + fields.append( new UAVObjectField(QString("Pos1StabilizationSettings"), QString(""), UAVObjectField::ENUM, Pos1StabilizationSettingsElemNames, Pos1StabilizationSettingsEnumOptions) ); + QStringList Pos2StabilizationSettingsElemNames; + Pos2StabilizationSettingsElemNames.append("Roll"); + Pos2StabilizationSettingsElemNames.append("Pitch"); + Pos2StabilizationSettingsElemNames.append("Yaw"); + QStringList Pos2StabilizationSettingsEnumOptions; + Pos2StabilizationSettingsEnumOptions.append("None"); + Pos2StabilizationSettingsEnumOptions.append("Rate"); + Pos2StabilizationSettingsEnumOptions.append("Position"); + fields.append( new UAVObjectField(QString("Pos2StabilizationSettings"), QString(""), UAVObjectField::ENUM, Pos2StabilizationSettingsElemNames, Pos2StabilizationSettingsEnumOptions) ); + QStringList Pos3StabilizationSettingsElemNames; + Pos3StabilizationSettingsElemNames.append("Roll"); + Pos3StabilizationSettingsElemNames.append("Pitch"); + Pos3StabilizationSettingsElemNames.append("Yaw"); + QStringList Pos3StabilizationSettingsEnumOptions; + Pos3StabilizationSettingsEnumOptions.append("None"); + Pos3StabilizationSettingsEnumOptions.append("Rate"); + Pos3StabilizationSettingsEnumOptions.append("Position"); + fields.append( new UAVObjectField(QString("Pos3StabilizationSettings"), QString(""), UAVObjectField::ENUM, Pos3StabilizationSettingsElemNames, Pos3StabilizationSettingsEnumOptions) ); + QStringList Pos1FlightModeElemNames; + Pos1FlightModeElemNames.append("0"); + QStringList Pos1FlightModeEnumOptions; + Pos1FlightModeEnumOptions.append("Manual"); + Pos1FlightModeEnumOptions.append("Stabilized"); + Pos1FlightModeEnumOptions.append("Auto"); + fields.append( new UAVObjectField(QString("Pos1FlightMode"), QString(""), UAVObjectField::ENUM, Pos1FlightModeElemNames, Pos1FlightModeEnumOptions) ); + QStringList Pos2FlightModeElemNames; + Pos2FlightModeElemNames.append("0"); + QStringList Pos2FlightModeEnumOptions; + Pos2FlightModeEnumOptions.append("Manual"); + Pos2FlightModeEnumOptions.append("Stabilized"); + Pos2FlightModeEnumOptions.append("Auto"); + fields.append( new UAVObjectField(QString("Pos2FlightMode"), QString(""), UAVObjectField::ENUM, Pos2FlightModeElemNames, Pos2FlightModeEnumOptions) ); + QStringList Pos3FlightModeElemNames; + Pos3FlightModeElemNames.append("0"); + QStringList Pos3FlightModeEnumOptions; + Pos3FlightModeEnumOptions.append("Manual"); + Pos3FlightModeEnumOptions.append("Stabilized"); + Pos3FlightModeEnumOptions.append("Auto"); + fields.append( new UAVObjectField(QString("Pos3FlightMode"), QString(""), UAVObjectField::ENUM, Pos3FlightModeElemNames, Pos3FlightModeEnumOptions) ); QStringList ChannelMaxElemNames; ChannelMaxElemNames.append("0"); ChannelMaxElemNames.append("1"); @@ -225,6 +273,18 @@ void ManualControlSettings::setDefaultFieldValues() data.Accessory1 = 8; data.Accessory2 = 8; data.Accessory3 = 8; + data.Pos1StabilizationSettings[0] = 2; + data.Pos1StabilizationSettings[1] = 2; + data.Pos1StabilizationSettings[2] = 2; + data.Pos2StabilizationSettings[0] = 2; + data.Pos2StabilizationSettings[1] = 2; + data.Pos2StabilizationSettings[2] = 2; + data.Pos3StabilizationSettings[0] = 2; + data.Pos3StabilizationSettings[1] = 2; + data.Pos3StabilizationSettings[2] = 2; + data.Pos1FlightMode = 0; + data.Pos2FlightMode = 1; + data.Pos3FlightMode = 2; data.ChannelMax[0] = 2000; data.ChannelMax[1] = 2000; data.ChannelMax[2] = 2000; diff --git a/ground/src/plugins/uavobjects/manualcontrolsettings.h b/ground/src/plugins/uavobjects/manualcontrolsettings.h index 1fa158713..cd2f5297d 100644 --- a/ground/src/plugins/uavobjects/manualcontrolsettings.h +++ b/ground/src/plugins/uavobjects/manualcontrolsettings.h @@ -52,6 +52,12 @@ public: quint8 Accessory1; quint8 Accessory2; quint8 Accessory3; + quint8 Pos1StabilizationSettings[3]; + quint8 Pos2StabilizationSettings[3]; + quint8 Pos3StabilizationSettings[3]; + quint8 Pos1FlightMode; + quint8 Pos2FlightMode; + quint8 Pos3FlightMode; qint16 ChannelMax[8]; qint16 ChannelNeutral[8]; qint16 ChannelMin[8]; @@ -86,6 +92,36 @@ public: // Field Accessory3 information /* Enumeration options for field Accessory3 */ typedef enum { ACCESSORY3_CHANNEL0=0, ACCESSORY3_CHANNEL1=1, ACCESSORY3_CHANNEL2=2, ACCESSORY3_CHANNEL3=3, ACCESSORY3_CHANNEL4=4, ACCESSORY3_CHANNEL5=5, ACCESSORY3_CHANNEL6=6, ACCESSORY3_CHANNEL7=7, ACCESSORY3_NONE=8 } Accessory3Options; + // Field Pos1StabilizationSettings information + /* Enumeration options for field Pos1StabilizationSettings */ + typedef enum { POS1STABILIZATIONSETTINGS_NONE=0, POS1STABILIZATIONSETTINGS_RATE=1, POS1STABILIZATIONSETTINGS_POSITION=2 } Pos1StabilizationSettingsOptions; + /* Array element names for field Pos1StabilizationSettings */ + typedef enum { POS1STABILIZATIONSETTINGS_ROLL=0, POS1STABILIZATIONSETTINGS_PITCH=1, POS1STABILIZATIONSETTINGS_YAW=2 } Pos1StabilizationSettingsElem; + /* Number of elements for field Pos1StabilizationSettings */ + static const quint32 POS1STABILIZATIONSETTINGS_NUMELEM = 3; + // Field Pos2StabilizationSettings information + /* Enumeration options for field Pos2StabilizationSettings */ + typedef enum { POS2STABILIZATIONSETTINGS_NONE=0, POS2STABILIZATIONSETTINGS_RATE=1, POS2STABILIZATIONSETTINGS_POSITION=2 } Pos2StabilizationSettingsOptions; + /* Array element names for field Pos2StabilizationSettings */ + typedef enum { POS2STABILIZATIONSETTINGS_ROLL=0, POS2STABILIZATIONSETTINGS_PITCH=1, POS2STABILIZATIONSETTINGS_YAW=2 } Pos2StabilizationSettingsElem; + /* Number of elements for field Pos2StabilizationSettings */ + static const quint32 POS2STABILIZATIONSETTINGS_NUMELEM = 3; + // Field Pos3StabilizationSettings information + /* Enumeration options for field Pos3StabilizationSettings */ + typedef enum { POS3STABILIZATIONSETTINGS_NONE=0, POS3STABILIZATIONSETTINGS_RATE=1, POS3STABILIZATIONSETTINGS_POSITION=2 } Pos3StabilizationSettingsOptions; + /* Array element names for field Pos3StabilizationSettings */ + typedef enum { POS3STABILIZATIONSETTINGS_ROLL=0, POS3STABILIZATIONSETTINGS_PITCH=1, POS3STABILIZATIONSETTINGS_YAW=2 } Pos3StabilizationSettingsElem; + /* Number of elements for field Pos3StabilizationSettings */ + static const quint32 POS3STABILIZATIONSETTINGS_NUMELEM = 3; + // Field Pos1FlightMode information + /* Enumeration options for field Pos1FlightMode */ + typedef enum { POS1FLIGHTMODE_MANUAL=0, POS1FLIGHTMODE_STABILIZED=1, POS1FLIGHTMODE_AUTO=2 } Pos1FlightModeOptions; + // Field Pos2FlightMode information + /* Enumeration options for field Pos2FlightMode */ + typedef enum { POS2FLIGHTMODE_MANUAL=0, POS2FLIGHTMODE_STABILIZED=1, POS2FLIGHTMODE_AUTO=2 } Pos2FlightModeOptions; + // Field Pos3FlightMode information + /* Enumeration options for field Pos3FlightMode */ + typedef enum { POS3FLIGHTMODE_MANUAL=0, POS3FLIGHTMODE_STABILIZED=1, POS3FLIGHTMODE_AUTO=2 } Pos3FlightModeOptions; // Field ChannelMax information /* Number of elements for field ChannelMax */ static const quint32 CHANNELMAX_NUMELEM = 8; @@ -98,7 +134,7 @@ public: // Constants - static const quint32 OBJID = 1845767664U; + static const quint32 OBJID = 3505967188U; static const QString NAME; static const bool ISSINGLEINST = 1; static const bool ISSETTINGS = 1; diff --git a/ground/src/plugins/uavobjects/manualcontrolsettings.py b/ground/src/plugins/uavobjects/manualcontrolsettings.py index 83c6b537e..c4190ddc9 100644 --- a/ground/src/plugins/uavobjects/manualcontrolsettings.py +++ b/ground/src/plugins/uavobjects/manualcontrolsettings.py @@ -202,6 +202,90 @@ _fields = [ \ '8' : 'None', } ), + uavobject.UAVObjectField( + 'Pos1StabilizationSettings', + 'b', + 3, + [ + 'Roll', + 'Pitch', + 'Yaw', + ], + { + '0' : 'None', + '1' : 'Rate', + '2' : 'Position', + } + ), + uavobject.UAVObjectField( + 'Pos2StabilizationSettings', + 'b', + 3, + [ + 'Roll', + 'Pitch', + 'Yaw', + ], + { + '0' : 'None', + '1' : 'Rate', + '2' : 'Position', + } + ), + uavobject.UAVObjectField( + 'Pos3StabilizationSettings', + 'b', + 3, + [ + 'Roll', + 'Pitch', + 'Yaw', + ], + { + '0' : 'None', + '1' : 'Rate', + '2' : 'Position', + } + ), + uavobject.UAVObjectField( + 'Pos1FlightMode', + 'b', + 1, + [ + '0', + ], + { + '0' : 'Manual', + '1' : 'Stabilized', + '2' : 'Auto', + } + ), + uavobject.UAVObjectField( + 'Pos2FlightMode', + 'b', + 1, + [ + '0', + ], + { + '0' : 'Manual', + '1' : 'Stabilized', + '2' : 'Auto', + } + ), + uavobject.UAVObjectField( + 'Pos3FlightMode', + 'b', + 1, + [ + '0', + ], + { + '0' : 'Manual', + '1' : 'Stabilized', + '2' : 'Auto', + } + ), uavobject.UAVObjectField( 'ChannelMax', 'h', @@ -258,7 +342,7 @@ _fields = [ \ class ManualControlSettings(uavobject.UAVObject): ## Object constants - OBJID = 1845767664 + OBJID = 3505967188 NAME = "ManualControlSettings" METANAME = "ManualControlSettingsMeta" ISSINGLEINST = 1 diff --git a/ground/src/shared/uavobjectdefinition/manualcontrolcommand.xml b/ground/src/shared/uavobjectdefinition/manualcontrolcommand.xml index f93c18d06..3420baef3 100644 --- a/ground/src/shared/uavobjectdefinition/manualcontrolcommand.xml +++ b/ground/src/shared/uavobjectdefinition/manualcontrolcommand.xml @@ -8,6 +8,7 @@ + diff --git a/ground/src/shared/uavobjectdefinition/manualcontrolsettings.xml b/ground/src/shared/uavobjectdefinition/manualcontrolsettings.xml index c7cacfb3a..0958d3f8e 100644 --- a/ground/src/shared/uavobjectdefinition/manualcontrolsettings.xml +++ b/ground/src/shared/uavobjectdefinition/manualcontrolsettings.xml @@ -10,6 +10,12 @@ + + + + + +