1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

Manual control: Changed 'Position' stabilization mode to 'Attitude'

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1944 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
les 2010-10-11 17:58:11 +00:00 committed by les
parent 1f6f5fe674
commit 6d6ec37474
12 changed files with 33 additions and 33 deletions

View File

@ -175,8 +175,8 @@ static void manualControlTask(void *parameters)
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;
else if(settings.Pos1StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_ATTITUDE)
cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE;
}
if(settings.Pos1FlightMode == MANUALCONTROLSETTINGS_POS1FLIGHTMODE_MANUAL)
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL;
@ -190,8 +190,8 @@ static void manualControlTask(void *parameters)
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;
else if(settings.Pos3StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_ATTITUDE)
cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE;
}
if(settings.Pos3FlightMode == MANUALCONTROLSETTINGS_POS3FLIGHTMODE_MANUAL)
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL;
@ -205,8 +205,8 @@ static void manualControlTask(void *parameters)
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;
else if(settings.Pos2StabilizationSettings[i] == MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_ATTITUDE)
cmd.StabilizationSettings[i] = MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE;
}
if(settings.Pos2FlightMode == MANUALCONTROLSETTINGS_POS2FLIGHTMODE_MANUAL)
cmd.FlightMode = MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL;
@ -295,7 +295,7 @@ static void manualControlTask(void *parameters)
attitudeSettings.PitchBias = cmd.Accessory1 * 15;
attitudeSettings.RollBias = cmd.Accessory2 * 15;
AHRSSettingsSet(&attitudeSettings);
}
}
}
}

View File

@ -120,7 +120,7 @@ static void stabilizationTask(void* parameters)
ManualControlCommandData manualControl;
SettingsUpdatedCb((UAVObjEvent *) NULL);
// Main task loop
lastSysTime = xTaskGetTickCount();
ZeroPids();
@ -142,7 +142,7 @@ static void stabilizationTask(void* parameters)
AttitudeActualGet(&attitudeActual);
AttitudeRawGet(&attitudeRaw);
SystemSettingsGet(&systemSettings);
float *manualAxis = &manualControl.Roll;
float *attitudeDesiredAxis = &attitudeDesired.Roll;
@ -159,7 +159,7 @@ static void stabilizationTask(void* parameters)
rates[ct] = manualAxis[ct] * settings.ManualRate[ct];
break;
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION:
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE:
rates[ct] = ApplyPid(&pids[PID_ROLL + ct], attitudeDesiredAxis[ct], attitudeActualAxis[ct], 1);
break;
}
@ -184,7 +184,7 @@ static void stabilizationTask(void* parameters)
switch(manualControl.StabilizationSettings[ct])
{
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE:
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION:
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE:
{
float command = ApplyPid(&pids[PID_RATE_ROLL + ct], rates[ct], attitudeRaw.gyros_filtered[ct], 0);
actuatorDesiredAxis[ct] = bound(command);
@ -193,10 +193,10 @@ static void stabilizationTask(void* parameters)
}
}
}
// Save dT
actuatorDesired.UpdateTime = dT * 1000;
if(manualControl.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL)
{
shouldUpdate = 0;

View File

@ -102,7 +102,7 @@ typedef enum { MANUALCONTROLCOMMAND_ARMED_FALSE=0, MANUALCONTROLCOMMAND_ARMED_TR
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;
typedef enum { MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_ATTITUDE=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 */

View File

@ -122,21 +122,21 @@ typedef enum { MANUALCONTROLSETTINGS_ACCESSORY2_CHANNEL0=0, MANUALCONTROLSETTING
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;
typedef enum { MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLSETTINGS_POS1STABILIZATIONSETTINGS_ATTITUDE=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;
typedef enum { MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLSETTINGS_POS2STABILIZATIONSETTINGS_ATTITUDE=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;
typedef enum { MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_NONE=0, MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_RATE=1, MANUALCONTROLSETTINGS_POS3STABILIZATIONSETTINGS_ATTITUDE=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 */

View File

@ -80,7 +80,7 @@ ManualControlCommand::ManualControlCommand(): UAVDataObject(OBJID, ISSINGLEINST,
QStringList StabilizationSettingsEnumOptions;
StabilizationSettingsEnumOptions.append("None");
StabilizationSettingsEnumOptions.append("Rate");
StabilizationSettingsEnumOptions.append("Position");
StabilizationSettingsEnumOptions.append("Attitude");
fields.append( new UAVObjectField(QString("StabilizationSettings"), QString(""), UAVObjectField::ENUM, StabilizationSettingsElemNames, StabilizationSettingsEnumOptions) );
QStringList Accessory1ElemNames;
Accessory1ElemNames.append("0");

View File

@ -74,7 +74,7 @@ public:
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;
typedef enum { STABILIZATIONSETTINGS_NONE=0, STABILIZATIONSETTINGS_RATE=1, STABILIZATIONSETTINGS_ATTITUDE=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 */

View File

@ -126,7 +126,7 @@ _fields = [ \
{
'0' : 'None',
'1' : 'Rate',
'2' : 'Position',
'2' : 'Attitude',
}
),
uavobject.UAVObjectField(

View File

@ -160,7 +160,7 @@ ManualControlSettings::ManualControlSettings(): UAVDataObject(OBJID, ISSINGLEINS
QStringList Pos1StabilizationSettingsEnumOptions;
Pos1StabilizationSettingsEnumOptions.append("None");
Pos1StabilizationSettingsEnumOptions.append("Rate");
Pos1StabilizationSettingsEnumOptions.append("Position");
Pos1StabilizationSettingsEnumOptions.append("Attitude");
fields.append( new UAVObjectField(QString("Pos1StabilizationSettings"), QString(""), UAVObjectField::ENUM, Pos1StabilizationSettingsElemNames, Pos1StabilizationSettingsEnumOptions) );
QStringList Pos2StabilizationSettingsElemNames;
Pos2StabilizationSettingsElemNames.append("Roll");
@ -169,7 +169,7 @@ ManualControlSettings::ManualControlSettings(): UAVDataObject(OBJID, ISSINGLEINS
QStringList Pos2StabilizationSettingsEnumOptions;
Pos2StabilizationSettingsEnumOptions.append("None");
Pos2StabilizationSettingsEnumOptions.append("Rate");
Pos2StabilizationSettingsEnumOptions.append("Position");
Pos2StabilizationSettingsEnumOptions.append("Attitude");
fields.append( new UAVObjectField(QString("Pos2StabilizationSettings"), QString(""), UAVObjectField::ENUM, Pos2StabilizationSettingsElemNames, Pos2StabilizationSettingsEnumOptions) );
QStringList Pos3StabilizationSettingsElemNames;
Pos3StabilizationSettingsElemNames.append("Roll");
@ -178,7 +178,7 @@ ManualControlSettings::ManualControlSettings(): UAVDataObject(OBJID, ISSINGLEINS
QStringList Pos3StabilizationSettingsEnumOptions;
Pos3StabilizationSettingsEnumOptions.append("None");
Pos3StabilizationSettingsEnumOptions.append("Rate");
Pos3StabilizationSettingsEnumOptions.append("Position");
Pos3StabilizationSettingsEnumOptions.append("Attitude");
fields.append( new UAVObjectField(QString("Pos3StabilizationSettings"), QString(""), UAVObjectField::ENUM, Pos3StabilizationSettingsElemNames, Pos3StabilizationSettingsEnumOptions) );
QStringList Pos1FlightModeElemNames;
Pos1FlightModeElemNames.append("0");

View File

@ -94,21 +94,21 @@ public:
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;
typedef enum { POS1STABILIZATIONSETTINGS_NONE=0, POS1STABILIZATIONSETTINGS_RATE=1, POS1STABILIZATIONSETTINGS_ATTITUDE=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;
typedef enum { POS2STABILIZATIONSETTINGS_NONE=0, POS2STABILIZATIONSETTINGS_RATE=1, POS2STABILIZATIONSETTINGS_ATTITUDE=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;
typedef enum { POS3STABILIZATIONSETTINGS_NONE=0, POS3STABILIZATIONSETTINGS_RATE=1, POS3STABILIZATIONSETTINGS_ATTITUDE=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 */

View File

@ -214,7 +214,7 @@ _fields = [ \
{
'0' : 'None',
'1' : 'Rate',
'2' : 'Position',
'2' : 'Attitude',
}
),
uavobject.UAVObjectField(
@ -229,7 +229,7 @@ _fields = [ \
{
'0' : 'None',
'1' : 'Rate',
'2' : 'Position',
'2' : 'Attitude',
}
),
uavobject.UAVObjectField(
@ -244,7 +244,7 @@ _fields = [ \
{
'0' : 'None',
'1' : 'Rate',
'2' : 'Position',
'2' : 'Attitude',
}
),
uavobject.UAVObjectField(

View File

@ -8,7 +8,7 @@
<field name="Yaw" units="%" type="float" elements="1"/>
<field name="Throttle" units="%" type="float" elements="1"/>
<field name="FlightMode" units="" type="enum" elements="1" options="Manual,Stabilized,Auto"/>
<field name="StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Position"/>
<field name="StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Attitude"/>
<field name="Accessory1" units="%" type="float" elements="1"/>
<field name="Accessory2" units="%" type="float" elements="1"/>
<field name="Accessory3" units="%" type="float" elements="1"/>

View File

@ -10,9 +10,9 @@
<field name="Accessory1" units="channel" type="enum" elements="1" options="Channel0,Channel1,Channel2,Channel3,Channel4,Channel5,Channel6,Channel7,None" defaultvalue="None"/>
<field name="Accessory2" units="channel" type="enum" elements="1" options="Channel0,Channel1,Channel2,Channel3,Channel4,Channel5,Channel6,Channel7,None" defaultvalue="None"/>
<field name="Accessory3" units="channel" type="enum" elements="1" options="Channel0,Channel1,Channel2,Channel3,Channel4,Channel5,Channel6,Channel7,None" defaultvalue="None"/>
<field name="Pos1StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Position" defaultvalue="Position"/>
<field name="Pos2StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Position" defaultvalue="Position"/>
<field name="Pos3StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Position" defaultvalue="Position"/>
<field name="Pos1StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Attitude" defaultvalue="Attitude"/>
<field name="Pos2StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Attitude" defaultvalue="Attitude"/>
<field name="Pos3StabilizationSettings" units="" type="enum" elementnames="Roll,Pitch,Yaw" options="None,Rate,Attitude" defaultvalue="Attitude"/>
<field name="Pos1FlightMode" units="" type="enum" elements="1" options="Manual,Stabilized,Auto" defaultvalue="Manual"/>
<field name="Pos2FlightMode" units="" type="enum" elements="1" options="Manual,Stabilized,Auto" defaultvalue="Stabilized"/>
<field name="Pos3FlightMode" units="" type="enum" elements="1" options="Manual,Stabilized,Auto" defaultvalue="Auto"/>