RTL failded with "Failed to update home location"

i use pixhawk and firmware of apm copter 3.4-dev for a project, and i have set the battery failsafe, the radio failsafe and the gcs failsafe on mission planner 1.3.39. When i was tuning the PID, at first, it went well, but suddenly i couldn’t control the copter with my RC, it just flew away in a strange direction and hit a tree, then crashed. When the copter lost control, i saw the mission planner says “Failed to update home location”(i connected my copter and MP with a Xbee).
Later i analyzed the log, and i found that it’s because battery failsafe triggered RTL that i couldn’t control the copter with RC, but it’s strange the copter didn’t return the place i took off instead it flew away in a strange direction. And i think it’s not reasonable that people can not control the copter with RC in RTL mode.

could anyone help? thx a lot.

the log is in this cloud link:

when RTL triggered, the NSat and HDop seemed good…

You can switch out of RTL and in to another mode at any time unless you’ve lost radio contact.It takes practice to achieve in a proper emergency like this though.Brain fog gets in the way for half a second and then it hits a tree.

Post the whole log.It may have some clues somewhere but it used to be (in my APM days ) that it hadn’t got a decent GPS lock when armed and locked it in the air or simply guessed.

Thank you very much for replying!:grinning:
I certainly don’t know i can switch and regain control, i’ll try practicing.
I armed and took off in PosHold and the NSat is never below 10 so i think the gps lock is mostly good when armed.
I am trying to read code of mision planner and copter 3.4-dev to find where it goes wrong, it’s not easy job.:disappointed_relieved:
I try to upload the log but it’s too large, so i use a cloud link but i dont know if you can open it because the cloud server is in China.