Aerobatic flight. How to make a barrel

What does a fighter have in common with a container for storing liquid and a Goldberg machine? It would seem that the plane and the barrel may turn out to be parts of a useless, but fascinating mechanism, but no. The figure of aerobatic keg combines all these things and not only.



Running a barrel does not help a civilian plane to take its passengers to a destination or a fighter in combat, but it requires, if properly executed, to use all aircraft controls: ailerons, elevator and rudder.

This publication describes the process of turning the plane 360 ​​degrees around the longitudinal axis without a reduction from the point of view of such science as flight dynamics, and describes how you can make your plane make a barrel correctly.

Introduction


After the completion of the active phase of the next project, my colleague in unmanned activity raised the question of what to do until new projects took up all their free time. In response to a question given to emptiness, we received a very specific answer “make a barrel ( do a barrel roll )”. And the truth is: the barrel of Goldberg's aircraft in aviation, at the same time complicated, practically (in aerial combat), is a useless and extremely aesthetic pleasure. So why not teach your model aircraft to make a barrel in automatic mode, even Google does it.

Before starting the practical implementation, we decided to study this process using computer models, and this is what came of it.

A bit of theory


First, a little about why airplanes fly and how the position of the aircraft is described relative to the field of aggression. The plane holds a lift in the air, let's call it Y, which is created on the wing, but what a thing, this force appears only when the wing is blown by the oncoming air flow, respectively, you need to accelerate the plane. You can, of course, “run up from the cliff”, spend some of the potential energy of the field of the earth to accelerate and even hang for a moment, but aerodynamic resistance arises indissolubly with the lifting force, let's call this force X, which the plane will slow down, and the lifting force will fall, and with it we. We will fall under the action of gravity G. To counteract the resistance force, all normal aircraft have an engine, it creates traction force P, which can be used to overcome the power of resistance. The simplest kinematic model of an aircraft describes its movement as the movement of a material point in a field of earth. In horizontal flight at a constant speed, the force of gravity is balanced by the lifting force of the wing Y = G, and the force of resistance is by the force of the engine X = P.

If you look at a material point under a microscope, it will turn into a material body. It is for the better: we can see the aircraft’s fuselage, wing, tail, which consists of a horizontal stabilizer and a vertical keel. The ailerons are located on the left and right wing consoles, the elevator on the horizontal tail, the elevator, and the rudder on the vertical. If all this is hard to turn, the apparatus will begin to maneuver, and the task of making the barrel will be reduced to what law will change the position of the controls to achieve the desired trajectory of the apparatus in space and relative to its own axes.

Description of the coordinate systems used in the description of the movement of aircraft.
In the Russian / Soviet tradition, the coordinate system (SC), rigidly connected with the aircraft, is introduced as follows. The x axis is directed longitudinally in the plane of symmetry of the aircraft, from tail to nose. Perpendicular to this axis, the y axis is entered upwards. These two axes are complemented to the right three of vectors by the z axis. It turns out that the z axis will pass along the right wing.

Движение аппарата в пространстве невозможно описать только при помощи связанной с самолетом системой координат, ведь нам интересно положение аппарата относительно земли. Для этого вводится система координат, которая называется «местная земная система координат». Ось X этой системы находится в горизонтальной плоскости и направлена на географический север. Oсь Y направлена вертикально вверх. Ось Z дополняет их до правой тройки векторов. Расположение связанной системы координат относительно местной земной системы определяется углами крена, тангажа и рыскания. Угол между продольной осью самолета (в нашем случае ось x связанной СК) и горизонтальной плоскостью XZ называется углом тангажа, он изменяется при отклонении руля высоты. Угол между осью z связанной СК и осью Z местной земной СК, повёрнутой так, что угол рыскания равен нулю, называется углом крена, он изменяется при отклонении элеронов. Угол между осью X местной земной СК и проекцией оси x связанной СК на горизонтальную плоскость XZ называется углом рыскания, отсчитывается против часовой стрелки от оси X местной земной СК. Такой формализации нам должно быть достаточно для описания движения самолета при выполнении бочки, и пусть, мы не воспользуемся далее буквенными обозначениями осей, всегда полезно повторить основы.



