Skip to content

Commit

Permalink
improve log2mission; rework rebase code
Browse files Browse the repository at this point in the history
  • Loading branch information
stronnag committed Mar 27, 2024
1 parent efe00fc commit 799f522
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions manual/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ If a mission file is given, this will also be displayed by BulletGCSS, albeit in

`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 120 mission points (or configurated maximum).

From log2mission 1.0.17 and Blackbox logs from INAV 7.1.0 and later, the active waypoint number is stored in the log and the majority of filtering options are ignored.
From log2mission 1.0.17 and Blackbox logs from INAV 7.1.0 and later, the active waypoint number is stored in the log and the majority of filtering options are ignored, unless `-mode-filter` is uses, which reimposes the legacy simplification algorithm.

For such logs (log2mission 1.0.17+, INAV BBL 7.1.0+):

* `-start-offset`, `-end-offset`, `-epsilon`, `-max-wp`, `-mode-filter`, `-split-time` have no effect and are ignored.
* `-start-offset`, `-end-offset`, `-epsilon`, `-max-wp`, `-split-time` have no effect and are ignored **unless** `-mode-filter` is used (which then bypasses the INAV 7.1.0+ `activeWpNumber`).
* You should probably use a lower `-interval` (for example 10).

### Usage
Expand Down
24 changes: 15 additions & 9 deletions pkg/log2mission/l2m.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ func generate_filename(m types.FlightMeta) string {

func Generate_mission(seg types.LogSegment, meta types.FlightMeta) {
mfilter := byte(0)
if strings.Contains(options.Config.Modefilter, "cruise") {
mfilter |= 1
}
if strings.Contains(options.Config.Modefilter, "wp") {
mfilter |= 2
}

if options.Config.Modefilter == "any" {
mfilter = 0xff
} else {
if strings.Contains(options.Config.Modefilter, "cruise") {
mfilter |= 1
}
if strings.Contains(options.Config.Modefilter, "wp") {
mfilter |= 2
}
}
if (mfilter == 0) && (seg.L.Cap&types.CAP_WPNO) == types.CAP_WPNO {
generate_from_active(seg, meta)
} else {
Expand Down Expand Up @@ -68,9 +72,11 @@ func generate_from_path(seg types.LogSegment, meta types.FlightMeta, mfilter byt
if !et.IsZero() && b.Utc.After(et) {
continue
}
if (mfilter&1 == 1 && b.Fmode != types.FM_CRUISE2D && b.Fmode != types.FM_CRUISE3D) ||
(mfilter&2 == 2 && b.Fmode != types.FM_WP) {
continue
if mfilter != 0xff {
if ((mfilter&1 == 1) && b.Fmode != types.FM_CRUISE2D && b.Fmode != types.FM_CRUISE3D) ||
(mfilter&2 == 2 && b.Fmode != types.FM_WP) {
continue
}
}
pt := simpleline.Point3d{X: b.Lon, Y: b.Lat, Z: b.Alt}
points = append(points, &pt)
Expand Down
2 changes: 1 addition & 1 deletion pkg/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func ParseCLI(gv func() string) ([]string, string) {
flag.Float64Var(&Config.Epsilon, "epsilon", Config.Epsilon, "Epsilon")
flag.IntVar(&Config.StartOff, "start-offset", Config.StartOff, "Start Offset (seconds)")
flag.IntVar(&Config.EndOff, "end-offset", Config.EndOff, "End Offset (seconds)")
flag.StringVar(&Config.Modefilter, "mode-filter", Config.Modefilter, "Mode filter (cruise,wp)")
flag.StringVar(&Config.Modefilter, "mode-filter", Config.Modefilter, "Mode filter (cruise,wp,any)")
flag.IntVar(&Config.MaxWP, "max-wp", Config.MaxWP, "Maximum WPs in mission")
} else if strings.HasPrefix(app, "fl2sitl") {
Config.Intvl = 100
Expand Down

0 comments on commit 799f522

Please sign in to comment.