Linux系统ubuntu20.04 无人机PX4 开发环境搭建(失败率很低)

PX4固件下载

PX4的源码处于GitHub,因为众所周知的原因git clone经常失败,此处从Gitee获取PX4源码和依赖模块。

复制代码
git clone https://gitee.com/voima/PX4-Autopilot.git

正克隆到 'PX4-Autopilot'...

remote: Enumerating objects: 454209, done.

remote: Total 454209 (delta 0), reused 0 (delta 0), pack-reused 454209

接收对象中: 100% (454209/454209), 215.48 MiB | 2.32 MiB/s, 完成.

处理 delta 中: 100% (334699/334699), 完成.

使用cd命令切换到 px4项目文件目录:

复制代码
cd ~/PX4-Autopilot

使用以下命令切换版本,以V1.14.0为例:

复制代码
git checkout v1.14.0 #切换到1.14.0分支,当然也可以尝试其他版本

因为PX4的完整项目是嵌套子模块存储的,以上命令只下载了px4的基本代码,所以我们要进行子模块的下载,运行下列命令:

复制代码
git submodule update --init --recursive # 在~/PX4-Autopilot目录下执行

以上命令中,submodule是子模块的意思, ---init 选项会初始化,并注册子模块的地址,---recursive选项会递归克隆子模块。

此更新的链接来源于

~/PX4-Autopilot/.gitmodules(注意是隐藏文件)

将文件打开,粘贴到下面,可以看到里面都github的地址,直接用上面的命令,会很难成功

复制代码
[submodule "src/modules/mavlink/mavlink"]    path = src/modules/mavlink/mavlink    url = https://github.com/mavlink/mavlink.git    branch = master[submodule "src/drivers/uavcan/libuavcan"]    path = src/drivers/uavcan/libuavcan    url = https://github.com/dronecan/libuavcan.git    branch = main[submodule "Tools/simulation/jmavsim/jMAVSim"]    path = Tools/simulation/jmavsim/jMAVSim    url = https://github.com/PX4/jMAVSim.git    branch = main[submodule "Tools/simulation/gazebo-classic/sitl_gazebo-classic"]    path = Tools/simulation/gazebo-classic/sitl_gazebo-classic    url = https://github.com/PX4/PX4-SITL_gazebo-classic.git    branch = main[submodule "src/drivers/gps/devices"]    path = src/drivers/gps/devices    url = https://github.com/PX4/PX4-GPSDrivers.git    branch = main[submodule "platforms/nuttx/NuttX/nuttx"]    path = platforms/nuttx/NuttX/nuttx    url = https://github.com/PX4/NuttX.git    branch = px4_firmware_nuttx-10.3.0+-v1.14[submodule "platforms/nuttx/NuttX/apps"]    path = platforms/nuttx/NuttX/apps    url = https://github.com/PX4/NuttX-apps.git    branch = px4_firmware_nuttx-10.3.0+[submodule "Tools/flightgear_bridge"]    path = Tools/simulation/flightgear/flightgear_bridge    url = https://github.com/PX4/PX4-FlightGear-Bridge.git[submodule "Tools/simulation/jsbsim/jsbsim_bridge"]    path = Tools/simulation/jsbsim/jsbsim_bridge    url = https://github.com/PX4/px4-jsbsim-bridge.git[submodule "src/drivers/cyphal/libcanard"]    path = src/drivers/cyphal/libcanard    url = https://github.com/opencyphal/libcanard.git[submodule "src/drivers/cyphal/public_regulated_data_types"]    path = src/drivers/cyphal/public_regulated_data_types    url = https://github.com/opencyphal/public_regulated_data_types.git[submodule "src/drivers/cyphal/legacy_data_types"]    path = src/drivers/cyphal/legacy_data_types    url = https://github.com/PX4/public_regulated_data_types.git    branch = legacy[submodule "src/lib/crypto/monocypher"]    path = src/lib/crypto/monocypher    url = https://github.com/PX4/Monocypher.git    branch = px4[submodule "src/lib/events/libevents"]    path = src/lib/events/libevents    url = https://github.com/mavlink/libevents.git    branch = main[submodule "src/lib/crypto/libtomcrypt"]    path = src/lib/crypto/libtomcrypt    url = https://github.com/PX4/libtomcrypt.git    branch = px4[submodule "src/lib/crypto/libtommath"]    path = src/lib/crypto/libtommath    url = https://github.com/PX4/libtommath.git    branch = px4[submodule "src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client"]    path = src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client    url = https://github.com/PX4/Micro-XRCE-DDS-Client.git    branch = px4

将其更新为 gitee 的地址,已经整理测试好了,直接替换掉文件的内容即可

​​​​​​​

