FreeTAKTeam / FreeTAKUAS

DJI drone flying app with integrations for FreeTAKServer
MIT License
83 stars 16 forks source link

Terrain point resolution, Offline DEM #5

Open mkrupczak3 opened 2 years ago

mkrupczak3 commented 2 years ago

Hi,

I've been working on a program called OpenAthena which finds the spot on the ground a drone is looking at, in any given photo, using terrain elevation data

It works pretty well:

pretty_good

concept_whiteboard_diagram

I'd like to donate, free of license or restriction, this technique and functionality to integrate it with the ATAK-UAS app. Could drastically improve the process of forward artillery observation and search and rescue use cases of the ATAK platform

Required for this technique: a Digital Elevation Model (DEM) GeoTIFF file covering at least the UAS's location and the location of the subject of its camera

With Open Athena, a DEM of a customized area (large or small alike) can be downloaded for offline use (as a GeoTIFF file) by the Python eio clip command from the easy to use Python elevation package

I'm away from my workstation at the moment, but I'd like to ask: does ATAK-UAS store a map, including a Digital Elevation Model, for offline use?

If so, it will be pretty easy to implement this technique in the app. All the functionality can be re-wrote with some basic Java, as long as there's a way to obtain the elevation at a certain lat/lon.

Otherwise, if ATAK-UAS currently does not implement a DEM, it should still be fairly simple to add the OpenAthena technique along with a system that can read in a GeoTIFF file into the ATAK-UAS app

No Python required in either case :)

-Matthew

mkrupczak3 commented 2 years ago

Mentioned previously with @brothercorvo in this issue: https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/issues/205#issuecomment-1133137638

mkrupczak3 commented 2 years ago

@rdkgit 👀

mkrupczak3 commented 2 years ago

Related documentation for the ATAK-UAS app: https://github.com/FreeTAKTeam/FreeTAKServer-User-Docs/blob/main/docs/docs/tools/FreeTAKUAS.md

brothercorvo commented 2 years ago

What do you think @niccellular this could improve the accuracy of the target, currently we ignore terrain elevation

mkrupczak3 commented 2 years ago

So I thought it'd be worth sharing:

I've been really surprised by the efficacy of this technique, that is: using drone sensor data combined with an existing public global Digital Elevation Model data to find the exact location a drone's camera is looking at

The quality of the sensor data from the drones is usually quite good, and in the best case terrain resolution matches can be within 1-2 meters of the exact location

image of railway terrain resolution match proof of concept

In the current version, OpenAthena can automatically extract sensor data from a DJI or Skydio UAS' image: image of command line interface OpenAthena is given cobb.tif and DJI_0419.JPG and resolves a GPS location on the ground

The quality of the free Digital Elevation Model is quite good as well, providing a significant advantage in accuracy with this technique

The open source Digital Elevation Model dataset I use was generated by the Space Shuttle Radar Topography Mission (SRTM) using a technique known as synthetic aperture radar. More detail is available here, but basically the short of it is that the radar technique is really good because it will go through stuff like cloud cover and surface foliage (trees) before bouncing off of hard terrain. The model's reported altitude for every datapoint is pretty darn close to the real thing

Also, the elevation model is free to use (download clips of), and it covers the entire earth

The resolution is 30 meters between each datapoint, going North, East, South, West, etc, but the vertical accuracy is within ~7 meters or so. OpenAthena just uses the altitude of the nearest datapoint (without any weighting or averaging)

mkrupczak3 commented 2 years ago

Mainly I bring this up because FreeTAK seems like the perfect platform for this kind of software

In conflicts today, consumer rotary-wing aircraft are already being commonly used for forward artillery observation (and to devastating effect)

My hope is that implementation on the FreeTAK-UAS app may simplify the targeting process for the operator of a UAS and make the process of forward artillery observation easier, more accurate, and less prone to error

In addition, the ability to quickly get location data instantly into the FreeTAK platform may improve situational awareness for commanders and armed forces

brothercorvo commented 2 years ago

