首页 > 其他分享 >PX4安装和编译遇到一些坑

PX4安装和编译遇到一些坑

时间:2023-02-23 20:33:23浏览次数:49  
标签:shaun submodule com gitee 编译 https path PX4 安装

最近由于实验需要,又得安装px4和gazebo,特此记录一些遇到的bug和解决方法,希望能帮助其他uu。

1下载

一般的安装步骤如下(不建议完全按下面命令执行):

点击查看代码
git clone https://github.com/PX4/PX4-Autopilot.git
mv PX4-Autopilot PX4_Firmware
cd PX4_Firmware
git checkout -b xtdrone/dev v1.11.0-beta1
#到这一步git submodule一般就因为网络原因总是出错了
git submodule update --init --recursive
make px4_sitl_default gazebo
由于需要在GitHub下载代码,而国内访问受限,可能会出现一些问题,这里建议使用github国内镜像,当然下面会给出具体解决方案。

更新工程子模块git submodule update --init --recursive

若该步骤出错,归根到底还是因为github访问不稳定。
解决方案如下:
方案的总体原则就是改变源码里面各个.gitmodules文件里的下载地址,需要注意的是源码位置,我这里是将源码放在主文件夹下,也就是~/PX4_Firmware,后面的代码是我借鉴其他博客的,所以PX4_Firmware还是PX4_Autopilot根据你的px4改没改名决定

(1)源码主文件夹下

cd ~/PX4_Autopilot
gedit .gitmodules
(注意:这里主要是为了修改文件,我用的是gedit编辑器,也可以用vim, nano,vs code之类的,后面相同)
将 .gitmodules 中的内容更换为:

点击查看代码
#注意这里的格式不对,你只需改一下url的内容就行,大概就是让你通过gitee下载而不是github下载,解决网络不稳定问题
[submodule "mavlink/include/mavlink/v2.0"]path = mavlink/include/mavlink/v2.0url = https://gitee.com/robin_shaun/c_library_v2.gitbranch = master
[submodule "src/drivers/uavcan/libuavcan"]path = src/drivers/uavcan/libuavcanurl = https://gitee.com/robin_shaun/uavcan.gitbranch = px4
[submodule "Tools/jMAVSim"]path = Tools/jMAVSimurl = https://gitee.com/robin_shaun/jMAVSim.gitbranch = master
[submodule "Tools/sitl_gazebo"]path = Tools/sitl_gazebourl = https://gitee.com/robin_shaun/sitl_gazebo.gitbranch = master
[submodule "src/lib/matrix"]path = src/lib/matrixurl = https://gitee.com/robin_shaun/Matrix.gitbranch = master
[submodule "src/lib/ecl"]path = src/lib/eclurl = https://gitee.com/robin_shaun/ecl.gitbranch = master
[submodule "boards/atlflight/cmake_hexagon"]path = boards/atlflight/cmake_hexagonurl = https://gitee.com/robin_shaun/cmake_hexagon.gitbranch = px4
[submodule "src/drivers/gps/devices"]path = src/drivers/gps/devicesurl = https://gitee.com/robin_shaun/GpsDrivers.gitbranch = master
[submodule "src/modules/micrortps_bridge/micro-CDR"]path = src/modules/micrortps_bridge/micro-CDRurl = https://gitee.com/robin_shaun/micro-CDR.gitbranch = px4
[submodule "platforms/nuttx/NuttX/nuttx"]path = platforms/nuttx/NuttX/nuttxurl = https://gitee.com/robin_shaun/NuttX.gitbranch = px4_firmware_nuttx-9.1.0+
[submodule "platforms/nuttx/NuttX/apps"]path = platforms/nuttx/NuttX/appsurl = https://gitee.com/robin_shaun/NuttX-apps.gitbranch = px4_firmware_nuttx-9.1.0+
[submodule "platforms/qurt/dspal"]path = platforms/qurt/dspalurl = https://gitee.com/robin_shaun/dspal.git
[submodule "Tools/flightgear_bridge"]path = Tools/flightgear_bridgeurl = https://gitee.com/robin_shaun/PX4-FlightGear-Bridge.gitbranch = master 
[submodule "Tools/jsbsim_bridge"]path = Tools/jsbsim_bridgeurl = https://gitee.com/robin_shaun/px4-jsbsim-bridge.git
[submodule "src/examples/gyro_fft/CMSIS_5"]path = src/examples/gyro_fft/CMSIS_5url = https://gitee.com/mirrors/CMSIS_5
git submodule update --init

(2) libuavcan文件夹

cd ~/PX4_Autopilot/src/drivers/uavcan/libuavcan
gedit .gitmodules
将 .gitmodules 中的内容更换为:

点击查看代码
#同上,只需改url,下面都一样
[submodule "dsdl"]path = dsdlurl = https://gitee.com/robin_shaun/dsdlbranch = legacy-v0
[submodule "libuavcan/dsdl_compiler/pyuavcan"]path = libuavcan/dsdl_compiler/pyuavcanurl = https://gitee.com/robin_shaun/pyuavcan
[submodule "libuavcan_drivers/kinetis"]path = libuavcan_drivers/kinetisurl = https://gitee.com/robin_shaun/libuavcan_kinetis.git
git submodule update --init

(3) jMAVSim文件夹

cd ~/PX4_Autopilot/Tools/jMAVSim
gedit .gitmodules
将 .gitmodules 中的内容更换为:

点击查看代码
[submodule "jMAVlib"]path = jMAVliburl = https://gitee.com/robin_shaun/jMAVlibbranch = master
git submodule update --init

(4) sitl_gazebo文件夹

