Toiletbowling during takeoff after MAV_CMD_NAV_TAKEOFF

I have a small octocopter running px4 1.17.0 on a pixhawk 6c. Lately, i have swapped the standard HG-C05 GNSS module for an Here4, so I can use RTK.

When I start it by hand in position mode, it usually starts fine, but when I autonomously start it with a MAV_CMD_NAV_TAKEOFF from a companion computer, the start is really messy. Instead of flying straight upwards, it flies a toiletbowling-pattern and it’s yaw drifts up to 45°. When the takeoff height is reached, this scary presentation is usually over and the rest of the mission continues without issues.

I unfortunately don’t have a video, but the following graph outlines the problem:

It plots the position setpoints against the actual position, as well as the actual yaw. During takeoff (the blue z position line drops), you can see that the setpoints remain calm, but the actual positions are swinging around them by more than one meter. Also, the heading starts a sinusiodal oscillation, that quickly reduces. You can find the whole log under https://review.px4.io/plot_app?log=99a1a96f-36c1-48d2-8861-5decbbb87304

So far, i tried setting EKF2_MAG_TYPE to 1 (recommendation from a certain AI) and giving it 10 seconds more waiting time after acquiring a home position and before arming.

Does anybody else have any more ideas?