打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
[原]JSBSim 自动驾驶(浅出)

jsbsim的脚本文件分为几大类:

系统脚本:

systems  包含通用飞机各部分功能模块组件以及自动飞行控件:Autopilot.xml  和 自动飞行的算法控件:GNCUtilities.xml

引擎脚本:

engine:包含各个飞机的发动机控件

飞机脚本:

aircraft:包含各个飞机的控件、输入输出、初始化参数

控制脚本:

scripts:一次飞行模拟的全过程

下面我来分析一次自动飞行使用的部分脚本,以及脚本中的参数意义。

C172

脚本文件scripts中找到c1722.xml文件

1 <use aircraft='c172x' initialize='reset01'/> 2 <run start='0.0' end='200' dt='0.00833333'> 3 4 <event name='Engine start'> 5 <condition>simulation/sim-time-sec ge 0.25</condition> 6 <set name='fcs/throttle-cmd-norm' value='0.65'/> 7 <set name='fcs/mixture-cmd-norm' value='0.87'/> 8 <set name='propulsion/magneto_cmd' value='3'/> 9 <set name='propulsion/starter_cmd' value='1'/>10 <set name='ap/heading_hold' value='0'/>11 <notify>12 <property>velocities/vc-kts</property>13 <property>position/h-agl-ft</property>14 </notify>15 </event>16 17 <event name='Trim'>18 <condition>simulation/sim-time-sec ge 0.50</condition>19 <set name='simulation/do_simple_trim' value='0'/>20 <notify>21 <property>velocities/vc-kts</property>22 <property>position/h-agl-ft</property>23 </notify>24 </event>25 26 <event name='Set roll autopilot'>27 <condition>simulation/sim-time-sec ge 5.0</condition>28 <set name='ap/attitude_hold' value='1'/>29 <notify>30 <property>velocities/vc-kts</property>31 <property>position/h-agl-ft</property>32 </notify>33 </event>34 35 </run>

第一行:可以看到飞机文件用的是c172x.xml  初始化文件用的是:reset01.xml

第二行:表示执行的过程,0到200秒,间隔帧数是0.008秒

第四行:event代表事件处理:

    遇到condition的条件成立就执行后面的set步骤

以上是整体框架。

下面开启我们的疑问列表:

  1.飞机文件c172x.xml是干什么的?初始化文件又初始化哪些东西?

  2.第五行中的  sim-time-sec是什么意思?表达式是完成什么条件?

  3.哪些和自动飞行控制有关?

   。。。。。。

1.飞机文件c172x.xml是干什么的?初始化文件又初始化哪些东西?

答1:飞机文件c172x.xml是在“飞机脚本aircraft”文件夹下的c172x文件夹中,

初始化文件reset01.xml也在这个文件夹中。

初始化文件很简单:

<initialize name='reset00'>  <vt unit='KTS'>        100.0  </vt>  <latitude unit='DEG'>   28.0  </latitude>  <longitude unit='DEG'> -90.0  </longitude>  <psi unit='DEG'>       200.0  </psi>  <altitude unit='FT'>   4000.0  </altitude>  <running>                0    </running></initialize>

初始化了飞机的位置,姿态等信息

飞机定义文件c172x.xml包含了很多东西,我们只关心部分代码:

。。。   <system file='GNCUtilities'/> <system file='Autopilot'> <property value='0.523'> guidance/roll-angle-limit </property> <property value='0.174'> guidance/roll-rate-limit </property> </system> <autopilot file='c172ap'/> <flight_control name='c172'> <channel name='Pitch'> <summer name='fcs/pitch-trim-sum'> <input>ap/elevator_cmd</input> <input>fcs/elevator-cmd-norm</input> <input>fcs/pitch-trim-cmd-norm</input> <clipto> <min>-1</min> <max> 1</max> </clipto> </summer> <aerosurface_scale name='fcs/elevator-control'> <input>fcs/pitch-trim-sum</input> <range> <min>-28</min> <max> 23</max> </range> <gain>0.01745</gain> </aerosurface_scale> <actuator name='fcs/elevator-actuator'> <input> fcs/elevator-control </input> <lag> 60 </lag> <bias> 0.002 </bias> <hysteresis_width> 0.05 </hysteresis_width> <clipto> <!-- +/- 20 degrees --> <min> -0.34 </min> <max> 0.34 </max> </clipto> <output>fcs/elevator-pos-rad</output> </actuator> </channel>。。。

这里我们看到:飞机文件引用了两个和自动飞行相关的系统文件:GNCUtilities和 Autopilot

这个两个文件提供通用的自动飞行算法和组件

接着我们又看到这个c172飞机自定义了一个自动飞行的文件:c172ap

我们的问题列表又多了一个问题:4.自定义自动飞行文件c172ap做了哪些事情?

问题保留,我们接着看这个飞机文件:

它提供了自己的飞行控制组件

<flight_control name='c172'>

这个里面又分成很多部分,我们只看一个通道:Pitch

里面有一个加法器定义一个属性值 <summer name='fcs/pitch-trim-sum'>

这个值由三方输入参数构成:

1.ap/elevator_cmd

2.fcs/elevator-cmd-norm

3.fcs/pitch-trim-cmd-norm

其中的2和3都是在jsbsim中有明确绑定的 “成员变量”

只有1我们没见过

我们的问题列表又多了一个问题:5.输入参数ap/elevator_cmd在哪里定义?由什么提供输入?

似乎问题总在加多,但其实都在抽丝剥茧中变少变得更加具体,继续把Pitch通道看完:

我们看到这个加法器属性值fcs/pitch-trim-sum又作为输入参数被下一个算法使用,得到值fcs/elevator-control

这个值fcs/elevator-control又被fcs/elevator-actuator继续输入使用算出最终的输出fcs/elevator-pos-rad

这个通道Pitch就此结束。

这个通道是干什么的?为了计算飞机一个姿态参数的!(此文仅讨论自动驾驶部分)

先跳过其他问题,我们看4.自定义自动飞行文件c172ap做了哪些事情?

答4 这个是一个自定义的c172自动驾驶脚本

打开c172ap.xml文件发现自定义输出输出的地方:答5

<!-- INTERFACE PROPERTIES --> <property>ap/attitude_hold</property> <property>ap/altitude_hold</property> <property>ap/heading_hold</property> <property>ap/altitude_setpoint</property> <property>ap/heading_setpoint</property> <property>ap/aileron_cmd</property> <property>ap/elevator_cmd</property> <property>ap/airspeed_setpoint</property> <property>ap/airspeed_hold</property> <property>ap/throttle-cmd-norm</property><!-- INITIAL GAIN VALUES --> <property value='0.5'> ap/hdg-roll-err-c1 </property> <property value='50.0'> ap/roll-pid-kp </property> <property value='5.0'> ap/roll-pid-ki </property> <property value='17.0'> ap/roll-pid-kd </property> <!-- <property>attitude/sensor/phi-rad</property> -->
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
二、Ubuntu14.04下安装Hadoop2.4.0 (伪分布模式)
mybatis热部署加载*Mapper.xml文件
linux下通过sed命令直接修改文件内容
Spring中ref local与ref bean区别:
一文搞定SonarQube接入C#(.NET)代码质量分析
Hadoop安装部署
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服