Parameter optimization for a TREX 550 flybarless helicopter using metaheuristic algorithms and state-space modeling
- About
- Features
- Installation
- Prerequisites
- Quick Start
- Algorithms Implemented
- Usage Guide
- Parameter Description
- Project Structure
- Results Visualization
- Troubleshooting
- Contributing
- Citation
- License
- Authors
This project implements system identification for an unmanned TREX 550 flybarless helicopter using the state-space structure based on Bernard Mettler's Yamaha RMAX helicopter model. The system optimizes 40 aerodynamic and control parameters to maximize the correlation between actual flight test data and simulated model outputs.
Maximize the Pearson correlation coefficient between:
- Actual flight test data from the TREX 550 helicopter
- Simulated outputs from the state-space model
The optimization problem involves a 40-dimensional parameter space representing the A, B, C, and D matrices of the state-space model with 13 states, 4 inputs, and 10 measurable outputs.
- Multiple Optimization Algorithms: Six different metaheuristic algorithms implemented
- Real Flight Data: Validated using actual flight test data from TREX 550 helicopter
- State-Space Modeling: Based on Bernard Mettler's proven helicopter dynamics model
- Performance Optimizations: Parallel computing, memory optimization, and progress tracking
- Profiling Tools: Identify bottlenecks and optimize execution time
- 3D Visualization: Advanced animation and visualization capabilities
- Comprehensive Results: Detailed comparison and statistical analysis tools
- Modular Design: Easy to extend with new algorithms or cost functions
- Comprehensive Testing: 47+ test cases covering unit, integration, and regression tests
git clone https://github.com/dronefreak/system-identification-helicopter.git
cd system-identification-helicopterEnsure you have MATLAB R2014b or later installed with the required toolboxes (see Prerequisites).
Open MATLAB and add the project directory to your path:
addpath(genpath('/path/to/system-identification-helicopter'));
savepath;- MATLAB: R2014b or later (tested on R2014b, R2016a, R2018b)
- Operating System: Windows, macOS, or Linux
- Control System Toolbox - For state-space models (
ss(),lsim()) - Statistics and Machine Learning Toolbox - For correlation functions (recommended)
- Parallel Computing Toolbox - For parallel cost function evaluation (2-8x speedup)
% Check if toolboxes are installed
ver('control')
ver('stats')
ver('distcomp') % Parallel Computing Toolbox (optional)The following third-party libraries are included in the repository:
- Yarpiz YPEA Framework - Optimization algorithms (BSD License)
- STLRead - 3D model import (File Exchange)
- MatlabPlaneGraphics - 3D visualization framework
% 1. Navigate to IWO directory
cd src/algorithms/iwo/IWO
% 2. Load the workspace with flight data
load('../../../../data/experiments/best.mat')
% 3. Run the optimization (5000 iterations)
iwo
% 4. Visualize results
cd ../../../..
addpath('src/utils')
PopulCheckExpected runtime: 30-60 minutes (depends on your CPU)
| Algorithm | Status | Directory | Iterations | Population Size |
|---|---|---|---|---|
| Invasive Weed Optimization (IWO) | ✅ Tested | src/algorithms/iwo/ |
5000 | 40 |
| Genetic Algorithm (GA) | ✅ Tested | src/algorithms/ga/ |
1000 | Variable |
| Artificial Bee Colony (ABC) | src/algorithms/abc/ |
Configurable | Variable | |
| Bees Behavior Algorithm (BBA) | src/algorithms/bba/ |
Configurable | Variable | |
| Particle Swarm Optimization (PSO) | 📝 Example | src/algorithms/pso_example.m |
- | - |
| Simulated Annealing (SA) | 🔨 In Development | src/algorithms/sa/ |
Configurable | Variable |
Legend: ✅ Fully tested |
Invasive Weed Optimization is the recommended algorithm for this problem.
% Step 1: Load the workspace
cd src/algorithms/iwo/IWO
load('../../../../data/experiments/best.mat') % Contains: inr, outr, t, population
% Step 2: Run optimization
iwo % Runs for 5000 iterations
% Step 3: Extract best parameters
bestParameters = BestSol.Position;
% Step 4: Visualize results
cd ../../../..
addpath('src/utils')
popul = bestParameters'; % Copy to popul variable
PopulCheck % Generates comparison plotsWhat happens during optimization:
- The
Sphere.mcost function creates a state-space model using the 40 parameters - Simulates helicopter response using
lsim()with actual input data - Compares simulated output with actual flight test data
- Returns a cost value (to be minimized) based on correlation and least squares error
cd src/algorithms/ga
MainCode % Run genetic algorithm optimizationArtificial Bee Colony:
cd src/algorithms/abc
main % Run ABC optimizationBees Behavior Algorithm:
cd src/algorithms/bba
Main % Run BBA optimizationSimulated Annealing:
cd 'src/algorithms/sa/01 TSP using SA (Standard)'
% Configure and runThe IWO algorithm includes several performance optimization features:
For 2-8x speedup with Parallel Computing Toolbox:
% Edit src/algorithms/iwo/IWO/config_iwo.m:
config.useParallel = true; % Enable parallel evaluation
% Then run normally
load('data/experiments/best.mat')
iwoIdentify bottlenecks and optimize:
% Profile 100 iterations
load('data/experiments/best.mat')
results = profile_iwo('iterations', 100);
% View detailed profiler report
profview(0, results.profileInfo);Check system capabilities and configure:
% Interactive performance configuration
config = configure_performance();
% Disable progress bar for batch processing
config = configure_performance('progress', false);Performance Features:
- Parallel Computing: Evaluate cost functions simultaneously (2-8x speedup)
- Memory Optimization: Preallocated arrays reduce overhead (enabled by default)
- Progress Tracking: Real-time progress bar with ETA
- Profiling Tools: Identify and optimize bottlenecks
See docs/PERFORMANCE.md for the complete performance guide.
The optimization identifies 40 parameters in the state-space model:
ẋ = Ax + Bu
y = Cx + Du
Where:
-
States (13): u, v, w, p, q, r, φ, θ, ψ, a, b, rfb, c
- u, v, w: Velocity components
- p, q, r: Angular rates
- φ, θ, ψ: Euler angles
- a, b, c: Rotor flapping angles
- rfb: Rotor feedback
-
Inputs (4): δlat, δlon, δped, δcol
- Lateral cyclic, Longitudinal cyclic, Pedal, Collective
-
Outputs (10): Measurable states (excluding rfb, c, d)
| Parameter Type | Min Value | Max Value | Description |
|---|---|---|---|
| Velocity derivatives | -60 | +60 | Xu, Xa, Yv, Yb, etc. |
| Rotational dynamics | -220 | +220 | Angular rate coefficients |
| Time constants | 0 | 220 | Tf, Ts |
| Control gains | -100 | +100 | Control effectiveness |
Total: 40 parameters optimized simultaneously
system-identification-helicopter/
├── src/ # Source code
│ ├── algorithms/ # Optimization algorithms
│ │ ├── iwo/ # Invasive Weed Optimization
│ │ │ └── IWO/
│ │ │ ├── iwo.m # Main IWO algorithm
│ │ │ ├── Sphere.m # Cost function
│ │ │ └── config_iwo.m # Configuration
│ │ ├── ga/ # Genetic Algorithm
│ │ ├── abc/ # Artificial Bee Colony
│ │ ├── bba/ # Bees Behavior Algorithm
│ │ ├── sa/ # Simulated Annealing
│ │ └── pso_example.m # PSO example
│ │
│ ├── models/ # Helicopter dynamics models
│ ├── utils/ # Utility functions
│ │ ├── PopulCheck.m # Results visualization
│ │ ├── profile_iwo.m # Performance profiling
│ │ └── configure_performance.m # Performance configuration
│ └── visualization/ # 3D visualization & animation
│ └── Animations/ # Animation framework
│
├── data/ # All data files
│ ├── flight_data/ # Raw flight test data
│ │ └── raw/ # .bin and .mat files
│ ├── experiments/ # Experimental results
│ │ ├── best.mat # Primary dataset
│ │ ├── best2.mat # Alternative dataset
│ │ └── *.mat # Other results
│ └── logs/ # Flight and simulation logs
│ ├── flight_logs/ # 17 flight sessions
│ └── reference/ # Reference logs
│
├── docs/ # Documentation & papers
│ ├── PERFORMANCE.md # Performance optimization guide
│ ├── IFAC_heli_weed.doc # Academic paper
│ └── figures/ # Plots and diagrams
│
├── examples/ # Example scripts
├── tests/ # Test suite (47+ test cases)
│ ├── test_sphere_cost.m # Cost function unit tests
│ ├── test_config_iwo.m # Configuration tests
│ ├── test_popul_check.m # Visualization tests
│ ├── test_iwo_integration.m # Integration tests
│ ├── test_regression.m # Regression tests
│ ├── validate_installation.m # Installation validator
│ └── run_all_tests.m # Test runner
├── results/ # Output directory for new results
│
├── README.md # This file
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE # Project license
├── CHANGELOG.md # Version history
└── CITATION.cff # Citation information
Note: Each directory contains its own README.md with detailed information.
After optimization completes, visualize the identified parameters:
% Copy best parameters to popul variable
popul = BestSol.Position';
% Run visualization
PopulCheckThis generates:
- Time-domain comparison plots (actual vs. simulated)
- State trajectories for all 10 outputs
- Correlation coefficients for each output
- Model fit quality metrics
% Best solution structure
BestSol.Position % 40 optimized parameters
BestSol.Cost % Final cost value
% Convergence history
figure;
semilogy(BestCosts);
xlabel('Iteration');
ylabel('Best Cost');
title('Optimization Convergence');Problem: Random initialization sometimes produces NaN cost values.
Solution: The code uses pre-defined initial populations in best.mat to avoid this issue. If you modify initialization:
% Check for NaN before evaluation
if any(isnan(pop(i).Position))
pop(i).Position = unifrnd(VarMin, VarMax);
endProblem: Undefined function 'ss' for input arguments of type 'double'
Solution: Install Control System Toolbox:
% Check installation
ver('control')
% Or use MATLAB Add-On Explorer to installProblem: Unable to read file 'best.mat'
Solution: Ensure you're in the correct directory:
cd 'YPEA119 Invasive Weed Optimization/IWO'
ls % Verify best.mat existsProblem: MATLAB runs out of memory during optimization
Solution: Reduce population size or iterations:
% In iwo.m, modify:
MaxIt = 1000; % Instead of 5000
nPop = 20; % Instead of 40Problem: Optimization takes too long
Solution: Use built-in performance optimization features:
% Enable parallel computing (2-8x faster)
% Edit src/algorithms/iwo/IWO/config_iwo.m:
config.useParallel = true;
% Profile to find bottlenecks
load('data/experiments/best.mat')
results = profile_iwo('iterations', 100);
% Check configuration
configure_performance();See docs/PERFORMANCE.md for complete performance optimization guide.
Quick tips:
- Close unnecessary MATLAB figures during optimization
- Reduce iteration count for testing:
config.maxIterations = 1000 - Monitor progress with built-in progress bar
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Additional optimization algorithms
- Performance improvements
- Better visualization tools
- Documentation improvements
- Test coverage
- Bug fixes
If you use this code in your research, please cite:
@software{krishnan2019sysid,
author = {Krishnan, Navaneeth and Kumaar, Saumya},
title = {System Identification for Unmanned Helicopter using Metaheuristic Algorithms},
year = {2019},
publisher = {GitHub},
url = {https://github.com/dronefreak/system-identification-helicopter}
}Related Publications:
- Bernard Mettler's helicopter dynamics papers
- IFAC paper (see
IFAC_heli_weed.doc)
Also see CITATION.cff for structured citation data.
This project is licensed under the MIT License - see the LICENSE file for details.
- Yarpiz YPEA Framework: BSD License (see individual algorithm directories)
- STLRead: BSD License
- MatlabPlaneGraphics: See respective directories for licenses
Creator: Navaneeth Krishnan Maintainer: Saumya Kumaar
- Bernard Mettler for the helicopter state-space model framework
- Yarpiz team for optimization algorithm implementations
- Contributors to STLRead and MatlabPlaneGraphics
For questions, issues, or feature requests:
- Issues: GitHub Issues
- Email: Contact the maintainer via GitHub profile
Last Updated: 2026-01-06 Version: 2.0.0