Tools


To simulate the movement of the device, we use tools that are provided by the program for modeling the dynamics of aircraft with open source code JSBSim . We will entrust the output of graphs to gnuplot , and the visualization of the maneuvers of the FlightGear aircraft . As a basic dynamic model, take the North American P-51 Mustang fighter : its maneuverability will be enough to carry the barrel. For the visualization, we will use a less aggressive, sporty YAK-53 aircraft .

Description of the process of setting up the program and output the results.
Все файлы, необходимые для запуска скриптов, находятся в Github репозитории. Для повторения действий, приведенных в статье, нам понадобится установить JSBSim, FlightGear и gnuplot. Все действия буду приведены для операционной системы Windows. За основу взята инструкция отсюда. Скачиваем и устанавливаем последнюю версию FlightGear с www.flightgear.org и gnuplot с www.gnuplot.info. Собираем JSBSim по инструкции. После этого ищем два необходимых нам каталога. Корневые каталоги JSBSim\ и FlightGear\. В каталоге FlightGear\data\Aircraft находятся папки с моделями самолетов: туда нужно скопировать модель, которая будет использоваться для визуализации. Я использую модель Як-53, которую нашел на просторах Интернета. Другие модели можно найти здесь. В каталоге FlightGear\bin находится основной исполняемый файл симулятора fgfs. Для визуализации динамики будем использовать строку запуска

fgfs --native-fdm=socket,in,60,,5500,tcp --fdm=external --timeofday=noon --aircraft=Yak-53 --disable-sound  --disable-real-weather-fetch --disable-clouds3d --disable-clouds

В этой строке первые параметры указывают внешний источник данных о динамике самолета при запуске симулятора. Параметр aircraft задает требуемую модель аппарата. Остальные параметры не обязательны, их значения можно найти здесь. Полезные сочетания клавиш:

«V»-изменить вид модели
Shift+Esc – перезапуск FlightGear с сохранением параметров командной строки
Ctrl+«R» — запуск записи полета для повторения того, что получилось.

Вот собственно и все, что нам понадобится в симуляторе FlightGear. Вернемся к программе моделирования динамики JSBSim. В каталоге JSBSim\aircraft находятся динамические модели самолетов. В каталоге JSBSim\engine находятся динамические модели двигателей и винтов. Динамические модели самолетов хранятся в отдельных каталогах в файлах вида name*.xml. В конце каждого файла есть секция, отвечающая за вид выходных данных при моделировании. Если мы хотим, чтобы вывод был в виде, подходящем для визуализации во FlightGear, то она должна выглядеть так:

<outputname="localhost"type="FLIGHTGEAR"port="5500"rate="60"/>

Если же мы хотим сохранять данные в файл, то так:

<outputname="p51d.csv"rate="60"type="CSV"><property> velocities/vc-kts </property><property> aero/alphadot-deg_sec </property><property> aero/betadot-deg_sec  </property><property> fcs/throttle-cmd-norm </property><simulation>       OFF </simulation><atmosphere>       OFF </atmosphere><massprops>        OFF </massprops><aerosurfaces>     ON  </aerosurfaces><rates>            ON  </rates><velocities>       ON  </velocities><forces>           OFF </forces><moments>          OFF </moments><position>         ON  </position><coefficients>     OFF </coefficients><ground_reactions> OFF </ground_reactions><fcs>              ON  </fcs><propulsion>       OFF </propulsion></output>

Запускать процесс моделирования удобно при помощи пакетного файла, расположенного в корневой папке JSBSim\, строкой

JSBtest.bat *имя_скрипта

с содержанием

rem Remove the old result filedel /Q aircraft\p51d\Results\%1.csv

rem Run the test 
Debug\JSBSim --script=aircraft\p51d\scripts\%1.xml  --outputlogfile=aircraft\p51d\Results\%1.csv>JSBSim.out --realtime

rem Generate gnuplot to the screen
gnuplot aircraft\p51d\plots\%1.p

Данный файл удаляет предыдущие результаты моделирования, запускает скрипт, расположенный по адресу \JSBSim\aircraft\p51d\scripts\, а затем запускает отрисовку полученных данных при помощи gnuplot. Параметр realtime необходимо указывать в случае, когда данные из JSBSim хочется получать в режиме реального времени, например, при визуализации во FlightGear.

