飞行的高度是如何测量的?地面的高度和海平面的高度差别很大,飞控又是如何有效判别进行降落的?这是我脑子里的疑问。搜索的一圈发现很少有人讨论这方面的问题,于是本次我就直接看一下源代码,一起分析一下PX4中关于高度的相关问题,以及如何利用高度实现自动降落的。

注:看文档最好还是看英文的,有时候翻译的没有把关键信息给翻译出来,会有很多误解。

1、PX4降落的几种模式

Fixed Wing:

  • Manual-Easy: Position, Altitude, Stabilized, Manual
  • Manual-Acrobatic: Acro
  • Autonomous: Hold, Return, Mission, Takeoff, Land, Offboard

先看看land mode是什么:

Land mode causes the vehicle to turn and land at the location at which the mode was engaged. Fixed wing landing logic and parameters are explained in the topic: Landing (Fixed Wing)

“Land mode 让飞行器调转方向,并且在该模式被激发的那个位置着陆。”这句话的意思是,给飞机下达land mode指令,飞机就会立刻着陆的意思。不管之前的规划路线了么?看一下代码是怎么写的。

再看第二句:

In Land mode the ground altitude is not known and the vehicle will use assume it is at 0m (sea level). Often the ground level will be much higher than sea level, so the vehicle will land in the first phase (it will land on the ground before it reaches the flare altitude).

“在land mode地面高度是未知的,并且飞机会假定地面高度是0m(海平面),通常地面高度远高于海平面,所以飞机将在降落的第一阶段着陆(也就是在到底 flare高度之前就会着陆)”。 也就是说,在land mode,飞行器不判断地面的高度,直接用0m作为地面高度进行降落程序。看起来好像有点傻,但可能因为飞到了一个任意地点,不知道当地的高度信息。

再看:

In a mission, Return mode, or if the vehicle has a range sensor fitted then ground level can be accurately estimated and landing behaviour will be as shown in the preceding diagram.

“在mission mode / return mode,或者飞机有一个距离传感器时,地面高度将被准确的估计,这样的话降落行为就看上去跟上面的图一样了。” 也就是说,在return mode等模式中,是有参考的地平面的(在飞机arm的时候,更新当前位置为home position,里面包括一个当前位置的高度,作为降落时候的地平面),所以可以实现flared landing。

再看一下QGC的一段文档:

The Fly View displays the actual home position set by the vehicle firmware when it arms (this where the vehicle will return in Return/RTL mode).

当飞机arm的时候,由固件来设置真实的home position,在QGC上规划的那个lanch点不是真实的home pos,只是规划而已。这个点也是return mode的返回点。

2、地面高度和海拔高度

查询了一下MAVLINK里面关于高度的消息。

