当前位置:网站首页>PX4-Things you need to know for secondary development of flight control-Cxm
PX4-Things you need to know for secondary development of flight control-Cxm
2022-08-08 19:20:00 【CHENxiaomingming】
前言:
废话:
来了,之前一直在做APMDevelopment of flight control,found in addition to corporate useAPM,still in the gamePX4a little more,In addition, there is also a need for this recently, so I picked it up again.PX4.The biggest difference between the two flight controllers should be the system.,PX4学习起来还是比较简单的,Compare systems and modularity.recoveringPX4之前,And try to transplantNUTTXThe system finds that if it wants to doPX4这种,It is very troublesome to write a lot of compile chains and scripts,I will directly use altogetherPX4了,That's why I regainedPX4的原因.
Questions about setting up the environment
阿木实验室、科学上网、Many resources such as Baidu are mostly network problems,If you have done all these and still can't compile successfully!!!!!评论留言!!!!!!
学习路线
Find that many of the study of the flight control and I are both students,If you just want to add functionality at the application layer, you only need to start from digital point+51+STM32+LINUXbasically can doPX4的开发了,If want to optimization of flight control or want to control in addition to the previous level deep ****+NUTTX+mavlink+各种协议+线代+控制论等,If I am fortunate enough to deeply cultivate the sharing process without reservation.
学习资源
In addition to the learning route, there are many resources that students ask where to find.,Did you pay for classes?,我有21I bought Amu'sPX4Development of intermediate courses but not much content is basically talking about some basics, so I haven't bought any courses in the future.,The basic source of learning resources are and I love you+官方+百度+群里+CSDN.The best and latest resources are of course from the official ones. Post the official link and the link to the Amu document. They are all very good resources..
https://github.com/PX4/PX4-Autopilot
5-进阶功能-outdoor pointing flight — P系列无人机-wiki 1.0 文档
PX4的作用
简单的介绍一下PX4,It is a foreign open source flight control project,Its hardware platform usesPIXHAWK,PX4Not just multi-rotor drones or even fixed-wing,无人车等,其实个人觉得PX4What's really powerful is the potential of his entire project,Due to the system architecture of the entire project,It supports a variety of protocols, so learnPX4More than just flight control,可以说PX4Meet the needs of me most in the embedded development,If you want to look goodUI就另说了.
记录方式
I will continue to update my learning experience and journey in the blog,通过APMI found that everyone is not very fond of watching that kind of source code analysis.,Add more like some practical function,Moved directly can use that one,所以之后的PX4文章,I will use a project-based way to record and hope it can help everyone,This article is mainly to briefly introduce the protocols and knowledge we need to use,I won't talk about it later.
目录
PX4system and compilation
PX4采用的系统是NUTTX,系统官方链接,简单来说就是8位到64an embedded system,The advantage is that it supports more content(hardware and various protocols).Understand this becausepx4没用使用muttxThe way the native functionality is added is placed inapps里面,As for the careful students in the compilation process, they must have discoveredMakefile这个文件,This is the compile script this islinuxCompile scripts in the environment,The role is to compile,Can control who compiles first and who compiles later,compile with what,to compile those etc..
除了Makefile还有CMakeLists.txt
可以吧CMAKEUnderstand it as a configuration file for auxiliary compilation,We can configure what we want to compile and the size etc.,看案例,You can see only two files
DMODULE 下的名字,MAIN main function command,SRCS 源码


PX4的通信协议
PX4The communication protocol with the ground station ismavlinkAnd the internal communication protocol isuorb协议 malinkIt's the flight control,而uorbIt is a protocol for data communication between systems,There are many of these things on the same platform. I won't go into details. I will post them directly in future projects. This is also very understandable.
uorbThe protocol is roughly used in:
1.创建 .msg 结构体文件
2.添加进CMakeLists.txt 注册
看图可知msgCommunication is really a data message forwarding,uarb分为注册,发布,订阅,在msgAfter adding contentPX4It will automatically compile the header file of the same name for you and store it inuORB/topics/中 For example I put a wasd.msgfile will automatically generate awasd.hheader file and We can call our source code like#include <uORB/topics/wasd.h>So we can let themsgLook at a header file where we save data forwarding data.
The second step is to add into our overallCMakefile registered outsidemsg文件夹中和.msgHide the files together, see Figure 2 and add it in the same format as Figure 3.



PX4的进程
Call the task scheduling library,然后分配资源
See the official case
1module是进程名
2is the default schedule
3是优先级
4是栈大小
5是入口函数


总结
Build good compilation environment,will compile the process and communication protocol,And the addition of the process can start our initial development,In this article, I did not explain these contents in detail. If you are interested, you can search on the same platform.,The next step is for us to master the functionality as we developpx4architecture and native code functionality
谢谢大家!!!!!!!
边栏推荐
猜你喜欢
随机推荐
什么是Shell?从小白到入门你只差一个它
USB CY68013设备描述符识别失败
view, index
如何在Firewalld中为特定IP地址开放端口
Architecture Design Fundamentals
请问在MAXCOMPUTE SQL 里有没有函数判断string 是否为数字?
软件测试主要是做什么的?
hdu2647 N!Again
nyoj 712 Exploring treasure
即将开幕!阿里云飞天技术峰会邀您一同探秘云原生最佳实践
nyoj714 Card Trick (The 6th Henan Province Programming Contest)
最长子串(长沙理工大学第十一届程序设计竞赛 离线 做了n天.....崩溃了)
轻量全景查看器 pannellum初探
我们想更换RDS数据库,从sqlserver 2016 web升级到 2017企业集群版,有专家咨询
Redis Server启动过程
Securities account is better to choose which brokerage platform, which is more safe
能力一般,却可以大厂随便横跳?强在哪里?
【761. 特殊的二进制序列】
数据库学习之库的操作
架构设计基本原则




![[MRCTF2020]你传你码呢](/img/5b/28eede6532decad6c57db62d30bf9c.png)




