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.