# Examples for the Library for Aircraft Dynamics And Control (LADAC)
This repository contains multiple examples to demonstrate the usage of LADAC.
There are multicopter, airplane and eVTOL flight dynamic models as well as flight controllers for the specific vehicles.
The flight dynamic models and the flight controllers are based on LADAC and written in MATLAB/Simulink.
Moreover, there are interfaces to external programs like FlightGear (for visualization) and ArduPilot (for software in the loop tests and flight tests).
<div align="center">
<h3>Quadrotor Flight Path Control Demo</h3>
<a href="https://youtu.be/NKl482yJtZI">
<img
src="https://img.youtube.com/vi/NKl482yJtZI/0.jpg"
alt="Quadrotor Flight Path Control Demo"
style="width:50%;">
</a>
</div>
## Motivation
It is sometimes not clear how to get new aircraft configurations to fly with existing software such as ArduPilot or PX4.
With such software, you usually have no insight into the dynamics of the open and closed loop of the aircraft and are limited to an empirical controller design through flight tests or simulations.
This project provides the opportunity to design controllers specifically in MATLAB/Simulink.
First, you can quickly parameterize existing aircraft models or easily create new aircraft models based on LADAC building blocks.
Then you can analyze the dynamics of the aircraft and design controllers.
Then it is possible to translate the created controller into C/C++ code (code generation) and implement it in software like ArduPilot.
Finally, you can test your software in a software-in-the-loop simulation before running your code on a Pixhawk for flight testing.
## Installation
- **MATLAB:**
1. You need MATLAB/Simulink 2018b or later (older versions may work but they are not supported).
2. You may also need some MATLAB toolboxes like Curve Fitting Toolbox,
Aerospace Blockset, Aerospace Toolbox, MATLAB Coder, MATLAB Compiler,
Simulink Control Design, Simulink Coder depending on what you want to do.
- **Remote control:**
You can use a remote control via USB if you have one.
- **FlightGear:**
You also should install FlightGear for visualization. Normally, any version should work.
- **ArduPilot SITL:**
You might install [ArduPilot SITL](https://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html) if you want to do software in the loop simulations.
- **Ground control station:**
You might install a ground control station like QGroundControl or MissionPlanner
for communication with ArduPilot SITL.
- **LADAC-Examples:**
Clone this project including the submodules LADAC and LADAC-Example-Data:
```
git clone --recursive https://github.com/iff-gsc/ladac-examples.git
```
## Examples
- **Start a simulation of quadcopter Bebop2 with loiter controller (both quadcopter dynamics and controller run in MATLAB/Simulink):**
1. Open MATLAB/Simulink.
2. Run the Bebop2 initialization file [`Copter/Bebop2/init_quadcopter_Bebop2_Loiter_INDI_simple`](Copter/Bebop2/init_quadcopter_Bebop2_Loiter_INDI_simple.m).
```
cd('Copter/Bebop2')
init_quadcopter_Bebop2_Loiter_INDI_simple
```
3. Plug in a remote control via USB.
By default, the calibration settings of the Xbox-360 joystick are used as you can see in the init script [`init_quadcopter_Bebop2_Loiter_INDI_simple`](Copter/Bebop2/init_quadcopter_Bebop2_Loiter_INDI_simple.m#L24).
This calibration settings may not be compatible with your joystick! Therefore, you should [test and calibrate your joystick](https://github.com/iff-gsc/LADAC/tree/main/control/joystick#readme).
If you do not have connected a remote control, set [`jystck.enable = 0`](Copter/Bebop2/init_quadcopter_Bebop2_Loiter_INDI_simple.m#L25) (else an error will occur).
1. Run the Simulink file [`QuadcopterSimModel_INDI_Loiter_simple.slx`](Copter/models/QuadcopterSimModel_INDI_Loiter_simple.slx) (should open after step 2) to start the simulation. You can either control the system with the remote
control (vertical velocity, yaw rate, pitch angle, roll angle) or dummy
inputs will be performed.
```
sim('QuadcopterSimModel_INDI_Loiter_simple')
```
2. You can view the system outputs in the block visualization clicking on the scopes. However, this is not visually intuitive.
- **Visualize simulation with FlightGear:**
1. Run the start script of FlightGear by running [`runfg_IRIS.bat`](https://github.com/iff-gsc/LADAC-Examples-Data/tree/main/FlightGear/runfg_IRIS.bat) (Windows) or [`runfg_IRIS.sh`](https://github.com/iff-gsc/LADAC-Examples-Data/tree/main/FlightGear/runfg_IRIS.sh) (Linux):
```
./modules/ladac-examples-data/FlightGear/runfg_IRIS.sh
```
This will open FlightGear and load an IRIS quadcopter animation (for visualization
only, the computation is carried out by MATLAB).
- **Use the dynamics model of MATLAB/Simulink for software in the loop simulation of ArduPilot (controller runs in ArduPilot):**
1. Run a new MATLAB/Simulink simulation with Bebop2 quadcopter with the ArduPilot SITL interface:
```
cd('Copter/Bebop2')
init_quadcopter_Bebop2_ArduPilot_SITL
sim('QuadcopterSimModel_ArduCopter_SITL')
```
2. Run ArduPilot SITL in Gazebo mode from terminal (`sim_vehicle.py` must be on the path or you find it in the [ArduPilot](https://github.com/ArduPilot/ardupilot) repository in `Tools/autotest/`). Make sure that you have a proper ArduPilot configuration file for the ArduPilot SITL where you have set the joystick inputs etc. correctly. You should use the provided [ArduPilot parameters file of the Bebop2](https://github.com/iff-gsc/LADAC-Examples-Data/tree/main/ArduPilot_params/Parrot_Bebop2_MATLAB_SITL.param) as a basis for the configuration, since the sensor filter and control parameters are already correctly set here for the Bebop2 Simulink model. Finaly you can start the ArduPilot SITL with the `--add-param-file` option (here, our parameter file is used as an example):
```
sim_vehicle.py -v ArduCopter --model=gazebo --add-param-file=<path-to-repository>/modules/ladac-examples-data/ArduPilot_params/Parrot_Bebop2_MATLAB_SITL.param
```
The dynamics model in MATLAB/Simulink is tested with ArduCopter 4.2.0. If you run into any problems try checking out the older ArduCopter release in the ArduPilot repository with:
```
git checkout Copter-4.2.0
git submodule update --init --recursive
```
3. Control the quadcopter from ArduPilot. Therefore, you should use
a ground control station (read QGroundControl or MissionPlanner documentation) or the
[MAVProxy command prompt](https://ardupilot.org/dev/docs/copter-sitl-mavproxy-tutorial.html#copter-sitl-mavproxy-tutorial).
## How to use?
### General use of the MATLAB/Simulink files
There are initialization m-files in multiple subfolders (e.g. `Copter/Bebop2/init_...`) to initialize the parameters of
the physical model as well as of the controller. There are simulation
slx-file (e.g. `Copter/models/QuadcoterSimModel_...`) for different kinds of vehicles
and different types of controllers.
### General use of ArduPilot SITL
Standard ArduPilot flight modes will only work if you load appropriate parameters for you vehicle.
The default parameters (e.g. `-f gazebo-iris`) only work for similar quadcopters (e.g. IRIS quadcopter).
For other vehicles you have to load different parameters using the `--add-param-file` option.
For some vehicles you find the parameters in [`modules/ladac-examples-data/ArduPilot_params`](https://github.com/iff-gsc/LADAC-Examples-Data/tree/main/ArduPilot_params). You can use these parameter files as a basis for your own configuration and add your joystick configuration, for example.
- **IRIS:**
You can load the ArduPilot IRIS parameters with the `-f` parameter: `sim_vehicle.py -v ArduCopter -f gazebo-iris --model=gazebo`
- **Muetze
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。
资源推荐
资源详情
资源评论




























收起资源包目录







































































































共 80 条
- 1
资源评论


毕业小助手
- 粉丝: 2771
- 资源: 5583
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 84105929555134世界网络收音机 .apk
- 【毕业设计】基于Python的Django-html人脸表情的分类算法的设计源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 中移铁通操作手册.docx
- 【毕业设计】基于Python的Django-html人信息管理系统及安全策略分析系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 狮子座12025年一定要.txt
- 【毕业设计】基于Python的Django-html深度学习文本相似度检测系统(bert)源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html深度学习的web端多格式纠错系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html图像取证技术研究与实现系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html手写数字识别系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 2025误差理论作业参考.zip
- 【毕业设计】基于Python的Django-html图像去雾算法研究系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html图像信息隐藏技术设计源码(完整前后端+mysql+说明文档+LW+PPT).zip
- esp32配置 light-sleep 和 adc button 运行一段时间后系统重启
- 龙岩市乡镇边界,shp格式
- 宁德市乡镇边界,shp格式
- 景德镇市乡镇边界,shp格式
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
