Skip to content

Alansi775/Drone-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drone RTK Control System

Overview

A professional-grade autonomous drone control system built for the DJI 350 RTK platform with real-time kinematic positioning capabilities. This system integrates NVIDIA Jetson Xavier NX as the flight computer, Pixhawk Orange Cube autopilot, and Here4 RTK GPS module for centimeter-level precision navigation.

The platform enables autonomous flight control, real-time video streaming, precision GPS navigation with RTK corrections, and remote operation through UDP-based communication protocols.


Hardware Architecture

Core Components

Component Specification Role
Flight Platform DJI 350 RTK Quadcopter Airframe with integrated RTK module
Autopilot Pixhawk Orange Cube Flight control and stabilization
Companion Computer NVIDIA Jetson Xavier NX Mission planning and autonomous control
RTK GPS Here4 RTK Dual Frequency Precision positioning (cm-level accuracy)
Camera IMX477 12MP Aerial imaging and streaming
Network Ethernet Gateway UDP-based ground station communication

System Specifications

  • Position Accuracy: ±2cm (with RTK fix)
  • Camera Resolution: 4056x3040 (12MP)
  • Video Modes: 1080p@60fps, 4K@30fps
  • Network: Static IP configuration (192.168.100.x)
  • Processing: ARM 6-core CPU with NVIDIA GPU acceleration

Key Features

  • Autonomous Flight Control: Full offboard mode operations via MAVSDK
  • RTK Precision Navigation: Centimeter-level positioning using Here4 GPS module
  • Real-time Video Streaming: Hardware-accelerated video encoding via NVIDIA GStreamer
  • Joystick Integration: UDP-based joystick control with switch state management
  • Failsafe Systems: Automatic timeout handling and emergency stop capabilities
  • Multi-Service Architecture: Modular systemd services for scalability
  • Advanced Telemetry: Real-time GPS, altitude, battery, and vehicle state monitoring

System Architecture

Ground Station (Commander)          Jetson Xavier NX (Drone)
   192.168.100.1                       192.168.100.2
        |                                     |
        +-------- UDP 5656 -------> Joystick Control
        |                                     |
        +-------- UDP 5658 <------- GPS Bridge (RTK Data)
        |                                     |
        +-------- HTTP 8080 <------- Video Stream
        |                                     |
        +-------- TCP 50051 <------- MAVSDK Server


  MAVSDK Interface (Port 50051)
           |
    +------+------+
    |      |      |
   PX4   GPS   Telemetry
 Control Bridge  Engine

Core Services

1. mavsdk-server.service

Provides MAVSDK interface for drone communication.

  • Port: 50051 (TCP)
  • Function: Mission planning, vehicle state queries, offboard control
  • Protocol: gRPC

2. drone-control.service

Main autonomous flight control handler.

  • Port: UDP 5656
  • Function: Processes joystick inputs and switch states
  • Features: Attitude rate control, failsafe monitoring

3. gps-bridge.service

RTK GPS data bridge to ground station.

  • Port: UDP 5658
  • Function: Streams GPS position, satellite count, fix type
  • Data Format: JSON over UDP

4. video-stream.service

Hardware-accelerated video streaming service.

  • Port: HTTP 8080
  • Format: JPEG/H.264 stream
  • Resolution: Dynamic (1080p/4K selectable)
  • Encoding: NVIDIA GStreamer pipeline

Software Components

droneCommands/

Mission and control handlers for autonomous operations.

  • full_control.py: Enhanced multi-switch drone control interface
  • gps_bridge.py: RTK GPS data bridge with real-time streaming
  • joystick_to_offboard.py: Joystick input processing and attitude command generation
  • arm.py: Arming/disarming automation with safety checks
  • ThrottleControl.py: Precision throttle management

microservices/

Distributed service components for modular architecture.

  • drone_receiver.py: UDP packet receiver and command parser
  • jetson_kamera.py: Camera interface with hardware acceleration
  • jetson_yayinci.py: Video encoder and HTTP streaming server
  • joystick_udp_receiver.py: Joystick input UDP receiver
  • sender.py: Example UDP sender for testing network connectivity

systemd_services/

Systemd unit files for service management.

  • mavsdk-server.service: MAVSDK server daemon
  • drone-control.service: Main control service
  • gps-bridge.service: GPS bridge service
  • video-stream.service: Video streaming service

Installation & Setup

Prerequisites

  • Ubuntu 20.04+ (Jetson Xavier NX with L4T)
  • Python 3.8+
  • Network connectivity (Ethernet recommended)

Required Python Packages

pip install mavsdk asyncio
pip install opencv-python
pip install flask
pip install numpy

Network Configuration

Configure static IP on Jetson Xavier NX:

# Edit netplan configuration
sudo nano /etc/netplan/00-installer-config.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 192.168.100.2/24
      routes:
        - to: default
          via: 192.168.100.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

# Apply configuration
sudo netplan apply

PX4 Configuration

Essential PX4 parameter configuration:

COM_ARM_WO_GPS=1           # Allow arming without GPS
UAVCAN_ENABLE=3            # Enable UAVCAN and CAN
RTK_CONFIG=2               # RTK mode configuration
RTK_SURVEY_MASK=0          # Skip survey-in
MAV_0_RATE=800             # Telemetry rate

Configure via QGroundControl or MAVProxy command line.

Service Installation

