Problem with setting attitude of fixed-wing aircraft

Dear all,

I am trying to control aircraft via the mouse. So, when I point to some point on the screen, aircraft will be commanded toward that point. I can calculate pitch and yaw angles towards that point correctly. I am sure about that. After calculating pitch and yaw angles I am commanding it to PX4 in offboard mode via drone.offboard.set_attitude command. roll angle is calculated based on yaw angle, namely roll=tan(yaw) Below you can see the partial code:

pitch = get_pitch()
yaw = get_yaw()
roll = tan(yaw)
await cls.drone.offboard.set_attitude(Attitude(roll, pitch, yaw, thrust))

Now the problem is that, yaw angle can be tracked very good. It is very sensitive to the yaw angle. However, in terms of pitch angle, it doesn’t track it correctly. Namely, I have to give more pitch than desired in order to make the aircraft to be directed towards that. It is heading towards the pitch correctly, namely if I raise my pointer, aircraft will raise its nose also, if I down my pointer, aircraft will do also, but not exactly. It does it smaller angle than my commanded angle. May I know why? Is it because there is some kind of dynamics in aircraft that I don’t take into account? If there is, isn’t it automatically adjusted by PX4? Or is it because of thrust variable? If it is, how can I adjust it? Thank you very much for your time and patience.

What about using position or velocity setpoints instead of attitude to make it easier?