# Dangerous pitch oscillation at high speed

**URL:** <https://discuss.px4.io/t/dangerous-pitch-oscillation-at-high-speed/9321>\
**Category:** Flight Testing & Log Analysis\
**Created:** [January 23, 2019, 3:55pm UTC](https://discuss.px4.io/t/dangerous-pitch-oscillation-at-high-speed/9321 "2019-01-23T15:55:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DrProton](https://discuss.px4.io/user_avatar/discuss.px4.io/drproton/32/5344_2.png) [@DrProton](https://discuss.px4.io/u/DrProton)\
**Post date:** [January 23, 2019, 3:55pm UTC](https://discuss.px4.io/t/dangerous-pitch-oscillation-at-high-speed/9321/1 "2019-01-23T15:55:34Z")

</div>

I was doing some high speed testing yesterday on a custom “H” quad. There were several instances where at high speed (\>20m/s) a violent oscillation on pitch occurred. Initially I suspected a tuning problem and so tried to crank up the pitch gains, but this did not offer any improvement. After reviewing the log files I can see that the oscillation is in fact being induced by the control system.

check out the pitch chart in this log at times 5:48-5:52, 7:24-7:29, 10:50-10:55, 13:21-13:24

[https://logs.px4.io/plot\_app?log=f40dd08c-49ef-4086-8d9f-4718b3562359](https://logs.px4.io/plot_app?log=f40dd08c-49ef-4086-8d9f-4718b3562359)

It seems that the controller is commanding oscillating pitch values when throttle = 100%. While it does make sense to back off on pitch at high throttle values, the oscillation it creates is frightening. I suppose it is possible that phase delay on the pitch response of my platform is to blame, but that the fact the the pitch controller is allowing this oscillation to get set up is disturbing.

Is there a way to fix this problem or is it simply a matter of I need to ease back on the speed?

Similar problem occurs in this log at times 12:45-12:52,

[https://review.px4.io/plot\_app?log=2c6808e7-765d-4c0b-9984-09a96a046435](https://review.px4.io/plot_app?log=2c6808e7-765d-4c0b-9984-09a96a046435)

---

<div class="post-metadata">

**Author:** ![QuadCatpter](https://discuss.px4.io/letter_avatar_proxy/v4/letter/q/8797f3/32.png) [@QuadCatpter](https://discuss.px4.io/u/QuadCatpter)\
**Post date:** [January 26, 2019, 12:41am UTC](https://discuss.px4.io/t/dangerous-pitch-oscillation-at-high-speed/9321/2 "2019-01-26T00:41:02Z")

</div>

My guess is your MPC\_PITCH\_P is tuned to high. Your pitch rate or MPC\_Pitchrate\_P tracking is doing okay and doing what the angle setpoint is telling it to do. Your Pitch angle is leading the instability so start by lowering MPC\_Pitch\_P.

Capping your pitch angle with MPC\_TILTMAX\_AIR to 20 deg could also help put a bandage over the problem but wont solve the root cause.

---

<div class="post-metadata">

**Author:** ![DrProton](https://discuss.px4.io/user_avatar/discuss.px4.io/drproton/32/5344_2.png) [@DrProton](https://discuss.px4.io/u/DrProton)\
**Post date:** [January 28, 2019, 1:37pm UTC](https://discuss.px4.io/t/dangerous-pitch-oscillation-at-high-speed/9321/3 "2019-01-28T13:37:45Z")

</div>

In the course of testing this problem I tried several different pitch tunings and none of them made any real difference. Pitch angle changes are being commanded by the control system and the pitch controller is attempting to follow them. I suspect if I could reduce the phase delay on the pitch axis all would be well. I think the problem is here, from around line 280 in PositionControl.cpp:

` float thrust\_max\_NE\_tilt = fabsf(\_thr\_sp(2)) \* tanf(\_constraints.tilt);  
float thrust\_max\_NE = sqrtf(MPC\_THR\_MAX.get() \* MPC\_THR\_MAX.get() - \_thr\_sp(2) \* \_thr\_sp(2));  
thrust\_max\_NE = math::min(thrust\_max\_NE\_tilt, thrust\_max\_NE);

```
	// Saturate thrust in NE-direction.
	_thr_sp(0) = thrust_desired_NE(0);
	_thr_sp(1) = thrust_desired_NE(1);

	if (thrust_desired_NE * thrust_desired_NE > thrust_max_NE * thrust_max_NE) {
		float mag = thrust_desired_NE.length();
		_thr_sp(0) = thrust_desired_NE(0) / mag * thrust_max_NE;
		_thr_sp(1) = thrust_desired_NE(1) / mag * thrust_max_NE;
	}`

```

This limits the maximum lateral thrust to whatever is “left over” after throttle control takes what it needs. Trouble is there is no rate limiting here so very high bandwidth changes are possible. In my opinion \_vel\_sp (further up) should be slowly reduced to mitigate this problem. All that being said, limiting MPC\_TILTMAX\_AIR will at least be a bandaid for now.