ALTITUDE ( #141 )

[Message] The current system altitude.

Field Name Type Units Description
time_usec uint64_t us Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
altitude_monotonic float m This altitude measure is initialized on system boot and monotonic (it is never reset, but represents the local altitude change). The only guarantee on this field is that it will never be reset and is consistent within a flight. The recommended value for this field is the uncorrected barometric altitude at boot time. This altitude will also drift and vary between flights.
altitude_amsl float m This altitude measure is strictly above mean sea level and might be non-monotonic (it might reset on events like GPS lock or when a new QNH value is set). It should be the altitude to which global altitude waypoints are compared to. Note that it is *not* the GPS altitude, however, most GPS modules already output MSL by default and not the WGS84 altitude.
altitude_local float m This is the local altitude in the local coordinate frame. It is not the altitude above home, but in reference to the coordinate origin (0, 0, 0). It is up-positive.
altitude_relative float m This is the altitude above the home position. It resets on each change of the current home position.
altitude_terrain float m This is the altitude above terrain. It might be fed by a terrain database or an altimeter. Values smaller than -1000 should be interpreted as unknown.
bottom_clearance float m This is not the altitude, but the clear space below the system according to the fused clearance estimate. It generally should max out at the maximum range of e.g. the laser altimeter. It is generally a moving target. A negative value indicates no measurement available.

这里有好几个高度,可以用QGC看一下获取到飞机的实时消息。

  • altitude_amsl:平均海拔高度(AMSL----> above mean sea level)
  • altitude_relative: 在home position之上的高度,home点就是起飞的时候设置的位置
  • altitude_local: 这个是以NED坐标系为参考的高度,但注意,向上是正,跟NED坐标系的z轴值是相反反的。NED坐标系的原点在一开始启动飞机的时候,记录下的地方。并且不随你设置不同的home pos而变化。

感觉这三个可能比较有用。

还有一个名词 QNH,查了一下维基百科

QNH is the barometric altimeter setting that causes an altimeter to read airfield elevation above mean sea level when on the airfield. In ISA temperature conditions the altimeter will read altitude above mean sea level in the vicinity of the airfield.

3、PX4降落时用的是什么高度

按照文档描述分为两种情况:

在LAND MODE,也就是直接降落。这时候就是认为地面在海平面;

在RETURN MODE,也就是先返回到起点再降落。这时候就用的home postion里面的高度作为地平面。

对于LAND MODE 的情况:

mavlink/mavlink_mission.cpp

#1297    mission_item->altitude = mavlink_mission_item->z;  // 从mavlink消息中取出land的高度

PX4-Autopilot/src/modules/navigator/land.cpp

void
Land::on_activation()
{/* set current mission item to Land */set_land_item(&_mission_item, true);_navigator->get_mission_result()->finished = false;_navigator->set_mission_result_updated();reset_mission_item_reached();/* convert mission item to current setpoint */struct position_setpoint_triplet_s *pos_sp_triplet = _navigator->get_position_setpoint_triplet();pos_sp_triplet->previous.valid = false;mission_apply_limitation(_mission_item);mission_item_to_position_setpoint(_mission_item, &pos_sp_triplet->current);pos_sp_triplet->next.valid = false;_navigator->set_can_loiter_at_sp(false);_navigator->set_position_setpoint_triplet_updated();
}

从mission_item 中取出当前的setpoint,来控制飞机降落。

mission_item里面的高度是什么呢?通过set_land_item(),使用当前的位置,而高度直接设置为0。貌似没有用到MAVLINK发过来的数据(发过来的数据好像高度也是0,待确认)。请看下面的代码:

void
MissionBlock::set_land_item(struct mission_item_s *item, bool at_current_location)
{/* VTOL transition to RW before landing */if (_navigator->force_vtol()) {vehicle_command_s vcmd = {};vcmd.command = NAV_CMD_DO_VTOL_TRANSITION;vcmd.param1 = vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC;vcmd.param2 = 0.0f;_navigator->publish_vehicle_cmd(&vcmd);}/* set the land item */item->nav_cmd = NAV_CMD_LAND;/* use current position */if (at_current_location) {item->lat = (double)NAN; //descend at current positionitem->lon = (double)NAN; //descend at current positionitem->yaw = _navigator->get_local_position()->heading;} else {/* use home position */item->lat = _navigator->get_home_position()->lat;item->lon = _navigator->get_home_position()->lon;item->yaw = _navigator->get_home_position()->yaw;}item->altitude = 0;item->altitude_is_relative = false;item->loiter_radius = _navigator->get_loiter_radius();item->acceptance_radius = _navigator->get_acceptance_radius();item->time_inside = 0.0f;item->autocontinue = true;item->origin = ORIGIN_ONBOARD;
}

因此,再LAND MODE ,直接就把海平面当作地面高度,直接开始降落的逻辑。

4、QGC里面的高度

在规划路径的时候,上面显示的应该是AMSL,也就是海平面高度。同时,QGC还能够读取当前路径下的地形高度,所以有个对比示意图。

而且,如果你的高度设置的不合理,路线低于地形高度,它规划的路线会显示红色。

例如,这个路径中,我们穿越了紫金山。但是路径点5-6-7之间的高度比紫金山的地形高度低,标记成了红色。在下方的高度示意图中,可以看到绿色是地形高度,黄色是规划的路线高度,其中有一段是红色,表示比地形高度低。

降落的地点,可以输入高度,这个高度是距离地面的相对高度,最好选择在开始点附近,不然太远了,地形如果不平,则肯定会有问题。

关于PX4中的高度若干问题相关推荐

  1. 在PX4中如何使用offboard模式以及对c_uart_interface_example程序的分析

        c_uart_interface_example是mavlink团队提供的一个演示如何用c语言调用mavlink API对飞机做offboard控制的例子程序,这个程序写的挺漂亮的,但是,新的 ...

  2. php判断数组不重复的元素,php从数组中随机选择若干不重复元素

    php从数组中随机选择若干唯一元素 /* * $array = the array to be filtered * $total = the maximum number of items to r ...

  3. php设置页面最小高度,HTML_CSS布局中最小高度的妙用,最小高度可以设定一个BOX的最 - phpStudy...

    CSS布局中最小高度的妙用 最小高度可以设定一个BOX的最小高度,当其内容较少时时,也能保持BOX的高度为一定,超出就自动向下延伸,但到目前为止,只有Opera 和 Mozilla 支持,IE7开始也 ...

  4. li中浮动元素span等在IE和Firefox中的高度Bug

    当li中存在浮动元素如span时 ,ie中li高度多出2px,必须浮动li元素才能保证ie和firefox相同. 转载于:https://www.cnblogs.com/tacker/archive/ ...

  5. iframe在ie和firefox中的高度兼容性问题解决

    iframe在ie和firefox中的高度兼容性问题解决 参考文章: (1)iframe在ie和firefox中的高度兼容性问题解决 (2)https://www.cnblogs.com/haore1 ...

  6. html中定义高度的属性是什么,height【css 高度】属性教程

    css height[css 高度]height属性 DIV CSS高度height属性教程 height翻译成中文也是高.高度意思.在CSS样式中高度样式设置也是height来布局.几乎每个网页布局 ...

  7. PX4中vtol_att_control 源码解析

    px4中vtol姿态控制源码分析 /src/modules/vtol_att_control/文件夹中包含vtol_att_control_main.vtol_type.standard/tailsi ...

  8. sar点目标成像matlab,SARrawdata 根据矩阵中的高度数据,通过SAR点目标成像算法 过程,将 转换为实际从飞机 matlab 272万源代码下载- www.pudn.com...

    文件名称: SARrawdata下载  收藏√  [ 5  4  3  2  1 ] 开发工具: matlab 文件大小: 1897 KB 上传时间: 2017-03-31 下载次数: 0 提 供 者 ...

  9. 算法-从1,...,99,2015这100个数中任意选择若干个数(可能为0个数)求异或,试求异或的期望值

    题目: 从1,2,3,-..98,99,2015这100个数中任意选择若干个数(可能为0个数)求异或,试求异或的期望值. 解题思路: 这是阿里巴巴的一道笔试题目,这并不是一道编程类的题目(虽然可以用编 ...

最新文章

  1. R学习笔记之五:数据操作
  2. Linux下恢复误删文件:思路+实践
  3. ECMall如何在后台添加模板编辑页
  4. 安卓布局参数类LayoutParams
  5. 【Python笔记】正则表达式
  6. 不错的Feature设计:提建议并投票
  7. 计算机组成原理白中英知识点总结,计算机组成原理重点整理(白中英版)
  8. Java主流框架技术及少量前端框架使用与总结
  9. excel文件修复工具_用EXCEL自己制作批量修改文件名的实用工具
  10. 基于MATLAB车牌识别算法实现 GUI界面
  11. 猿编程 python_猿编程客户端下载_猿编程(小学阶段编程课程学习专用) 1.5.2 官方版_极速下载站...
  12. 机房动力环境监测系统
  13. html转化pug,pug转化html,sass转化scss
  14. 爬取京东收件地址下得所有数据
  15. linux下打开xls文件怎么打开方式,xls是什么文件格式?xls文件怎么打开?
  16. Cesium场景泛光
  17. 如何解决win7开机提示未能连接一个Windows服务
  18. git-常见问题解决方法(全)
  19. 苹果原壁纸高清_精选创意设计系列高清苹果手机壁纸
  20. 计算机网络在财务管理中的运用,浅析如何应用计算机网络进行财务管理

热门文章

  1. 以后坚决不养会冬眠的动物叻。。
  2. AUTOCAD——快速计算器
  3. 百度数据仓库palo使用总结
  4. Sigmoid、Tanh、ReLU、Leaky_ReLU、SiLU、Mish函数python实现
  5. element ui Tag 动态添加标签
  6. /root/miniconda3/bin/python: can‘t open file ‘/root/autodl-tmp/train.py‘: [Errno 2] No such file
  7. Corda ledger 概念性非技术白皮书
  8. Arcgis使用教程(十)ARCGIS地图制图之地图整饰要素及使用方法
  9. 最早解决制约计算机汉字输入,摆脱键盘束缚 计算机时代的汉字情结
  10. 如何快速将几十张纸质材料转换成电子文档