关于PX4中的高度若干问题

2023-05-16

飞行的高度是如何测量的?地面的高度和海平面的高度差别很大,飞控又是如何有效判别进行降落的?这是我脑子里的疑问。搜索的一圈发现很少有人讨论这方面的问题,于是本次我就直接看一下源代码,一起分析一下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指令,飞机就会立刻着陆的意思。不管之前的规划路线了么?看一下代码是怎么写的。

再看第二句:

Fixed Wing - Landing Path

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 NameTypeUnitsDescription
time_usecuint64_tusTimestamp (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_monotonicfloatmThis 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_amslfloatmThis 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_localfloatmThis 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_relativefloatmThis is the altitude above the home position. It resets on each change of the current home position.
altitude_terrainfloatmThis 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_clearancefloatmThis 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 position
		item->lon = (double)NAN; //descend at current position
		item->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之间的高度比紫金山的地形高度低,标记成了红色。在下方的高度示意图中,可以看到绿色是地形高度,黄色是规划的路线高度,其中有一段是红色,表示比地形高度低。

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

关于PX4中的高度若干问题 的相关文章

  • ardupilot & px4 书写自己的app & drivers (二)

    新建任务列表任务 打印时间 任务列表 const AP Scheduler span class hljs tag Task span Copter span class hljs tag scheduler tasks span span
  • PX4二次开发中查无资料的踩坑总结

    写在前 xff1a 2021年9月下旬开始摸索px4飞控的二次开发 xff0c 从C 43 43 零基础到第一个修改算法后的版本稳定运行 xff0c 大概用了2个月 xff0c 从12月初改用新版本px4源码到现在又过去了约1个月 xff0
  • 【8-12】树莓派部署t265+px4飞控实现无人机视觉定位

    在之前的文章中 xff0c 我们已经成功在树莓派 xff08 ubuntu mate 18 04 xff09 上部署了T265的追踪摄像头 本文将利用MAVROS协议 xff0c 将T265测量的位姿信息发送给px4固件 xff0c 实现室
  • 关于PX4中的高度若干问题

    飞行的高度是如何测量的 xff1f 地面的高度和海平面的高度差别很大 xff0c 飞控又是如何有效判别进行降落的 xff1f 这是我脑子里的疑问 搜索的一圈发现很少有人讨论这方面的问题 xff0c 于是本次我就直接看一下源代码 xff0c
  • Ubuntu20.04+MAVROS+PX4+Gazebo保姆级安装教程

    Ubuntu20 04 43 MAVROS 43 PX4 43 Gazebo 安装PX4步骤安装MAVROS安装QGCPX4仿真 安装PX4步骤 从github上clone源码 span class token function git s
  • Ubuntu下构建PX4软件

    本搭建过程基于http dev px4 io starting building html xff0c 希望大家互相交流学习 原文 xff1a Building PX4 Software xff08 构建PX4软件 xff09 PX4 ca
  • PX4源代码下载编译

    sudo git clone https github com PX4 PX4 Autopilot git recursivegit submodule update init recursivegit submodule update r
  • 无人机仿真—PX4编译,gazebo仿真及简单off board控制模式下无人机起飞

    无人机仿真 PX4编译 xff0c gazebo仿真及简单off board控制模式下无人机起飞 前言 在上篇记录中 xff0c 已经对整体的PX4仿真环境有了一定的了解 xff0c 现如今就要开始对无人机进行起飞等仿真环境工作 xff0c
  • PX4 ---- Mixer

    文章目录 Mixer 混合控制 作用输入输出装载混控文件MAVROS代码解析总结示例MAINAUX Mixer 混合控制 作用 经过位置控制和姿态控制后 xff0c 控制量通过 actuator controls发布 xff0c 其中 co
  • PX4 ---- Indoor Flight

    文章目录 室内飞行ROS amp PX4Pose Data 飞机配置MAVROS 基于工训赛 VIO 飞行总结 室内飞行 ROS amp PX4 Pose Data 飞机配置 VIO 参考此处 xff0c 采用 T265 配置 相机与飞控机
  • PX4模块设计之一:SITL & HITL模拟框架

    PX4模块设计之一 xff1a SITL amp HITL模拟框架 1 模拟框架1 1 SITL模拟框架1 2 HITL模拟框架 2 模拟器类型3 MAVLink API4 总结 基于PX4开源软件框架简明简介的框架设计 xff0c 逐步分
  • PX4模块设计之四:MAVLink简介

    PX4模块设计之四 xff1a MAVLink简介 1 MAVLink PX4 应用简介2 MAVLink v2 0新特性3 MAVLink协议版本4 MAVLink通信协议帧4 1 MAVLink v1 0 帧格式4 2 MAVLink
  • PX4模块设计之十七:ModuleBase模块

    PX4模块设计之十七 xff1a ModuleBase模块 1 ModuleBase模块介绍2 ModuleBase类介绍3 ModuleBase类功能介绍3 1 模块入口3 2 模块启动3 3 模块停止3 4 状态查询3 5 任务回调3
  • PX4模块设计之三十四:ControlAllocator模块

    PX4模块设计之三十四 xff1a ControlAllocator模块 1 ControlAllocator模块简介2 模块入口函数2 1 主入口control allocator main2 2 自定义子命令custom command
  • PX4模块设计之四十三:icm20689模块

    PX4模块设计之四十三 xff1a icm20689模块 1 icm20689模块简介2 模块入口函数2 1 主入口icm20689 main2 2 自定义子命令custom command2 3 模块状态print status 重载 3
  • mavros连接px4失败的usb-ttl原因

    问题描述 xff1a 最近在搞mavros xff0c 以方便协处理器和pixhawk通讯 xff0c 在按照官网教程安装mavros xff0c 设置px4 xff0c 连接硬件之后发现mavros卡在中间下不去 xff1a MAVROS
  • px4_simple_example和uorb机制

    px4 simple app PX4 Autopilot src exampes px4 simple app xff0c 这个程序是用c语言调用orb API和poll机制订阅和发布通讯数据 xff0c 但是这个例子并不是既有接收又有发送
  • Px4源码框架结构图

    此篇blog的目的是对px4工程有一个整体认识 xff0c 对各个信号的流向有个了解 xff0c 以及控制算法采用的控制框架 PX4自动驾驶仪软件 可分为三大部分 xff1a 实时操作系统 中间件和飞行控制栈 1 NuttX实时操作系统 提
  • PX4软件在环仿真注意点

    注 xff1a 最新内容参考PX4 user guide 点击此处 PX4下载指定版本代码和刷固件的三种方式 点击此处 PX4sitl固件编译方法 点击此处 PX4开发指南 点击此处 PX4无人机仿真 Gazebo 点击此处 px4仿真 知
  • PX4 OffBoard Control

    终于还是走上了这一步 xff0c 对飞控下手 xff0c 可以说是一张白纸了 记录一下学习的过程方便以后的查阅 目录 一 ubuntu18 04配置px4编译环境及mavros环境 二 PX4的OffBoard控制 1 搭建功能包 2 编写

随机推荐

  • RGB-D相机建图——3、使用kalibr进行相机标定

    Kalibr 视觉惯性校准工具箱 官方网站 xff1a https github com ethz asl kalibr Kalibr是一个工具箱 xff0c 可以解决以下校准问题 xff1a 多摄像机校准 xff1a 具有非全局共享重叠视
  • 02.构建项目流程梳理及总结

    02 构建项目流程梳理及总结
  • Nuttx学习入门

    Nuttx学习 NuttX 是一个实时操作系统 RTOS xff0c 强调标准合规性和占用空间小 可从 8 位扩展到 64 位微控制器环境 xff0c NuttX 中的主要管理标准是 POSIX 和 ANSI 标准 NuttX 的主要环境依
  • 软件测试之如何介绍自己的项目

    测试人员在找工作的过程中 xff0c 通常有一个问题是很难绕开的 就是要如何向别人介绍自己之前做过的项目 要解决这个问题 xff0c 大致可以分为如下几个步骤 xff1a 1 对项目进行基本介绍 2 说明自己负责测试的模块 3 针对部分模块
  • FreeRTOS多任务管理

    文章目录 1 任务1 1 任务简介1 2 任务调度1 3 任务的状态 就绪态 运行态 阻塞态 挂起态 1 4 空闲任务 2 动态创建两个任务2 1 定义动态内存空间的堆2 2 定义任务函数2 3 定义 任务控制块 指针2 4 动态创建任务
  • 计算机类期刊投稿心得 [ 添加中...现35种 ]

    1 杂志名称 计算机应用研究 杂志文章包含专业 建模 xff0c 仿真 xff0c 网络 xff0c 人工智能 xff0c 比较杂 投稿联系方式 http www arocmag com 注册在线投稿审稿 投稿费用 250元 页 杂志级别
  • Minix下的汇编

    Minix下的汇编 大多数的编译器 xff0c 如Turbo C C 43 43 xff0c Borland C C 43 43 xff0c M C C 43 43 xff0c GCC xff0c VC 43 xff0c 编译过程都是 xf
  • 解决Xshell 7 报错 “要继续使用此程序,您必须应用最新的更新或使用新版本”

    1 先创建一个文本文档 xff0c 同时把该文档名称和后缀改为xshell7 bat xff1b 2 打开编辑这个xshell7 bat文件 xff0c 并且把以下文字复制进去 xff0c 注意set XSHELL 61 这一项需要改成你自
  • 多任务操作系统的任务切换

    在学习OS时 xff0c 对于多任务操作系统的任务切换 xff0c 一直不能理解 xff1a 控制权是怎么么回到调度程序上的 xff1f 记得在描述任务切换时 xff0c 一般都是这么描述的 xff1a 在每一个时钟滴答 xff0c 都将检
  • Minix下的汇编2

    似乎minix平台并没有带一个真正的汇编编译器 xff0c 看看makefile xff0c 几乎都是清一色的用cc来编译汇编代码的 而且 xff0c 即使是一个最简单功能的汇编程序 xff0c 也少不了一个 main 标签 在minix的
  • 原来在/var/spool/mail中

    fetchmail会把从mail server收到的邮件投递到 var spool mail 中去 而mutt也会自动地到 var spool mail里取信 xff0c 解码 xff0c 并显示 但 xff0c fetchmail的速度不
  • 汉字编码标准与识别(一)代码页(Code Page)初识

    BBS水木清华站 精华区 发信人 yanglc 魂归燕园 别理我 xff0c 烦着呢 信区 Linux 标 题 汉字编码标准与识别 一 发信站 BBS 水木清华站 Sat Apr 29 17 19 05 2000 http www linu
  • 让xpdf支持中文(C++primer中文版)

    首先到http www linuxfans org nuke modules php name 61 Site Downloads amp op 61 geninfo amp did 61 2385下载一个打了补丁的xpdf 安装 xff0
  • Xpdf-3 for MDK

    http www linuxfans org nuke modules php name 61 Site Downloads amp op 61 geninfo amp did 61 2385 Xpdf 3 for MDK 类别 其它软件
  • 不同公司的牛

    本文转自 C 43 43 Builder 研究 http www ccrun com other go asp i 61 264 amp d 61 sgz5id 传统公司 xff1a 你有两头母牛 你卖掉一头 xff0c 买了一头公牛 你的
  • 从词法分析开始

    刚开始时 xff0c 用lex的确是很方便 xff0c 但是这样却不能将词法分析的思想实践出来 最好的方法还是自己写一个lex 当然龙书上写得很详细了 xff0c 但是写得再详细 xff0c 把它实现出来还是很难的 我的计划是 xff1a
  • Python 获取当前路径几种方法

    Python 获取当前路径的几种方法 绝对路径 1 os path 方法 span class token comment coding utf 8 span span class token comment usr bin python
  • [pixhawk笔记]2-飞行模式

    本文翻译自px4官方开发文档 xff1a https dev px4 io en concept flight modes html xff0c 有不对之处 xff0c 敬请指正 pixhawk的飞行模式如下 xff1a MANUAL xf
  • 扩展卡尔曼滤波详解

    Extened Kalman Filter 简单介绍 卡尔曼滤波详解讲解的基本的卡尔曼滤波算法是通过一个线性随机差分方程来估计当前状态 xff0c 但是如果状态估计关系以及测量关系使非线性的怎么办 xff0c 而且在实际使用中大部分的问题都
  • 关于PX4中的高度若干问题

    飞行的高度是如何测量的 xff1f 地面的高度和海平面的高度差别很大 xff0c 飞控又是如何有效判别进行降落的 xff1f 这是我脑子里的疑问 搜索的一圈发现很少有人讨论这方面的问题 xff0c 于是本次我就直接看一下源代码 xff0c