Ubuntu下构建PX4软件

2023-05-16

本搭建过程基于http://dev.px4.io/starting-building.html,希望大家互相交流学习。

原文:Building PX4 Software(构建PX4软件)

PX4 can be built on the console or in a graphical development environment / IDE.(PX4可以在终端被构建或者在图形开发环境/集成开发环境

Compiling on the Console(在终端编译)

Before moving on to a graphical editor or IDE, it is important to validate the system setup. Do so by bringing up the terminal. On OS X, hit ⌘-space and search for 'terminal'. On Ubuntu, click the launch bar and search for 'terminal'. On Windows, find the PX4 folder in the start menu and click on 'PX4 Console'.(在使用图形编辑器或集成开发环境前,验证系统设置是很重要的。该工作需要使用终端完成。在Ubuntu上,点击登录工具条并选择terminal,也可以快捷键Ctrl+Alt+T)。

The terminal starts in the home directory. We default to '~/src/Firmware' and clone the upstream repository. Experienced developers might clone their fork instead.(终端启动后在home路径下。我们默认到'~/src/Firmware' 路径下,并且克隆相应源码。有经验工程师可能会克隆代替

mkdir -p ~/src
cd ~/src
git clone https://github.com/PX4/Firmware.git(远程操作的第一步,通常是从远程主机克隆一个版本库,这时就要用到git clone命令。即:git clone <版本库的网址>;该命令会在本地主机生成一个目录,与远程主机的版本库同名。如果要指定不同的目录名,可以将目录名作为git clone命令的第二个参数,即git clone <版本库的网址> <本地目录名>;git clone支持多种协议,除了HTTP(s)以外,还支持SSH、Git、本地文件协议等,下面是一些例子:

$ git clone http[s]://example.com/path/to/repo.git/
$ git clone ssh://example.com/path/to/repo.git/
$ git clone git://example.com/path/to/repo.git/
$ git clone /opt/git/project.git 
$ git clone file:///opt/git/project.git
$ git clone ftp[s]://example.com/path/to/repo.git/
$ git clone rsync://example.com/path/to/repo.git/   )  
cd Firmware
git submodule update --init --recursive(当使用git clone下来的工程中带有submodule时,初始的时候,submodule的内容并不会自动下载下来的,此时,只需执行该指令,即可将子模块内容下载下来后工程才不会缺少相应的文件。
cd ..

Now its time to build the binaries by compiling the source code. But before going straight to the hardware, asimulation run is recommended as the next step. Users preferring to work in a graphical development environment should continue with the next section.(现在就可编译源码构建二进制代码了。但在直接到硬件前,仿真运行作为下一步的推荐。喜欢使用图形开发环境的用户应当继续下一部分学习。)

NuttX / Pixhawk based boards

cd Firmware
make px4fmu-v2_default

Note the syntax: 'make' is the build tool, 'px4fmu-v2' is the hardware / autopilot version and 'default' is the default configuration. All PX4 build targets follow this logic. A successful run will end with this output:(注意语法:make是编译工具;px4fmu-v2是硬件版本,default是默认的配置。所有的PX4编译目标遵循该逻辑。成功的运行将有如下输出:

[100%] Linking CXX executable firmware_nuttx
[100%] Built target firmware_nuttx
Scanning dependencies of target build_firmware_px4fmu-v2
[100%] Generating nuttx-px4fmu-v2-default.px4
[100%] Built target build_firmware_px4fmu-v2

By appending 'upload' to these commands the compiled binary will be uploaded via USB to the autopilot hardware:(通过执行加载命令,编译的二进制代码将被通过USB加载到无人机中。)

make px4fmu-v2_default upload

A successful run will end with this output:(成功运行有如下输出)

Erase  : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting.

[100%] Built target upload

Raspberry Pi 2/3 boards

The command below builds the target for Raspbian.

Cross-compiler build

cd Firmware
make posix_rpi_cross # for cross-compiler build

The "mainapp" executable file is in the directory build_posix_rpi_cross/src/firmware/posix. Make sure you can connect to your RPi over ssh, see instructions how to access your RPi.

Then set the IP (or hostname) of your RPi using:

export AUTOPILOT_HOST=192.168.X.X

And upload it with:

cd Firmware
make posix_rpi_cross upload # for cross-compiler build

Then, connect over ssh and run it with :

./mainapp mainapp.config

Native build

If you're building directly on the Pi, you will want the native build target (posix_rpi_native).

cd Firmware
make posix_rpi_native # for native build

The "mainapp" executable file is in the directory build_posix_rpi_native/src/firmware/posix. Run it directly with :

./build_posix_rpi_native/src/firmware/posix/mainapp ./posix-configs/rpi/mainapp.config

A successful build followed by executing mainapp will give you this :

[init] shell id: 1996021760
[init] task name: mainapp

______  __   __    ___
| ___ \ \ \ / /   /   |
| |_/ /  \ V /   / /| |
|  __/   /   \  / /_| |
| |     / /^\ \ \___  |
\_|     \/   \/     |_/

Ready to fly.


pxh>

Parrot Bebop

Support for the Bebop is really early stage and should not be used.

Build it

cd Firmware
make posix_bebop_default

Turn on your Bebop and connect your host machine with the Bebop's wifi. Then, press the power button four times to enable ADB and start the telnet daemon.

make posix_bebop_default upload
Note this will also copy mainapp.config file.

Run it

Connect to the Bebop's wifi and press the power button four times.

telnet 192.168.42.1

Run mainapp with:

mainapp
You can also use adb shell to start the mainapp.

QuRT / Snapdragon based boards

Build it

The commands below build the targets for the Linux and the DSP side. Both executables communicate viamuORB.

cd Firmware
make eagle_default

To load the SW on the device, connect via USB cable and make sure the device is booted. Run this in a new terminal window:

adb shell

Go back to previous terminal and upload:

make eagle_default upload
Note that this will also copy (and overwrite) the two config files [mainapp.config](https://github.com/PX4/Firmware/blob/master/posix-configs/eagle/flight/mainapp.config) and [px4.config](https://github.com/PX4/Firmware/blob/master/posix-configs/eagle/flight/px4.config) to the device. Those files are stored under /usr/share/data/adsp/px4.config and /home/linaro/mainapp.config respectively if you want to edit the startup scripts directly on your vehicle.

The mixer currently needs to be copied manually:

adb push ROMFS/px4fmu_common/mixers/quad_x.main.mix  /usr/share/data/adsp

Run it

Run the DSP debug monitor:

${HEXAGON_SDK_ROOT}/tools/mini-dm/Linux_Debug/mini-dm

Go back to ADB shell and run mainapp:

cd /home/linaro
./mainapp mainapp.config

Note that the mainapp will stop as soon as you disconnect the USB cable (or if you ssh session is disconnected). To fly, you should make the mainapp auto-start after boot.

Auto-start mainapp

To run the mainapp as soon as the Snapdragon has booted, you can add the startup to rc.local:

Either edit the file /etc/rc.local directly on the Snapdragon:

adb shell
vim /etc/rc.local

Or copy the file to your computer, edit it locally, and copy it back:

adb pull /etc/rc.local
gedit rc.local
adb push rc.local /etc/rc.local

For the auto-start, add the following line before exit 0:

(cd /home/linaro && ./mainapp mainapp.config > mainapp.log)

exit 0

Make sure that the rc.local is executable:

adb shell
chmod +x /etc/rc.local

Then reboot the Snapdragon:

adb reboot

Compiling in a graphical IDE(图形集成开发环境编译)

The PX4 system supports Qt Creator, Eclipse and Sublime Text. Qt Creator is the most user-friendly variant and hence the only officially supported IDE. Unless an expert in Eclipse or Sublime, their use is discouraged. Hardcore users can find an Eclipse project and a Sublime project in the source tree.(PX4系统支持Qt Creator, Eclipse and Sublime和 Sublime Text。Qt Creator是最友好的,因此是官方支持的IDE。除非是 Eclipse 或 Sublime专家,否则他们的使用是让人气馁的。硬核使用者可以找到 Eclipse p工程Sublime工程在源码树中。

frameborder="0" allowfullscreen="" src="http://www.youtube.com/embed/Bkk8zttWxEI" style="box-sizing: border-box; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;font-size:undefined; border-style: none; border-width: initial; position: absolute; top: 0px; left: 0px; width: 770px; height: 458.125px;">

Qt Creator Functionality(Qt Creator功能)

Qt creator offers clickable symbols, auto-completion of the complete codebase and building and flashing firmware.(Qt creator提供了可点击符号,自动代码补全和构建、刷新固件功能)。

Qt Creator on Linux

Before starting Qt Creator, the project file needs to be created:(在使用Qt Creator之前,工程文件需要先创建)

cd ~/src/Firmware
mkdir ../Firmware-build
cd ../Firmware-build
cmake ../Firmware -G "CodeBlocks - Unix Makefiles"

Then load the CMakeLists.txt in the root firmware folder via File -> Open File or Project -> Select the CMakeLists.txt file.(然后加载CMakeLists.txt到根固件文件夹通过File -> Open File or Project -> Select the CMakeLists.txt file.操作)

After loading, the 'play' button can be configured to run the project by selecting 'custom executable' in the run target configuration and entering 'make' as executable and 'upload' as argument.(加载之后,运行按钮可以被配置为运行项目通过在运行配置中选择'custom executable',并且输入“make”作为执行,‘upload' 作为参数。)

Qt Creator on Windows

Windows has not been tested with Qt creator yet.

Qt Creator on Mac OS

Before starting Qt Creator, the project file needs to be created:

cd ~/src/Firmware
mkdir build_creator
cd build_creator
cmake .. -G "CodeBlocks - Unix Makefiles"

That's it! Start Qt Creator, then complete the steps in the video below to set up the project to build.


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

Ubuntu下构建PX4软件 的相关文章

  • Docker 不遵循构建目录中的符号链接

    我正在对一个应用程序进行 Docker 化 其中涉及通过 Clang 将二进制文件与其他 C 文件链接 我们维护二进制文件的符号链接版本 因为它们在整个代码库中使用 我的 Docker 构建目录包含整个代码库 包括源文件以及这些源文件的符号
  • SVN 不断提示我输入密码并拒绝缓存我的凭据

    环境 Eclipse Indigo Ubuntu 11 04 Subclipse 1 6 SVN 客户端 Subclipse RabbitVCS 我通过 svn ssh 连接 我的网址如下所示 svn ssh 我的名字 我的域名 路径 我可
  • Ubuntu 下使用 rpmbuild 构建

    我需要在 Ubuntu 10 4 下使用补丁构建 yum 原因是我需要为我的虚拟服务器实例提供支持 chroot 的 yum 由于 ubuntu 的 yum src 不可用 第 3 方存储库 我从官方存储库下载了源代码 并从 linux v
  • mongodb 无法在 ubuntu 18.04 上启动

    我在 Windows 10 上运行 ubuntu 18 04 我在 cli 上运行 mongod mongodb 正常启动 然后我尝试运行 mongo 并收到此错误 MongoDB shell version v4 0 2 connecti
  • PostgreSQL docker:“无法绑定 IPv6 套接字:无法分配请求的地址”

    编辑2 经过很长一段时间 解决了 请参阅下面的答案 编辑 我很遗憾地说 从昨天到今天 问题 自行 消失了 而我没有做任何事情 在这里学习很棒的非确定性课程 额外的乐趣 无法绑定 IPv6 套接字 错误仍然出现在错误日志中 因此这可能根本不是
  • gnutls_handshake() 失败:握手失败 GIT

    一切都工作正常 但突然我收到错误 致命 无法访问 https 电子邮件受保护 cdn cgi l email protection name repo name git gnutls handshake 失败 握手失败 我在我的计算机和 E
  • 如何解决 STS 启动时出现“无法找到用于堆栈映射生成的 Asm”错误?

    我正在尝试使用Spring工具套件3 8 3在 Ubuntu 16 04 上 启动后我收到此错误 期间发生内部错误 初始化 Java 工具 详细消息 在 初始化 Java 工具 期间发生内部错误 无法 找到用于堆栈图生成的 Asm 寻找 a
  • 分割 tar.bz2 文件并单独提取每个文件

    我可以将一个大的 tar bz2 文件分割成几个较小的文件并在 Ubuntu 中单独提取这些小 tar bz2 文件吗 Thanks 我认为这不容易实现 A tar bz2是单个流 它没有像这样的索引zip这将允许跳到存档中特定文件的开头
  • 如何在Linux中获取带有图标的活动应用程序

    我想找到一种方法获取活动应用程序的列表及其名称和图标 实际上 我正在使用此命令来获取所有活动进程 wmctrl lp 示例输出 0x03800002 0 3293 user notebook XdndCollectionWindowImp
  • 连接到远程 Docker 守护进程

    我已经安装了 VirtualBox 并在 VirtualBox VM 中安装了 Ubuntu 服务器版本 我的主机是Windows 10 我还在我的 Windows 主机上安装了 Docker 我的目的是使用 Windows 中的 dock
  • make找不到curses.h

    我有一个名为 samtools 版本 1 3 的程序 用于操作从 DNA 测序实验中获得的文件 下载的程序包含在一个文件夹中 为了设置程序 我在终端 在 ubuntu 计算机上 中输入该文件夹 我输入突击队 make 它运行并打印它所做的事
  • 环境变量未加载到 Nodejs 中的 process.env

    我正在构建一个nodejs api 并设置了dotenv打包为开发依赖项以将变量加载到process env在开发人员的本地计算机上 请注意 当我登录时 我使用sudo i作为root 我的目的是在部署过程中 环境变量将在我的 Ubuntu
  • 如何将其他语言添加到 TeX

    在 MediaWiki 中 如果您在公式中添加非英文文本 则会被剪切 例如 如果你写 text f b and 俄语 西里尔字母 符号 输出将是fb not f b 首先 如果您的 MediaWiki 版本低于 1 18 则打开文件 inc
  • Vim:无法让病原体加载包

    我在 Stackoverflow 和 github 等上阅读了有关此问题的其他五个问题 但一直无法解决这个问题 此时我完全迷失了 我使用的是 Ubuntu 11 10 和 Vim 7 3 这是我的 vimrc set nocp call p
  • 在菜单中显示 gtk.Calendar?

    我想构建一个上下文菜单 其中包含用于选择日期的菜单项 用例是在树视图中选择一堆项目 然后为所有项目设置新的截止日期 由于菜单项是 Gtk Bin 因此我可以指定任何小部件来代替标签 然而 我似乎无法interact与小部件 如果我单击菜单上
  • Mono 3.0、Ubuntu 12.10、Nginx 和 ServiceStack

    根据 ServiceStack 网站的说法 使用 Mono 在 Linux 上启动和运行 ServiceStack 应该很容易 我已经在系统 Ubuntu 12 10 上安装了 nginx mono 3 0 和 fastcgi 我用过thi
  • 在ubuntu中打开spyder

    我想在ubuntu中打开spyder Python IDE 通常我会在 shell 中编写 spyder 它会打开spyder IDE 现在 当我在shell中编写spyder时 它只是换行 什么也没有发生 类似于按 enter 我如何找回
  • Ubuntu + SVN:无法打开请求的 SVN 文件系统

    我知道这个问题已经被问过很多次了 我相信我明白答案 但我仍然没有运气 我都尝试过one repo and multiple repos配置 两者都有相同的问题 因此 对于我感兴趣的配置
  • 无法启动 MySQL 服务器 - 控制进程退出并出现错误代码

    我的 mysql 服务器停止后无法启动 命令使用 sudo etc init d mysql restart Error 重新启动 mysql 通过 systemctl mysql serviceJob for mysql service
  • 关键字“if”如何测试一个值是真还是假?

    在 bash 脚本中 if 1 then echo Yes else echo No fi Output Yes 它表示 1 被视为真值 但在代码中 word Linux letter nuxi if echo word grep q le

随机推荐

  • 让Editplus和SVN集成

    很多人用Editplus xff0c 但是修改了文件后 xff0c 需要切换到文件目录 xff0c 点击鼠标右键使用TortoiseSVN的提交菜单项来提交 xff0c 需要增加很多鼠标点击和确认的操作 xff0c 对于频繁修改的文件来说
  • 服务器是否支持断点续传

    通常情况下 xff0c Web服务器 如Apache 会默认开启对断点续传的支持 因此 xff0c 如果直接通过Web服务器来提供文件的下载 xff0c 可以不必做特别的配置 xff0c 即可享受到断点续传的好处 断点续传是在发起HTTP请
  • git-cola

    http git cola github io downloads html you can get a binary git cola https github com git cola git cola archive v2 3 tar
  • 北邮IT类就业攻略

    发信人 noobody everybody 信区 Job 标 题 北邮IT类就业攻略 发信站 北邮人论坛 Sun Sep 6 12 16 28 2009 站内 不久前发了那篇 盘点IT类就业方向 的文章 xff0c 感受到了师弟师妹们对找工
  • Android开发又将带来新一轮热潮,很多开发者都投入到这个浪潮中去了,创造了许许多多相当优秀的...

    Android开发又将带来新一轮热潮 xff0c 很多开发者都投入到这个浪潮中去了 xff0c 创造了许许多多相当优秀的 应用 其中也有许许多多的开发者提供了应用开源项 目 xff0c 贡献出他们的智慧和创造力 学习开源代码 是掌握技术的一
  • 关于Java加密扩展的出口限制

    近日 xff0c 在Matrix Security版上 http www matrix org cn thread shtml topicId 61 39543 amp forumId 61 55 提出一个问题 xff0c 即他的程序不能正
  • Win7 USB接口无法使用/驱动错误/该设备无法启动。(代码10) 故障解决方法

    电脑USB接口突然有一个不能用了 xff0c 开始以为是驱动问题 xff0c 可是用好几个驱动软件 xff08 驱动精灵 驱动人生等 xff09 更新驱动都无法解决 xff0c 后来发现在设备管理器里有一个设备驱动有问题 xff0c 尝试卸
  • Linux操作手册

    Linux操作手册 查看防火墙是否开启 systemctl status firewalld 开启防火墙 systemctl start firewalld 关闭防火墙 systemctl stop firewalld 查看所有开启的端口
  • 【转】实现电子词典要解决的技术问题及初步的解答

    转自 url http www blogjava net nokiaguy archive 2010 07 31 327623 html url quote 英文词典是手机中经常使用的应用 因此 xff0c 在本文将结合Android来讨论
  • 关于I2C和SPI总线协议

    关于I2C和SPI总线协议 IICvs SPI 现今 xff0c 在低端数字通信应用领域 xff0c 我们随处可见IIC Inter Integrated Circuit 和 SPI Serial Peripheral Interface
  • strchr()、strrchr()、strchrnul()函数

    原文链接 xff1a http blog sina com cn s blog 8b745a5f01017t8b html 头文件 xff1a include 函数原型 xff1a char strchr char str int c ch
  • 面向对象编程之分层思想

    分层 xff1a 就是为了忽略细节 xff0c 关注自己需要关注的地方 1 实体层 xff1a 分析模块所要设计的表 xff0c 确定表之间的关系 gt 编写hibernate Mapping 文件和持久化实体类 2 DAO层 xff1a
  • Linux_apt-get remove 与 apt-get autoremove、aptitude remove的不同

    apt get remove 与 apt get autoremove aptitude remove 的不同 apt get remove 的行为我们很好理解 xff0c 就是删除某个包的同时 xff0c 删除依赖于它的包 例如 xff1
  • 再见,2011

    2011 xff0c 又是匆匆的一年 悄然回首 xff0c 得到的 xff0c 失去的 xff0c 欢乐的 xff0c 酸楚的 xff0c 每天都在交错 即将过去的201一年注定不平凡的是一年 xff0c 是难忘的一年 xff0c 是蛋疼的
  • pptv web前端面试题答案

    这是星期一考完试 xff0c 答应星期三补上的 xff0c 代码很简单 xff0c 就不写注释了 php快排 function quickSort amp arr arr left 61 new array arr right 61 new
  • Android初级教程_在电脑上共享手机屏幕

    我们知道有的时候需要截取手机屏幕 可以通过豌豆荚 91助手等工具 第一这种方式在电脑上看到的手机屏幕比实际的要小 第二 需要安装此类软件 有时候该类软件和eclipse开发Android的时候可能冲突 连接不到adb 我们可以通过一下方式来
  • CMake 执行shell

    使用cmake时 xff0c 可以在cmakelist txt中如下执行shell 一 xff0c 方法1 set LOG 34 log txt 34 add custom command OUTPUT LOG COMMAND echo 3
  • 我对产品化的理解

    我对产品化的理解 产品化的时机是看业务的需要 xff0c 不管是对前景的落实 xff0c 还是项目转化成产品 xff0c 这些都不是技术人员能考虑的 xff0c 业务的发展和策划 xff0c 如何进行市场细化等如果都由技术人员考虑 xff0
  • PostMan中文设置

    第一 xff0c 打开postman所在文件的位置 查看自己的版本号 第二 xff0c 打开下面的链接找到对应的版本号下载 页面链接 xff1a https gitee com hlmd PostmanCn releases 下载好后回到p
  • Ubuntu下构建PX4软件

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