Main Content

鹦鹉微龙的光流

Introduction

鹦鹉极小情况使用了各种板载传感器,例如加速度计和陀螺仪来稳定自身。但是,由于次要缺陷,无人机不在位,往往会漂移。可以通过使用无人机向下摄像头的图像来避免这种情况。摄像机连续捕获图像并在X和Y方向上检查运动。除了加速度计和陀螺仪外,飞行控制器使用摄像头数据在太空中稳定自身并保持无人机的X-Y位置。

光流

要理解光流,请考虑一种情况下,由于传感器中的某些噪声,无人机在x和y方向上沿x和dy的距离漂移。在这种情况下,控制器需要知道X和Y方向上移动的距离,以使其恢复原始位置。

This can be obtained using the downward-facing camera by comparing consecutive images as the drone moves. The downward facing camera fixes onto objects/patterns on the ground and if there is any change in position of that object/pattern, the camera reports it as a movement in terms of velocity – which is optical flow. This velocity measurement can be used to calculate the distance moved by the drone.

故障排除光流问题

在某些情况下,相机无法检测到水平运动。如果无人机下方的表面质地均匀,没有模式,则相机可能无法检测到运动。另外,当照明较低时,相机可能无法检测到运动。在这种情况下,光流值将为零,导致无人机漂移和可能的崩溃。

为了避免这种情况,我们在新的Simulink项目模板中建模了逻辑(崩溃预测逻辑),金宝appHover Parrot Minidrone。这parrotminidronehover项目(这是模板的一部分)包含崩溃预测器标志子系统(在Flight ControlsystemSimulink model). This subsystem is used to shut down the drone if there is no optical flow measurement for 50 continuous sample times.

如果由于光流问题而关闭无人机,则可以对表面进行一些修复以增加对比度。表面上的对比度增加可确保您的相机产生非零的光流值。

下图显示了表面的场景,您可能会看到光流误差:

红色标记的区域是均匀质地的表面。当无人机飞越地面时,它会收到零光流信息。这就是无人机看到的:

In this case, the drone will drift and eventually crash.

为了增加对比度,请在无人机飞行的表面上添加磁带。由于光流问题,此更改避免了无人机的关闭。

这below image shows an example of adding tapes to the surface to increase contrast.

这就是无人机现在看到的:

表面上的纹理不必如上图所示。只要表面上有对比度,就可以是任何随机模式。

In cases where there are optical flow issues even though there is contrast on the surface, the lighting can be an issue. In this case, increase the room's lighting so that the drone can get non-zero optical flow values.

Simulink Model for Optical Flow

In theparrotminidronehover项目(这是Hover Parrot Minidrone金宝appsimulink模板),关闭无人机的崩溃预测逻辑是在Crash Prediction Flagssubsystem in theFlight Controlsystem模型。

In theCrash Prediction Flagssubsystem, the is a vector obtained from视觉传感器,它具有以下字段:DX_OF(velocity in x-direction),dy_of(Y方向的速度)和OF_status。这OF_status当无人机无法检测到光流和“ 1”时,当无人机检测到光流时为“ 0”。

没有光流的最大循环数可以通过更改的值来更改比较常量block, highlighted in purple. Once the specified value is reached, the drone shuts down.

To disable the Optical flow, perform one of the following options:

  • 增加价值比较常量块(以紫色突出显示)至非常大的价值。

    笔记

    增加计数(没有光流的最大循环数)到非常大的值可能导致无人机漂移。

  • 打开No optical flow子系统(以蓝色突出显示),并将子系统内部常数的值设置为0

从配置参数中删除启用光流选项

启用光流选项的配置参数对话框is now removed, and the functionality is exposed in theFlight Controlsystemmodel as shown above. The option is deprecated from R2019a onwards.

限制/向后兼容性

对于较旧的Simulink模金宝app型(R2019a之前),光流行为不变(鹦鹉无人机在没有光流的50个循环后关闭)。但是,建议移动到新模板(Hover Parrot Minidrone) introduced in R2019a.

也可以看看