Посмотрим на содержание файла скрипта:

<?xml version="1.0" encoding="utf-8"?><runscript><useaircraft="p51d"initialize="scripts/airborne"/><runstart="0"end="5"dt="0.0166666"><!-- 
	Проводим триммирование аппарата для горизонтального полета  
	--><eventname="Trims"><condition> sim-time-sec ge 0.0 </condition><setname="simulation/do_simple_trim"value="1"/></event><!-- 
	Отклоняем элероны по максимуму   
	--><event><condition> sim-time-sec ge 0.5 </condition><setname="fcs/aileron-cmd-norm"value="1"/></event><!-- 
	Возвращаем элероны в исходное положение   
	--><event><condition> sim-time-sec ge 2.95 </condition><setname="fcs/aileron-cmd-norm"value="0"/></event></run></runscript>

Для правильного запуска в третьей строке указывается модель самолета, который будет смоделирован, и путь к инициализационному файлу с содержанием

<?xml version="1.0" encoding="utf-8"?><initializename="airborne"><!-- 
     Файл с начальными параметрами состояния аппарата
  --><running>                -1   </running><altitudeunit="FT">  325.0  </altitude><vcunit="KTS">        210.0  </vc><latitudeunit="DEG">   42.3769  </latitude><longitudeunit="DEG"> -70.9993  </longitude></initialize>

Осталось только рассмотреть содержание файла для построения графиков через gnuplot:

set   autoscale                        # scale axes automaticallyunsetlog# remove any log-scalingunset label                            # remove any previous labelsset xtic auto                          # set xtics automaticallyset ytic auto                          # set ytics automaticallyset tics font "Arial, 16"set key font "Arial, 16"set xlabel font "Arial, 16"set ylabel font "Arial, 16"# If you have graphical capabilities, you can plot on your screen# if none of the other terminals is specificed.# This is how to output the plot in PostScript format#set terminal postscript portrait enhanced color lw 1 "Helvetica" 14 size 8.5,11# This is how to output the plot in PNG format#set terminal png size 1280,960#set output "aircraft/p51d/results/plot.png"# This is how to output the plot in PDF format. (Not available on Mac)#set terminal pdfcairo color size 8.5,11#set output " aircraft/p51d/results/plot.pdf"set multiplot title ""set size 1,0.30
set lmargin 10
set xrange [0:4]
set ytic auto 
set origin 0.0,0.00
set xlabel "Время,с"set ylabel "Высота, м"
plot \
   "aircraft/p51d/results/trim-cruisep51d.csv" using 1:($43*0.3048) title "" with lines\
set origin 0.0,0.33
set ylabel "Угол тангажа, °"set xlabel ""
plot \
   "aircraft/p51d/results/trim-cruisep51d.csv" using 1:33 title "" with lines\
set origin 0.0,0.66
set ylabel "Угол крена, °"set xlabel ""set yrange [-180:180]
set ytics 60
plot  \
   \
   "aircraft/p51d/results/trim-cruisep51d.csv" using 1:32 title "" with lines\
unset multiplot                         # exit multiplot mode
pause -1 "Press ENTER to continue"

Данный файл формирует и выводит изображение на экран трех графиков: угла крена, тангажа и высоты от времени. Данные для построения берутся из файла *имя_скрипта.csv. Попутно, имперские единицы переводятся в привычные нам, метрические. Можно изменить файл для вывода в форматах PostScript, PNG или PDF, раскомментировав соответствующие строки.
Вот, в общем-то, и весь процесс подготовки инструментов для самостоятельного моделирования и отображения движения самолета.

Simulation and results


If you imagine a “spherical”, or rather an ideal plane, in which the axes of the associated coordinate system coincide with the main axes of the inertia ellipsoid and the controls create moments each relative to only one of the axes, you can qualitatively understand how the device will move when the controls deviate. Suppose an airplane is flying in horizontal flight; rejecting the ailerons in opposite directions, we change the magnitude of the lifting force on the consoles of the wing, which leads to the emergence of a moment of forces about the x axis, and the apparatus will begin to rotate around this axis. For the implementation of the barrel is just what we need. We make a script in which the ailerons are rejected for a maximum of 2.45 seconds, and then return to their original position:

