Toilet bowl problem

we are building a copter and for the past couple of days we had the toilet bowl problem i will share all my flight logs and explain my set up.
at first our drone started to drift away when it is switched to althold or poshold or any mode that is GPS dependent but instead after this modifications the drone started to fly in circles ther was an improvement but we want it to fly smoothly and end the problem.
the modifications(we just tried to decrease the magnetic interference):
1-placed all the wires at the farthest place possible from the navio2(near the battery)
2-we placed some aluminum foil(all around the navio2+raspberry) to block any kind of interference to the compass

here is our logs if there is any possible mistakes we overlooked we are happy to hear any kind of feedback.

lastly we are using a 3D printed closed box and we placed the raspberry pi+navio2 inside it my question is did this have any effect or it don’t matter.
https://www.thingiverse.com/thing:4095463

logs:

our drone:

Loiter is the mode you want to use instead of poshold, it’s much more modern and configurable.
Althold is not a GPS-assisted mode, but still a very important mode.

Aluminium foil wont help at all. Magnetic fields affect a compass, and aluminium foil is not ferrous.
You’ll need to disable the onboard compass, and only use the external compass contained in the GPS unit. Ensure that GPS mast is not vibrating too.
Then go outside in a clear area, wait for good 3D fix then run the compass calibration.

I’ll check the log file and let you know more.

You have an old version of Arducopter. Why are you not using this?
Beta firmware
I don’t know much about Navio2 but both compass’s appear to be internal on the SPI bus. Those don’t work well.

And yea. lose the aluminum foil…

Both compasses are affected by throttle approximately equally, so you’ll have to try the compass/motor calibration again, after redoing the compass cal outside with a good 3D fix.
See if you can find out of there’s a compass in that GPS unit and get it working.

EDIT:
I would rework your wiring a bit: Move the battery to underneath that bottom plate, and move all the ESCs and power wiring in where the battery was. That might help a little bit.

Follow the tuning guide exactly…

thank you guys for all the feedback @xfacta @dkemxr it was really helpful, we removed the aluminum foil and we calibrated the compass ( after we got 3D fix in a clear open area ) but the problem was not solved.
and soon we will rework our wiring as Shawn said.

and we are using the navio2 internal compass and GPS ,and after reading we are thinking of purchasing a external GPS unit (with compass) do u guys have any preferences according to our setup?

You need an external GPS/compass module and disable the internal compass’s. Any M8N module will do.