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

Refactor ADS-B input support in Mission Planner #3251

Merged
merged 22 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8ad605c
Fix ADSB: heading, speed & callsign, fix unit conv
MUSTARDTIGERFPV Oct 24, 2023
c14175b
Add Squawk codes to SBS-1 decode
MUSTARDTIGERFPV Oct 24, 2023
ffaae9d
Debug-filled functional 1Hz ADS-B
MUSTARDTIGERFPV Oct 25, 2023
8138473
Send less planes faster if less are in radius
MUSTARDTIGERFPV Oct 25, 2023
b986400
Fix ADS-B unit conversions, fix internal API, add velocities
MUSTARDTIGERFPV Oct 30, 2023
8bdf961
Use ADS-B ThreatLevel from MAV
MUSTARDTIGERFPV Oct 31, 2023
c2ee543
Clean up old planes from our internal memory
MUSTARDTIGERFPV Oct 31, 2023
e8179e4
Merge remote-tracking branch 'origin' into adsb-ticks
MUSTARDTIGERFPV Oct 31, 2023
829efce
Add ADS-B Collision risk to tooltip
MUSTARDTIGERFPV Oct 31, 2023
7787e78
Fix ADS-B radius render errors
MUSTARDTIGERFPV Oct 31, 2023
db9ec5e
Improve collision risk tooltip wording
MUSTARDTIGERFPV Oct 31, 2023
b205ee8
Pass source to UpdatePlanePosition
MUSTARDTIGERFPV Oct 31, 2023
4dfe01c
Only update threat level when necessary, fix messages
MUSTARDTIGERFPV Nov 1, 2023
4d4dfe6
Shorten ADS-B loop, simplify code
MUSTARDTIGERFPV Nov 4, 2023
436994c
Remove log lines
MUSTARDTIGERFPV Nov 5, 2023
0aec567
Only show tooltips on hover for ADSB
MUSTARDTIGERFPV Nov 14, 2023
780f3bf
Fix scaling bugs & add user-agent
MUSTARDTIGERFPV Feb 17, 2024
f254844
Merge branch 'master' of https://github.com/ArduPilot/MissionPlanner …
MUSTARDTIGERFPV Apr 18, 2024
09cd0ea
Fix merge issue
MUSTARDTIGERFPV Apr 18, 2024
059e065
Improve ADSB HTTP logic, rate limiting, default to adsb.lol
MUSTARDTIGERFPV May 16, 2024
3913f24
Merge branch 'master' into adsb-ticks
MUSTARDTIGERFPV May 16, 2024
202e55b
Merge branch 'master' into adsb-ticks
MUSTARDTIGERFPV Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions ExtLibs/ArduPilot/Mavlink/MAVLinkInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5122,15 +5122,21 @@ public async Task<MAVLinkMessage> readPacketAsync()
var id = adsb.ICAO_address.ToString("X5");

if (_UpdateADSBPlanePosition != null)
_UpdateADSBPlanePosition(this, new adsb.PointLatLngAltHdg(adsb.lat / 1e7,
_UpdateADSBPlanePosition(this, new adsb.PointLatLngAltHdg(
adsb.lat / 1e7,
adsb.lon / 1e7,
adsb.altitude / 1000.0, adsb.heading * 0.01f, adsb.hor_velocity * 0.01f, id,
DateTime.Now)
{
CallSign = Encoding.UTF8.GetString(adsb.callsign),
Squawk = adsb.squawk,
Raw = adsb
}
adsb.altitude / 1000,
adsb.heading * 0.01f,
adsb.hor_velocity,
id,
DateTime.Now
)
{
CallSign = Encoding.UTF8.GetString(adsb.callsign),
Squawk = adsb.squawk,
Raw = adsb,
VerticalSpeed = adsb.ver_velocity,
}
);
}

Expand Down
16 changes: 14 additions & 2 deletions ExtLibs/Maps/GMapMarkerQuad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,26 +198,38 @@ public override void OnRender(IGraphics g)
double width =
(Overlay.Control.MapProvider.Projection.GetDistance(Overlay.Control.FromLocalToLatLng(0, 0),
Overlay.Control.FromLocalToLatLng(Overlay.Control.Width, 0)) * 1000.0);
// size of a square meter in pixels on our map
double m2pixelwidth = Overlay.Control.Width / width;

GPoint loc = new GPoint((int) (LocalPosition.X - (m2pixelwidth * warn * 2)), LocalPosition.Y);

var markerDimension = (int)Math.Abs(loc.X - LocalPosition.X);
if (markerDimension == 0)
{
return;
}

if (m2pixelwidth > 0.001 && warn > 0)
g.DrawArc(Pens.Orange,
new System.Drawing.Rectangle(
LocalPosition.X - Offset.X - (int) (Math.Abs(loc.X - LocalPosition.X) / 2),
LocalPosition.Y - Offset.Y - (int) Math.Abs(loc.X - LocalPosition.X) / 2,
(int) Math.Abs(loc.X - LocalPosition.X), (int) Math.Abs(loc.X - LocalPosition.X)), 0,
markerDimension, markerDimension), 0,
360);

loc = new GPoint((int) (LocalPosition.X - (m2pixelwidth * danger * 2)), LocalPosition.Y);
markerDimension = (int)Math.Abs(loc.X - LocalPosition.X);
if (markerDimension == 0)
{
return;
}

if (m2pixelwidth > 0.001 && danger > 0)
g.DrawArc(Pens.Red,
new System.Drawing.Rectangle(
LocalPosition.X - Offset.X - (int) (Math.Abs(loc.X - LocalPosition.X) / 2),
LocalPosition.Y - Offset.Y - (int) Math.Abs(loc.X - LocalPosition.X) / 2,
(int) Math.Abs(loc.X - LocalPosition.X), (int) Math.Abs(loc.X - LocalPosition.X)), 0,
markerDimension, markerDimension), 0,
360);
}
}
Expand Down
17 changes: 17 additions & 0 deletions ExtLibs/Utilities/Download.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,23 @@ public static async Task<string> GetAsync(string uri)
return await Task.Run(() => (content));
}

public struct HTTPResult
{
public string content;
public HttpStatusCode status;
}

/// <summary>
/// Perform a GET request and return the content and status code
/// </summary>
public static async Task<HTTPResult> GetAsyncWithStatus(string uri)
{
var httpClient = new HttpClient();
var response = await httpClient.GetAsync(uri);
var content = await response.Content.ReadAsStringAsync();
return await Task.Run(() => (new HTTPResult() { content = content, status = response.StatusCode }));
}

public static event EventHandler<HttpRequestMessage> RequestModification;

public static async Task<bool> getFilefromNetAsync(string url, string saveto, Action<int, string> status = null)
Expand Down
3 changes: 3 additions & 0 deletions ExtLibs/Utilities/PointLatLngAlt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class PointLatLngAlt: IComparable
public static readonly PointLatLngAlt Zero = new PointLatLngAlt();
public double Lat { get; set; } = 0;
public double Lng { get; set; } = 0;
/// <summary>
/// Altitude in meters
/// </summary>
public double Alt { get; set; } = 0;
public string Tag { get; set; } = "";
public string Tag2 { get; set; } = "";
Expand Down
Loading
Loading