Skip to content

Repository files navigation

Neural-ESO: Provably Robust Learning-Based Control for Quadrotors

This repository contains the official implementation of the Neural-Extended State Observer (Neural-ESO) for robust quadrotor flight control. By bridging traditional ESO with a learning-based dual-pathway architecture, this framework dynamically predicts and compensates for unmodeled dynamics and external disturbances in real-time.

The codebase includes offline PyTorch training scripts with spectral normalization (Lipschitz constraints) and online ROS/MAVSDK deployment scripts for hardware flight testing using PX4 and OptiTrack.

Features

  • Data-Driven Disturbance Prediction: Utilizes a lightweight Multi-Layer Perceptron (MLP) to predict Z-axis disturbances ($z_3$) based on 5 system states (altitude, velocity, thrust, roll, pitch).
  • Provable Stability: Incorporates Spectral Normalization during training (Lipschitz constant $K=1$) to bound the neural network's output and guarantee closed-loop stability.
  • Linear ESO Core: Robust baseline control using Linear ESO, modified to accept neural feedforward commands alongside the standard Extended State Observer.
  • Hardware-Ready Deployment: Fully asynchronous Python deployment script utilizing MAVSDK for PX4 offboard control and vrpn_client_node for high-fidelity OptiTrack motion capture.

Repository Structure

  • TrainingBoxLandingDNNchangable.py - PyTorch training script for the Neural-ESO.
  • Test_BoxLandingLearningWithNN.py - ROS/MAVSDK online deployment and flight script.
  • requirements.txt - Python package dependencies.
  • README.md - This documentation file.

Requirements & Installation

The system requires Python 3.8+, ROS Noetic, and a PX4 Autopilot environment (either SITL or physical hardware).

  1. Download and extract the code: Download the provided .zip file and extract it to your local workspace.
    cd path/to/extracted/Neural-ESO-3051
    
  2. Install the required Python dependencies:
    pip install -r requirements.txt
    (Note: Ensure your ROS Noetic environment is sourced properly so rospy and geometry_msgs are available).

Usage

Phase 1: Train the Neural-ESO Model

The neural network learns the disturbance mapping from baseline flight logs.

  1. Place your baseline ESO flight log (.csv) in the directory.
  2. Update the FILENAME_TO_LOAD variable in TrainingBoxLandingDNNchangable.py.
  3. Run the training script:
    python TrainingBoxLandingDNNchangable.py
  4. Outputs: The script will generate three files required for deployment:
    • disturbance_model_BoxLanding.pth (Model Weights)
    • scaler_X_BoxLanding.pkl (Input Scaler)
    • scaler_y_BoxLanding.pkl (Output Scaler)

Phase 2: Hardware Deployment

Ensure your OptiTrack system is publishing pose data to /vrpn_client_node/Drone1/pose and your PX4 autopilot is listening for MAVSDK UDP connections on udp://:14550.

  1. Launch the flight script:
    python Test_BoxLandingLearningWithNN.py
  2. Flight Sequence: The quadrotor will automatically arm, take off to a hover state to lock its initial position, and then execute the pre-programmed trajectory while running the Neural-ESO feedforward loop at a target rate of 50Hz ($dt = 0.02s$).
  3. Logging & Visualization: Upon landing, the script will automatically save a new .csv flight log and generate matplotlib figures comparing the actual trajectory, ESO residual estimations, and NN predictions.

License

This project is licensed under the MIT License

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages