当前位置:网站首页>Px4 source code compilation to establish its own program module
Px4 source code compilation to establish its own program module
2022-07-27 06:47:00 【Star shadow_ sysu】
Preface : I found a big circle on the Internet , How to be in px4 Source code examples Add your own program , Including the official website is useless , Later, it was found that you need to pair cmake File modification , As follows :
1. Create a new folder in the location you want , Suggestions and yours c perhaps cpp The same name of the file , Generally in module perhaps examples Create your new folder under the folder , I was in examples New below . Path is ../PX4-Autopilot/src/examples/xxx
Some students should be ../Firmware/src/examples/xxx

2. newly build .c perhaps .cpp file , as well as CMakeLists.txt
.c perhaps .cpp file and CMakeLists.txt Please refer to the official website for the compilation suggestions
First Application Tutorial (Hello Sky) | PX4 User Guide
Here's my , Because it's just for compiling , The content is on the official website px4_simple_app Abridged edition
#CMakeLists.txt
px4_add_module(
MODULE examples__my_example_app
MAIN my_example_app
STACK_MAIN 200
SRCS
my_example_app.c
DEPENDS
)
#my_example_app.c
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/tasks.h>
#include <px4_platform_common/posix.h>
#include <unistd.h>
#include <stdio.h>
#include <poll.h>
#include <string.h>
#include <math.h>
#include <uORB/uORB.h>
#include <uORB/topics/sensor_combined.h>
#include <uORB/topics/vehicle_attitude.h>
__EXPORT int my_example_app_main(int argc, char *argv[]);
int my_example_app_main(int argc, char *argv[])
{
PX4_INFO("Hello Sky!");
PX4_INFO("exiting");
return OK;
}3. The most troublesome place before , As mentioned in many tutorials CMake Look for configs Folder , But do I have , Therefore, the compilation fails , Later according to
Found the corresponding modification
(1) stay PX4-Autopilot/boards/px4/sitl/default.cmake Modify in process , Just add your file name

First note if you are compiling other versions , Then in px4 Find your compilation method under the folder , I am software in the loop simulation, so I am looking for sitl Folder
Second note , If the folder you created before is in modules Under the folder , Then your corresponding modification should be in modules below
(2) stay PX4-Autopilot/boards/px4/sitl/test.cmake Modify in process , Add your file name , The steps are the same as above

4. The modification is complete , Save the file and open it on the terminal , To run jmavsim For example
make clean
make px4_sitl jmavsimAfter performing help command , See if there is the one you created in the pile given

Some words , Just type in this sentence , Let's see the output
completion of enforcement ~
边栏推荐
猜你喜欢

Ftx.us launched stock and ETF trading services to make trading more transparent

Linux安装Redis操作

regular expression

一键修复漏洞可行吗?向日葵来告诉你一键修复漏洞可行吗?向日葵来告诉你一键修复漏洞可行吗?向日葵来告诉你一键修复漏洞可行吗?向日葵来告诉你一键修复漏洞可行吗?向日葵来告诉你一键修复漏洞可行吗?向日葵来告

项目实训经历2

Redis fast learning

Lamp -- source code compilation and installation

DHCP principle and configuration

DNS domain name resolution service

2021-06-26
随机推荐
如何避免漏洞?向日葵远程为你讲解不同场景下的安全使用方法
Socket programming II: using Select
Shell programming specifications and variables
Sunflower popularizes Science in an all-round way to avoid loopholes for your remote control equipment in time
Talk about why you need to declare the member function of a class as private
DNS fault analysis optimization
Basic knowledge of English: modifying sentence elements - Part 1
Project training experience 2
Source code compilation and installation LNMP and discuz Forum
Soul continues to make efforts to list its social channels in Hong Kong. Why is "soul style social" popular?
Shell脚本备份MySQL数据库
If conditional statement of shell
PXE高效批量网络装机
Go语言学习
Relevant preparation materials for system design
Shell脚本一键配置LAMP
Three methods to judge whether it is palindrome structure
面试常问的问题总结【呕心沥血熬了一个晚上总结的】
About the use of TestNG related tags
ArcGIS for JS API (2) get the ID set of element services