The contents of the script.
<?xml version="1.0" encoding="utf-8"?><runscript><useaircraft="p51d"initialize="scripts/airborne"/><runstart="0"end="5"dt="0.0166666"><!-- 
	Проводим триммирование аппарата для горизонтального полета  
	--><eventname="Trims"><condition> sim-time-sec ge 0.0 </condition><setname="simulation/do_simple_trim"value="1"/></event><!-- 
	Отклоняем элероны по максимуму   
	--><event><condition> sim-time-sec ge 0.5 </condition><setname="fcs/aileron-cmd-norm"value="1"/></event><!-- 
	Возвращаем элероны в исходное положение   
	--><event><condition> sim-time-sec ge 2.95 </condition><setname="fcs/aileron-cmd-norm"value="0"/></event></run></runscript>




The simulation results are shown in the graph:



It can be seen that the plane turned 360 degrees in roll, however, it made this maneuver with a drop of 40 meters and tilted its nose by 14 degrees - this is an example of a completely unfit barrel.
And really, if you remember that a plane from a distance is a material point, then while rotating, the projection of lift on the direction of gravity decreases and the plane starts to decline, but we don’t need it at all, because we want to make a beautiful barrel without reduction. For this, before we began to deflect the ailerons, you need to create a supply of vertical velocity. We take the wheel itself - the elevator is deflected - a moment of force arises about the z axis. The nose of the plane rises, and we begin to gain altitude - at this moment it is time to start the rotation. Add to the script the elevator deflection by 40 percent for 0.4 seconds before the beginning of the deflection of the ailerons and return it to the neutral position. 0.2 seconds before the end of the rotation, we take the helm completely by ourselves to eliminate the lowering of the nose of the aircraft:

The contents of the script.
<?xml version="1.0" encoding="utf-8"?><runscript><useaircraft="p51d"initialize="scripts/airborne"/><runstart="0"end="5"dt="0.0166666"><!-- 
	Проводим триммирование аппарата для горизонтального полета  
	--><eventname="Trims"><condition> sim-time-sec ge 0.0 </condition><setname="simulation/do_simple_trim"value="1"/></event><!-- 
	Отклоняем руль высоты "на себя" 
	--><event><condition> sim-time-sec ge 0.1 </condition><setname="fcs/elevator-cmd-norm"value="-0.4"/></event><!-- 
	Отклоняем элероны по максимуму
	Возвращаем руль высоты в нейтральное положение
	--><event><condition> sim-time-sec ge 0.5 </condition><setname="fcs/aileron-cmd-norm"value="1"/><setname="fcs/elevator-cmd-norm"value="0"/></event><!-- 
	Отклоняем руль высоты "на себя" 
	--><event><condition> sim-time-sec ge 2.75 </condition><setname="fcs/elevator-cmd-norm"value="-1"/></event><!-- 
	Возвращаем элероны в нейтральное положение 
	Возвращаем руль высоты в нейтральное положение
	--><event><condition> sim-time-sec ge 2.95 </condition><setname="fcs/aileron-cmd-norm"value="0"/><setname="fcs/elevator-cmd-norm"value="0"/></event></run></runscript>




We look what happened:



Here it is - quite decent, fast barrel. If we returned the elevator to a neutral position a little later, the device would gain a small height and, after deflecting the ailerons, would turn into a U-turn. The combination of the “steering wheel to itself” and “deviation of the ailerons” leads to the fact that the lifting force of the wing when tilting the vehicle starts to act normal to the current trajectory of the vehicle and bends it the more, the more the elevator is tilted. You can try it yourself and make sure of it.

