Yaw setpoint keeps jumping from 180 to -180

#1

We are using a Pixhawk Cube unit with no external GPS or magnetometer, we only have a TFMini connected on the TELEM2 port. The PX4 Software version is v1.9.0 (RC). We were testing the yawing behaviour of the quadcopter by holding it in the hands and giving yaw input using a transmitter. The flight log is here: https://logs.px4.io/plot_app?log=70c4582e-3f91-472e-9e8b-4ba039184943.

We observed that the yaw setpoint is going beyond 180 degrees and carrying over from -180 degrees frequently, when a yaw input is set to maximum in one direction. Here is a picture of this behaviour:

This causes the yaw rate setpoint to wildly switch from high positive values to high negative values, as seen here:

This also happens for relatively small yaw inputs. What could be the reason behind this? And what can be done to fix this?

#2

A hand test is not really going to give you a realistic test result. Also make sure to understand the difference between yaw and yaw rate - the yaw setpoint is not crossing 180 degrees, but the yaw rate of course does, as a rate doesn’t wrap.

In summary: The test you did will not yield useful results. You would need to let the system fly for yaw and yaw rate controllers to show nominal behaviour.