1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

LP-56 - Use separate roll/picth factors and add firmware support

This commit is contained in:
Alessio Morale 2015-07-24 21:37:46 +02:00
parent ac877a036e
commit 7973ab9d0a
7 changed files with 23 additions and 12 deletions

View File

@ -10,6 +10,7 @@
*
* @file innerloop.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2014.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* @brief Attitude stabilization module.
*
* @see The GNU Public License (GPL) Version 3
@ -301,10 +302,15 @@ static void stabilizationInnerloopTask()
-StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t],
StabilizationBankMaximumRateToArray(stabSettings.stabBank.MaximumRate)[t]
);
const float acro_factors[] = {
stabSettings.stabBank.AcroInsanityFactor.Roll,
stabSettings.stabBank.AcroInsanityFactor.Pitch,
stabSettings.stabBank.AcroInsanityFactor.Yaw
};
pid_scaler ascaler = create_pid_scaler(t);
ascaler.i *= boundf(1.0f - (1.5f * fabsf(stickinput[t])), 0.0f, 1.0f); // this prevents Integral from getting too high while controlled manually
float arate = pid_apply_setpoint(&stabSettings.innerPids[t], &ascaler, rate[t], gyro_filtered[t], dT);
float factor = fabsf(stickinput[t]) * stabSettings.stabBank.AcroInsanityFactor;
float factor = fabsf(stickinput[t]) * acro_factors[t];
actuatorDesiredAxis[t] = factor * stickinput[t] + (1.0f - factor) * arate;
}
break;

View File

@ -9,6 +9,7 @@
*
* @file txpid.c
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2011.
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
* @brief Optional module to tune PID settings using R/C transmitter.
*
* @see The GNU Public License (GPL) Version 3
@ -382,17 +383,21 @@ static void updatePIDs(UAVObjEvent *ev)
case TXPIDSETTINGS_PIDS_GYROTAU:
needsUpdateStab |= update(&stab.GyroTau, value);
break;
case TXPIDSETTINGS_PIDS_ACROPLUSFACTOR:
needsUpdateBank |= update(&bank.AcroInsanityFactor, value);
case TXPIDSETTINGS_PIDS_ACROPLUSFACTORROLL:
needsUpdateBank |= update(&bank.AcroInsanityFactor.Roll, value);
break;
case TXPIDSETTINGS_PIDS_ACROPLUSFACTORPITCH:
needsUpdateBank |= update(&bank.AcroInsanityFactor.Pitch, value);
break;
case TXPIDSETTINGS_PIDS_ACCELTAU:
needsUpdateAtt |= update(&att.AccelTau, value);
needsUpdateAtt |= update(&att.AccelTau, value);
break;
case TXPIDSETTINGS_PIDS_ACCELKP:
needsUpdateAtt |= update(&att.AccelKp, value);
needsUpdateAtt |= update(&att.AccelKp, value);
break;
case TXPIDSETTINGS_PIDS_ACCELKI:
needsUpdateAtt |= update(&att.AccelKi, value);
needsUpdateAtt |= update(&att.AccelKi, value);
break;
#ifdef REVOLUTION

View File

@ -16,8 +16,8 @@
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit"/>
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>
<field name="EnableThrustPIDScaling" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="FALSE"/>

View File

@ -16,7 +16,7 @@
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>

View File

@ -16,7 +16,7 @@
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>

View File

@ -16,7 +16,7 @@
<field name="PitchPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
<field name="YawPI" units="" type="float" elementnames="Kp,Ki,ILimit" defaultvalue="2.5,0,50" limits="%BE:0:10; %BE:0:10; "/>
<field name="AcroInsanityFactor" units="percent" type="float" elements="1" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="AcroInsanityFactor" units="percent" type="float" elementnames="Roll,Pitch,Yaw" defaultvalue="0.4" limits="%BE:0.0:1.0"/>
<field name="EnablePiroComp" units="" type="enum" elements="1" options="FALSE,TRUE" defaultvalue="TRUE"/>

View File

@ -20,7 +20,7 @@
Roll+Pitch Attitude.Kp, Roll+Pitch Attitude.Ki, Roll+Pitch Attitude.ILimit, Roll+Pitch Attitude.Resp,
Yaw Attitude.Kp, Yaw Attitude.Ki, Yaw Attitude.ILimit, Yaw Attitude.Resp,
Roll.Expo, Pitch.Expo, Roll+Pitch.Expo, Yaw.Expo,
GyroTau,AcroPlusFactor,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta,
GyroTau,AcroPlusFactorRoll,AcroPlusFactorPitch,Altitude Pos.Kp,Altitude Velocity.Kp,Altitude Velocity.Ki,Altitude Velocity.Kd,Altitude Velocity.Beta,
AccelTau, AccelKp, AccelKi"
defaultvalue="Disabled"/>
<field name="MinPID" units="" type="float" elementnames="Instance1,Instance2,Instance3" defaultvalue="0"/>