2016年4月12日 星期二

apm PID reference


Basic tuning:

Ref : http://ardupilot.org/copter/docs/basic-tuning.html


Roll Control Tuning

Method 1

This method is the simplest, but won’t give the best result. For those users familiar with tuning the old PID controllers, the RLL2SRV_PRLL2SRV_I and RLL2SRV_D gains have the same effect, but there are some additional values that can be set by more advanced users.
  1. With the model in FBW-A mode, put in a rapid bank angle demand by pushing the aileron stick all the way over, hold it for a couple of seconds and then release. Do the same in the other direction. You want the model to roll quickly and smoothly to the new bank angle and back again without overshoot or any wing ‘rocking’. If the roll response is too slow, then progressively increase RLL2SRV_P in increments of 0.1 until you are happy with the response.
  2. If you get bank angle oscillation or overshoot, then you need to reduce RLL2SRV_P. If at this point you still don’t have sufficient response then you need to follow Method 2.
  3. Once you are happy with the roll response you should now slowly increase the RLL2SRV_I to give the controller some “I gain” to allow it to cope better with wind. A value of 0.05 will work for most models. If you see overshoot or oscillation when raising the I value then halve it.

Method 2

This method will give a better result, but requires more caution because step 2 can produce a high frequency instability that can overheat the aileron servo(s) if allowed to continue.
  1. With the model in FBW-A mode, put in a rapid bank angle demand, hold it and release. Do the same in the other direction. You want the model to roll quickly and smoothly to the new bank angle and back again without overshoot or any wing ‘waggle’. If the roll response is too slow, then progressively increase the RLL2SRV_P gain in increments of 0.1 until you are happy with the response or you start to get oscillation in bank angle or overshoot
  2. Increase RLL2SRV_D in increments of 0.01 until it it starts to oscillate, then halve it. Do not go above 0.1 for RLL2SRV_D without checking the temperature of your servos when you land as in extreme cases turning up this gain can cause rapid servo movement and overheat the servos leading to premature failure.
  3. Now start to increase the integrator gain RLL2SRV_I in steps of 0.05 from its default value of zero until the bank angle starts to overshoot or oscillate, then halve it.

Tuning tips

  • Select the tuning box on the bottom of the Mission Planners Flight Data page. You should get a scrolling black window above the map. Double click in the black window and you should get a list of parameters to plot. Change the selection until you have the roll and nav_roll plotted. Nav_roll is the demand and roll is the response. You can use this to look for overshoot and other behaviour that isn’t so obvious from the ground looking at the model.
  • Check for any steady offset between nav_roll and roll. If you have followed the basic method you may see an offset which can be removed by setting RLL2SRV_I to a small value (say 0.01) which will allow the control loop to slowly trim the aileron demand to remove the steady error.
  • Although the autopilot will prevent the integrator from increasing if the maximum aileron is exceeded, there is additional protection provided by the RLL2SRV_IMAX parameter. This parameter sets the maximum amount of aileron (in centi-degrees) that the integrator can control. The default value of 1500 allows the integrator to trim up to 1/3 of the total aileron travel. This parameter should not need to be changed unless you are trying to tune the controller to be able to compensate for large roll offsets due to system failures.
  • The maximum roll rate can be constrained to make the model bank more smoothly by setting the roll rate limit RLL2SRV_RMAX parameter to a non-zero value. The default value of 60 deg/sec works well for most models. Setting this parameter to 0 turns the rate limiter off and can make the effect of tuning changes easier to see. If this value is reduced too far, then the roll controller is unable to keep up with demands from the navigation controller which leads to overshoot and weaving in the aircraft’s trajectory.
  • The time constant parameter RLL2SRV_T_CONST can also be used to adjust how rapidly the bank angle reaches the demanded value. The effect of this parameter will be seen mostly in the response to small step changes in demanded roll. For larger roll demands, the roll rate limitRLL2SRV_I tends to mask its effect. Making this parameter smaller will cause the aircraft to reach its demanded roll angle in less time, but only if the aircraft is capable. A very slow responding airframe may require a slightly larger setting for this parameter.
  • Plot the roll_speed in the tuning window. This shows the rate of roll in radians/second. A value of 1 radian/second is approximately equal to 60 degrees/second (57 to be more precise), so if you have RLL2SRV_RMAX set to 60, the maximum roll_speed when responding to a large bank angle demand (eg full bank one way to full bank the other) should be just above 1.0. A value of greater than 1.1 indicates that RLL2SRV_P is too high and should be reduced, whereas a value of less than 1 indicates that RLL2SRV_P should be increased.

Pitch Control Tuning

Method 1

This method is the simplest and but won’t give the best result. For those users familiar with tuning the old PID controller gains, the K_P, K_I and K_D gains in this controller have the same effect, but there are some additional values that can be set by more advanced users.
  1. With the model in FBW-A mode, put in a rapid pitch angle demand, hold it and release. Do the same in the other direction. You want the model to pitch quickly and smoothly to the new pitch angle and back again without overshoot or any porpoising. If the pitch response is too slow, then progressively increase PTCH2SRV_P in increments of 0.1 until you are happy with the response.
  2. If you get pitch angle oscillation or overshoot, then you need to reduce PTCH2SRV_P. If at this point you still don’t have sufficient response then you need to check your radio calibration, the minimum and maximum pitch angles and potentially follow Method 2.
  3. Now roll the model to maximum bank in each direction. The nose should stay fairly level during the turns without significant gain or loss of altitude. Some loss of altitude during sustained turns at constant throttle is expected, because the extra drag of turning slows the model down which will cause a mild descent. If the model gains height during the turns then you need to reduce the PTCH2SRV_RLL by small increments of 0.05 from the default value of 1.0. If the model descends immediately when the model banks (a mild descent later in the turn when the model slows down is normal as explained earlier) then increase the PTCH2SRV_RLL by small increments of 0.01 from the default value of 1.0. If you need to change the PTCH2SRV_RLL parameter outside the range from 0.7 to 1.4 then something is likely wrong with either the earlier tuning of your pitch loop, your airspeed calibration or you APM’s bank angle estimate.

Method 2

This method can give a better result, but requires more caution because step 2) can produce a high frequency instability that unless reversion back to manual is done quickly, could overstress the plane.
  1. Perform the tuning steps from Method 1
  2. Increase PTCH2SRV_D in increments of 0.01 until it it starts to oscillate, then halve it. Do not go above 0.1 for PTCH2SRV_D without checking the temperature of your servos when you land as in extreme cases turning up this gain can cause rapid servo movement and overheat the servos leading to premature failure.
  3. Now start to increase the integrator gain PTCH2SRV_I in steps of 0.05 from its default value of zero until the pitch angle starts to overshoot or oscillate, then halve it.

