How dkapur17/djicontrolserver works
Project type and purpose
• This is a single-module Android application (Kotlin) that runs an embedded REST HTTP server on port 8080.
• Its purpose is to accept high-level REST GET requests (e.g., /takeoff, /moveForward/{dist}, /getCurrentIMUState) from any client, translate them into DJI SDK commands, and relay them to a DJI drone via a connected remote controller.
• It also collects IMU state data in memory and exposes endpoints to start/stop sampling and retrieve or clear that data.
File structure
• Top-level:
• app/ – Android Studio Gradle module
• assets/ – static assets used in README (logo, screenshots)
• build.gradle, settings.gradle, gradle wrapper, etc.
• app/src/main/java/com/rrc/djiControlServer:
• MApplication.kt (Application subclass – initializes services)
• MainActivity.kt (UI + server startup)
• app/src/main/res: Android UI layouts & resource definitions
• app/src/test & androidTest: unit and instrumentation tests
• No external microservices – everything runs inside one monolithic APK.
README for additional insights
• The README enumerates ~40 GET endpoints (connection, takeoff/land, control modes, motion planning, IMU collection, positional/velocity commands, etc.).
• Usage instructions indicate you must supply the DJI API key in AndroidManifest and connect the phone to a DJI remote controller.
• Clients (Python or any REST client) issue HTTP calls to the phone’s IP:8080.
a. Main components
1. Android App (APK) on Mobile Device
• Application Layer
• Embedded HTTP Server (e.g., NanoHTTPD or Ktor)
• Controller Layer (maps REST endpoints → service calls)
• Service/Domain Layer (DroneControlService, IMUCollector)
• Data Store (in-memory list of IMUState objects)
• DJI Mobile SDK (3rd-party library)
2. DJI Remote Controller
3. DJI Drone Hardware
4. External REST Client (e.g., Python script, web UI, Postman)
b. Relationships & data flow
• REST Client → HTTP Server (GET request)
• HTTP Server → Controller Layer → Service Layer
• Service Layer → DJI SDK API → Remote Controller → Drone
• Drone → SDK → Service Layer for telemetry (IMU, heading)
• Service Layer → Data Store (collect/clear telemetry)
• Service Layer → HTTP Server → HTTP Response → REST Client
c. Architectural patterns & design principles
• Layered (Presentation/Network → Controller → Service → SDK/Hardware)
• Use of Kotlin Coroutines for asynchronous commands & IMU sampling
• In-memory state management (no persistent DB)
• Monolithic APK hosting both API layer and business logic
d. Key technologies & frameworks
• Kotlin & Android SDK
• Embedded HTTP server (NanoHTTPD or Ktor HTTP)
• DJI Mobile SDK (for drone control & telemetry)
• Android lifecycle components (Application, Activity)
• Kotlin Coroutines