A Python package for generating DJI task plan KMZ files with type safety and integrity checks
Project description
DjiKMZ - DJI Task Plan KMZ File Generator
⚠️ DEVELOPMENT STATUS NOTICE
This project is currently in active development and testing phase. Due to time and resource constraints, real-world flight testing has only covered partial functionality and drone models. (Mostly M350)
Please use with caution in production environments. We strongly recommend thorough testing/validation on controller before field deployment.
🤝 Contributions and bug reports are welcome! Help us improve the library by:
- Testing with different drone models
- Reporting issues and edge cases
- Contributing code improvements
- Sharing real-world usage experiences
A Python package for generating DJI task plan KMZ files with comprehensive type safety, validation, and integrity checks.
Goal
- 🛡️ Type Safety: Full type hints and Pydantic models for all data structures
- ✅ Validation: Comprehensive validation of waypoints, coordinates, and flight parameters
- 🔒 Integrity Checks: Built-in validation for DJI-specific constraints and limits
- 📦 KMZ Generation: Generate valid KMZ files compatible with DJI flight planning software
- 🎯 Abstraction: High-level API for easy waypoint and mission creation
Installation
pip install djikmz
Quick Start
from djikmz import DroneTask
# Create a mission
mission = (DroneTask("M350", "Survey Pilot")
.name("Basic Survey")
.payload("P1")
.speed(8.0)
.altitude(75.0)
.fly_to(37.7749, -122.4194)
.take_photo("point0")
.hover(2.0)
.fly_to(37.7750, -122.4195)
.take_photo("point1"))
# Generate KMZ
mission.to_kmz("mission.kmz")
Supported Drone Models
- M350 (Matrice 350 RTK)
- M300 (Matrice 300 RTK)
- M30/M30T (Matrice 30 Series)
- M3E/M3T/M3M (Mavic 3 Enterprise Series)
- M3D/M3TD (Mavic 3 Classic Series)
- Other drones may be added in future releases.
API Reference
Task Builder API
from djikmz import DroneTask
# TaskBuilder API - Primary interface
mission = DroneTask(drone_model, pilot_name)
.payload(payload_model) # Optional payload model
.name(mission_name)
.speed(m_per_sec)
.altitude(meters)
# Flight commands
.fly_to(lat, lon, height=None) # Optional height for altitude
# waypoint settings
.height(meters)
.speed(m_per_sec)
.turn_mode("turn_at_point"|"early_turn"|"curve_and_stop"|"curve_and_pass")
# Camera actions
.take_photo(label)
.start_recording()
.stop_recording()
# Hover
.hover(seconds)
# Aircraft Heading
.heading(angle)
# Gimbal control (absolute positioning)
.gimbal_down(45) # Point down to 45° from forward
.gimbal_up(30) # Point up to 30° from forward
.gimbal_front() # Point straight forward (0°)
.gimbal_pitch(-90) # Precise pitch: -90° (straight down)
.gimbal_yaw(180) # Precise yaw: 180° (facing south)
.gimbal_rotate(pitch=-45, yaw=90) # Combined rotation
# Save to a ready to use Dji KMZ file
mission.to_kmz(file_path)
# Or generate KML for further processing
mission.build() -> KML
Advanced Model Access
from djikmz.model import KML, Waypoint, DroneModel
from djikmz.model.action import TakePhotoAction, HoverAction
# For direct model manipulation and custom integrations
waypoint = Waypoint(lat=37.7749, lon=-122.4194)
action = TakePhotoAction(action_id=1)
Validation
DjiKMZ provides comprehensive validation:
- Coordinates: Latitude [-90,90], Longitude [-180,180]
- Drone Limits: Speed, altitude, and capability validation
- DJI Standards: Action IDs, waypoint limits, XML structure
TODOs
- Load existing KMZ files and parse waypoints
- Task modifications
Development
# Clone the repository
git clone https://github.com/yourusername/djikmz.git
cd djikmz
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djikmz-0.1.0.tar.gz.
File metadata
- Download URL: djikmz-0.1.0.tar.gz
- Upload date:
- Size: 58.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
765693b89ccc000081c6dc76b489d3a8853050bcac20e8f54b646b58fb266424
|
|
| MD5 |
2872b01906e67e15c62fc23af54c86bf
|
|
| BLAKE2b-256 |
7d148841aa02ae43fa67c7ed75d99ac1ff1fe71a8fe5dc4b52586c0f7d25da89
|
File details
Details for the file djikmz-0.1.0-py3-none-any.whl.
File metadata
- Download URL: djikmz-0.1.0-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c9e180cc36d7b2671372b461a1ba568d85be19a859fc05a62afe7ea10a44979
|
|
| MD5 |
216d769830558412828e6bb979ab8102
|
|
| BLAKE2b-256 |
489429cde6be31f2c3b7ef586a98bca1f7b81d0d785f64e129405747f9bbf99f
|