Tuning tips

  • Select the tuning box on the bottom of the Mission Planners Flight Data page. You should get a scrolling black window above the map. Double click in the black window and you should get a list of parameters to plot. Change the selection until you have the pitch and nav_pitch plotted. Nav_pitch is the demand and pitch is the response. You can use this to look for overshoot and other behaviour that isn’t so obvious from the ground looking at the model.
  • Check for any steady offset between nav_pitch-roll and pitch. If you have followed the basic method you may see an offset which can be removed by setting PTCH2SRV_I to a small value (say 0.05) which will allow the control loop to slowly trim the elevator demand to remove the steady error. The value of PTCH2SRV_I can be increased in small increments of 0.05 until you are satisfied with the speed at which the control loop ‘re-trims’.
  • Although the autopilot will prevent the integrator from increasing if the maximum elevator is exceeded, there is additional protection provided by the PTCH2SRV_IMAX parameter. This parameter sets the maximum amount of elevator(in centi-degrees) that the integrator can control. The default value of 1500 allows the integrator to trim up to 1/3 of the total elevator travel. This should be enough to allow for the trim offset and variation in trim with speed for most models.
  • WARNING : If PTCH2SRV_IMAX is set too high, then there is a danger that in FBW-A, if the model has been levelled so that zero pitch is too nose-up to glide at a safe speed, that the integrator will continue to keep increasing the elevator to maintain the demanded pitch angle until the model stalls. PTCH2SRV_IMAX should be set to a value that is big enough to allow from trim changes, but small enough so that it cannot stall the plane.
  • The rate of pitch (and therefore the reduce the number of g’s) used to correct pitch angle errors can be limited setting the pitch rate limit PTCH2SRV_RMAX_DN and PTCH2SRV_RMAX_UP parameters to non-zero values. Setting these values to 560 divided by the airspeed (in metres/second) gives a limit equivalent to approximately +- 1g.
  • The time constant parameter PTCH2SRV_T_CONST can also be used to adjust how rapidly the pitch angle reaches the demanded value. The effect of this parameter will be seen mostly in the response to small step changes in demanded pitch. For larger pitch demands, the pitch rate limitsPTCH2SRV_RMAX_DN and PTCH2SRV_RMAX_UP tend to mask its effect. Making this parameter smaller will cause the aircraft to reach its demanded pitch angle in less time, but only if the aircraft is capable. A very slow responding airframe may require a slightly larger setting for this parameter.
  • Plot the pitch_speed in the tuning window. This shows the rate of pitch in radians/second. A value of 1 radian/second is approximately equal to 60 degrees/second (57 to be more precise), so if for example you had PTCH2SRV_RMAX_DN/UP set to 30, the maximum pitch_speed when responding to a large pitch angle demand (eg full pitch one way to full pitch the other way) should be just above 0.5. A value of greater than 0.6 would indicate that PTCH2SRV_P is too high and should be reduced, whereas a value of less than 0.5 would indicate that RLL2SRV_P should be increased.



  • ANGLE_MAX controls the maximum lean angle which by default is 4500 (i.e. 45 degrees)
  • ANGLE_RATE_MAX controls the maximum requested rotation rate in the roll and pitch aixs which by default is 18000 (180deg/sec).

  • ACRO_YAW_P controls how quickly copter rotates based on a pilot’s yaw input. The default of 4.5 commands a 200 deg/sec rate of rotation when the yaw stick is held fully left or right. Higher values will make it rotate more quickly.
  • Stabilize Roll/Pitch P controls the responsiveness of the copter’s roll and pitch to pilot input and errors between the desired and actual roll and pitch angles. The default of 4.5 will command a 4.5deg/sec rotation rate for each 1 degree of error in the angle. A higher gain such as 7 or 8 will allow you to have a more responsive copter and resist wind gusts more quickly.
    • A low stabilize P will cause the copter to rotate very slowly and may cause the copter to feel unresponsive and could cause a crash if the wind disturbs it. Try lowering the RC_Feel parameter before lowering Stability P if smoother flight is desired.
  • Rate Roll/Pitch P, I and D terms control the output to the motors based on the desired rotation rate from the upper Stabilize (i.e. angular) controller. These terms are generally related to the power-to-weight ratio of the copter with more powerful copters requiring lower rate PID values. For example a copter with high thrust might have Rate Roll/Pitch P number of 0.08 while a lower thrust copter might use 0.18 or even higher.
    • Rate Roll/Pitch P is the single most important value to tune correctly for your copter.
    • The higher the P the higher the motor response to achieve the desired turn rate.
    • Default is P = 0.15 for standard Copter.
    • Rate Roll/Pitch I is used to compensate for outside forces that would make your copter not maintain the desired rate for a longer period of time
    • A high I term will ramp quickly to hold the desired rate, and will ramp down quickly to avoid overshoot.
    • Rate Roll/Pitch D is used to dampen the response of the copter to accelerations toward the desired set point.
    • A high D can cause very unusual vibrations and a “memory” effect where the controls feel like they are slow or unresponsive. A properly mounted controller should allow a Rate D value of .011.
    • Values as low as 0.001 and as high as .02 have all been used depending upon the vehicle.

Ref : http://ardupilot.org/copter/docs/stabilize-mode.html#stabilize-mode-tuning



============================================================

FBWA Mode (FLY BY WIRE_A)

This is the most popular mode for assisted flying in Plane, and is the best mode for inexperienced flyers. In this mode Plane will hold the roll and pitch specified by the control sticks. So if you hold the aileron stick hard right then the plane will hold it’s pitch level and will bank right by the angle specified in the LIM_ROLL_CD option (in centidegrees). It is not possible to roll the plane past the roll limit specified in LIM_ROLL_CD, and it is not possible to pitch the plane beyond theLIM_PITCH_MAX/LIM_PITCH_MINsettings.
Note that holding level pitch does not mean the plane will hold altitude. How much altitude a plane gains or loses at a particular pitch depends on its airspeed, which is primarily controlled by throttle. So to gain altitude you should raise the throttle, and to lose altitude you should lower the throttle. If you want Plane to take care of holding altitude then you should look at the FlyByWireB mode.
In FBWA mode throttle is manually controlled, but is constrained by the THR_MIN and THR_MAXsettings.
In FBWA mode the rudder is under both manual control, plus whatever rudder mixing for roll you have configured. Thus you can use the rudder for ground steering, and still have it used for automatically coordinating turns.

沒有留言:

張貼留言