The previous barrel was made without reduction, the pitch angle at the exit of the barrel was not much different from the original. However, the height in the process of execution was changed to 12 meters. Let's try to more actively use the controls to minimize casting in height during the execution of the figure. In order not to turn the controls of the aircraft anyhow, let's take a look at Wikipediaand see how we are recommended to make a barrel. The main idea of ​​the perfect barrel is to keep the longitudinal axis of the aircraft in a horizontal plane. For this, the elevator and the rudder are alternately used. At the beginning of the barrel, as usual, we use the elevator to gain vertical speed. We reject the ailerons - we start the rotation. When the plane turns around the longitudinal axis, the elevator and the rudder change places. Upon reaching a roll angle of about 90 degrees, the rudder deviation will raise or lower the nose of the aircraft in a vertical plane. In this regard, we reject the rudder in a way to prevent the nose from lowering. Further, when the roll angle reaches 180 degrees, you need to deflect the rudder from yourself in order to keep the nose of the aircraft in a horizontal plane in an inverted flight. With a further turn, we repeat the deflections of the rudder with the opposite sign at a roll angle near - 90 degrees and finish the barrel with a slight deflection of the elevator “towards ourselves”. All these steps are expressed in the script below:

The contents of the script.
<?xml version="1.0" encoding="utf-8"?><runscript><useaircraft="p51d"initialize="scripts/airborne"/><runstart="0"end="10"dt="0.0166666"><!-- 
	Проводим триммирование аппарата для горизонтального полета  
	--><eventname="Trims"><condition> sim-time-sec ge 0.0 </condition><setname="simulation/do_simple_trim"value="1"/></event><!-- 
	Отклоняем руль высоты "на себя" 
	--><event><condition> sim-time-sec ge 0.0 </condition><setname="fcs/elevator-cmd-norm"value="-0.05"/></event><!-- 
	Отклоняем элероны по максимуму
	--><event><condition> sim-time-sec ge 0.5 </condition><setname="fcs/aileron-cmd-norm"value="1"/></event><!-- 
	Возвращаем руль высоты в нейтральное положение
	--><event><condition> sim-time-sec ge 0.6 </condition><setname="fcs/elevator-cmd-norm"value="0"/></event><!-- 
	Отклоняем руль направления
	--><event><condition> sim-time-sec ge 1.4 </condition><setname="fcs/rudder-cmd-norm"value="0.7"/></event><!-- 
	Возвращаем руль направления в нейтральное положение
	--><event><condition> sim-time-sec ge 1.6 </condition><setname="fcs/rudder-cmd-norm"value="0"/></event><!-- 
	Отклоняем руль высоты "от себя"
	--><event><condition> sim-time-sec ge 1.65 </condition><setname="fcs/elevator-cmd-norm"value="0.5"/></event><!-- 
	Возвращаем руль высоты в нейтральное положение
	--><event><condition> sim-time-sec ge 2.35 </condition><setname="fcs/elevator-cmd-norm"value="0"/></event><!-- 
	Отклоняем руль направления в противоположную сторону
	--><event><condition> sim-time-sec ge 2.6 </condition><setname="fcs/rudder-cmd-norm"value="-1.0"/></event><!-- 
	Возвращаем руль направления в нейтральное положение
	--><event><condition> sim-time-sec ge 2.8 </condition><setname="fcs/rudder-cmd-norm"value="0"/></event><!-- 
	Отклоняем руль высоты "на себя" 
	--><event><condition> sim-time-sec ge 2.75 </condition><setname="fcs/elevator-cmd-norm"value="-0.4"/></event><!-- 
	Возвращаем элероны в нейтральное положение 
	--><event><condition> sim-time-sec ge 2.95 </condition><setname="fcs/aileron-cmd-norm"value="0"/></event><!-- 
	Возвращаем руль высоты в нейтральное положение
	--><event><condition> sim-time-sec ge 3.0 </condition><setname="fcs/elevator-cmd-norm"value="0"/></event></run></runscript>




We start and see what happened:



On roll, the device turned 180 degrees, while the total span of the height change was about 2.5 m, which is five times less than in the previous case. We can say, we have turned out almost perfect barrel.

Instead of conclusion


So, we looked at some of the principles for performing a barrel aerobatics and made sure that, acting reasonably, we can perform a barrel of good quality on the simulator. It would be nice to move on to practice, and with the help of what we propose to do it - model aircraft + stm32f103 + mpu9250. All these elements are easily accessible and cheap, so that anyone can try it himself. The results of trial, error and instruction for repetition are the subject of the following publications.

Also popular now: