Browse Source

Update AP_PitchController.cpp

mission-4.1.18
Nathan E 6 years ago committed by Tom Pittenger
parent
commit
fbb2252fd9
  1. 26
      libraries/APM_Control/AP_PitchController.cpp

26
libraries/APM_Control/AP_PitchController.cpp

@ -3,12 +3,12 @@ @@ -3,12 +3,12 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -25,7 +25,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = { @@ -25,7 +25,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
// @Param: TCONST
// @DisplayName: Pitch Time Constant
// @Description: This controls the time constant in seconds from demanded to achieved pitch angle. A value of 0.5 is a good default and will work with nearly all models. Advanced users may want to reduce this time to obtain a faster response but there is no point setting a time less than the aircraft can achieve.
// @Description: Time constant in seconds from demanded to achieved pitch angle. Most models respond well to 0.5. May be reduced for faster responses, but setting lower than a model can achieve will not help.
// @Range: 0.4 1.0
// @Units: s
// @Increment: 0.1
@ -34,7 +34,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = { @@ -34,7 +34,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
// @Param: P
// @DisplayName: Proportional Gain
// @Description: This is the gain from pitch angle to elevator. This gain works the same way as PTCH2SRV_P in the old PID controller and can be set to the same value.
// @Description: Proportional gain from pitch angle demands to elevator. Higher values allow more servo response but can cause oscillations. Automatically set and adjusted by AUTOTUNE mode.
// @Range: 0.1 3.0
// @Increment: 0.1
// @User: User
@ -42,15 +42,15 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = { @@ -42,15 +42,15 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
// @Param: D
// @DisplayName: Damping Gain
// @Description: This is the gain from pitch rate to elevator. This adjusts the damping of the pitch control loop. It has the same effect as PTCH2SRV_D in the old PID controller and can be set to the same value, but without the spikes in servo demands. This gain helps to reduce pitching in turbulence. Some airframes such as flying wings that have poor pitch damping can benefit from increasing this gain term. This should be increased in 0.01 increments as too high a value can lead to a high frequency pitch oscillation that could overstress the airframe.
// @Range: 0 0.1
// @Description: Damping gain from pitch acceleration to elevator. Higher values reduce pitching in turbulence, but can cause oscillations. Automatically set and adjusted by AUTOTUNE mode.
// @Range: 0 0.2
// @Increment: 0.01
// @User: User
AP_GROUPINFO("D", 2, AP_PitchController, gains.D, 0.04f),
// @Param: I
// @DisplayName: Integrator Gain
// @Description: This is the gain applied to the integral of pitch angle. It has the same effect as PTCH2SRV_I in the old PID controller and can be set to the same value. Increasing this gain causes the controller to trim out constant offsets between demanded and measured pitch angle.
// @Description: Integrator gain from long-term pitch angle offsets to elevator. Higher values "trim" out offsets faster but can cause oscillations. Automatically set and adjusted by AUTOTUNE mode.
// @Range: 0 0.5
// @Increment: 0.05
// @User: User
@ -58,7 +58,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = { @@ -58,7 +58,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
// @Param: RMAX_UP
// @DisplayName: Pitch up max rate
// @Description: This sets the maximum nose up pitch rate that the controller will demand (degrees/sec). Setting it to zero disables the limit.
// @Description: Maximum pitch up rate that the pitch controller demands (degrees/sec) in ACRO mode.
// @Range: 0 100
// @Units: deg/s
// @Increment: 1
@ -76,7 +76,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = { @@ -76,7 +76,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
// @Param: RLL
// @DisplayName: Roll compensation
// @Description: This is the gain term that is applied to the pitch rate offset calculated as required to keep the nose level during turns. The default value is 1 which will work for all models. Advanced users can use it to correct for height variation in turns. If height is lost initially in turns this can be increased in small increments of 0.05 to compensate. If height is gained initially in turns then it can be decreased.
// @Description: Gain added to pitch to keep aircraft from descending or ascending in turns. Increase in increments of 0.05 to reduce altitude loss. Decrease for altitude gain.
// @Range: 0.7 1.5
// @Increment: 0.05
// @User: User
@ -84,7 +84,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = { @@ -84,7 +84,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
// @Param: IMAX
// @DisplayName: Integrator limit
// @Description: This limits the number of centi-degrees of elevator over which the integrator will operate. At the default setting of 3000 centi-degrees, the integrator will be limited to +- 30 degrees of servo travel. The maximum servo deflection is +- 45 degrees, so the default value represents a 2/3rd of the total control throw which is adequate for most aircraft unless they are severely out of trim or have very limited elevator control effectiveness.
// @Description: Limit of pitch integrator gain in centi-degrees of servo travel. Servos are assumed to have +/- 4500 centi-degrees of travel, so a value of 3000 allows trim of up to 2/3 of servo travel range.
// @Range: 0 4500
// @Increment: 1
// @User: Advanced
@ -92,7 +92,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = { @@ -92,7 +92,7 @@ const AP_Param::GroupInfo AP_PitchController::var_info[] = {
// @Param: FF
// @DisplayName: Feed forward Gain
// @Description: This is the gain from demanded rate to elevator output.
// @Description: Gain from demanded rate to elevator output.
// @Range: 0.1 4.0
// @Increment: 0.1
// @User: User
@ -248,7 +248,7 @@ int32_t AP_PitchController::get_rate_out(float desired_rate, float scaler) @@ -248,7 +248,7 @@ int32_t AP_PitchController::get_rate_out(float desired_rate, float scaler)
/*
get the rate offset in degrees/second needed for pitch in body frame
to maintain height in a coordinated turn.
Also returns the inverted flag and the estimated airspeed in m/s for
use by the rest of the pitch controller
*/
@ -336,4 +336,4 @@ int32_t AP_PitchController::get_servo_out(int32_t angle_err, float scaler, bool @@ -336,4 +336,4 @@ int32_t AP_PitchController::get_servo_out(int32_t angle_err, float scaler, bool
void AP_PitchController::reset_I()
{
_pid_info.I = 0;
}
}
Loading…
Cancel
Save