Struggling to setup vehicle to use rangefinder to terrain follow/surface track in MODE_AUTO

Hello everyone,

I use a slightly customized version of 4.0.5 (we will be upgrading soon). ArduCopter has been great to us, however I have hit a snag.

For some reason I have been struggling to set this up successfully. I have read all the posts even remotely related to this but I still cannot get it to work.

This is what I have done so far:

  • Set up LW20 rangefinder on i2c. the rangefinder works and maintains altitude in manual modes like Loiter, AltHold, etc
  • EK2_ALT_SOURCE = 0
  • EK2_RNG_USE_HGT = -1

When I planned my missions and used relative altitude - changes in rangefinder readings did nothing to target alt

When I planned using terrain frame for altitude - it terrain failsafed (Terrain data missing)

I am attaching a log as well

log w terrain frame -
log with relative frame -

Please help! What am I missing?

If anyone is having the same issues I found out it worked for me when I setup a switch for surface tracking.

Basically pick a 3-position switch on your transmitter
Find out which channel (X) it is bound to
set RCx_OPTION for that channel to 75 - surface tracking up/down. Basically it switches between tracking the ground or the ceiling (if there is a rangefinder facing up). The middle position turns surface tracking off.

I hope this helps others.

OH and it is very important to set the alt frame waypoints to be Terrain. It was failsafing for me because I had set the Terrain parameters incorrectly.