Quad Flies away when in RTL, Loiter modes

Hi all,
I built a quad with a dji flamewheel f450 frame and the pixhawk and it all flies normally when in stabilize and alt hold modes. However when I tested RTL mode it went up to altitude and flew in a curve past home not passing over it at about 30mph and then crashed into the ground. An auto analysis of the log came up with this:

[code]Log File C:/Program Files (x86)/Mission Planner/logs/QUADROTOR/1/2014-12-13 20-00-38 5.bin.log
Size (kb) 2542.4033203125
No of lines 35195
Duration 0:07:05
Vehicletype ArduCopter
Firmware Version V3.1.5
Firmware Hash ee63c88b
Hardware Type
Free Mem 0
Skipped Lines 0

Test: Autotune = UNKNOWN - No ATUN log data
Test: Balance/Twist = GOOD -
Test: Brownout = FAIL - Truncated Log? Ends while armed at altitude 3.68m
Test: Compass = FAIL - Large compass off params (X:-24.74, Y:-32.41, Z:-159.02)
Large compass offset in MAG data:
Z: -159.00
mag_field interference within limits (9.91%)
Max mag field length (560.95) > recommended (550.00)

Test: Dupe Log Data = GOOD -
Test: Empty = GOOD -
Test: Event/Failsafe = GOOD -
Test: GPS = GOOD -
Test: Parameters = GOOD -
Test: PM = GOOD -
Test: Pitch/Roll = GOOD -
Test: Thrust = FAIL - Avg climb rate 7.00 cm/s for throttle avg 718
Test: VCC = GOOD -
[/code]
Somewhere in the chain of events my gps mast broke and my battery and 3dr power module seperated from the quad… I was told before it could be my HDOP… Also when I fly in loiter mode the quad drifts rapidly away at app. 20 mph+. The log files from the incident are attached.
All help is appreciated,
L

First 3.1.5 has a problem with downloading logs through mission planner. Truncated logs which is what you have. Best to get them right from the Compact Flash.

Second the Compass is needed to determine what direction to fly to get back home. Since yours is off it will not fly in any auto mode. A good indication is that it did not fly in a straight line back to home but had an arc.

Third GPS is fine no issues there.

Mike

Ok. So how can I fix my Compass problem? Would mounting it on a block of foam in the center work or should I get the 3dr mast(which is out of stock)…

Perhaps you can find an open spot and orient the GPS so that the arrow points forward and then Hot Glue it in place for now. Run the compass calibration making sure you have the compass orientation correct for how you have your compass mounted.

The motors are magnets and as such effect the compass. Mount as close as possible to be in the center of the two motors.

The calibration should compensate for this interference.

Compass Mot will help with interference from running wires near the compass and may not be necessary.

Mike