复制代码
[submodule "src/modules/mavlink/mavlink"]    path = src/modules/mavlink/mavlink    url = https://gitee.com/wtp95/mavlink.git    branch = master[submodule "Tools/flightgear_bridge"]    path = Tools/simulation/flightgear/flightgear_bridge    url = https://gitee.com/seokhb/PX4-FlightGear-Bridge.git[submodule "Tools/simulation/gazebo-classic/sitl_gazebo-classic"]    path = Tools/simulation/gazebo-classic/sitl_gazebo-classic    url = https://gitee.com/seokhb/PX4-SITL_gazebo-classic.git    branch = main[submodule "Tools/simulation/jmavsim/jMAVSim"]    path = Tools/simulation/jmavsim/jMAVSim    url = https://gitee.com/seokhb/jMAVSim.git    branch = main[submodule "Tools/simulation/jsbsim/jsbsim_bridge"]    path = Tools/simulation/jsbsim/jsbsim_bridge    url = https://gitee.com/seokhb/px4-jsbsim-bridge.git[submodule "platforms/nuttx/NuttX/apps"]    path = platforms/nuttx/NuttX/apps    url = https://gitee.com/seokhb/NuttX-apps.git    branch = px4_firmware_nuttx-10.3.0+[submodule "platforms/nuttx/NuttX/nuttx"]    path = platforms/nuttx/NuttX/nuttx    url = https://gitee.com/seokhb/NuttX.git    branch = px4_firmware_nuttx-10.3.0+-v1.14[submodule "src/drivers/cyphal/public_regulated_data_types"]    path = src/drivers/cyphal/public_regulated_data_types    url = https://gitee.com/seokhb/public_regulated_data_types.git[submodule "src/drivers/cyphal/legacy_data_types"]    path = src/drivers/cyphal/legacy_data_types    url = https://gitee.com/jiyuanwangxs/legacy_data_types.git    branch = legacy[submodule "src/drivers/cyphal/libcanard"]    path = src/drivers/cyphal/libcanard    url = https://gitee.com/seokhb/libcanard.git[submodule "src/drivers/gps/devices"]    path = src/drivers/gps/devices    url = https://gitee.com/seokhb/PX4-GPSDrivers.git    branch = main[submodule "src/drivers/uavcan/libuavcan"]    path = src/drivers/uavcan/libuavcan    url = https://gitee.com/seokhb/libuavcan.git[submodule "src/lib/crypto/libtomcrypt"]    path = src/lib/crypto/libtomcrypt    url = https://gitee.com/seokhb/libtomcrypt.git    branch = px4[submodule "src/lib/crypto/libtommath"]    path = src/lib/crypto/libtommath    url = https://gitee.com/seokhb/libtommath.git    branch = px4[submodule "src/lib/crypto/monocypher"]    path = src/lib/crypto/monocypher    url = https://gitee.com/seokhb/Monocypher.git    branch = px4[submodule "src/lib/events/libevents"]    path = src/lib/events/libevents    url = https://gitee.com/seokhb/libevents.git    branch = main[submodule "src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client"]    path = src/modules/uxrce_dds_client/Micro-XRCE-DDS-Client    url = https://gitee.com/seokhb/Micro-XRCE-DDS-Client.git    branch = px4

然后执行下面的命令,就可以

复制代码
git submodule update --init --recursive

有的子模块还是走的github,失败了就多试几次,直到用上面命令不再下载东西了就可以了

点击Linux系统ubuntu20.04 无人机PX4 开发环境搭建(失败率很低)可查看全文

相关推荐
Adorable老犀牛9 小时前
可遇不可求的自动化运维工具 | 2 | 实施阶段一:基础准备
运维·git·vscode·python·node.js·自动化
华纳云IDC服务商9 小时前
Linux服务器的系统安全强化超详细教程
linux·服务器·系统安全
衍余未了9 小时前
k8s镜像推送到阿里云,使用ctr推送镜像到阿里云
linux·运维·服务器
yiqiqukanhaiba9 小时前
Linux编程笔记1-概念&数据类型&输入输出
linux·运维·服务器
乌萨奇也要立志学C++9 小时前
【Linux】进程概念(一):从冯诺依曼体系到 PCB 的进程核心解析
linux·运维·服务器
JAVA数据结构10 小时前
Linux 运维常用命令详解
linux
huangyuchi.10 小时前
【Linux系统】初见线程,概念与控制
linux·运维·服务器·页表·linux线程概念·linux线程控制·分页式存储管理
葡萄城技术团队10 小时前
SpreadJS:让多源数据筛选排序如 Excel 般便捷高效
运维·服务器·excel
宇钶宇夕10 小时前
S7-200 SMART 实战:自动包装控制系统的指令应用拆解
运维·自动化
MacroZheng10 小时前
堪称一站式管理平台,同时支持Linux、MySQL、Redis、MongoDB可视化管理!
java·linux·后端