When I tested terrain following, I noticed that the vehicle decreases its altitude and even crashes on the ground. I guess that this issue is related to a fixed issue.
This issue could be reproduced as following steps:
./Tools/autotest/sim_vehicle.py -v ArduCopter --console -w --speedup=10 -L Karuizawa
I’ve reproduced the problem so we will look into it. Maybe we have a bug in how the terrain offset is initialised when entering Guided mode because the issue only seems to occur if the vehicle is switched to AltHold momentarily.
This portion of the instructions you’ve kindly posted are critical to seeing the bug
Set the current altitude to 40 meters above terrain by increasing throttle
I’ve tested Leonard’s fix (linked above) and it seems to resolve the problem. Since you’re quite handy with SITL testing maybe you want to give it a try as well? I will probably merge it in an hour or two in either case but feedback would be very welcome!
I have tested the fixed version.
It seems likely to me that the fixed version resolves the problem!
However, RTL mode still leads to an issue. Maybe, this issue comes from another root cause.