Overhaul WPOverlay (and add arc wp)#3668
Open
robertlong13 wants to merge 17 commits intoArduPilot:masterfrom
Open
Overhaul WPOverlay (and add arc wp)#3668robertlong13 wants to merge 17 commits intoArduPilot:masterfrom
robertlong13 wants to merge 17 commits intoArduPilot:masterfrom
Conversation
Collaborator
Author
Collaborator
Author
|
Note the Android failures (failing on restore) are happening on master. Looks like the winusb testing branch got merged in and the packages got added into the xamarin project, not just to Windows. |
18b949b to
b01c3bc
Compare
This is needed for the upcomming WPOverlay2 renderer
Graph-based mission analysis: MissionGraph builds nodes/edges/bookmarks, MissionSegmentizer converts to typed geometry, MissionStyle applies rule-based visual properties. Includes Spline3 (cubic Hermite) and CommandUtils (command classifiers).
Replace WPOverlay with WPOverlay2 in both views. Add Edit Style menu item. Fix resx metadata for gDALOpacityToolStripMenuItem that was clobbered by the designer.
b01c3bc to
679737b
Compare
Collaborator
Author
|
@meee1 I've rebased this onto my Mac CI fix PR, and it's all passing now. I've done a bit of trying to torture-test the renderer too with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Note
Sorry in advance for the wall of text. This is a big PR and it needs some explanation.
WPOverlay is due for an overhaul. It's mostly one giant method with deeply nested conditions, there's no separation between mission logic and rendering, and every command touches some inline shared state. There was a lot of complexity with the handling of jumps and splines (because it is a complex subject).
I've tried to work with it a couple times, but I was never able to get it to do what I wanted without subtly breaking something. Arc waypoints were recently introduced in ArduPilot, and I was dreading slotting them into the old structure. That was the final push to do this rewrite.
I've rewritten it as
WPOverlay2and, for now, it coexists as an optional alternative renderer toWPOverlayScreenshots
Plane mission with figure-8s. A jump tag (T0) in orange, and a DO_LAND_START (LS) in orange.
The entire landing sequence is colored green
Copter spline tests
Copter splines with jumps
Massive, needlessly complicated plane mission with zero-turn loiters
(the plane-man's arc waypoint) and a converging return path system (blue lines)
Copter arc waypoint support
What this PR Adds
New rendering pipeline
The mission is now processed through a three-stage pipeline:
Each stage has a single responsibility, and adding a new command mostly means just a new method in
MissionSegmentizer. The arc waypoint commit in this PR is an example (though I actually had a couple placeholder lines in place beforehand). Another example is ArduPilot's off-spec implementation ofDO_GO_AROUNDas a bookmark item (likeDO_LAND_START), but there are too many problems with it to include in this PR.Themeable styles
Line color, marker color, circle transparency, dash pattern, midline arrow: all of the rendering properties that were previously hard-coded are now exposed through
MissionStyle. A built-in style editor lets you customize and save presets.Bonus
MissionGraph as a reusable structure
The graph representation is a generally useful model of mission structure and could come in handy elsewhere: validation, statistics, distance calculations, etc.
Spline3
Spline2is a line-by-line port of ArduPilot's spline nav controller, carrying velocity ramping, acceleration, time-stepping, and areached_destinationflag that are needed for the real-time controller but don't affect the curve shape when used purely for rendering.Spline3keeps the Hermite math (same tangent logic, same overshoot clamp) and drops the simulation scaffolding, coming out at about half the code.VehicleClass enum
We throw around a lot of checks against the firmware enum, and for plane this always means checking
ArduPlaneandAteryxseparately. In almost every case, it's being used for something like "is a reasonable takeoff altitude 2 meters or 20 meters", and my renderer was going to have similar "does vehicle stop and wait at a LOITER, or does it fly in circles around it" questions. Firmware doesn't feel like the right check for these questions. I've added aVehicleClassproperty (Copter,Plane,Rover) and used it in the new pipeline. Eventually I'd likeVehicleClassto come fromMAV_TYPE(cached like we currently cache firmware), falling back to the firmware check only when needed, but that's future work.Fallback toggle
The old overlay is still reachable via Map Tool > "Use Legacy Overlay". If anyone doesn't like the new behavior, or if someone finds some edge-case bug I didn't handle, they can flip back.
Drive-by fixes
DO_LAND_START: fix altitude unit typeDO_RETURN_PATHcommandGMapMarkerWP: adjust label text centeringFlightPlanner: null-safetcellvalue checkFlightPlanner: useTryParseingroupmarkeraddReviewing
The branch is structured for commit-by-commit review. Foundation and prerequisites are at the bottom of the stack (drive-by fixes, GMapRoute cleanup, marker/enum changes), the core pipeline and renderer are in the middle, and the integration commit that wires everything up is near the top.
GMapRoute: fix formattingis a whitespace-only commit that normalizes mixed indentation before the arrow-modes commit builds on top of it.I'll follow up with a second comment walking through the style editor concepts, which will also help explain some terms in the code for reviewers.