Loading repository data…
Loading repository data…
iff-gsc / repository
Examples for the Library for Aircraft Dynamics And Control
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
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).
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.
MATLAB:
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 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
Start a simulation of quadcopter Bebop2 with loiter controller (both quadcopter dynamics and controller run in MATLAB/Simulink):
Copter/Bebop2/init_quadcopter_Bebop2_Loiter_INDI_simple.
cd('Copter/Bebop2')
init_quadcopter_Bebop2_Loiter_INDI_simple
init_quadcopter_Bebop2_Loiter_INDI_simple.jystck.enable = 0 (else an error will occur).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')
Visualize simulation with FlightGear:
runfg_IRIS.bat (Windows) or 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):
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.
For airplanes you can use the following FlightGear model for visualization: ./modules/ladac-examples-data/FlightGear/runfg_Dummy-RC-Airplane.sh
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. 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:
Muetze is very similar to IRIS. That is why ArduCopter works with -f gazebo-iris option.
Please have a look at the LADAC readme.
Have a look at the LindiCopter autopilot.
You can implement your controllers in ArduPilot to quickly proceed to flight tests, see ArduPilot Custom Controller.
Before reporting a bug, please try the following:
git statusCreate an issue and provide the following information:
cd('Copter/Bebop2')
init_quadcopter_Bebop2_ArduPilot_SITL
sim('QuadcopterSimModel_ArduCopter_SITL')
sim_vehicle.py must be on the path or you find it in the 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 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