Battery failsafe crash from "Land" function

So during a test flight the battery got low and triggered the failsafe.

This was not an issues prior to using Optitrack, but this time it when the failsafe triggered the copter rolled left and hit the wall (I then killed the arm and must have bumped the mode to Loiter in the scramble but I’m sure the roll left was prior to the mode switch.)

I cannot understand why this would happen.

I have reviewed the log and cannot see anything out of place but its also very hard to see when the exact moment the Land command is given.

Can anyone see any issues in the log or how to determine why the position control is not correct and not landing straight down.

Thanks, Tristan.

There is inconsistence between yaw from optitrack & ekf. I think you place the drone in wrong direction when creating rigid body

@chobitsfan Thank you for your suggestion. I will try this later this week.

Can you confirm that this is the correct translation between Ardupilot and MAVProxy?

MAV att_pos.x = rbData.x; //north Optitrack
MAV att_pos.y = rbData.z; //east` Optitrack

MAV att_pos.z = -rbData.y; //down` Optitrack

Thanks,

@chobitsfan

I have re-created the rigid body in the correct orientation.

Unfortunately the same problem occurs when trying to use Loiter. The copter will try to roll and pitch in a random direction.

When checking the logs, the yaw seems to match (within a few deg.) but i can see that pitch is opposite between the VISP and XKF1.

How can I resolve this?

Any ideas or input is greatly appreciated.

Thanks, Tristan.