当前位置:网站首页>[flight control development foundation tutorial 4] crazy shell · open source formation UAV - serial port (optical flow data acquisition)
[flight control development foundation tutorial 4] crazy shell · open source formation UAV - serial port (optical flow data acquisition)
2022-07-27 07:49:00 【efans_ Mike】
COCOFLY course
—— Crazy shell · Unmanned aerial vehicle (uav) · series
A serial port ( Optical flow data acquisition )
chart 1
One 、 Introduction to optical flow module
Optical flow (optical flow) It refers to the instantaneous speed of the pixel motion of the space moving object on the observation imaging plane .
Optical flow method uses the changes of pixels in the time domain and the correlation between adjacent frames in the image sequence to find the corresponding relationship between the previous frame and the current frame , A method to calculate the motion information of objects between adjacent frames .
Usually, the instantaneous change rate of gray level on a specific coordinate point of two-dimensional image plane is defined as optical flow vector .
generally speaking , Optical flow is due to the movement of the foreground target itself in the scene 、 The motion of the camera , Or the joint movement of the two .
When a person's eyes observe a moving object , The scene of an object forms a series of continuously changing images on the retina of the human eye , This series of continuously changing information is constantly “ Flow through ” retina ( Image plane ), Like a kind of light “ flow ”, So it is called optical flow . Optical flow expresses the change of image , Because it contains the information of target motion , Therefore, it can be used by the observer to determine the movement of the target .
COCOFLY The optical flow module used by UAV is based on PMW3901,PMW3901 It is an optical motion tracking sensor , The sensor is small 、 Low power consumption 、 High precision . As shown in the figure below, the physical drawing of the optical flow module is shown in the figure below .
chart 2
The optical flow module has PMW3901 Good data processing , And transmit periodically through serial port , The baud rate is 19200, The serial port transmission protocol of the optical flow module is shown in the table below .
surface 1
among DATA0、DATA1 yes flow_x Split low 8 Bit data and high 8 Bit data , namely flow_x=(int16_t)(DATA1<<8)|(DATA0),DATA2、DATA3 yes flow_y It's low 8 Position and height 8 position , namely flow_y=(int16_t)(DATA3<<8)|(DATA2), Where the sum check is DATA0~DATA3 The cumulative value of , namely SUM=DATA0+DATA1+DATA2+DATA3;SQUAL For the ground environmental quality , The larger the value, the higher the ground environmental quality ; The last byte is the terminator , There are two kinds of : Fixed in normal mode is 0xAA(Y Pin to high level )、 It is fixed in yaw mode 0xBB(Y Pin connected to low level ). Two 、 Serial optical flow data acquisition experiment
Serial optical flow data acquisition experiment use STM32 Serial port 2 namely UART2 Connected with optical flow module , A serial port 1 namely UART1 adopt USB Connect the serial port module to the computer , Put the serial port 2 The obtained optical flow data passes through the serial port 1 The serial port debugging assistant transmitted to the computer is displayed . A serial port 2 The pins are shown in the figure below :
chart 3
The two serial port pins are respectively connected with PA2 And PA3 Pin to pin , Then we are right PA2 And PA3 Pin configuration , A serial port 1 The configuration of can refer to 《 A serial port ( Basic transceiver )》, Configuration code ( By calling the official library ) The idea of writing is as follows :
surface 2
A serial port 2 The initialization code is as follows :
chart 4
A serial port 2 The data received from the optical flow module is forwarded to the serial port 1, A serial port 2 The interrupt function code of is as follows .
chart 5
Set the serial port 2 The baud rate of is 19200, The code is as follows :
chart 6
preservation 、 compile 、 Download code , Ensure serial port 2 Connect the optical flow module , Then put the serial port 1 Connect
USB Serial port module , Finally connected to the computer USB port , As shown in the figure below :
chart 7
Then I'm putting USB Plug the serial transfer module into the computer USB mouth , Open the serial port debugging assistant on the computer , Find the corresponding COM mouth ( The premise is that USB Serial port drive ), Set the baud rate to 115200, open , You can see that the serial port is constantly printing the data sent by the optical flow module , As shown in the figure below .
chart 8
边栏推荐
- Systematic explanation of unit testing: mockito
- MCU multi-level menu
- 一体化实时HTAP数据库StoneDB,如何替换MySQL并实现近百倍分析性能的提升
- 增强:BTE流程简介
- The DrawImage method calls the solution of not displaying pictures for the first time
- 「翻译」SAP变式物料的采购如何玩转?看看这篇你就明白了
- 【飞控开发基础教程4】疯壳·开源编队无人机-串口(光流数据获取)
- 电子量产项目框架--基本思想
- Redison 3.17.5 release, officially recommended redis client
- slf4j如何进行logback配置呢?
猜你喜欢
![[stonedb class] introductory lesson 1: popular science of database knowledge](/img/ec/4e3c0b91ac2ee164595c2891b23dfb.jpg)
[stonedb class] introductory lesson 1: popular science of database knowledge

opengl-shader学习笔记:varying变量

The DrawImage method calls the solution of not displaying pictures for the first time

What is the real HTAP? (2) Challenge article
![[resolved] SSO forwarding succeeded, and there was an unexpected error (type=internal server error, status=500) caused by parameters in the forwarding URL](/img/05/41f48160fa7895bc9e4f314ec570c5.png)
[resolved] SSO forwarding succeeded, and there was an unexpected error (type=internal server error, status=500) caused by parameters in the forwarding URL

Regular expression foundation sorting

国内首款开源MySQL原生HTAP数据库即将发布!三大亮点抢先看,限量周边等你来~

ADC噪声全面分析 -02- ADC 噪声测量方法和相关参数

Demo:pa30 Bank Country Code default CN enhancement

【飞控开发基础教程4】疯壳·开源编队无人机-串口(光流数据获取)
随机推荐
Showdoc vulnerability learning - cnvd-2020-26585 (arbitrary file upload)
容器内使用sudo报错bash: sudo: command not found解决
为啥国内大厂都把云计算当成香饽饽,这个万亿市场你真的了解吗
Lua迭代器
SQL labs SQL injection platform - level 1 less-1 get - error based - Single Quotes - string (get single quote character injection based on errors)
Resttemplate connection pool configuration
Regular and sed exercises
[day42 literature intensive reading] a Bayesian model of perfect head centered velocity during smooth pursuit eye movement
Hu related configuration
Understanding and learning of node flow and processing flow in io
Docker install MySQL 8.0.28
The token verification of applet message push configuration failed. Please check and confirm
Comprehensive analysis of ADC noise-01-types of ADC noise and ADC characteristics
小程序消息推送配置 Token校验失败,请检查确认
Shell Scripts相关
Redisson 3.17.5 发布,官方推荐的 Redis 客户端
C# 中的转译字符'/b'
Pg_ relation_ Size question
防止Cookie修改id欺骗登录
【已解决】新版Pycharm(2022)连接服务器进行上传文件报错“Command rsync is not found in PATH”,无法同步文件