@mkrupczak3 just to be clear: this is a Open Source project driven by regular people in our free time. There is no commercial interest here. So if you want to contribute all you need to do is to look at the code (based on the DJI SDK and submit a pull request. @niccellular and myself will review it and approve it that's make sense.

mkrupczak3 commented 2 years ago

Sounds good 👍

I have no commercial interest at this time, and regardless I wish to contribute this to FreeTAK without any license or restriction

I'm working on internationalization of OpenAthena right now, but after I can take a deeper look into the FreeTAK app

OSGEO can be imported into an Android project, details in the following link. I anticipate this will probably be the most difficult part of implementation: https://trac.osgeo.org/gdal/wiki/BuildingForAndroid building as an "easy to use" .aar library: https://github.com/paamand/GDAL4Android

The OpenAthena codebase is fairly readable, in case either of y'all would like to evaluate in anticipation of eventual integration into FreeTAK

brothercorvo commented 2 years ago

Ok. OpenAthena is written in Python. FT UAS is an Android java application. You should convert your classes in java

On Sun., May 22, 2022, 2:52 p.m. mkrupczak3, @.***> wrote:

Yes,

I have no commercial interest at this time, and regardless I wish to contribute this to FreeTAK without any license or restriction

I'm working on internationalization of OpenAthena right now, but after I can take a deeper look into the FreeTAK app

OSGEO can be imported into an Android project, details in the following link. I anticipate this will probably be the most difficult part of implementation: https://github.com/paamand/GDAL4Android

The OpenAthena codebase https://github.com/mkrupczak3/OpenAthena is fairly readable, in case either of y'all would like to evaluate in anticipation of eventual integration into FreeTAK

— Reply to this email directly, view it on GitHub https://github.com/FreeTAKTeam/FreeTAKUAS/issues/5#issuecomment-1133943322, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOPIAPLUBDRJD4W3MUO46DLVLJX6ZANCNFSM5WQUX7ZA . You are receiving this because you were mentioned.Message ID: @.***>

niccellular commented 2 years ago

@mkrupczak3 @brothercorvo

This seems like a great enhancement for FTUAS. As mentioned we currently do not consider terrain when calculating drone's Sensor Point of Interest (SPI) because we do not have elevation data.

Trying to think through how we can use this capability. A naïve approach would be to require the user to load digital elevation data in some predetermined format, (DTED, GeoTIFF, etc) onto their device, like their SDcard. Then the app provides a toggle to enable the new calculations that leverage the elevation data.

This is a rough approach but does fit the ATAK model, as all users typically load their own DTED data.

If the maths involved in computing the more accurate target can be implemented in Java. We should be able to make it happen.

Another thought, we currently bundle HERE maps via their sdk. I wonder if they provide elevation data from an online source. This would only work for internet connected devices and might not be great for Ukraine like ops.

mkrupczak3 commented 2 years ago

Sounds good

I think offline operation is very important for a Minimum Viable Product, so or now I'm going to focus on getting a GUI version of OpenAthena ready, then a simple Android version (if I can figure out how to get GDAL working as a library)

The code for OpenAthena is available in case you're interested in adapting it for FreeTAK in the mean time. Most of the math is very simple for the calculation itself, I think the hardest part honestly is importing the GDAL library and being able to read data from a GeoTIFF DEM file

mkrupczak3 commented 2 years ago

@niccellular @brothercorvo I've updated OpenAthena to support SK-42 Gaus Krüger values (as used as labels on old Soviet maps) and more drone models

Stubbed out an Android version here with some Android binaries for the GDAL library necessary for parsing GeoTIFF DEM's. Not functional yet though

Is there any interest in this project from the DHS Science and Technology directorate? I'd like to transfer ownership of the project if possible. Think y'all might be able to move on this faster than myself

mkrupczak3 commented 1 year ago

@brothercorvo @niccellular I've managed to port the core of OpenAthena to Java, get it working in an Android app, and integrate the tiff-java library maintained by the National Geospatial Intelligence Agency for reading a GeoTIFF DEM.

I would really like to provide an implementation for use with FreeTAK. The repo is currently licensed GPLv3.0 instead of LGPL 2.1, but I can provide the Java core and the GeoTIFF parsing implementation under whatever license would be compatible with the FreeTAK project