# Copy service files
sudo cp systemd_services/*.service /etc/systemd/system/

# Enable services
sudo systemctl daemon-reload
sudo systemctl enable mavsdk-server.service drone-control.service gps-bridge.service video-stream.service

# Start services
sudo systemctl start mavsdk-server.service
sudo systemctl start drone-control.service
sudo systemctl start gps-bridge.service
sudo systemctl start video-stream.service

# Check status
sudo systemctl status mavsdk-server.service

Operation

Basic Flight Operations

from mavsdk import System
import asyncio

async def main():
    drone = System(mavsdk_server_address="localhost", port=50051)
    await drone.connect()
    
    # Arm and take off
    await drone.action.arm()
    await drone.action.takeoff()
    
    # Monitor telemetry
    async for position in drone.telemetry.position():
        print(f"Position: {position.latitude_deg}, {position.longitude_deg}")

asyncio.run(main())

Joystick Control

Connect joystick to ground station and launch:

python3 droneCommands/full_control.py

Monitor drone status on port 8080:

http://192.168.100.2:8080/video

GPS RTK Status Monitoring

# Real-time GPS monitoring from ground station
nc -l -u -p 5658  # Listen on UDP 5658

Testing & Debugging

Network Connectivity Test

# From ground station (192.168.100.1)
ping 192.168.100.2
nc -u 192.168.100.2 5656   # Test UDP 5656
curl http://192.168.100.2:8080/video   # Test video stream

Service Logs

# Monitor service logs in real-time
sudo journalctl -u drone-control.service -f

# View service startup logs
sudo journalctl -u mavsdk-server.service --no-pager

PX4 Firmware Status

# Via MAVProxy
mavproxy.py --master 127.0.0.1:50051 --console

# Check vehicle health
param set COM_ARM_WO_GPS 0  # Require GPS for arming
param set RTK_CONFIG 2       # Verify RTK setup

Configuration Parameters

Network Settings

# UDP Communication Ports
UDP_JOYSTICK_PORT = 5656    # Joystick commands
UDP_GPS_PORT = 5658         # GPS data stream
HTTP_VIDEO_PORT = 8080      # Video streaming

# Network Addresses
JETSON_IP = "192.168.100.2"
GROUND_STATION_IP = "192.168.100.1"

Flight Parameters

MAX_PITCH_RATE = 30.0       # degrees/second
MAX_ROLL_RATE = 30.0        # degrees/second
MIN_THRUST = 0.0            # minimum throttle
MAX_THRUST = 0.9            # maximum throttle
DEADZONE = 0.10             # joystick deadzone
COMMAND_RATE = 0.05         # 50Hz control rate
FAILSAFE_TIMEOUT = 3.0      # timeout seconds

Camera Settings

Sensor: IMX477
Resolution: 4056x3040
Capture Width: 1280
Capture Height: 720
Framerate: 30fps
Format: BGRx
GStreamer Pipeline: NVIDIA Hardware Acceleration

Performance Specifications

Metric Value
Position Update Rate 1 Hz
Control Command Rate 50 Hz
Video Latency <500ms
RTK Convergence Time 30-60 seconds
Satellite Lock Time 60-90 seconds
System Uptime Target 99.5%

Troubleshooting

Common Issues

No GPS Fix

  • Verify Here4 module is powered and connected
  • Check RTK corrections are being transmitted
  • Wait 2-3 minutes for RTK convergence
  • Verify PX4 COM_ARM_WO_GPS parameter setting

Video Lag

  • Check Jetson temperature (throttling possible above 80°C)
  • Reduce video resolution in GStreamer pipeline
  • Verify UDP connection quality
  • Monitor network utilization with iftop

Failsafe Triggered

  • Verify joystick UDP packets are arriving
  • Check FAILSAFE_TIMEOUT setting (default 3 seconds)
  • Monitor service logs: journalctl -u drone-control.service -f
  • Test connectivity: nc -u 192.168.100.1 5656

MAVSDK Connection Refused

  • Verify mavsdk-server.service is running
  • Check port 50051 is listening: netstat -tuln | grep 50051
  • Restart service: sudo systemctl restart mavsdk-server.service

Security Considerations

  • Use firewall rules to restrict UDP ports to authorized IPs
  • Implement authentication tokens for remote operations
  • Encrypt video stream in production deployments
  • Monitor system logs for unauthorized access attempts
  • Regular firmware updates for PX4 and Jetson

Development Roadmap

  • Autonomous mission planning with waypoint navigation
  • Machine learning-based obstacle detection
  • Multi-drone coordination system
  • Web-based ground control station
  • Advanced flight logs and data analysis
  • RTK baseline convergence monitoring
  • Predictive failsafe with terrain awareness

Contributing

Contributions are welcome. Please ensure:

  • Code follows PEP 8 style guidelines
  • All services include proper error handling
  • Documentation is updated with changes
  • Testing performed on actual hardware

Documentation References


Support & Contact

For technical support, issues, or inquiries:

  • Create an issue in the GitHub repository
  • Check existing documentation and troubleshooting guides
  • Review service logs and system diagnostics

License

This project is provided as-is for educational and professional use.


Acknowledgments

Built on industry-standard drone control frameworks:

  • MAVSDK for vehicle communication
  • PX4 Autopilot for flight control
  • NVIDIA CUDA for GPU-accelerated processing
  • Open-source drone community

Last Updated: 2026 System Version: 1.0 Status: Production Ready

About

Drone RTK Control System

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages