mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Stabilization: Changed to new switch format. Both position and rate modes work.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1886 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
1e26ca11ee
commit
7ddb0f6f80
@ -142,15 +142,30 @@ static void stabilizationTask(void* parameters)
|
|||||||
SystemSettingsGet(&systemSettings);
|
SystemSettingsGet(&systemSettings);
|
||||||
|
|
||||||
|
|
||||||
|
float *manualAxis = &manualControl.Roll;
|
||||||
|
float *attitudeDesiredAxis = &attitudeDesired.Roll;
|
||||||
|
float *attitudeActualAxis = &attitudeActual.Roll;
|
||||||
|
float *actuatorDesiredAxis = &actuatorDesired.Roll;
|
||||||
|
|
||||||
|
//Calculate desired rate
|
||||||
float rates[MAX_AXES]= {0,0,0};
|
float rates[MAX_AXES]= {0,0,0};
|
||||||
rates[ROLL] = ApplyPid(&pids[PID_ROLL], attitudeDesired.Roll, attitudeActual.Roll ,false);
|
for(int ct=0; ct< MAX_AXES; ct++)
|
||||||
rates[PITCH] = ApplyPid(&pids[PID_PITCH], attitudeDesired.Pitch, attitudeActual.Pitch,false);
|
{
|
||||||
if(settings.YawMode == LESSTABILIZATIONSETTINGS_YAWMODE_RATE) { // rate stabilization on yaw
|
switch(manualControl.StabilizationSettings[ct])
|
||||||
rates[YAW] = manualControl.Yaw * settings.ManualYawRate;
|
{
|
||||||
}else{
|
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE:
|
||||||
rates[YAW] = ApplyPid(&pids[PID_YAW], attitudeDesired.Yaw, attitudeActual.Yaw,true);
|
rates[ct] = manualAxis[ct] * settings.ManualRate[ct];
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION:
|
||||||
|
rates[ct] = ApplyPid(&pids[PID_ROLL + ct], attitudeDesiredAxis[ct], attitudeActualAxis[ct], true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool shouldUpdate = false;
|
||||||
|
ActuatorDesiredGet(&actuatorDesired);
|
||||||
|
//Calculate desired command
|
||||||
for(int ct=0; ct< MAX_AXES; ct++)
|
for(int ct=0; ct< MAX_AXES; ct++)
|
||||||
{
|
{
|
||||||
if(fabs(rates[ct]) > settings.MaximumRate[ct])
|
if(fabs(rates[ct]) > settings.MaximumRate[ct])
|
||||||
@ -164,39 +179,38 @@ static void stabilizationTask(void* parameters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
switch(manualControl.StabilizationSettings[ct])
|
||||||
|
{
|
||||||
|
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_RATE:
|
||||||
|
case MANUALCONTROLCOMMAND_STABILIZATIONSETTINGS_POSITION:
|
||||||
|
{
|
||||||
|
float command = ApplyPid(&pids[PID_RATE_ROLL + ct], rates[ct], attitudeRaw.gyros_filtered[ct], false);
|
||||||
|
actuatorDesiredAxis[ct] = bound(command);
|
||||||
|
shouldUpdate = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(manualControl.FlightMode == MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL)
|
||||||
|
{
|
||||||
|
shouldUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float commands[MAX_AXES];
|
|
||||||
commands[ROLL] = ApplyPid(&pids[PID_RATE_ROLL], attitudeRaw.gyros_filtered[ROLL], rates[ROLL],false);
|
|
||||||
commands[PITCH] = ApplyPid(&pids[PID_RATE_PITCH], attitudeRaw.gyros_filtered[PITCH], rates[PITCH],false);
|
|
||||||
commands[YAW] = ApplyPid(&pids[PID_RATE_YAW], attitudeRaw.gyros_filtered[YAW], rates[YAW],false);
|
|
||||||
|
|
||||||
|
if(shouldUpdate)
|
||||||
// On fixed wing we don't try to stabilizew yaw
|
|
||||||
if ( systemSettings.AirframeType < SYSTEMSETTINGS_AIRFRAMETYPE_VTOL)
|
|
||||||
{
|
|
||||||
commands[YAW] = -manualControl.Yaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
actuatorDesired.Pitch = bound(-commands[PITCH]);
|
|
||||||
actuatorDesired.Roll = bound(-commands[ROLL]);
|
|
||||||
actuatorDesired.Yaw = bound(-commands[YAW]);
|
|
||||||
// Setup throttle
|
|
||||||
actuatorDesired.Throttle = attitudeDesired.Throttle;
|
|
||||||
|
|
||||||
// Save dT
|
|
||||||
actuatorDesired.UpdateTime = dT * 1000;
|
|
||||||
|
|
||||||
// Write actuator desired (if not in manual mode)
|
|
||||||
if ( manualControl.FlightMode != MANUALCONTROLCOMMAND_FLIGHTMODE_MANUAL )
|
|
||||||
{
|
{
|
||||||
|
actuatorDesired.Throttle = attitudeDesired.Throttle;
|
||||||
ActuatorDesiredSet(&actuatorDesired);
|
ActuatorDesiredSet(&actuatorDesired);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if(manualControl.Armed == MANUALCONTROLCOMMAND_ARMED_FALSE ||
|
||||||
|
!shouldUpdate)
|
||||||
{
|
{
|
||||||
ZeroPids();
|
ZeroPids();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save dT
|
||||||
|
actuatorDesired.UpdateTime = dT * 1000;
|
||||||
// Clear alarms
|
// Clear alarms
|
||||||
AlarmsClear(SYSTEMALARMS_ALARM_STABILIZATION);
|
AlarmsClear(SYSTEMALARMS_ALARM_STABILIZATION);
|
||||||
}
|
}
|
||||||
@ -258,15 +272,9 @@ static void SettingsUpdatedCb(UAVObjEvent * ev)
|
|||||||
{
|
{
|
||||||
memset(pids,0,sizeof (pid_type) * PID_MAX);
|
memset(pids,0,sizeof (pid_type) * PID_MAX);
|
||||||
LesStabilizationSettingsGet(&settings);
|
LesStabilizationSettingsGet(&settings);
|
||||||
pids[PID_RATE_ROLL].p = settings.RollRateP;
|
|
||||||
pids[PID_RATE_PITCH].p = settings.PitchRateP;
|
|
||||||
pids[PID_RATE_YAW].p = settings.YawRatePI[LESSTABILIZATIONSETTINGS_YAWRATEPI_KP];
|
|
||||||
pids[PID_RATE_YAW].i = settings.YawRatePI[LESSTABILIZATIONSETTINGS_YAWRATEPI_KI];
|
|
||||||
pids[PID_RATE_YAW].iLim = settings.YawRatePI[LESSTABILIZATIONSETTINGS_YAWRATEPI_ILIMIT];
|
|
||||||
|
|
||||||
|
float * data = settings.RollRatePI;
|
||||||
float * data = settings.RollPI;
|
for(int pid=0; pid < PID_MAX; pid++)
|
||||||
for(int pid=PID_ROLL; pid < PID_MAX; pid++)
|
|
||||||
{
|
{
|
||||||
pids[pid].p = *data++;
|
pids[pid].p = *data++;
|
||||||
pids[pid].i = *data++;
|
pids[pid].i = *data++;
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#define LESSTABILIZATIONSETTINGS_H
|
#define LESSTABILIZATIONSETTINGS_H
|
||||||
|
|
||||||
// Object constants
|
// Object constants
|
||||||
#define LESSTABILIZATIONSETTINGS_OBJID 2839831188U
|
#define LESSTABILIZATIONSETTINGS_OBJID 3247121950U
|
||||||
#define LESSTABILIZATIONSETTINGS_NAME "LesStabilizationSettings"
|
#define LESSTABILIZATIONSETTINGS_NAME "LesStabilizationSettings"
|
||||||
#define LESSTABILIZATIONSETTINGS_METANAME "LesStabilizationSettingsMeta"
|
#define LESSTABILIZATIONSETTINGS_METANAME "LesStabilizationSettingsMeta"
|
||||||
#define LESSTABILIZATIONSETTINGS_ISSINGLEINST 1
|
#define LESSTABILIZATIONSETTINGS_ISSINGLEINST 1
|
||||||
@ -75,11 +75,10 @@ typedef struct {
|
|||||||
uint8_t RollMax;
|
uint8_t RollMax;
|
||||||
uint8_t PitchMax;
|
uint8_t PitchMax;
|
||||||
uint8_t YawMax;
|
uint8_t YawMax;
|
||||||
uint8_t YawMode;
|
float ManualRate[3];
|
||||||
float ManualYawRate;
|
|
||||||
float MaximumRate[3];
|
float MaximumRate[3];
|
||||||
float RollRateP;
|
float RollRatePI[3];
|
||||||
float PitchRateP;
|
float PitchRatePI[3];
|
||||||
float YawRatePI[3];
|
float YawRatePI[3];
|
||||||
float RollPI[3];
|
float RollPI[3];
|
||||||
float PitchPI[3];
|
float PitchPI[3];
|
||||||
@ -92,17 +91,26 @@ typedef struct {
|
|||||||
// Field RollMax information
|
// Field RollMax information
|
||||||
// Field PitchMax information
|
// Field PitchMax information
|
||||||
// Field YawMax information
|
// Field YawMax information
|
||||||
// Field YawMode information
|
// Field ManualRate information
|
||||||
/* Enumeration options for field YawMode */
|
/* Array element names for field ManualRate */
|
||||||
typedef enum { LESSTABILIZATIONSETTINGS_YAWMODE_RATE=0, LESSTABILIZATIONSETTINGS_YAWMODE_HEADING=1 } LesStabilizationSettingsYawModeOptions;
|
typedef enum { LESSTABILIZATIONSETTINGS_MANUALRATE_ROLL=0, LESSTABILIZATIONSETTINGS_MANUALRATE_PITCH=1, LESSTABILIZATIONSETTINGS_MANUALRATE_YAW=2 } LesStabilizationSettingsManualRateElem;
|
||||||
// Field ManualYawRate information
|
/* Number of elements for field ManualRate */
|
||||||
|
#define LESSTABILIZATIONSETTINGS_MANUALRATE_NUMELEM 3
|
||||||
// Field MaximumRate information
|
// Field MaximumRate information
|
||||||
/* Array element names for field MaximumRate */
|
/* Array element names for field MaximumRate */
|
||||||
typedef enum { LESSTABILIZATIONSETTINGS_MAXIMUMRATE_ROLL=0, LESSTABILIZATIONSETTINGS_MAXIMUMRATE_PITCH=1, LESSTABILIZATIONSETTINGS_MAXIMUMRATE_YAW=2 } LesStabilizationSettingsMaximumRateElem;
|
typedef enum { LESSTABILIZATIONSETTINGS_MAXIMUMRATE_ROLL=0, LESSTABILIZATIONSETTINGS_MAXIMUMRATE_PITCH=1, LESSTABILIZATIONSETTINGS_MAXIMUMRATE_YAW=2 } LesStabilizationSettingsMaximumRateElem;
|
||||||
/* Number of elements for field MaximumRate */
|
/* Number of elements for field MaximumRate */
|
||||||
#define LESSTABILIZATIONSETTINGS_MAXIMUMRATE_NUMELEM 3
|
#define LESSTABILIZATIONSETTINGS_MAXIMUMRATE_NUMELEM 3
|
||||||
// Field RollRateP information
|
// Field RollRatePI information
|
||||||
// Field PitchRateP information
|
/* Array element names for field RollRatePI */
|
||||||
|
typedef enum { LESSTABILIZATIONSETTINGS_ROLLRATEPI_KP=0, LESSTABILIZATIONSETTINGS_ROLLRATEPI_KI=1, LESSTABILIZATIONSETTINGS_ROLLRATEPI_ILIMIT=2 } LesStabilizationSettingsRollRatePIElem;
|
||||||
|
/* Number of elements for field RollRatePI */
|
||||||
|
#define LESSTABILIZATIONSETTINGS_ROLLRATEPI_NUMELEM 3
|
||||||
|
// Field PitchRatePI information
|
||||||
|
/* Array element names for field PitchRatePI */
|
||||||
|
typedef enum { LESSTABILIZATIONSETTINGS_PITCHRATEPI_KP=0, LESSTABILIZATIONSETTINGS_PITCHRATEPI_KI=1, LESSTABILIZATIONSETTINGS_PITCHRATEPI_ILIMIT=2 } LesStabilizationSettingsPitchRatePIElem;
|
||||||
|
/* Number of elements for field PitchRatePI */
|
||||||
|
#define LESSTABILIZATIONSETTINGS_PITCHRATEPI_NUMELEM 3
|
||||||
// Field YawRatePI information
|
// Field YawRatePI information
|
||||||
/* Array element names for field YawRatePI */
|
/* Array element names for field YawRatePI */
|
||||||
typedef enum { LESSTABILIZATIONSETTINGS_YAWRATEPI_KP=0, LESSTABILIZATIONSETTINGS_YAWRATEPI_KI=1, LESSTABILIZATIONSETTINGS_YAWRATEPI_ILIMIT=2 } LesStabilizationSettingsYawRatePIElem;
|
typedef enum { LESSTABILIZATIONSETTINGS_YAWRATEPI_KP=0, LESSTABILIZATIONSETTINGS_YAWRATEPI_KI=1, LESSTABILIZATIONSETTINGS_YAWRATEPI_ILIMIT=2 } LesStabilizationSettingsYawRatePIElem;
|
||||||
|
@ -84,25 +84,30 @@ static void setDefaults(UAVObjHandle obj, uint16_t instId)
|
|||||||
data.RollMax = 35;
|
data.RollMax = 35;
|
||||||
data.PitchMax = 35;
|
data.PitchMax = 35;
|
||||||
data.YawMax = 35;
|
data.YawMax = 35;
|
||||||
data.YawMode = 0;
|
data.ManualRate[0] = 150;
|
||||||
data.ManualYawRate = 200;
|
data.ManualRate[1] = 150;
|
||||||
|
data.ManualRate[2] = 150;
|
||||||
data.MaximumRate[0] = 300;
|
data.MaximumRate[0] = 300;
|
||||||
data.MaximumRate[1] = 300;
|
data.MaximumRate[1] = 300;
|
||||||
data.MaximumRate[2] = 300;
|
data.MaximumRate[2] = 300;
|
||||||
data.RollRateP = 0.0015;
|
data.RollRatePI[0] = 0.0015;
|
||||||
data.PitchRateP = 0.0015;
|
data.RollRatePI[1] = 0;
|
||||||
|
data.RollRatePI[2] = 0.5;
|
||||||
|
data.PitchRatePI[0] = 0.0015;
|
||||||
|
data.PitchRatePI[1] = 0;
|
||||||
|
data.PitchRatePI[2] = 0.5;
|
||||||
data.YawRatePI[0] = 0.003;
|
data.YawRatePI[0] = 0.003;
|
||||||
data.YawRatePI[1] = 0.003;
|
data.YawRatePI[1] = 0;
|
||||||
data.YawRatePI[2] = 0.003;
|
data.YawRatePI[2] = 0.5;
|
||||||
data.RollPI[0] = 0;
|
data.RollPI[0] = 2;
|
||||||
data.RollPI[1] = 0;
|
data.RollPI[1] = 0;
|
||||||
data.RollPI[2] = 0;
|
data.RollPI[2] = 0.5;
|
||||||
data.PitchPI[0] = 0;
|
data.PitchPI[0] = 2;
|
||||||
data.PitchPI[1] = 0;
|
data.PitchPI[1] = 0;
|
||||||
data.PitchPI[2] = 0;
|
data.PitchPI[2] = 0.5;
|
||||||
data.YawPI[0] = 0;
|
data.YawPI[0] = 2;
|
||||||
data.YawPI[1] = 0;
|
data.YawPI[1] = 0;
|
||||||
data.YawPI[2] = 0;
|
data.YawPI[2] = 0.5;
|
||||||
|
|
||||||
UAVObjSetInstanceData(obj, instId, &data);
|
UAVObjSetInstanceData(obj, instId, &data);
|
||||||
|
|
||||||
|
@ -47,33 +47,33 @@ LesStabilizationSettings::LesStabilizationSettings(): UAVDataObject(OBJID, ISSIN
|
|||||||
fields.append( new UAVObjectField(QString("UpdatePeriod"), QString("ms"), UAVObjectField::UINT8, UpdatePeriodElemNames, QStringList()) );
|
fields.append( new UAVObjectField(QString("UpdatePeriod"), QString("ms"), UAVObjectField::UINT8, UpdatePeriodElemNames, QStringList()) );
|
||||||
QStringList RollMaxElemNames;
|
QStringList RollMaxElemNames;
|
||||||
RollMaxElemNames.append("0");
|
RollMaxElemNames.append("0");
|
||||||
fields.append( new UAVObjectField(QString("RollMax"), QString("degrees"), UAVObjectField::UINT8, RollMaxElemNames, QStringList()) );
|
fields.append( new UAVObjectField(QString("RollMax"), QString("Degrees"), UAVObjectField::UINT8, RollMaxElemNames, QStringList()) );
|
||||||
QStringList PitchMaxElemNames;
|
QStringList PitchMaxElemNames;
|
||||||
PitchMaxElemNames.append("0");
|
PitchMaxElemNames.append("0");
|
||||||
fields.append( new UAVObjectField(QString("PitchMax"), QString("degrees"), UAVObjectField::UINT8, PitchMaxElemNames, QStringList()) );
|
fields.append( new UAVObjectField(QString("PitchMax"), QString("Degrees"), UAVObjectField::UINT8, PitchMaxElemNames, QStringList()) );
|
||||||
QStringList YawMaxElemNames;
|
QStringList YawMaxElemNames;
|
||||||
YawMaxElemNames.append("0");
|
YawMaxElemNames.append("0");
|
||||||
fields.append( new UAVObjectField(QString("YawMax"), QString("degrees"), UAVObjectField::UINT8, YawMaxElemNames, QStringList()) );
|
fields.append( new UAVObjectField(QString("YawMax"), QString("Degrees"), UAVObjectField::UINT8, YawMaxElemNames, QStringList()) );
|
||||||
QStringList YawModeElemNames;
|
QStringList ManualRateElemNames;
|
||||||
YawModeElemNames.append("0");
|
ManualRateElemNames.append("Roll");
|
||||||
QStringList YawModeEnumOptions;
|
ManualRateElemNames.append("Pitch");
|
||||||
YawModeEnumOptions.append("rate");
|
ManualRateElemNames.append("Yaw");
|
||||||
YawModeEnumOptions.append("heading");
|
fields.append( new UAVObjectField(QString("ManualRate"), QString("Degrees/sec"), UAVObjectField::FLOAT32, ManualRateElemNames, QStringList()) );
|
||||||
fields.append( new UAVObjectField(QString("YawMode"), QString(""), UAVObjectField::ENUM, YawModeElemNames, YawModeEnumOptions) );
|
|
||||||
QStringList ManualYawRateElemNames;
|
|
||||||
ManualYawRateElemNames.append("0");
|
|
||||||
fields.append( new UAVObjectField(QString("ManualYawRate"), QString("Degrees/sec"), UAVObjectField::FLOAT32, ManualYawRateElemNames, QStringList()) );
|
|
||||||
QStringList MaximumRateElemNames;
|
QStringList MaximumRateElemNames;
|
||||||
MaximumRateElemNames.append("Roll");
|
MaximumRateElemNames.append("Roll");
|
||||||
MaximumRateElemNames.append("Pitch");
|
MaximumRateElemNames.append("Pitch");
|
||||||
MaximumRateElemNames.append("Yaw");
|
MaximumRateElemNames.append("Yaw");
|
||||||
fields.append( new UAVObjectField(QString("MaximumRate"), QString("Degrees/sec"), UAVObjectField::FLOAT32, MaximumRateElemNames, QStringList()) );
|
fields.append( new UAVObjectField(QString("MaximumRate"), QString("Degrees/sec"), UAVObjectField::FLOAT32, MaximumRateElemNames, QStringList()) );
|
||||||
QStringList RollRatePElemNames;
|
QStringList RollRatePIElemNames;
|
||||||
RollRatePElemNames.append("0");
|
RollRatePIElemNames.append("Kp");
|
||||||
fields.append( new UAVObjectField(QString("RollRateP"), QString(""), UAVObjectField::FLOAT32, RollRatePElemNames, QStringList()) );
|
RollRatePIElemNames.append("Ki");
|
||||||
QStringList PitchRatePElemNames;
|
RollRatePIElemNames.append("ILimit");
|
||||||
PitchRatePElemNames.append("0");
|
fields.append( new UAVObjectField(QString("RollRatePI"), QString(""), UAVObjectField::FLOAT32, RollRatePIElemNames, QStringList()) );
|
||||||
fields.append( new UAVObjectField(QString("PitchRateP"), QString(""), UAVObjectField::FLOAT32, PitchRatePElemNames, QStringList()) );
|
QStringList PitchRatePIElemNames;
|
||||||
|
PitchRatePIElemNames.append("Kp");
|
||||||
|
PitchRatePIElemNames.append("Ki");
|
||||||
|
PitchRatePIElemNames.append("ILimit");
|
||||||
|
fields.append( new UAVObjectField(QString("PitchRatePI"), QString(""), UAVObjectField::FLOAT32, PitchRatePIElemNames, QStringList()) );
|
||||||
QStringList YawRatePIElemNames;
|
QStringList YawRatePIElemNames;
|
||||||
YawRatePIElemNames.append("Kp");
|
YawRatePIElemNames.append("Kp");
|
||||||
YawRatePIElemNames.append("Ki");
|
YawRatePIElemNames.append("Ki");
|
||||||
@ -131,25 +131,30 @@ void LesStabilizationSettings::setDefaultFieldValues()
|
|||||||
data.RollMax = 35;
|
data.RollMax = 35;
|
||||||
data.PitchMax = 35;
|
data.PitchMax = 35;
|
||||||
data.YawMax = 35;
|
data.YawMax = 35;
|
||||||
data.YawMode = 0;
|
data.ManualRate[0] = 150;
|
||||||
data.ManualYawRate = 200;
|
data.ManualRate[1] = 150;
|
||||||
|
data.ManualRate[2] = 150;
|
||||||
data.MaximumRate[0] = 300;
|
data.MaximumRate[0] = 300;
|
||||||
data.MaximumRate[1] = 300;
|
data.MaximumRate[1] = 300;
|
||||||
data.MaximumRate[2] = 300;
|
data.MaximumRate[2] = 300;
|
||||||
data.RollRateP = 0.0015;
|
data.RollRatePI[0] = 0.0015;
|
||||||
data.PitchRateP = 0.0015;
|
data.RollRatePI[1] = 0;
|
||||||
|
data.RollRatePI[2] = 0.5;
|
||||||
|
data.PitchRatePI[0] = 0.0015;
|
||||||
|
data.PitchRatePI[1] = 0;
|
||||||
|
data.PitchRatePI[2] = 0.5;
|
||||||
data.YawRatePI[0] = 0.003;
|
data.YawRatePI[0] = 0.003;
|
||||||
data.YawRatePI[1] = 0.003;
|
data.YawRatePI[1] = 0;
|
||||||
data.YawRatePI[2] = 0.003;
|
data.YawRatePI[2] = 0.5;
|
||||||
data.RollPI[0] = 0;
|
data.RollPI[0] = 2;
|
||||||
data.RollPI[1] = 0;
|
data.RollPI[1] = 0;
|
||||||
data.RollPI[2] = 0;
|
data.RollPI[2] = 0.5;
|
||||||
data.PitchPI[0] = 0;
|
data.PitchPI[0] = 2;
|
||||||
data.PitchPI[1] = 0;
|
data.PitchPI[1] = 0;
|
||||||
data.PitchPI[2] = 0;
|
data.PitchPI[2] = 0.5;
|
||||||
data.YawPI[0] = 0;
|
data.YawPI[0] = 2;
|
||||||
data.YawPI[1] = 0;
|
data.YawPI[1] = 0;
|
||||||
data.YawPI[2] = 0;
|
data.YawPI[2] = 0.5;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,11 +47,10 @@ public:
|
|||||||
quint8 RollMax;
|
quint8 RollMax;
|
||||||
quint8 PitchMax;
|
quint8 PitchMax;
|
||||||
quint8 YawMax;
|
quint8 YawMax;
|
||||||
quint8 YawMode;
|
float ManualRate[3];
|
||||||
float ManualYawRate;
|
|
||||||
float MaximumRate[3];
|
float MaximumRate[3];
|
||||||
float RollRateP;
|
float RollRatePI[3];
|
||||||
float PitchRateP;
|
float PitchRatePI[3];
|
||||||
float YawRatePI[3];
|
float YawRatePI[3];
|
||||||
float RollPI[3];
|
float RollPI[3];
|
||||||
float PitchPI[3];
|
float PitchPI[3];
|
||||||
@ -64,17 +63,26 @@ public:
|
|||||||
// Field RollMax information
|
// Field RollMax information
|
||||||
// Field PitchMax information
|
// Field PitchMax information
|
||||||
// Field YawMax information
|
// Field YawMax information
|
||||||
// Field YawMode information
|
// Field ManualRate information
|
||||||
/* Enumeration options for field YawMode */
|
/* Array element names for field ManualRate */
|
||||||
typedef enum { YAWMODE_RATE=0, YAWMODE_HEADING=1 } YawModeOptions;
|
typedef enum { MANUALRATE_ROLL=0, MANUALRATE_PITCH=1, MANUALRATE_YAW=2 } ManualRateElem;
|
||||||
// Field ManualYawRate information
|
/* Number of elements for field ManualRate */
|
||||||
|
static const quint32 MANUALRATE_NUMELEM = 3;
|
||||||
// Field MaximumRate information
|
// Field MaximumRate information
|
||||||
/* Array element names for field MaximumRate */
|
/* Array element names for field MaximumRate */
|
||||||
typedef enum { MAXIMUMRATE_ROLL=0, MAXIMUMRATE_PITCH=1, MAXIMUMRATE_YAW=2 } MaximumRateElem;
|
typedef enum { MAXIMUMRATE_ROLL=0, MAXIMUMRATE_PITCH=1, MAXIMUMRATE_YAW=2 } MaximumRateElem;
|
||||||
/* Number of elements for field MaximumRate */
|
/* Number of elements for field MaximumRate */
|
||||||
static const quint32 MAXIMUMRATE_NUMELEM = 3;
|
static const quint32 MAXIMUMRATE_NUMELEM = 3;
|
||||||
// Field RollRateP information
|
// Field RollRatePI information
|
||||||
// Field PitchRateP information
|
/* Array element names for field RollRatePI */
|
||||||
|
typedef enum { ROLLRATEPI_KP=0, ROLLRATEPI_KI=1, ROLLRATEPI_ILIMIT=2 } RollRatePIElem;
|
||||||
|
/* Number of elements for field RollRatePI */
|
||||||
|
static const quint32 ROLLRATEPI_NUMELEM = 3;
|
||||||
|
// Field PitchRatePI information
|
||||||
|
/* Array element names for field PitchRatePI */
|
||||||
|
typedef enum { PITCHRATEPI_KP=0, PITCHRATEPI_KI=1, PITCHRATEPI_ILIMIT=2 } PitchRatePIElem;
|
||||||
|
/* Number of elements for field PitchRatePI */
|
||||||
|
static const quint32 PITCHRATEPI_NUMELEM = 3;
|
||||||
// Field YawRatePI information
|
// Field YawRatePI information
|
||||||
/* Array element names for field YawRatePI */
|
/* Array element names for field YawRatePI */
|
||||||
typedef enum { YAWRATEPI_KP=0, YAWRATEPI_KI=1, YAWRATEPI_ILIMIT=2 } YawRatePIElem;
|
typedef enum { YAWRATEPI_KP=0, YAWRATEPI_KI=1, YAWRATEPI_ILIMIT=2 } YawRatePIElem;
|
||||||
@ -98,7 +106,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
static const quint32 OBJID = 2839831188U;
|
static const quint32 OBJID = 3247121950U;
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
static const bool ISSINGLEINST = 1;
|
static const bool ISSINGLEINST = 1;
|
||||||
static const bool ISSETTINGS = 1;
|
static const bool ISSETTINGS = 1;
|
||||||
|
@ -78,23 +78,13 @@ _fields = [ \
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
uavobject.UAVObjectField(
|
uavobject.UAVObjectField(
|
||||||
'YawMode',
|
'ManualRate',
|
||||||
'b',
|
|
||||||
1,
|
|
||||||
[
|
|
||||||
'0',
|
|
||||||
],
|
|
||||||
{
|
|
||||||
'0' : 'rate',
|
|
||||||
'1' : 'heading',
|
|
||||||
}
|
|
||||||
),
|
|
||||||
uavobject.UAVObjectField(
|
|
||||||
'ManualYawRate',
|
|
||||||
'f',
|
'f',
|
||||||
1,
|
3,
|
||||||
[
|
[
|
||||||
'0',
|
'Roll',
|
||||||
|
'Pitch',
|
||||||
|
'Yaw',
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -112,21 +102,25 @@ _fields = [ \
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
uavobject.UAVObjectField(
|
uavobject.UAVObjectField(
|
||||||
'RollRateP',
|
'RollRatePI',
|
||||||
'f',
|
'f',
|
||||||
1,
|
3,
|
||||||
[
|
[
|
||||||
'0',
|
'Kp',
|
||||||
|
'Ki',
|
||||||
|
'ILimit',
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
uavobject.UAVObjectField(
|
uavobject.UAVObjectField(
|
||||||
'PitchRateP',
|
'PitchRatePI',
|
||||||
'f',
|
'f',
|
||||||
1,
|
3,
|
||||||
[
|
[
|
||||||
'0',
|
'Kp',
|
||||||
|
'Ki',
|
||||||
|
'ILimit',
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -184,7 +178,7 @@ _fields = [ \
|
|||||||
|
|
||||||
class LesStabilizationSettings(uavobject.UAVObject):
|
class LesStabilizationSettings(uavobject.UAVObject):
|
||||||
## Object constants
|
## Object constants
|
||||||
OBJID = 2839831188
|
OBJID = 3247121950
|
||||||
NAME = "LesStabilizationSettings"
|
NAME = "LesStabilizationSettings"
|
||||||
METANAME = "LesStabilizationSettingsMeta"
|
METANAME = "LesStabilizationSettingsMeta"
|
||||||
ISSINGLEINST = 1
|
ISSINGLEINST = 1
|
||||||
|
@ -2,19 +2,18 @@
|
|||||||
<object name="LesStabilizationSettings" singleinstance="true" settings="true">
|
<object name="LesStabilizationSettings" singleinstance="true" settings="true">
|
||||||
<description>PID settings used by the Stabilization module to combine the @ref AttitudeActual and @ref AttitudeDesired to compute @ref ActuatorDesired</description>
|
<description>PID settings used by the Stabilization module to combine the @ref AttitudeActual and @ref AttitudeDesired to compute @ref ActuatorDesired</description>
|
||||||
<field name="UpdatePeriod" units="ms" type="uint8" elements="1" defaultvalue="10"/>
|
<field name="UpdatePeriod" units="ms" type="uint8" elements="1" defaultvalue="10"/>
|
||||||
<field name="RollMax" units="degrees" type="uint8" elements="1" defaultvalue="35"/>
|
<field name="RollMax" units="Degrees" type="uint8" elements="1" defaultvalue="35"/>
|
||||||
<field name="PitchMax" units="degrees" type="uint8" elements="1" defaultvalue="35"/>
|
<field name="PitchMax" units="Degrees" type="uint8" elements="1" defaultvalue="35"/>
|
||||||
<field name="YawMax" units="degrees" type="uint8" elements="1" defaultvalue="35"/>
|
<field name="YawMax" units="Degrees" type="uint8" elements="1" defaultvalue="35"/>
|
||||||
<field name="YawMode" units="" type="enum" elements="1" options="rate,heading" defaultvalue="rate"/>
|
<field name="ManualRate" units="Degrees/sec" type="float" elements="3" elementnames="Roll,Pitch,Yaw" defaultvalue="150,150,150"/>
|
||||||
<field name="ManualYawRate" units="Degrees/sec" type="float" elements="1" defaultvalue="200"/>
|
<field name="MaximumRate" units="Degrees/sec" type="float" elements="3" elementnames="Roll,Pitch,Yaw" defaultvalue="300,300,300"/>
|
||||||
<field name="MaximumRate" units="Degrees/sec" type="float" elements="3" elementnames="Roll,Pitch,Yaw" defaultvalue="300"/>
|
|
||||||
|
|
||||||
<field name="RollRateP" units="" type="float" elements="1" defaultvalue="0.0015"/>
|
<field name="RollRatePI" units="" type="float" elements="2" elementnames="Kp,Ki,ILimit" defaultvalue="0.0015,0,0.5"/>
|
||||||
<field name="PitchRateP" units="" type="float" elements="1" defaultvalue="0.0015"/>
|
<field name="PitchRatePI" units="" type="float" elements="2" elementnames="Kp,Ki,ILimit" defaultvalue="0.0015,0,0.5"/>
|
||||||
<field name="YawRatePI" units="" type="float" elements="2" elementnames="Kp,Ki,ILimit" defaultvalue="0.003"/>
|
<field name="YawRatePI" units="" type="float" elements="2" elementnames="Kp,Ki,ILimit" defaultvalue="0.003,0,0.5"/>
|
||||||
<field name="RollPI" units="" type="float" elements="4" elementnames="Kp,Ki,ILimit" defaultvalue="0"/>
|
<field name="RollPI" units="" type="float" elements="4" elementnames="Kp,Ki,ILimit" defaultvalue="2,0,0.5"/>
|
||||||
<field name="PitchPI" units="" type="float" elements="4" elementnames="Kp,Ki,ILimit" defaultvalue="0"/>
|
<field name="PitchPI" units="" type="float" elements="4" elementnames="Kp,Ki,ILimit" defaultvalue="2,0,0.5"/>
|
||||||
<field name="YawPI" units="" type="float" elements="4" elementnames="Kp,Ki,ILimit" defaultvalue="0"/>
|
<field name="YawPI" units="" type="float" elements="4" elementnames="Kp,Ki,ILimit" defaultvalue="2,0,0.5"/>
|
||||||
|
|
||||||
<access gcs="readwrite" flight="readwrite"/>
|
<access gcs="readwrite" flight="readwrite"/>
|
||||||
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<field name="FeedForward" units="" type="float" elements="1" defaultvalue="0"/>
|
<field name="FeedForward" units="" type="float" elements="1" defaultvalue="0"/>
|
||||||
<field name="AccelTime" units="ms" type="float" elements="1" defaultvalue="0"/>
|
<field name="AccelTime" units="ms" type="float" elements="1" defaultvalue="0"/>
|
||||||
<field name="DecelTime" units="ms" type="float" elements="1" defaultvalue="0"/>
|
<field name="DecelTime" units="ms" type="float" elements="1" defaultvalue="0"/>
|
||||||
<field name="ThrottleCurve1" units="percent" type="float" elements="5" elementnames="0,25,50,75,100" defaultvalue="-10"/>
|
<field name="ThrottleCurve1" units="percent" type="float" elements="5" elementnames="0,25,50,75,100" defaultvalue="0,0.25,0.5,0.75,1"/>
|
||||||
<field name="ThrottleCurve2" units="percent" type="float" elements="5" elementnames="0,25,50,75,100" defaultvalue="-10"/>
|
<field name="ThrottleCurve2" units="percent" type="float" elements="5" elementnames="0,25,50,75,100" defaultvalue="0,0.25,0.5,0.75,1"/>
|
||||||
<field name="Mixer0Type" units="" type="enum" elements="1" options="Disabled,Motor,Servo" defaultvalue="Disabled"/>
|
<field name="Mixer0Type" units="" type="enum" elements="1" options="Disabled,Motor,Servo" defaultvalue="Disabled"/>
|
||||||
<field name="Mixer0Vector" units="" type="int8" elements="5" elementnames="ThrottleCurve1,ThrottleCurve2,Roll,Pitch,Yaw" defaultvalue="0"/>
|
<field name="Mixer0Vector" units="" type="int8" elements="5" elementnames="ThrottleCurve1,ThrottleCurve2,Roll,Pitch,Yaw" defaultvalue="0"/>
|
||||||
<field name="Mixer1Type" units="" type="enum" elements="1" options="Disabled,Motor,Servo" defaultvalue="Disabled"/>
|
<field name="Mixer1Type" units="" type="enum" elements="1" options="Disabled,Motor,Servo" defaultvalue="Disabled"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user