# 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文件(如有),仅供学习参考, 切勿用于商业用途。
资源推荐
资源详情
资源评论
收起资源包目录
毕业设计&课设-飞机动力学与控制库示例.zip (80个子文件)
matlab_codings_tt
Plane
EasyGlider
init_EasyGlider.m 738B
init_EasyGlider_SITL_gazebo.m 711B
EasyGlider_ManualMode.slx 63KB
EasyGlider_UnitTest.m 1KB
init_EasyGlider_Trajectory.m 3KB
eval_linearization.m 1KB
addPathEasyGlider.m 318B
init_EasyGlider_SITL.m 703B
addPathPlane.m 406B
models
AirplaneSimModel_SITL_gazebo.slx 48KB
AirplaneSimModel.slx 35KB
AirplaneSimModel_SITL.slx 55KB
AirplaneSimModel_AutomaticTrajectory.slx 69KB
Copter
Muetze
addPathMuetze.m 315B
init_quadcopter_Muetze_ArduPilot_SITL.m 1KB
init_quadcopter_Muetze_Loiter_INDI_simple.m 1KB
init_quadcopter_Muetze_AltHold_INDI_simple.m 1KB
Muetze_UnitTest.m 1KB
addPathCopter.m 407B
Bebop2
init_quadcopter_Bebop2_ArduPilot_SITL.m 1KB
ArduPilot_implementation
upload_script_bebob2.sh 2KB
README.md 4KB
init_quadcopter_Bebop2_AltHold_INDI_simple.m 1KB
addPathBebop2.m 315B
Bebop2_UnitTest.m 1KB
init_quadcopter_Bebop2_Loiter_INDI_simple.m 1KB
models
QuadcopterSimModel_LindiCopter.slx 45KB
QuadcopterSimModel_INDI_Loiter_simple.slx 52KB
QuadcopterSimModel_Trim.slx 32KB
QuadcopterSimModel_INDI_simple_AltHold.slx 45KB
QuadcopterSimModel_INDI_simple_Atti.slx 46KB
QuadcopterSimModel_ArduCopter_SITL.slx 36KB
Minnie
addPathMinnie.m 315B
tools
indi_cntrl_gain_alt_hold_Minnie.m 1KB
indi_cntrl_gain_loiter_cascaded_Minnie.m 2KB
Minnie_momentOfInertia.m 5KB
Minnie_prop_inertia.m 701B
init_quadcopter_Minnie_LindiCopter.m 2KB
ArduPilot_implementation
init_Arducopter_MinnieLindiCopter.m 1KB
params
Minnie.parm 28KB
ArduCopter_MinnieLoiterController.slx 55KB
ArduCopter_MinnieLindiCopter.slx 57KB
init_quadcopter_Minnie_ArduPilot_SITL.m 1KB
init_quadcopter_Minnie_AltHold_INDI_simple.m 1KB
init_quadcopter_Minnie_Loiter_INDI_simple.m 1KB
Minnie_UnitTest.m 1KB
IRIS
addPathIris.m 313B
init_quadcopter_IRIS_ArduPilot_SITL.m 1KB
IRIS_UnitTest.m 1KB
modules
ladac
ladac-examples-data
check_ladac_examples.m 397B
.gitmodules 186B
VTOL
addPathVtol.m 405B
Arkbird
init_Arkbird_INDI_simple.m 728B
addPathArkbird.m 314B
utilities
Arkbird_momentOfInertia.m 2KB
Tailsitter_Trim_Horizontal_Transition.m 2KB
Tailsitter_Linearize.m 2KB
runfg_ViTOLmina.sh 906B
Arkbird_UnitTest.m 1KB
runfg_ViTOLmina.bat 498B
init_Arkbird_ArduPilot_SITL.m 656B
README.md 3KB
models
TailsitterSimModel_ArduPilot_SITL.slx 39KB
TailsitterSimModel_INDI_simple.slx 48KB
TailsitterSimModel_Trim.slx 27KB
ladacExamplesUnitTest.m 1KB
.gitignore 1KB
common_functions
indiCntrlGainLoiterCascaded.m 4KB
trimSteady.m 5KB
addPathLadacExamples.m 373B
controlEffectiveness2G1G2.m 2KB
loadInitialConditionsParams.m 319B
indi_cntrl_gain_loiter_cascaded_example.m 2KB
centerOfGravity.m 875B
indiCntrlEffectiveness.m 3KB
indiCopterCntrlEffect.m 3KB
tailsitterTrimHorizontal.m 4KB
getWetWing.m 1KB
momentOfInertia.m 1KB
README.md 9KB
共 80 条
- 1
资源评论
毕业小助手
- 粉丝: 2761
- 资源: 5583
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 站长亲测微信朋友圈分享赚钱系统带分销功能源码 微小豆朋友圈分享赚钱系统
- STM32L152单片机连接BC28-NBIOT模块实现EDP发送到ONENET平台.zip
- 图书管理系统,设计一个图书管理系统,要求能够管理图书信息,包括图书的基本信息和借阅记录
- STM32L152单片机连接BC28-NBIOT模块实现MQTT协议传输传感器ADC模拟量数据到阿里云物联网平台.zip
- STM32L152单片机连接BC28-NBIOT模块实现UDP协议与云服务器双向透传.zip
- SQL函数与操作符入门数据分析师-编程语言与工具
- 智能交通 57 赵敏.zip
- 西工大软件类实验合集noj100题答案(含程序代码)
- 电子设计竞赛培训方案及目标解析
- 机器学习(预测模型):关注旧金山国际机场(SFO)的飞机着陆情况数据集
- WPS电信定制版_12.8.2.18205_Setup.exe
- Python爬虫项目集合.zip
- 生成2025年全年的公历日期以及对应的农历和干支历,还有各个年月日干支分别对应的阴阳属性和五行属性
- 如愿公益文件v7-2(3).zip
- 任路公益文件V18☸(2).zip
- Screenshot_20241218_193042.jpg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功