Terrain Following not working in GUIDED or with rally points

I’m playing with terrain following in SITL (Plane 4.4.4) and Mission Planner 1.3.81, and I have a few observations/ questions:

  1. With “guided” selected in the TERRAIN_FOLLOW param, the vehicle does not seem to maintain height above terrain when selecting ‘fly to here’. It looks like it is holding relative to home. (This has been asked here as well (Plane 4.3.3 Guided mode terrain following issue)

  2. With ‘RTL’ selected in TERRAIN_FOLLOW, the vehicle seems to correctly maintain ALT_HOLD_RTL height above terrain when travelling home and when circling around home location, however, when using rally points, the vehicle seems to maintain the relative altitude of the specific rally point, and not the altitude above terrain. Should it use the altitude of the rally point as height above terrain?

  3. In the TERRAIN_FOLLOW param, what is the functionality of ‘auto’?, since terrain following is enabled via the waypoints in the mission.


@Bill-B I can confirm the bug in 4.4.x with TERRAIN_FOLLOW set to GUIDED. I am working on a fix

@Bill-B it’s actually a bit more complex. ArduPilot itself is actually doing the “right thing” from a somewhat reasonable point of view, and the key problem is the GCS.
When we first added GUIDED mode interfaces like “Fly To” the MAVLink commands we used didn’t have a frame of reference in the packet, to using TERRAIN_FOLLOW to work out the frame made sense.
Quite a while ago we switched across to newer MAVLink packets which do have a coordinate frame, which means the GCS when it sends the “Fly To” is actually telling ArduPilot “treat this as a height above home” or “treat this as absolute alt” or “treat this as terrain alt”.
Unfortunately MissionPlanner always sends “relative to home”:

We need the little dialog box that asks for the altitude to also ask for the frame.
I’ve opened an issue for it:

Interesting. Do you think something similar is happening when RTLing to rally points?

IIRC rally points as all waypoints should have a Frame of Reference field.

OK, perhaps then a mission planner issue when trying to use terrain mode for rally points? I get this error when trying to upload a rally point to a vehicle with ‘terrain’ selected (MP1.3.81 and Plane 4.4.4 in sitl):

This all also brings me back to my third question, how should we correctly use the TERRAIN_FOLLOW param if terrain following is on a waypoint by waypoint basis, or rally point by rally point basis?