赞
踩
译文部分:
多旋翼无人机PID调参指南
不用碳化纤维或增强碳化纤维桨调整多轴,不使用损坏的桨片。
出于安全考虑,系统默认增益都设置的比较小。请增加增益以便获取更好的控制响应。
本指导方案适用于所有的多轴飞行器。比例,积分,微分控制(PID)是最广泛的控制技术。对于典型的预估性控制而言,PID控制实质上优于执行性控制技术,比如,线性二次型调节器(Linear Quadratic Regulator) 与线性二次高斯(linear quadratic gaussian),因为这些技术都或多或少的需要系统的精确模型,所以得不到广泛的使用。PX4的目的是在个人电脑上实现设备的尽可能快速的控制,因为不是所有的被控对象的系统模型都是可获得的,因此PID调参是非常有意义的,并且PID控制适用于所有情况。
介绍
PX4采用双闭环PID控制,其外环为角度(angle)控制,角度值是由滤波与姿态解算后得到的欧拉角,有延迟且存在误差,所以单纯的单闭环无法实现姿态控制过程。所以需要引入内环,内环选择角速度(rate)控制,角速度由陀螺仪直接测量得到,误差小,响应快,延迟短。所以,综上,整个控制系统外环选择纯比例控制,没有I,D,所以参数只有三个方向的P;内环选择PID控制器,参数有P,I,D三个量;同时方向控制上还引入了前馈控制,所以还有一个参数为MC_YAW_FF
file:///C:\Users\ADMINI~1\AppData\Local\Temp\ksohtml\wps4638.tmp.jpg
PX4地面站外环执行的飞行器角度控制 ,依靠的参数有:
Roll control (MC_ROLL_P)
Pitch control (MC_PITCH_P)
Yaw control (MC_YAW_P)
内环使用三个独立的PID控制器实现飞行器姿态控制:
Roll rate control (MC_ROLLRATE_P, MC_ROLLRATE_I, MC_ROLLRATE_D)
Pitch rate control (MC_PITCHRATE_P, MC_PITCHRATE_I, MC_PITCHRATE_D)
Yaw rate control (MC_YAWRATE_P, MC_YAWRATE_I, MC_YAWRATE_D)
外环输出以机身期望姿态比例为准(如果机身期望姿态为水平状态但是当前横滚方向有三十度的倾角,那么此时控制器将以每次60度输出)。内环速率控制改变电机转速以便飞行器以期望角速率旋转。
实质上增益具有直观的物理意义,比如,如果参数MC_ROLL_P增益为6,那么飞行器将以3弧度(170度)补偿0.5弧度(30度)的偏差。如果内环MC_ROLLRATE_P增益为0.1,那么内环输出为3乘0.1=0.3(外环输出输入给内环,进过PID控制后输出,若只有P=0.1,输入3,那么输出0.3)这意味着飞行器将降低一侧电机的转速,增加另一侧电机的转速使其恢复水平状态。
同样的,对于MC_YAW_FF参数,用于控制多大的用户输入用于前馈补偿给偏航速率控制器。0意味着非常慢的控制。控制器只能在检测到偏航位置误差时才开始修正。1意味着快速的响应,但是有超调,控制将执行的非常快速,误差总是保持在0附近。
电机幅值限制
正如上面的例子所展示的,在某些情况下会出现某种可能使得电机得到一个比其上限还要大的输入或者一个比0还要小的输入。如果这种情况发生,电机违背控制模型产生的升力可能会使飞行器翻筋斗。为了防止这种情况发生,PX4中加入了油门限幅。如果其中一个电机的转速偏离安全范围,系统总体推力将被变低以便控制器输出的相关比率达到一个期望值。其结果会是电机转速不会增加甚至降低,但是永远不会翻。
第一步 准备
首先设置所有参数到初始值。
1 设置所有的MC_XXX_P到0(roll,pitch,yaw)
2 除了MC_ROLLRATE_P与MC_PITCHRATE_P之外的所有MC_XXXRATE_P,I,D归零。
3 设置MC_ROLLRATE_P与MC_PITCHRATE_P到一个很小的值,比如0.02
4 设置MC_YAW_FF到0.5
所有参数缓慢增加,每次增加约百分之20到30,在最后调试时甚至可以降低到百分之10,。
注意:过大的增益(甚至仅仅比理想值多1.5到2倍)都可能导致大的抖动。
第二步 稳定俯仰和翻滚速率
P增益调节
参数:MC_ROLLRATE_P, MC_PITCHRATE_P
如果飞行器结构对称,那么ROLL与PITCH的概念应该等价,如果不对称,则应该分开讨论。
把飞行器拿在手中,中油门上下,到刚好平衡重力。向俯仰或翻滚方向上稍做倾斜,观察反应。(我不明白这个是怎么实现的,用手托着吧,飞行器平稳时升力最大,不会飞起来,那么有偏角了升力减小,更不会飞起来。但是这也太危险了吧,建议用细绳拉住两颗电机,不要用手)飞行器应该温和的抵抗倾斜过程,但保持倾斜角之后不会尝试恢复水平姿态。如果出现震荡,降低P。如果反应正确但非常慢,调大P直到开始出现抖动。重新调回P到稍稍有一点抖动甚至不再抖动(大概回调百分之十),到稍稍超调,典型值一般为0.1。
D增益调节
参数:MC_ROLLRATE_D, MC_PITCHRATE_D
如果参数处于某一值时,飞行器稍微抖动并且P值已经适量的减少。从0.01开始缓慢增加RATE_D直到消除最后一点震荡。如果此时飞行器又一次出现抖动,那就是D值过大。(一定会出现由抖动到平稳的过程,D值再大才会再次抖动,所以调参是不能着急,一点点增加,不然可能错过理想值)一般通过调节P与D就可以得到比较良好的电机响应。RATE_D的典型值一般在0.01–0.02
在QGoundControl可以锁定pitch与roll的速率。一定不能出现震荡,但是百分之十到二十的超调是允许的。
I增益调节
如果飞行器可以实现定点但是定点的位置与期望存在误差,那么增加MC_ROLLRATE_I 和MC_PITCHRATE_I(上面一句的翻译是个人想法,原句是never reach the setpoint but have an offset。我觉得它的意思是实现了悬停,但是此时的点不是想要的点,所以说,按照个人想法,I值并没有什么用处,我不会在乎悬停之后的误差)以增益MC_ROLLRATE_P的值得百分之五到百分之十开始向上增加。
第三步 稳定翻滚与俯仰角度
参数 MC_RATE_P, MC_RATE_P
把飞行器拿在手中,中油门上下,到刚好平衡重力。向俯仰或翻滚方向上稍做倾斜,观察反应。飞行器应该缓慢回到水平。如果出现抖动,减小P。如果反应正确但非常慢,调大P直到开始出现抖动。最佳的反应应该是超调10%–20%后得到良好的响应。
在QGoundControl可以锁定pitch与roll。姿态角度超调不要超过10%–20%.
第四步 稳定航向速率
P增益调节
参数:MC_YAWRATE_P
设置很小的MC_YAWRATE_P,比如0.1。
把飞行器拿在手中,中油门上下,到刚好平衡重力。转动飞行器方向轴,观察反应。电机声音应该发生改变,飞行器应该阻碍方向变化。但是这个响应应该弱于俯仰与横滚方向,这是正常现象。如果飞行器出现抖动,减小MC_YAWRATE_P。如果响应非常剧烈甚至在小幅转动(full throttle spinning vs idle spinning propellers不懂这句什么意思),减小P。典型值大概为0.2–0.3。(四轴因为其结构,导致航向上的不灵敏,yaw-p要小于pitch与roll)
在航向的速率控制中,如果响应非常强烈或出现震荡,会影响俯仰和横滚方向的响应。统筹调节pitch,roll,yaw达到平衡。
第五步 稳定航向角
把飞行器拿在手中,中油门上下,到刚好平衡重力。转动飞行器方向轴,观察反应。飞行器应该缓慢的回到初始方向。如果飞行器出现抖动,减小P。当响应正确但速度慢,增加P直到反应达到稳定,但不要出现震荡。典型值大概为2–3。
在QGoundControl观察ATTITUDE.yaw。超调不应该超过2%–5%.小于pitch与
Roll。(个人认为,航向上不用太较真啦,不影响另外两个就好)
前馈补偿调节
参数 MC_YAW_FF
这个参数不太重要,并且可以在飞行过程中调节。但是不理想的参数会使响应变慢或过快。应该调节MC_YAW_FF使飞行器得到良好的响应过程。其有效范围0–1,典型值大概为0.8–0.9。(有时为了航拍效果考虑,可以再改小MC_YAW_FF,以便得到平滑的响应过程)
在QGoundControl观察ATTITUDE.yaw。超调不应该超过2%–5%.小于pitch与
Roll。
外文部分:
Multirotor PID Tuning Guide
NEVER do multirotor tuning with carbon fiber or carbon fiber reinforced blades. NEVER use damaged blades.
For SAFETY reason, the default gains are set to small value. You HAVE TO increase the gains before you can expect any control responses.
This tutorial is valid for all multi rotor setups (AR.Drone, PWM Quads / Hexa / Octo setups). Proportional, Integral, Derivative controllers are the most widespread control technique. There are substantially better performing control techniques (LQR/LQG) from the model predictive control, since these techniques require a more or less accurate model of the system, they not as widely used. The goal of all PX4 control infrastructure is move as soon as possible on MPC, since not for all supported systems models are available, PID tuning is very relevant (and PID control sufficient for many cases).
Introduction
The PX4 multirotor_att_control app executes an outer loop of orientation controller, controlled by parameters:
Roll control (MC_ROLL_P)
Pitch control (MC_PITCH_P)
Yaw control (MC_YAW_P)
And an inner loop with three independent PID controllers to control the attitude rates:
Roll rate control (MC_ROLLRATE_P, MC_ROLLRATE_I, MC_ROLLRATE_D)
Pitch rate control (MC_PITCHRATE_P, MC_PITCHRATE_I, MC_PITCHRATE_D)
Yaw rate control (MC_YAWRATE_P, MC_YAWRATE_I, MC_YAWRATE_D)
The outer loop’s output are desired body rates (e.g. if the multirotor should be level but currently has 30 degrees roll, the control output will be e.g. a rotation speed of 60 degrees per second). The inner rate control loop changes the rotor motor outputs so that the copter rotates with the desired angular speed.
The gains actually have an intuitive meaning, e.g.: if the MC_ROLL_P gain is 6.0, the copter will try to compensate 0.5 radian offset in attitude (~30 degrees) with 6 times the angular speed, i.e. 3 radians/s or ~170 degrees/s. Then if gain for the inner loop MC_ROLLRATE_P is 0.1 then thrust control output for roll will be 3 * 0.1 = 0.3. This means that it will lower the speed of rotors on one side by 30% and increase the speed on the other one to induce angular momentum in order to go back to level.
There is also MC_YAW_FF parameter that controls how much of user input need to feed forward to yaw rate controller. 0 means very slow control, controller will start to move yaw only when sees yaw position error, 1 means very responsive control, but with some overshot, controller will move yaw immediately, always keeping yaw error near zero.
Motor Band / Limiting
As the above example illustrates, under certain conditions it would be possible that one motor gets an input higher than its maximum speed and another gets an input lower than zero. If this happens, the forces created by the motors violate the control model and the multi rotor will likely flip. To prevent this, the multi rotor mixers on PX4 include a band-limit. If one of the rotors leaves this safety band, the total thrust of the system is lowered so that the relative percentage that the controller did output can be satisfied. As a result the multi rotor might not climb or loose altitude a bit, but it will never flip over. The same for lower side, even if commanded roll is large, it will be scaled to not exceed commanded summary thrust and copter will not flip on takeoff at near-zero thrust.
Step 1: Preparation
First of all set all parameters to initial values:
Set all MC_XXX_P to zero (ROLL, PITCH, YAW)
Set all MC_XXXRATE_P, MC_XXXRATE_I, MC_XXXRATE_D to zero, except MC_ROLLRATE_P and MC_PITCHRATE_P
Set MC_ROLLRATE_P and MC_PITCHRATE_P to a small value, e.g. 0.02
Set MC_YAW_FF to 0.5
All gains should be increased very slowly, by 20%-30% per iteration, and even 10% for final fine tuning. Note, that too large gain (even only 1.5-2 times more than optimal!) may cause very dangerous oscillations!
Step 2: Stabilize Roll and Pitch Rates
P Gain Tuning
Parameters: MC_ROLLRATE_P, MC_PITCHRATE_P.
If copter is symmetrical, then values for ROLL and PITCH should be equal, if not - then tune it separately.
Keep the multi rotor in your hand and increase the thrust to about 50%, so that the weight is virtually zero. Tilt it in roll or pitch direction, and observe the response. It should mildly fight the motion, but it will NOT try to go back to level. If it oscillates, tune down RATE_P. Once the control response is slow but correct, increase RATE_P until it starts to oscillate. Cut back RATE_P until it does only mildly oscillate or not oscillate any more (about 10% cutback), just over-shoots. Typical value is around 0.1.
D Gain Tuning
Parameters: MC_ROLLRATE_D, MC_PITCHRATE_D.
Assuming the gains are in a state where the multi rotor oscillated and RATE_P was slightly reduced. Slowly increase RATE_D, starting from 0.01. Increase RATE_D to stop the last bit of oscillation. If the motors become twitchy, the RATE_D is too large, cut it back. By playing with the magnitudes of RATE_P and RATE_D the response can be fine-tuned. Typical value is around 0.01…0.02.
In QGroundControl you can plot roll and pitch rates (ATTITUDE.rollspeed/pitchspeed). It must not oscillate, but some overshot (10-20%) is ok.
I Gain Tuning
If the roll and pitch rates never reach the setpoint but have an offset, add MC_ROLLRATE_I and MC_PITCHRATE_I gains, starting at 5-10% of the MC_ROLLRATE_P gain value.
Step 3: Stabilize Roll and Pitch Angles
P Gain Tuning
Parameters: MC_RATE_P, MC_RATE_P.
Set MC_ROLL_P and MC_PITCH_P to a small value, e.g. 3
Keep the multi rotor in your hand and increase the thrust to about 50%, so that the weight is virtually zero. Tilt it in roll or pitch direction, and observe the response. It should go slowly back to level. If it oscillates, tune down P. Once the control response is slow but correct, increase P until it starts to oscillate. Optimal responce is some overshot (~10-20%). After getting stable respone fine tune RATE_P, RATE_D again.
In QGroundControl you can plot roll and pitch (ATTITUDE.roll/pitch) and control (ctrl0, ctrl1). Attitude angles overshot should be not more than 10-20%.
Step 4: Stabilize Yaw Rate
P Gain Tuning
Parameters: MC_YAWRATE_P.
Set MC_YAWRATE_P to small value, e.g. 0.1
Keep the multi rotor in your hand and increase the thrust to about 50%, so that the weight is virtually zero. Turn it around its yaw axis, observe the response. The motor sound should change and the system should fight the yaw rotation. The response will be substantially weaker than roll and pitch, which is fine. If it oscillates or becomes twitchy, tune down RATE_P. If responce is very large even on small movements (full throttle spinning vs idle spinning propellers) reduce RATE_P. Typical value is around 0.2…0.3.
The yaw rate control, if very strong or oscillating, can deteriorate the roll and pitch response. Check the total response by turning around, roll, pitch and yaw.
Step 5: Stabilize Yaw Angle
P Gain Tuning
Parameters: MC_YAW_P.
Set MC_YAW_P to a low value, e.g. 1
Keep the multi rotor in your hand and increase the thrust to about 50%, so that the weight is virtually zero. Rotate it around yaw, and observe the response. It should go slowly back to the initial heading. If it oscillates, tune down P. Once the control response is slow but correct, increase P until the response is firm, but it does not oscillate. Typical value is around 2…3.
Look at ATTITUDE.yaw in QGroundControl. Yaw overshot should be not more than 2-5% (less than for attitude).
Feed Forward Tuning
Parameters: MC_YAW_FF.
This parameter is not critical and can be tuned in flight, in worst case yaw responce will be sluggish or too fast. Play with FF parameter to get comfortable responce. Valid range is 0…1. Typical value is 0.8…0.9. (For aerial video optimal value may be much smaller to get smooth responce.)
Look at ATTITUDE.yaw in QGroundControl. Yaw overshot should be not more than 2-5% (less than for attitude).
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。