cd ~/PX4_Autopilot/Tools/sitl_gazebo
gedit .gitmodules
将 .gitmodules 中的内容更换为:

点击查看代码
[submodule "external/OpticalFlow"]path = external/OpticalFlowurl = https://gitee.com/robin_shaun/OpticalFlow
git submodule update --init

(5) dspal文件夹

cd ~/PX4_Autopilot/platforms/qurt/dspal
gedit .gitmodules
将 .gitmodules 中的内容更换为:

点击查看代码
[submodule "cmake_hexagon"]path = cmake_hexagonurl = https://gitee.com/robin_shaun/cmake_hexagon
git submodule update --init

(6) pyuavcan文件夹

cd ~/PX4_Autopilot/src/drivers/uavcan/libuavcan/libuavcan/dsdl_compiler/pyuavcan
gedit .gitmodules
将 .gitmodules 中的内容更换为:

点击查看代码
[submodule "dsdl"]path = dsdlurl = https://gitee.com/robin_shaun/dsdl
git submodule update --init

(7) OpticalFlow文件夹

cd ~/PX4_Autopilot/Tools/sitl_gazebo/external/OpticalFlow
gedit .gitmodules
将 .gitmodules 中的内容更换为:

点击查看代码
[submodule "external/klt_feature_tracker"]path = external/klt_feature_trackerurl = https://gitee.com/robin_shaun/klt_feature_tracker
git submodule update --init

(8)终于修改完了,可以再次运行下这句命令

cd ~/PX4_Autopilot
git submodule update --init --recursive

编译

/usr/bin/ld: 找不到 -lpthreads

这个我一开始按照网上下载apt-file,update,最后apt-file search pthread根本没用,还有apt-get install libxxx.dev也没用,我的解决办法如下

点击查看代码
#找到thread.so的动态库位置
vinson@vinson-XPS-8940:~/PX4_Firmware$ ldconfig -p|grep pthread
	libpthread.so.0 (libc6,x86-64, OS ABI: Linux 3.2.0) => /lib/x86_64-linux-gnu/libpthread.so.0
	libpthread.so.0 (libc6, OS ABI: Linux 3.2.0) => /lib/i386-linux-gnu/libpthread.so.0
	libpthread.so.0 (libc6, OS ABI: Linux 3.2.0) => /lib32/libpthread.so.0

sudo cp /lib/x86_64-linux-gnu/libpthread.so.0 /usr/lib
这样操作之后还是不太行,但出现了新问题

image
在如下的文件进行修改,在文件在Tools/sitl_gazebo/下

image
然后make px4_sitl_default gazebo成功(如果怕之前编译过影响后面结果可以先make clean)
总之过程艰难曲折,希望大家都能顺利装好!

参考博客:
https://www.ngui.cc/article/show-456981.html
https://blog.csdn.net/weixin_42319496/article/details/119371292
https://blog.csdn.net/qq_42412225/article/details/123582777

标签:shaun,submodule,com,gitee,编译,https,path,PX4,安装
From: https://www.cnblogs.com/zlszls3113373723/p/17149307.html

相关文章

  • 离线安装python第三方库
    有些公司,特别是一些大公司,对于网络安全这一块非常重视。上班用的电脑,系统都是公司标装系统,访问外网有很多限制,甚至只允许访问内网环境,不允许直接访问外网环境。这就导致我......
  • SQLite-安装,环境变量添加
    今后的Android编程中将使用SQLite,于是乎我们先要把它安装上。SQLite是什么?SQLite是一个进程内的库,实现了自给自足的、无服务器的、零配置的、事务性的SQL数据库引擎。......
  • 05. Kubernetes - 集群安装(二进制)
    安装准备区别于使用kubeadm部署集群时所有核心组件都托管在集群上。二进制安装则采用守护进程的方式直接将各个组件运行在宿主机,生产环境更为推荐。服务还是那些,只需要......
  • 【小白】FileZilla Window安装并连接 Centos7
    本文是小白教程 通过 FileZilla来实现 windows系统到Centos7 服务器的文件传输。FTP概述文件传输协议(FileTransferProtocol,FTP)是用于在网络上进行文......
  • linux安装8125B网卡驱动
    机器的系统是CentOS7,网卡是Realtek的2.5G网卡RTL8125B。1.下载驱动Realtek瑞昱官网:https://www.realtek.com/zh/下载链接:https://www.realtek.com/zh/component/zoo/c......
  • linux(centos)下安装.net6 环境
    添加仓储指令rpm-Uvhhttps://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm执⾏安装命令:1、如果不需要在linux上编译源码yuminstall dotnet......
  • Unbuntu源码下载编译nginx1.22.1
    下载nginx1.22.1源码nginx1.22.1使用ftp工具将下载的.tar.gz压缩包上传到服务器上。tar-zxvfnginx-1.22.1.tar.gz解压得到一个nginx-1.22.1文件夹。编译&安装官方......
  • MongoDB 6.0.4 安装记录
    须知:版本号x.y.z,看y:偶数版为稳定版,奇数版为开发版(1)下载zip,解压1https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-6.0.4.zip建立data文件夹,与bin同......
  • 安装 conda 后的部分问题解决方案
    WindowsPowerShell无法使用Conda虚拟环境Anaconda和Miniconda均适用。打开环境变量,选中用户变量(或者系统变量也可以)中的Path,点击编辑。将如下conda安......
  • Parallels Desktop 17 安装教程附下载地址
    1、首先安装ParallelsDesktop17,双击打开下载的ParallelsDesktop17dmg安装文件,双击“安装ParallelsDesktop.app”2、弹出提示“安装ParallelsDesktop.app”是......