Skip to content

Create QField plugin for generating flightplans, including user configuration fields & DEM sampling #633

@spwoodcock

Description

@spwoodcock

Requirement

  • Rather than develop a mobile app ourselves, we could use a QField plugin.
  • QML plugins can use JavaScript, so we would need to convert the login in the drone-flightplan package to JS.

User Story

  1. Go to QField project, with plugin already synced.
  2. Click on the task area square on the map --> the plugin button 'Generate flightplan' appears.
  3. User clicks button to generate flightplan, and the file is generated and downloaded to their phone.
  4. (bonus) instead of downloading the file, the user already has the drone controller plugged into their phone via USB. Clicking 'Generate flightplan' copies the file to the relevant place on the external storage of the controller, making it immediately flyable!

Implementation

DEM raster pixel value extraction

  • One key barrier is the elevation extraction from the DEM layer - can we do this within the plugin?
  • The DEM is cut out from a global DEM using our AOI, then will be included in the QField project files.
  • Alternatively we could make a web query for this, but (1) I'm not sure how feasible it is (2) it's less robust than bundling a <50MB DEM file.

Flightplan generation in JavaScript

  • We also need to call the .js logic within the QML, return the geojson, and load it as a layer into the project.
  • The actual logic for this is mostly Python, with some basic geospatial algorithms, e.g. generating a grid of squares over an area. So we need to convert to JavaScript and QGIS engine (geospatial queries) logic for this.
  • I hope we can easily hook into the QGIS engine for this.

Getting the flightplan file

  • Ideally we can also convert the geojson --> WPML XML, then download onto the users device to loading on the drone.
  • We could just download this file to the users device, then they follow the usual method of copying the file to the connected drone flight controller filesystem (Android).
  • Alternatively, it looks like we have WRITE_EXTERNAL_STORAGE permission for QField already: https://github.com/opengisch/QField/blob/master/platform/android/AndroidManifest.xml.in#L32, so is anything stopping us doing this directly from the plugin, as long as the drone controller is plugged into the phone via USB?

WIP at https://github.com/hotosm/drone-tm/tree/develop/src/qfield-plugin

Additional considerations

Metadata

Metadata

Assignees

Labels

backendRelated to backend codeeffort:highBroader scope task with unclear timeline (consider splitting)enhancementNew feature or requestpriority:highShould be addressed as a priorityrepo:drone-tm

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions