ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
11.08k stars 17.64k forks source link

Copter: Terrain following/surface tracking in AUTO mode uses unfiltered rangefinder reading #12911

Closed RickReeser closed 3 years ago

RickReeser commented 5 years ago

When using a rangefinder for following terrain (TERRAIN_ENABLE = 0, WPNAV_RFND_USE = 1, mission waypoint altitude type is Terrain), the desired climb rate will respond to big spiky readings from the rangefinder as long as they fall within the configured _MIN_CM and _MAX_CM.

I found this by looking at logs submitted by a user on the Discuss forum: https://discuss.ardupilot.org/t/filter-for-rangefinder-signal/49453/13

I think it would be better to use a filtered rangefinder value so that obvious bad readings are rejected. The EKF already does the filtering (logged as NKF5.rng), so maybe we can use that instead.

See the desired climb rate bottom out when the rangefinder spikes high, even though the EKF rng value is stable. When the pilot switches to Loiter, this does not happen. The log is posted in the linked discussion. image

Found on Copter 3.6.7.

rmackay9 commented 3 years ago

This is resolved in Copter-4.1 (see code here) so closing. thanks again for the report!