iff-gsc / ladac Goto Github PK
View Code? Open in Web Editor NEWLibrary for Aircraft Dynamics And Control
License: GNU General Public License v3.0
Library for Aircraft Dynamics And Control
License: GNU General Public License v3.0
All of the following suggestions would be breaking changes, meaning that any library or model using these blocks would need to be revised. The proposed changes are not important and could be made if another important breaking change were made.
y_0_src
and x_init
. It would probably be better to name them y_0_src
and y_0
.omega
and d
can be set separately to 'internal / external' .Unsteady RANS discrete gust and dynamic flap deflection simulations showed that the unsteady VLM wing project is not accurate enough.
This is the README which does not work anymore:
https://github.com/iff-gsc/LADAC/tree/main/utilities/interfaces_external_programs/ArduPilot_custom_controller#readme
In Test->ArduPlane->1., git gets stuck at:
git submodule update --init --recursive
The reason probably is that the url of two submodules has changed:
https://github.com/ArduPilot/libcanard --> https://github.com/ArduPilot/archived-libcanard
https://github.com/ArduPilot/uavcan --> https://github.com/ArduPilot/archived-uavcan
To get it to work again, the url must be changed:
git submodule set-url modules/libcanard https://github.com/ArduPilot/archived-libcanard.git
git submodule set-url modules/uavcan https://github.com/ArduPilot/archived-uavcan.git
This must be tested again because it did not work immediately on Fabian's PC.
Instead of increasing the drag coefficient, it decreases by negative deflection values.
Have a look at the code at L90
For testing, run the following command (-10-deg deflection):
alpha_M = [-pi/2:0.05:pi/2]';
beta_M = 0;
eta = [-10]'*pi/180;
figure
for i = 1:length(eta)
C_D = simpleWingGetCd( wing, alpha_M*[1,1], beta_M*[1,1], eta(i)*[1,1] );
plot( alpha_M, C_D )
hold on
end
xlabel('\alpha_M, rad'), ylabel('C_D'), grid on;
and then this (0-deg deflection):
alpha_M = [-pi/2:0.05:pi/2]';
beta_M = 0;
eta = [0]'*pi/180;
figure
for i = 1:length(eta)
C_D = simpleWingGetCd( wing, alpha_M*[1,1], beta_M*[1,1], eta(i)*[1,1] );
plot( alpha_M, C_D )
hold on
end
xlabel('\alpha_M, rad'), ylabel('C_D'), grid on;
You will see a decrease in the drag coefficient compared to a zero angle of attack.
This issue was originally created in GitLab on 5/19/2022 and probably refers to a version near that date.
sim_vehicle.py -v ArduPlane --model=gazebo
Does not connect with the Simulink model.
A similar problem occurred with a version from 2019 (f69be707
) where the ArduPlane SITL disconnects after approx. 30 seconds.
It is interesting that the ArduCopter SITL works in both cases (sim_vehicle.py -v ArduCopter --model=gazebo
)
We updated the ArduPilot interface so that the default data type should be single and that no single data types need to be specified in the code itself.
However, at least double parameters from the workspace are generated as doubles in the C++ code in rtwtypes (real_T double ...).
As a workaround, the user can manually change "double" to "float" in the generated code if doubles are not desired.
It could be usefull to change the interface of 'cntrlAttiRedIndi_lib/Multicopter (Reduced) Attitude INDI Controller'.
The inputs cmd_lean_angle_0_1
, cmd_lean_direction_angle_0_2pi
(lean command) could be changed to n_g_des
. In 'lindiCopter_lib/LindiCopter Autopilot', n_g_des
is already calculated in 'Pilot Reduced Attitude Commands' and all other blocks use n_g_des
directly. Only 'Multicopter (Reduced) Attitude INDI Controller' uses the lean command instead and calculates n_g_des
again in the block. Therefore we could directly use n_g_des
instead.
However, it is necessary to check how this block is used in other models/libraries to ensure that this change makes sense in all cases.
... due to changes done to the interface of cntrlPosNdi_lib/NDI position controller for copters reference model
When the default trajectoryBus initialization is called, the bus contains an array of type sections with the name sections.
In Matlab Simulink this is not a problem, but if the Matlab coder is used to generate the Ardupilot Code the code doesn't compile.
This is because the coder generates a the following data structure:
First possible workaround:
Changing the type of the struct in the generated code manually at the corresponding locations from sections to section.
Second possible workaround/solution:
section = sections
trajectoryBus.Elements(3).DataType = "section";
In function: simpleWingLoadParams:
In function: simpleWingLoadParams()
Using the ArduPilot template with single data type inputs, the trajectory functions throw an error because variables of data type double are written in variables with data type single.
Matching should be designed more cleverly in the future. It was actually once thought that with the trajSetMatch
the two fields active_section
and current_time
in the traj
struct can be updated and that the next matching takes into account the state of these two fields (or alternatively in Simulink - depending on the structuring - via unit delay feedback of these two variables). In addition, one can of course implement many other improvements.
When calculating the CP in Line 43 in simpleWingLoadParams.m
sin(Phi) is used. This causes a great error when the sweep angle is large.
phi = deg2rad(30);
error = tan(phi) - sin(phi)
error =
0.0774
This was tested using the wing from the new/eVTOL "TiltrotorAircraft":
The C_m0 is closer to the values calculated with tornado:
(without applying moment correction)
using sin(phi) C_m0 = -0,259
using tan(Phi) C_m0 = -0.2516
C_m0 = -0.1477
Is the file complete?
I run the check_ladac.m
, but unfortunately MATLAB errors are reported as following
fuselageUnitTest/fuselageExampleScriptTest
and fuselageUnitTest/fuselageLibTest
have errors and has not finished running.
正在运行 TestWidth
.
已完成 TestWidth
__________
正在运行 ladacUnitTest
.
已完成 ladacUnitTest
__________
正在运行 actuatorsUnitTest
.
已完成 actuatorsUnitTest
__________
正在运行 airfoilAnalytic0515UnitTest
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum found.
Optimization completed because the size of the gradient is less than
the value of the optimality tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum found.
Optimization completed because the size of the gradient is less than
the value of the optimality tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
.
已完成 airfoilAnalytic0515UnitTest
__________
正在运行 airfoilAnalytic9090UnitTest
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the size of the current step is less than
the value of the step size tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the size of the current step is less than
the value of the step size tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
.
已完成 airfoilAnalytic9090UnitTest
__________
正在运行 airfoilAnalyticBlAlUnitTest
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum found.
Optimization completed because the size of the gradient is less than
the value of the optimality tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum found.
Optimization completed because the size of the gradient is less than
the value of the optimality tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the value of the function tolerance.
<stopping criteria details>
.
已完成 airfoilAnalyticBlAlUnitTest
__________
正在运行 airfoilAnalyticSimpleUnitTest
.
已完成 airfoilAnalyticSimpleUnitTest
__________
正在运行 fuselageUnitTest
================================================================================
fuselageUnitTest/fuselageExampleScriptTest 中出现错误并且未运行完毕。
--------
错误 ID:
--------
'MATLAB:minrhs'
-----------
错误详细信息:
-----------
输入参数的数目不足。
出错 width (第 10 行)
W = size(X,2);
出错 fuselageSetParams (第 27 行)
fuselage.params.width(:) = width;
出错 fuselageCreate (第 67 行)
fuselage = fuselageSetParams( fuselage, filename );
出错 fuselage_example (第 11 行)
fuselage = fuselageCreate('fuselage_params_default',5,30);
出错 run (第 91 行)
evalin('caller', strcat(script, ';'));
出错 fuselageUnitTest>fuselageExampleScriptTest (第 33 行)
run('fuselage_example');
================================================================================
.
================================================================================
fuselageUnitTest/fuselageLibTest 中出现错误并且未运行完毕。
--------
错误 ID:
--------
'MATLAB:minrhs'
-----------
错误详细信息:
-----------
输入参数的数目不足。
出错 width (第 10 行)
W = size(X,2);
出错 fuselageSetParams (第 27 行)
fuselage.params.width(:) = width;
出错 fuselageCreate (第 67 行)
fuselage = fuselageSetParams( fuselage, filename );
出错 fuselage_lib_example_init (第 11 行)
fuselage = fuselageCreate('fuselage_params_default',5,20);
出错 run (第 91 行)
evalin('caller', strcat(script, ';'));
出错 fuselageUnitTest>fuselageLibTest (第 40 行)
run('fuselage_lib_example_init')
================================================================================
.
已完成 fuselageUnitTest
__________
正在运行 inducedVelocityUnitTest
...
已完成 inducedVelocityUnitTest
__________
正在运行 simpleFuselageUnitTest
.
已完成 simpleFuselageUnitTest
__________
正在运行 batteryUnitTest
.
已完成 batteryUnitTest
__________
正在运行 quatUnitTest
..........
已完成 quatUnitTest
__________
失败摘要:
Name Failed Incomplete 原因
=======================================================================
fuselageUnitTest/fuselageExampleScriptTest X X 出错。
-----------------------------------------------------------------------
fuselageUnitTest/fuselageLibTest X X 出错。
rt =
24×6 table
Name Passed Failed Incomplete Duration Details
________________________________________________________________________ ______ ______ __________ _________ ____________
{'TestWidth/TestWidth' } true false false 0.034523 {1×1 struct}
{'ladacUnitTest/Test_all_library_links_resolved' } true false false 18.233 {1×1 struct}
{'actuatorsUnitTest/actuatorsLibExampleTest' } true false false 0.2171 {1×1 struct}
{'airfoilAnalytic0515UnitTest/airfoilAnalytic0515AlExampleScriptTest' } true false false 1.6437 {1×1 struct}
{'airfoilAnalytic9090UnitTest/airfoilAnalytic9090ExampleScriptTest' } true false false 2.4375 {1×1 struct}
{'airfoilAnalyticBlAlUnitTest/airfoilAnalyticBlAlExampleScriptTest' } true false false 2.163 {1×1 struct}
{'airfoilAnalyticSimpleUnitTest/airfoilAnalyticSimpleExampleScriptTest'} true false false 0.103 {1×1 struct}
{'fuselageUnitTest/fuselageExampleScriptTest' } false true true 0.028166 {1×1 struct}
{'fuselageUnitTest/fuselageLibTest' } false true true 0.011417 {1×1 struct}
{'inducedVelocityUnitTest/Test_Vx_Vz_equal_Zero' } true false false 0.0039576 {1×1 struct}
{'inducedVelocityUnitTest/Test_Vertical_Decent_Slow' } true false false 0.003024 {1×1 struct}
{'inducedVelocityUnitTest/Test_Vertical_Decent_Fast' } true false false 0.0024349 {1×1 struct}
{'simpleFuselageUnitTest/fuselageExampleScriptTest' } true false false 0.73661 {1×1 struct}
{'batteryUnitTest/batteryExampleScriptTest' } true false false 0.29308 {1×1 struct}
{'quatUnitTest/Test_quatMultiply' } true false false 0.074671 {1×1 struct}
{'quatUnitTest/Test_quatConj' } true false false 0.1076 {1×1 struct}
{'quatUnitTest/Test_quatInv' } true false false 0.10452 {1×1 struct}
{'quatUnitTest/Test_quatDivide' } true false false 0.079949 {1×1 struct}
{'quatUnitTest/Test_quatNormalize' } true false false 0.084691 {1×1 struct}
{'quatUnitTest/Test_quatNorm' } true false false 0.078588 {1×1 struct}
{'quatUnitTest/Test_quatLog' } true false false 0.079613 {1×1 struct}
{'quatUnitTest/Test_quatExp' } true false false 0.090167 {1×1 struct}
{'quatUnitTest/Test_quatIntegration' } true false false 0.031214 {1×1 struct}
{'quatUnitTest/Test_quatLogDivide' } true false false 0.079631 {1×1 struct}
历时 36.998017 秒。
The following UnitTests fail in LADAC main branch:
Both things could be updated in one go.
Hello there
Can you explain, what is "c frame" ?!
For further changes to the Attitude controller it might be advantageous to add an external reset for the reference model.
Since this is needed when the Simulink controller consists of more than one flightmode and an inflight mode switch is desired.
Furthermore the initial_yaw input might be directly attached to the current attitude to reduce the number of inputs.
Exponents greater than E300 or E-300 appear in the generated code C++ code of Matlab.
ArduPilot throws an error when building for a microcontroller.
The Dragonfly autopilot (control/autopilots/dragonfly) did not work on Hardware (see also in LADAC-Examples: iff-gsc/LADAC-Examples#2).
It was tested for Minnie (Matek H743) and Bebop 2.
In both tests the unexpected behavior occurred as soon as the Simulink flight mode was enabled.
Unfortunately, there are no logs for Bebop 2.
The logs of Minnie did not reveal any performance issues.
Note that the flight mode worked well in SITL.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.