Ubuntu下建立PX4飞控固件编译环境
参考链接:https://docs.px4.io/main/en/dev_setup/dev_env_linux_ubuntu.html一、提升各种依赖包下载速度的预操作
1、Ubuntu软件包安装加速
# 更新包列表
sudo apt update
# 更新已安装的包
sudo apt upgrade2、python包安装加速
# 安装pip(python的包管理工具)
sudo apt install python3-pip
# 将pip更换为国内源(在线安装python包时,下载速度从kB到MB的秘诀)
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple二、下载PX4源代码
# 克隆源代码
git clone https://github.com/PX4/PX4-Autopilot.git
# 进入刚下载的代码的目录
cd PX4-Autopilot
# 查看所有稳定版tag
git tag
# 切换到当前最新的稳定版tag
# 注意,其版本号变化是v1.9 -> v1.10,也就是说v1.15.1会比v1.9.2新的多
git checkout -b My_v1.15.3 v1.15.3
# 更新子模块
git submodule update --init --recursive三、运行自动化脚本以安装编译工具链
# 进入刚下载的代码的目录
cd PX4-Autopilot
# 运行脚本
bash ./Tools/setup/ubuntu.sh
# 重启电脑!!!使得部分设置生效
# 重启电脑!!!使得部分设置生效
# 重启电脑!!!使得部分设置生效四、编译固件
# 进入源代码根目录
cd PX4-Autopilot
# 列出所有支持的飞控硬件的名字
make list_config_targets
# 编译fmu-v5硬件用的固件
make px4_fmu-v5_default
# 烧录入硬件中
make px4_fmu-v5_default upload
报错处理
1、/usr/bin/python3: Error while finding module specification for ‘symforce.symbolic’ (ModuleNotFoundError: No module named ‘symforce’)
原因:缺少名为“symforce”的python包,使用如下命令解决
pip3 install symforce -i https://pypi.tuna.tsinghua.edu.cn/simple
2、其他各种报错
# 更新子模块
git submodule update --init --recursive
# 清理编译产生的文件
make distclean
# 如果还不行,重启电脑试试,刚建立编译环境后立即编译,会提示缺arm-gcc,重启电脑可以解决
页:
[1]