Copter mission mix of Terrain and Relative waypoints (Big W) FAR FROM WORKING

This is an example video of “Terrain” (third parameter 10) waypoints on a low height mission using rangefinder. (BTW1, for future R/C car races filming following the cars on track). Waypoints were at 40/60cm height:
20200820_QuadX6_14_wps

However, when mixing in a Copter mission “Terrain” (third parameter 10) and “Relative” (third parameter 3) waypoints, the mission stops, “Failsafe: terrain data missing” is heard before the first “Terrain” waypoint is reached, and RTL begins. All that follows is with 4.07 stable version, and a rangefinder is installed for waypoints close to ground.

This is a mission of a Big W on a vertical plane (BTW2, emulating this) with a mix of “Terrain” (third parameter 10) and “Relative” (third parameter 3) waypoints:


(BTW3, the low Big W vertexes at 1m height should be all “Terrain” (third parameter 10), but the first ones were changed to “Relative” (third parameter 3) so that a few Big W’s were followed (mission stops at the first “Terrain” (third parameter 10) waypoint). The high Big W vertexes at 8m height are above rangefinder reach, so they all must be “Relative” (third parameter 3).

This is the log.

In the video it is clear theat “Failsafe: terrain data missing” is heard after waypoint 19 (“Relative” 3, high 8m) is reached, waypoint 20 (“Terrain” 10, low 1m) is not reached, and RTL begins. This happens three times (see index in the video description).

MP MSG’s:

APM Planner:

Is it possible to mixTerrain” (third parameter 10) and “Relative” (third parameter 3) waypoints in a Copter mission? If it is possible, what am I missing?

Of course, if all waypoints are “Relative” (third parameter 3) the mission is completed, but with low precision on the low waypoints and risk of hitting ground.

Regarding “ Failsafe: terrain data missing ” you need to connect the Vehicle to mission planner and mission planner needs to have a internet connection. This way the vehicle is able to fetch terrain database information (from it’s surroundings) from the internet via telemetry and mission planner.

This can only be done once, but it needs to be done at the location where you want to fly.

There are other ways to do this in mavproxy, search the docs for it.

Thanks for your answer.

The vehicle is connected to MP, and the laptop running MP has internet connection with a travel router. In adition, the SD card has terrain database information.

Anyhow, terrain data is not used. From the log:
TERRAIN_ENABLE,0
TERRAIN_FOLLOW,0
WPNAV_RFND_USE,1

If this means something, SITL admits missions mixing “Terrain” (third parameter 10) and “Relative” (third parameter 3) waypoints as this:


This is the log and this is the video.

BTW, trying to add a rangefinder in SITL as described here, I get errors (parameters not present).

You are probably mixing 4.1.0-dev sitl with 4.0.7 ArduCopter, and 4.0 wiki

Please explain exactly what versions are you using.

Yes, that is true: the documentation leads to do SITL with the development version.

Real copter mentioned above has 4.07, so I downloaded SITL 4.07 stable and repeated. The result is the same: SITL on 4.07 stable admits missions mixing “Terrain” (third parameter 10) and “Relative” (third parameter 3) waypoints. This is the log and this is the video.

Responding to myself:

I could moreless solve this with a parameters file with:
RNGFND1_ADDR 0.000000
RNGFND1_FUNCTION 0.000000
RNGFND1_GNDCLEAR 10.000000
RNGFND1_MAX_CM 300.000000
RNGFND1_MIN_CM 5.000000
RNGFND1_OFFSET 0.000000
RNGFND1_ORIENT 25.000000
RNGFND1_PIN 0.000000
RNGFND1_POS_X 0.000000
RNGFND1_POS_Y 0.000000
RNGFND1_POS_Z 0.000000
RNGFND1_PWRRNG 0.000000
RNGFND1_RMETRIC 1.000000
RNGFND1_SCALING 10.000000
RNGFND1_STOP_PIN -1.000000
RNGFND1_TYPE 1.000000
SIM_SONAR_SCALE 10.000000
but after
graph RANGEFINDER.distance
I get
RTL> Adding graph: [‘RANGEFINDER.distance’]
Process Process-1:
Traceback (most recent call last):
File “/usr/local/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py”, line 315, in _bootstrap
self.run()
File “/usr/local/Cellar/python@3.9/3.9.1_8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py”, line 108, in run
*self._target(*self._args, *self._kwargs)
File “/usr/local/lib/python3.9/site-packages/MAVProxy/modules/lib/live_graph.py”, line 56, in child_task
app.frame = live_graph_ui.GraphFrame(state=self)
File “/usr/local/lib/python3.9/site-packages/MAVProxy/modules/lib/live_graph_ui.py”, line 17, in _init
self.create_main_panel()
File “/usr/local/lib/python3.9/site-packages/MAVProxy/modules/lib/live_graph_ui.py”, line 30, in create_main_panel
from MAVProxy.modules.lib.MacOS import backend_wxagg
File “/usr/local/lib/python3.9/site-packages/MAVProxy/modules/lib/MacOS/backend_wxagg.py”, line 5, in
from backend_agg import FigureCanvasAgg
ModuleNotFoundError: No module named ‘backend_agg’

Manually:
$ python
Python 3.9.1 (default, Feb 3 2021, 07:04:48)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> from MAVProxy.modules.lib.MacOS import backend_wxagg
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python3.9/site-packages/MAVProxy/modules/lib/MacOS/backend_wxagg.py”, line 5, in
from backend_agg import FigureCanvasAgg
ModuleNotFoundError: No module named ‘backend_agg’
after
pip3 install backends
pip3 install backend
pip3 install MAVProxy --upgrade
so I have no idea of what is missing.

Yes, but after adding a rangefinder in SITL as described above, there is RTL before first “Terrain” (third parameter 10) waypoint, as can be seen in this video.

The good thing is that if there is a workaround it can be tested in SITL before going to the field. So I interpolated a “Relative” (third parameter 3) before each “Terrain” (third parameter 10) waypoint, thinking that perhaps then it would “know” how to go from a “Relative” to a “Terrain” waypoint if both were within rangefinder range, but that didn’t work as can be seen in this other video.

So, what else can I try or change?

Looking here appears:
3
MAV_FRAME_GLOBAL_RELATIVE_ALT
Global (WGS84) coordinate frame + altitude relative to the home position. First value / x: latitude, second value / y: longitude, third value / z: positive altitude with 0 being at the altitude of the home location.
10
MAV_FRAME_GLOBAL_TERRAIN_ALT
Global (WGS84) coordinate frame with AGL altitude (at the waypoint coordinate). First value / x: latitude in degrees, second value / y: longitude in degrees, third value / z: positive altitude in meters with 0 being at ground level in terrain model.
but that does not help in getting advantage from a rangefinder so as not to touch ground in missions.

What I know for sure:

  • Missions with only “Terrain” (third parameter 10) waypoints work beautifully.
  • Trying a mission with only “Terrain” (third parameter 10) waypoints with no rangefinder or type 0 (disabled) produces RTL immediately.

BTW, congratulations to all developers: here it is seen how faithfully the real thing is emulated in SITL.

That was on MacOS. On Ubuntu 20.04 the rangefinder scale works (video).

More on SITL.