Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to Altitude Angel integration #3147

Merged
merged 72 commits into from
Aug 12, 2023

Conversation

rupertbenbrook
Copy link
Contributor

@rupertbenbrook rupertbenbrook commented Jul 14, 2023

Updates with recent improvements to Altitude Angel services to enable them in Mission Planner. This includes:

  • Switched login to use an external browser rather than the built-in web browser control. Better compatibility and lets users use the browser they want to. Also requests to login again or failure are not obtrusive by popping up windows.

image
image

  • Added map altitude floor filtering to help focus on low altitude airspace.

image

  • Major update to the map info panel to include more information including UTM Ready zones, airspace contact phone number where available, and a link to request approval where available. Any links in map info open in the user's default browser, including new data like SSSI or land owner information for drone access.

image
image
image
image

  • Updates to the first start experience to explain what the plugin is and what it does, and where to go to get information, T&C and privacy details.

image

  • Moved plugin enable/disable to the main settings tab and included more user diagnostic information such as login scopes. These scopes are also used to enable and disable plugin functionality depending on user permissions. Also started preparing for additional telemetry services.

image

  • Updated the About tab to include more links to privacy policy, terms and conditions, and other Altitude Angel information. Also included links to get support or provide feedback.

image

  • Additional messages displayed when some map data is excluded from display because of zoom level or error conditions.

image

  • Map navigation improvements when data is showing, including using Ctrl + Click in flight planning so it doesn't annoy whilst setting waypoints.
  • Improvements in error handling and request retries.
  • Fixing plugin loading failures and assembly version mismatches that were causing first time users not to be prompted to use the plugin.
  • Minor package updates for security fixes.
  • Including the home location as part of a flight plan.
  • Adding VTOL aircraft types in flight plans.
  • Including Mission Planner version as user agent in requests made to Altitude Angel to aid diagnostics.
  • Removed a number of unused types.
  • Moved all app.config settings to the Settings in plugin instead.

@rupertbenbrook
Copy link
Contributor Author

@meee1 this is ready for you to review. If you have any questions, just ask. I've kept 99.9% of the changes to the AltitudeAngelWings assemblies, with one minor exception - removing app.config settings (as we're no longer using them).

@casrya
Copy link

casrya commented Jul 29, 2023

Hi Rupert,

@rupertbenbrook

Thanks for the update, I merged and tested your PR (with master 142d367) and seems to be now working as expected with a basic user account login.

I did however find one bug on Windows 11 where it was throwing an exception during Mission planner shutdown.

I found the issue was in the MessagesService class and was able to fix as follows:

In the MessagesService constructor where Messages.Subscribe() is called, this call returns an IDisposable which can be saved as an instance variable and then disposed immediately before calling Messages?.Dispose()

In my case this prevents RemoveMessage() still being called after Messages has been disposed which was the cause of the exception (see stack trace at end).

That said, according to ReplaySubject(T).Dispose Method (System.Reactive.Subjects) | Microsoft Learn this should be done anyway so it might be some sort of race condition so perhaps there is a more reliable solution than this?

P.S I can post my modified code if necessary but I think it should be clear based on above description although perhaps you will not be able to reproduce anyway since from the github checks it looks like you might be on OSX?

Cheers,

casrya

