I have a Matek H743-slim on a quadcopter configured with a downwards facing rangefinder. I want to fly a mission using terrain data points. The quad wouldn’t arm initially because of a pre-arm message saying that terrain data is missing. After disabling arming checks, I was able to get the quad in the air, but it quickly aborted the mission due to a “terrain data missing” failsafe. I am certain the SD card has the terrain data, as I’ve both seen the data loaded onto it by Mission Planner and added data on myself. It is also worth mentioning that my flight controller doesn’t have the TERRAIN_FOLLOW parameter. What could be the issue here? Any help would be greatly appreciated.
It might be good to post an onboard log.
For reference the Terrain Following wiki page is here.
The TERRAIN_FOLLOW parameter only exists on Plane. In Copter the equivalent is RTL_ALT_TYPE and allows specifying if you’d like RTL to use terrain altitude or not during the return. I’ll get the reference to TERRAIN_FOLLOW fixed on our Terrain Following wiki page.
In copter there is also a WPNAV_RFND_USE parameter that allows specifying whether you’d like Auto mode to use the rangefinder or the internal terrain database.
It’s a little unclear to me whether you’re trying to use the rangefinder or the terrain database. ArduPilot can only use one or the other but not both. The enhancement request to use both is here but it has not been completed and it may not be for some time because it is quite difficult.
I am trying to use the rangefinder; I had TERRAIN_ENABLE on because I got a pre-arm message saying terrain was disabled if it was off. I also tested a flight with TERRAIN_ENABLE and ARMING_CHECKS off and got the same failsafe. I have RTL_ALT_TYPE set to terrain and WPNAV_RFND_USE enabled. My log file and full parameter lists are attached.
MatekParams.param (15.6 KB)
From looking at the logs the rangefinder is almost never getting good readings.
The max range (RNGFND1_MAX_CM) is set to 400 (e.g. 4m) and the vehicle is nearly always higher than this limit.
There is quite a lot of noise in the rangefinder reading as well. I see you’re using the GY-US42v2 sonar which has a relatively short range so it might be better to switch to a longer range lidar.
Hi. The terrain pre-arm error message was actually a bug that we have fixed, and it will go out in the next stable release. But if your RangeFinder is not healthy then you will still get an error if TERRAIN is disabled.
As Randy says, if you want to do a mission with alt frame set to terrain, you would want an accurate rangefinder with good range for best results.
Thank you so much for the help. I was able to get a successful flight by reducing the waypoint altitude to 1.5m instead of 3m, but I’m definitely planning on purchasing a nicer rangefinder.