mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
LP-76 disable stabHandler for AutoTune mode
This commit is contained in:
parent
faf2fffb5a
commit
78dffae5a1
@ -798,7 +798,8 @@ static void UpdateSystemIdent(const float *X, const float *noise,
|
|||||||
|
|
||||||
static void UpdateStabilizationDesired(bool doingIdent) {
|
static void UpdateStabilizationDesired(bool doingIdent) {
|
||||||
StabilizationDesiredData stabDesired;
|
StabilizationDesiredData stabDesired;
|
||||||
StabilizationDesiredGet(&stabDesired);
|
// unneeded since we are setting everything in this uavo
|
||||||
|
//StabilizationDesiredGet(&stabDesired);
|
||||||
|
|
||||||
ManualControlCommandData manual_control_command;
|
ManualControlCommandData manual_control_command;
|
||||||
ManualControlCommandGet(&manual_control_command);
|
ManualControlCommandGet(&manual_control_command);
|
||||||
@ -806,7 +807,8 @@ static void UpdateStabilizationDesired(bool doingIdent) {
|
|||||||
stabDesired.Roll = manual_control_command.Roll * rollMax;
|
stabDesired.Roll = manual_control_command.Roll * rollMax;
|
||||||
stabDesired.Pitch = manual_control_command.Pitch * pitchMax;
|
stabDesired.Pitch = manual_control_command.Pitch * pitchMax;
|
||||||
stabDesired.Yaw = manual_control_command.Yaw * manualRate.Yaw;
|
stabDesired.Yaw = manual_control_command.Yaw * manualRate.Yaw;
|
||||||
stabDesired.Thrust = (airframeType == SYSTEMSETTINGS_AIRFRAMETYPE_HELICP) ? manual_control_command.Collective : manual_control_command.Throttle;
|
//stabDesired.Thrust = (airframeType == SYSTEMSETTINGS_AIRFRAMETYPE_HELICP) ? manual_control_command.Collective : manual_control_command.Throttle;
|
||||||
|
stabDesired.Thrust = manual_control_command.Thrust;
|
||||||
|
|
||||||
if (doingIdent) {
|
if (doingIdent) {
|
||||||
stabDesired.StabilizationMode.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_SYSTEMIDENT;
|
stabDesired.StabilizationMode.Roll = STABILIZATIONDESIRED_STABILIZATIONMODE_SYSTEMIDENT;
|
||||||
@ -829,6 +831,7 @@ static uint8_t CheckSettings()
|
|||||||
{
|
{
|
||||||
uint8_t retVal = 0;
|
uint8_t retVal = 0;
|
||||||
|
|
||||||
|
#if 1
|
||||||
// Check the axis gains
|
// Check the axis gains
|
||||||
// Extreme values: Your roll or pitch gain was lower than expected. This will result in large PID values.
|
// Extreme values: Your roll or pitch gain was lower than expected. This will result in large PID values.
|
||||||
if (systemIdentData.Beta.Roll < 6) {
|
if (systemIdentData.Beta.Roll < 6) {
|
||||||
@ -847,6 +850,7 @@ static uint8_t CheckSettings()
|
|||||||
else if (expf(systemIdentData.Tau) < 0.008f) {
|
else if (expf(systemIdentData.Tau) < 0.008f) {
|
||||||
retVal |= 8;
|
retVal |= 8;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ static float applyExpo(float value, float expo);
|
|||||||
static uint8_t currentFpvTiltAngle = 0;
|
static uint8_t currentFpvTiltAngle = 0;
|
||||||
static float cosAngle = 0.0f;
|
static float cosAngle = 0.0f;
|
||||||
static float sinAngle = 0.0f;
|
static float sinAngle = 0.0f;
|
||||||
|
#if 0
|
||||||
#if !defined(PIOS_EXCLUDE_ADVANCED_FEATURES)
|
#if !defined(PIOS_EXCLUDE_ADVANCED_FEATURES)
|
||||||
static FlightModeSettingsStabilization1SettingsData autotuneSettings = {
|
static FlightModeSettingsStabilization1SettingsData autotuneSettings = {
|
||||||
.Roll = FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_SYSTEMIDENT,
|
.Roll = FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_SYSTEMIDENT,
|
||||||
@ -65,6 +66,7 @@ static FlightModeSettingsStabilization1SettingsData attitudeSettings = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
#endif /* !defined(PIOS_EXCLUDE_ADVANCED_FEATURES) */
|
#endif /* !defined(PIOS_EXCLUDE_ADVANCED_FEATURES) */
|
||||||
|
#endif
|
||||||
|
|
||||||
static float applyExpo(float value, float expo)
|
static float applyExpo(float value, float expo)
|
||||||
{
|
{
|
||||||
@ -100,6 +102,7 @@ void stabilizedHandler(__attribute__((unused)) bool newinit)
|
|||||||
StabilizationDesiredInitialize();
|
StabilizationDesiredInitialize();
|
||||||
StabilizationBankInitialize();
|
StabilizationBankInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
ManualControlCommandData cmd;
|
ManualControlCommandData cmd;
|
||||||
ManualControlCommandGet(&cmd);
|
ManualControlCommandGet(&cmd);
|
||||||
|
|
||||||
@ -157,12 +160,18 @@ void stabilizedHandler(__attribute__((unused)) bool newinit)
|
|||||||
break;
|
break;
|
||||||
#if !defined(PIOS_EXCLUDE_ADVANCED_FEATURES)
|
#if !defined(PIOS_EXCLUDE_ADVANCED_FEATURES)
|
||||||
case FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE:
|
case FLIGHTSTATUS_FLIGHTMODE_AUTOTUNE:
|
||||||
|
#if 0
|
||||||
// if (SystemIdentHandle()) {
|
// if (SystemIdentHandle()) {
|
||||||
stab_settings = (uint8_t *)&autotuneSettings;
|
stab_settings = (uint8_t *)&autotuneSettings;
|
||||||
// } else {
|
// } else {
|
||||||
// stab_settings = (uint8_t *)&attitudeSettings;
|
// stab_settings = (uint8_t *)&attitudeSettings;
|
||||||
// }
|
// }
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
// let autotune.c handle it
|
||||||
|
// because it must switch to Attitude after <user configurable> seconds
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
#endif /* !defined(PIOS_EXCLUDE_ADVANCED_FEATURES) */
|
#endif /* !defined(PIOS_EXCLUDE_ADVANCED_FEATURES) */
|
||||||
default:
|
default:
|
||||||
// Major error, this should not occur because only enter this block when one of these is true
|
// Major error, this should not occur because only enter this block when one of these is true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user