--
INFO MissionPlanner.Controls.HUD - OnHandleDestroyed Start ERROR MissionPlanner.Program - RuntimeAssembly[] {} at mscorlib.dll.TimerQueue.FireNextTimers (IL offset: 0xf1) at mscorlib.dll.TimerQueueTimer.Fire (IL offset: 0x43) at mscorlib.dll.TimerQueueTimer.CallCallback (IL offset: 0x7f) at mscorlib.dll.ExecutionContext.Run (IL offset: 0x9) at mscorlib.dll.ExecutionContext.RunInternal (IL offset: 0x79) at System.Reactive.dll.AsyncLock.Wait (IL offset: 0xd0) at System.Reactive.dll.<>c__DisplayClass7_01.b__2 (IL offset: 0x0)
at System.Reactive.dll..Tick (IL offset: 0xe)
at System.Reactive.dll.
.OnNext (IL offset: 0x5a)
at System.Reactive.dll..OnNext (IL offset: 0x3c)
at System.Reactive.dll.InnerObserver.OnNext (IL offset: 0x0)
at System.Reactive.dll.AnonymousSafeObserver1.OnNext (IL offset: 0x16) at AltitudeAngelWings.dll.MultipleMessageDisplay.RemoveMessage (IL offset: 0x19) at AltitudeAngelWings.Plugin.dll.ControlOverlayMessageDisplay.RemoveMessage (IL offset: 0x2c) at AltitudeAngelWings.dll.UiThreadInvoke.Invoke (IL offset: 0x1b) at AltitudeAngelWings.dll.UiThreadInvoke.Invoke (IL offset: 0x20) at AltitudeAngelWings.Plugin.dll.<>c__DisplayClass0_1.<Configure>b__9 (IL offset: 0x5) at AltitudeAngelWings.dll.Resolver.Resolve (IL offset: 0x1) at AltitudeAngelWings.dll.ServiceLocator.GetService (IL offset: 0x77) Message: The type MissionPlanner.Plugin.PluginHost is not registered. ERROR MissionPlanner.Program - System.InvalidOperationException: The type MissionPlanner.Plugin.PluginHost is not registered. at AltitudeAngelWings.ServiceLocator.GetService[T](String key) in C:\Users\casrya\Downloads\MissionPlanner.Github\ExtLibs\AltitudeAngelWings\ServiceLocator.cs:line 79 at AltitudeAngelWings.ServiceLocator.Resolver.Resolve[T](String key) in C:\Users\casrya\Downloads\MissionPlanner.Github\ExtLibs\AltitudeAngelWings\ServiceLocator.cs:line 14 at AltitudeAngelWings.Plugin.ServiceLocatorConfiguration.<>c__DisplayClass0_1.<Configure>b__9(Func1 action) in C:\Users\casrya\Downloads\MissionPlanner.Github\ExtLibs\AltitudeAngelWings.Plugin\ServiceLocatorConfiguration.cs:line 36
at AltitudeAngelWings.UiThreadInvoke.Invoke[T](Func1 action) in C:\Users\casrya\Downloads\MissionPlanner.Github\ExtLibs\AltitudeAngelWings\UiThreadInvoke.cs:line 26 at AltitudeAngelWings.UiThreadInvoke.Invoke(Action action) in C:\Users\casrya\Downloads\MissionPlanner.Github\ExtLibs\AltitudeAngelWings\UiThreadInvoke.cs:line 17 at AltitudeAngelWings.Plugin.ControlOverlayMessageDisplay.RemoveMessage(Message message) in C:\Users\casrya\Downloads\MissionPlanner.Github\ExtLibs\AltitudeAngelWings.Plugin\ControlOverlayMessageDisplay.cs:line 54 at AltitudeAngelWings.Service.Messaging.MultipleMessageDisplay.RemoveMessage(Message message) in C:\Users\casrya\Downloads\MissionPlanner.Github\ExtLibs\AltitudeAngelWings\Service\Messaging\MultipleMessageDisplay.cs:line 26 at System.Reactive.AnonymousSafeObserver1.OnNext(T value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\AnonymousSafeObserver.cs:line 46
at System.Reactive.Linq.ObservableImpl.SelectMany2.ObservableSelector._.InnerObserver.OnNext(TResult value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\SelectMany.cs:line 998 at System.Reactive.Linq.ObservableImpl.Select2.Selector.
.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Select.cs:line 49
at System.Reactive.Linq.ObservableImpl.SkipWhile1.Predicate._.OnNext(TSource value) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\SkipWhile.cs:line 61 at System.Reactive.Linq.ObservableImpl.Timer.Periodic._.Tick(Int64 count) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Linq\Observable\Timer.cs:line 164 at System.Reactive.Concurrency.DefaultScheduler.<>c__DisplayClass7_01.b__2() in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Concurrency\DefaultScheduler.cs:line 114
at System.Reactive.Concurrency.AsyncLock.Wait(Action action) in D:\a\1\s\Rx.NET\Source\src\System.Reactive\Concurrency\AsyncLock.cs:line 71
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()`

@rupertbenbrook
Copy link
Contributor Author

Thanks @casrya, good spot. You're correct this is to do with disposal timing, but actually MessagesService wasn't using the pattern we have for other service classes using observables using the CompositeDisposer to handle this. I've pushed an update that uses this pattern and seems to fix the issue so if you could check your end that would be appreciated. I also spotted some methods that weren't passing CancellationToken to underlying methods, so fixed that too.

@casrya
Copy link

casrya commented Aug 1, 2023

Hi Rupert,

@rupertbenbrook

Tested here and all good, the CompositeDisposer is a good fix :)

Cheers,

casrya

@rupertbenbrook
Copy link
Contributor Author

Thanks @casrya , that's good to hear. Anything else you spot or improvements you'd like to see, please feel free to raise an issue and @ me or just get in touch.

@rupertbenbrook
Copy link
Contributor Author

@meee1 I merged the latest master into this PR, but the build appears to be broken. Looks like this commit broke the OpenDroneID plugin: 548dd34.

I've created PR #3157 to resolve this. It will need to be merged before this PR.

@rupertbenbrook
Copy link
Contributor Author

@meee1 thanks for merging the fix. I've merged into here and now the builds are passing again.

@rupertbenbrook
Copy link
Contributor Author

Hi @meee1 any feedback on this? Really keen to get this merged as we have a few other things lined up behind this.

@meee1 meee1 merged commit 9aae69f into ArduPilot:master Aug 12, 2023
7 checks passed
@meee1
Copy link
Contributor

meee1 commented Aug 12, 2023

ok reviewed and merged

@rupertbenbrook
Copy link
Contributor Author

Many thanks @meee1.

@rupertbenbrook rupertbenbrook deleted the aa-update branch August 12, 2023 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants