Testing Smart RTH - stronnag/mwptools GitHub Wiki

Introduction

Smart RTH is an experimental feature developed by Alberto García Hierro that may appear in iNav in the future. In theory, it calculates the best route home from previous positions, choosing the shortest route and using prior altitudes in order to avoid obstacles. This article documents the first flight test.

Test platform

260mm lightweight deadcat quad, QUARKF4 FC, Beitian BN880 / HMC5883. Proven reliable iNav machine (WP, RTH etc). Due to the size / space, and the non-Galileo capable GPS, GPS performance is not outstanding, typically 12-15 satellites, exceptionally 20.

Methodology

A short WP mission was generated that would provide:

  • Repeatability
  • Predictability
  • Safety (the path of the vehicle was known)
  • A certain degree of difficultly, with crossing paths offering multiple alternative routes home.

The following picture shows the chosen mission. The track in yellow is postulated to be the optimal return path (on the basis that there will be an initial path from home to WP1)

Test route

Note this view is naive, it is made from the luxury of looking back across all point; as we shall experience, the FC does have the option of keeping all points in memory, so the selected route will be less optimistic.

Some free flight tests were also made; these where less predictable, but actually seemed to perform better.

On the developer's advice, the experimental watchdog branch was also merged (it never barked), and the machine was power cycled between tests.

Test Results

Test 1

This uses an earlier mission (WP3 is E of the Home->WP line). An ancient battery of limited capacity was used to minimise the fly-away potential (though the additional experimental watch dog feature should also protect against FC lockup). After a while, due to low voltage, PH is enabled, the pilot fails to get S of the WP1-WP2 line, but a reasonable test results. After some initial hesitation, the obvious route is taken.

The only 'bad' is when the algorithm decides that it should descend directly to the launch point rather than reaching it at altitude and descending vertically. This resulted into the FC flying the machine (slowly) into the ground with no damage.

Test1

Video replay of BB Log

Blackbox Log

Test 2

Same mission and slow speed. A GPS glitch near WP5 (unusual). The craft fails to take the obvious short cut before WP8-WP9, due to RTH slow speed, the pilot bails out and lands manually.

Test1

Video replay of BB Log

Blackbox Log

Test 3

Prior to Test 3, the pilot used the CLI to adjust the navigation speed (the firmware seemed safe, if a little erratic on RTH route); this caused ALL FC settings to be lost and it was necessary to restore from a CLI diff before testing could be resumed.

A short test was performed (as the reset nav_auto_speed was lost). This worked as expected and is trivial (no video).

PH was engaged just before home to prevent the FC performing a controlled descent into terrain.

Test1

Blackbox Log

Test 4

Test 4 used the modified mission (WP3 moved a little west of the HOME-WP1 line), and 5 m/s auto speed. On the RTH there are a number of deviations (e.g. the curve near WP9) and some seemly obvious shortcuts are not taken (possibly because of small deviation in altitude?), between WP8-9 (not necessary to go to 8 or 7); although the FC goes as far S as WP6 (seemingly unnecessary, it avoids backtracking to WPs 5 and 4). After WP3 the pilot again retains control for a manual landing as the turn W is disconcerting and we're close to a controlled descent into terrain again. As everything seems safe, it will be time for greater altitude.

Test1

Video replay of BB Log

Blackbox Log

Test 5

For a change, this was random flying around LOS/Horizon. The RTH chooses a strange loop to the N, then passes almost exactly through the start point before taking quite a reasonable route home. Due to the higher altitude, it was not necessary to intervene on the landing.

Test1

Video replay of BB Log

Blackbox Log

Test 6

Flying the mission again. Same little dance around WP9, almost appears to consider the short cut to WP5, but goes the longer route via WP8/7. Doesn't go as far as WP6, another little dance around WP3, and the pilot hits PH just before home as we're about 2cm off the ground and still flying home.

Test1

Video replay of BB Log

Blackbox Log

Test 7

Flying the mission again, wuth greater WP altitude . RTH invoked at WP7. Desn't go as far as WP6, another little dance around WP3; the greater starting altitude allows the craft to autoland successfully, but it's close. The craft flew in a probably 0.5m above ground, stopped, rose to 1.5m and entered autoland.

Test1

Video replay of BB Log

Blackbox Log

Test 8

More random flying around LOS/Horizon. The RTH takes quite a reasonable route home (best of the day). It just manages to autoland (cm away from controlled descent into terrain), with landing behaviour as for test 7.

Test1

Video replay of BB Log

Blackbox Log

Summary

  • Nothing bad happened
  • Rarely took the intuitively shortest route home. This is probably not possible due to the limited storage available and the need for the algorithm to prune the return route as the flight develops.
  • Never took the absolutely longest route
  • Has one interesting / hopefully easily fixed defect in that it can emulate take off altitude perfectly and fly the model into the ground when nearly home. Needs to stop descending in the final run into home.
  • Completely lost all FC settings at one stage. No idea why. Due to the watchdog intervening and rebooting between data clear and re-write. Requires longer watchdog interval during flash writes.
  • Nevertheless, extremely promising; perhaps not for open space park fliers, but for long range flights in uneven / obstructed terrain.