Tricopter yaws incorrectly in Altitude mode

Tricopter yaws right when I steer left and right when I steer right…

I took my tricopter out for a flight recently and while it flew perfectly well in manual mode, I got very weird results whenever it was in Altitude mode. I wonder if anyone can give any advice? Here’s the log:

https://review.px4.io/plot_app?log=80db0303-0ef7-4ae3-b63e-0473cfdf6083

The problem is most visible on the Yaw Angle graph, where yaw FF setpoint seems to track the yaw stick (visible in Manual Control Inputs graph).

The problem first appears at 5:14. I push the yaw stick gently to the left, the tricopter yaws to the right. Confused, I push it little more to the left, it yaws more to the right. At 5:18 I push the stick right, wondering if the controls are reversed. It yaws even more to the right. Now it’s facing almost opposite where I want it, so at 5:21 I push the yaw stick hard right to complete the 360 and get it facing the right way.

You can see it again at around 6:10, this time I make it yaw both ways, but only by pushing the stick left both times.

My guess is than it seems to be interpreting the yaw stick as a direction, rather than a rate of change of direction, but also ignoring it whenever it’s centred. Not sure why this would be the case though. Any help welcome!

I’m trying to solve this problem and have made some discoveries looking through the log linked above. Still looking for the right solution, but I’ve learned the following is true for both flight modes.

  • The tail rotor servo PWM is permanently offset from neutral position by about 140us during stable flight. There must caused by some asymmetry in the aircraft, but understanding the software better is my primary goal here, so I’m not concentrating on mechanical solutions at present.
  • In the Yaw Angle chart, ‘Yaw estimated’ is a steady 30 degrees or so higher than the ‘Yaw setpoint’ in stable hover.
  • In the Yaw Angular Rate chart, ‘Yaw rate setpoint’ stays around -80 deg/s in stable hover.

The problem described in my post above seems come from these underlying issues. Basically the FC is applying a lot of left yaw just to stay stable, so a small control input to the right or left turns off yaw stabilisation temporarily and the aircraft yaws right because the setpoint is no longer way over to the left.

But my question is, what is ‘Yaw rate setpoint’ if not a target yaw rate? If the yaw rate setpoint is -80 deg/s for most of the flight, why is the aircraft not attempting to spin at -80 deg/s second for most of the flight?

Would it be better understood as ‘offset from what the yaw would be doing if the tail rotor were neutral’? If so, controlling it around a centrepoint of zero with stick inputs isn’t helpful if zero doesn’t mean zero yaw.