Ducted quad copter YAW problem

I am building a ducted quadcopter.
The frame is shendrone insider
http://www.shendrones.com/insider

But tuning is difficult. YAW slips during flight. In the worst case the fuselage will rotate 180 degrees.

It works well when flying with the ducts removed.

Attached are the logs with_duct and without_ducts.
Both are flying the same flight path in auto flight.

With duct
https://drive.google.com/file/d/1UVpprQf8OA8ggBYP-w1bK0yRb3HnKxQr/view?usp=sharing

Without duct
https://drive.google.com/file/d/1Ua_t9x27jEFWykcjYh5llJQ0-436eGwH/view?usp=sharing

With duct yaw spin

Without duct no spin

Please let me know how to tune it.

Start by connecting to MissionPlanner, Setup / Mandatory / Initial Parameters
Put in your prop size and battery cells, accept everything it offers including the suggested settings.
Then set
ARMING_CHECK,9718
INS_ACCEL_FILTER,10
ATC_THR_MIX_MAN,0.5
PSC_ACCZ_I,0.6
PSC_ACCZ_P,0.3
MOT_SPIN_MIN,0.13

Try these Compass setting and see if that helps:
COMPASS_OFS_X 484
COMPASS_OFS_Y -43
COMPASS_OFS_Z 327
COMPASS_DIA_X 0.881
COMPASS_DIA_Y 0.800
COMPASS_DIA_Z 0.800
COMPASS_ODI_X 0.200
COMPASS_ODI_Y 0.200
COMPASS_ODI_Z 0.079
COMPASS_MOT_X -10.000
COMPASS_MOT_Y -10.000
COMPASS_MOT_Z 6.948
COMPASS_SCALE 1.00
COMPASS_MOTCT 2

It was a bit tricky to get magfit to work without a GPS - supply your actual latitude and longitude and I cna run it again.
Keep a copy of your original settings in case you need to put them back, but we can always extract them from a .bin log.

Once the yaw is under control you could run Autotune.

I use 4inch and 4cell, 2300kv motor.
Indoor use only.
Real sense T265 for localization.

Thank you for your helping.

I’m wondering if one or more of the ducts are too close to the prop tips causing an issue for yaw authority??
Cant hurt to fine tune the compass though, I’d need your real lat and long

Thank you for your reply.

I am using realsense t265 for EK3_SECx_YAW in indoor and do not use a compass.

This problem is solved by removing the duct. Therefore, I don’t think the compass is relevant.

Yeah it seems related to a physical problem between the props and ducts, and there’s not enough yaw authority to overcome the negative affect.