pixhawk控制板的ArduPilot固件编译

0. 环境

- ubuntu18(依赖python2和pip,建议直接ubuntu18不用最新的)
- pixhawk 2.4.8
- pixhawk 4

1. 获取源码

# 安装git

sudo apt install git

# 获取源码

cd ~/work
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot
cd ardupilot


# 如果初次没顺利克隆子仓库,则:

git clone  https://github.com/ArduPilot/ardupilot
cd ardupilot
git submodule update --init --recursive

# 压缩源码备份

cd ~/work
7z a ardupilot_git_src_20240317.7z ardupilot


2. 安装依赖

$ ./Tools/environment_install/install-prereqs-ubuntu.sh
Install ArduPilot STM32 toolchain [N/y]?N

3. 安装交叉编译工具链


下载

https://firmware.ardupilot.org/Tools/STM32-tools/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2


可以到这里浏览版本:

https://firmware.ardupilot.org/Tools/STM32-tools/


解压

tar -xjvf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2


设置环境变量

export PATH=$PATH:/home/xxjianvm/work/gcc-arm-none-eabi-10-2020-q4-major/bin

4. 编译


# 设置环境变量

export PATH=$PATH:/home/xxjianvm/work/gcc-arm-none-eabi-10-2020-q4-major/bin
export PATH=$PATH:/home/xxjianvm/work/ardupilot/Tools/autotest
export PATH=/usr/lib/ccache:$PATH
source /home/xxjianvm/work/ardupilot/Tools/completion/completion.bash

# 配置

./waf list_boards
./waf configure --board fmuv3          # 3DR Pixhawk 2 boards
#./waf configure --board fmuv5          # Pixhawk 4

# 编译

./waf clean
#./waf rover
#./waf copter 

 

 

# 上传

./waf --targets bin/ardurover --upload

5. 问题集锦

问题:/usr/bin/python3: can't open file '/home/xxjianvm/work/ardupilot/modules/DroneCAN/dronecan_dsdlc/dronecan_dsdlc.py': [Errno 2] No such file or directory
分析:网络不好,浏览发现dronecan_dsdlc是空的
解决办法:把文件夹 dronecan_dsdlc 删除,再次执行 git submodule update --init --recursive

问题:dronecan_dsdlc.py: error: the following arguments are required: namespace_dir
分析:发现DroneCAN下的DSDL、libcanard又是空的

6. 参考


[Pixhawk] ardupilot源码windows编译教程,https://blog.csdn.net/Sandman06/article/details/115617932

Windows/Ubuntu操作系统下ArduPilot(APM)固件的编译方法,https://blog.csdn.net/oqqENvY12/article/details/60581036
ardupilot的编译过程,https://blog.csdn.net/u014220146/article/details/133068197
https://ardupilot.org/dev/docs/building-setup-linux.html#building-setup-linux
https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md
https://github.com/pixhawk/Hardware

  • 6
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值