Closed stronnag closed 3 years ago
It will also be possible just to give the number of mission points required and let the application iterate a few epsilon
values to give the desired number of points (subject to some sanity criteria, like greater than say 8, less than 60).
This is probably the final iteration for now:
log2mission
will create an inav XML mission file from a supported flight log (Blackbox, OpenTX, BulletGCSS). The mission will not exceed the inav maximum of 60 mission points.
$ log2mission
Usage of log2mission [options] file...
-end-offset int
End Offset (seconds) (default -30)
-epsilon float
Epsilon (default 0.015)
-index int
Log index
-interval int
Sampling Interval (ms) (default 1000)
-mode-filter string
Mode filter (cruise,wp)
-rebase string
rebase all positions on lat,lon[,alt]
-split-time int
[OTX] Time(s) determining log split, 0 disables (default 120)
-start-offset int
Start Offset (seconds) (default 30)
start-offset
and end-offset
compensate for the fact that the start / end of the flight is usually on the ground, and thus is not a good WP choice. The defaults are 30 seconds for the start offset and -30 seconds (i.e. 30 seconds from the end) for the end offset. The end offset may be specified as either a positive number of seconds from the start of the log or a negative number (from the end). Locations prior to the start offset and after the end offset are not considered for mission generation. If the end-offset
is specified (0 cancels it), and there is no flight mode filter, then RTH is included in the generated mission.mode-filter
allows the log to filtered on Cruise and WP modes, e.g. -mode-filter=cruise
, -mode-filter=wp
, -mode-filter=cruise,wp
. If mode-filter
is specified, log entries not in the required flight mode(s) are discarded. Cruise includes both 2D and 3D cruise.epsilon
tuningThe epsilon
value is an opaque factor that controls the point simplification process (using the Ramer–Douglas–Peucker algorithm). The default value should be a good starting point for fixed wing with reasonably sedate flying. On a multi-rotor in a small flight area, a much smaller value (e.g. 0.001) would be more appropriate. Increasing the value will decrease the number of mission points generated. log2mission
will do this automatically if the default value results in greater than 60 mission points, for example: the log here would generate 77 points with the default epsilon
value.
$ log2mission -start-offset 60 -end-offset -120 /t/inav-contrib/otxlogs/demolog.TXT
Flight : MrPlane on 2021-04-08 13:24:07
Firmware : INAV 3.0.0 (fc0e5e274) MATEKF405 of Apr 7 2021 / 17:02:08
Size : 19.36 MB
Log : demolog.TXT / 1
Speed : 28.0 m/s at 13:54
Range : 17322 m at 14:22
Current : 30.6 A at 00:05
Distance : 48437 m
Duration : 43:44
Altitude : 292.8 m at 25:42
Mission : 56 points (reprocess: 1, epsilon: 0.018)
The output from this example would be demolog.1.mission
Using a old, contributed MR log, in quite a small area, with user specifed epsilon
.
$ log2mission -epsilon 0.001 logfs.TXT
Log : logfs.TXT / 1
Flight : on 2019-02-08 15:21:13
Firmware : INAV 2.1.0 (7bdd5967e) OMNIBUSF4V3 of Jan 22 2019 09:39:17
Size : 32.03 MB
Current : 23.5 A at 02:21
Distance : 1560 m
Duration : 04:10
Altitude : 52.5 m at 02:50
Speed : 17.3 m/s at 02:38
Range : 174 m at 01:22
Mission : 13 points
13 points is a adequate mission to reproduce the flight.
Using an extreme user defined epsilon
results in an excessive number of points:
$ log2mission -epsilon 0.00001 logfs.TXT
...
Mission : 59 points (reprocess: 8, epsilon: 0.000105)
Whereas, with the default epsilon
of 0.015, no useful mission is generated:
$ log2mission logfs.TXT
...
Mission : 2 points
So some experimentation may be required to get a good mission, particularly for shorter MR flights. In particular, if reprocessing
is indicated and the number of generated points is close to 60, then it's probably worth running again with a slightly larger epsilon
than that shown in the output.
pre-release binaries, Linux x86_64 and Win32
Almost the last! Attempt to resolve short distance flights otherwise giving two point missions. fl2kml_0.98-rc4.tar.gz
Attached is a experimental
log2mission
that will take a supported flight log (Blackbox, OpenTX log, BulletGCSS log) and generate an inav mission file (MWXML). The generated log may then be edited in an inav mission planner (mwp, inav-Configurator, drone-helper etc.) and/or uploaded to the inav FC.At the moment the whole log is considered (see below for some possible filter options) and the number of points generated is controlled by the opaque
epsilon
value. The default value seems to work for the very few logs tested to date. It may be that the default value gives to many or too few points. Decrease the value to increase the number of mission points.Some ideas for future filters include:
Suggestions for (a) filters and feedback (especially on outrageously different
epsilon
, i.e. outside of say (0.01 - 0.02)) and samples of logs where it fails to give any sort of sane result will be appreciated.The mission file is created in the current directory, name derived from the source file and flight index, e,g, a BBL file
LOG00666.TXT
with a single flight would generateLOG00666.1.mission
The archive below contains Linux x86_64 and Win32 binaries for
log2mission
. fl2kml_0.98-rc2.tar.gz