PX4无人机安装问题及解决方案

1. git clone

1) git clone fatal error

一开始尝试了这个解决方案发现可以clone了但是很慢后面直接又fatal error,然后就把校园网关掉,改成连接手机热点即可



2) PX4源码下载很慢

  1. 参考文章https://blog.csdn.net/qq_43212651/article/details/116193397
    本来是要使用以下命令的
git clone https://github.com/PX4/Firmware.git --recursive

可以将其分成

git clone https://github.com/PX4/Firmware.git
cd Firmware
git submodule update --init --recursive

git submodule update --init --recursive出错将--init去掉,使用命令git submodule update --recursive即可

  1. 还可以使用码云加速,然后修改.gitmodules文件,具体步骤参考https://blog.csdn.net/qq_44939973/article/details/120965458
git clone https://gitee.com/robin_shaun/PX4_Firmware
cd PX4_Firmware
git checkout -b xtdrone/dev v1.11.0-beta1
bash ./Tools/setup/ubuntu.sh --no-nuttx --no-sim-tools

我在git clone https://gitee.com/robin_shaun/PX4_Firmware时,出现了fatal: repository 'https://xxx/xxx.git/' not found,后面把https的s去掉就可以,但是后面git submodule update --init --recursive的时候又出现了这种类型的错误(我的不是这个,这个是在网上找到的一种类型的错误),看别人给的解决方法是我写的上一个方法。

error: Server does not allow request for unadvertised object 5be5d61e5e5a93911256b5f2106e50da0ca81e8d
Fetched in submodule path 'squashfs-tools', but it did not contain 5be5d61e5e5a93911256b5f2106e50da0ca81e8d. Direct fetching of that commit failed.

后面发现是我之前配置过全局配置,git config --global url."https://gitclone.com/".insteadOf https://,将全局配置删除即可直接git clone https://gitee.com/robin_shaun/PX4_Firmware,具体操作参考博客



2.ROS安装

1) 设置密钥

官网上的命令为

sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

直接执行第二条命令会报错gpg: 找不到有效的 OpenPGP 数据
解决方法为,第二条命令中,将其拆分为

curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

这里参考了https://blog.csdn.net/wiborgite/article/details/52840371



2)E: 无法定位软件包 ros-melodic-desktop-full

这里找了很多个解决方案,换源什么的都不行,后面发现有人安装的是ros-melodic,有人安装的是ros-noetic,然后搜了一下才发现melodic—对应ubuntu 18.04,noetic —对应ubuntu20.04,各位根据对应的Ubuntu版本下载对应的版本

sudo apt install ros-melodic-desktop-full
sudo apt install ros-noetic-desktop-full


3) sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential未满足的依赖关系

我是因为没有创建catkin_ws文件夹,创建了再运行命令就没报错,一开始用aptitude安装这些包就直接把我的melodic删除了。
报错如下:

下列软件包有未满足的依赖关系:
 python3-rosdep : 依赖: python3-catkin-pkg 但是它将不会被安装
                  依赖: python3-rosdistro 但是它将不会被安装
                  依赖: python3-rospkg 但是它将不会被安装
                  依赖: python3-rosdep-modules (>= 0.21.0) 但是它将不会被安装
 python3-rosinstall : 依赖: python3-rosdistro (>= 0.3.0) 但是它将不会被安装
                      依赖: python3-catkin-pkg 但是它将不会被安装
 python3-rosinstall-generator : 依赖: python3-catkin-pkg (>= 0.1.28) 但是它将不会被安装
                                依赖: python3-rosdistro (>= 0.7.3) 但是它将不会被安装
                                依赖: python3-rospkg 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

创建catkin_ws文件夹:

mkdir -p ~/catkin_ws/src
mkdir -p ~/catkin_ws/scripts
cd catkin_ws/src 
catkin_init_workspace
cd .. 
catkin_make


4) rosdep update超时

https://blog.csdn.net/weixin_44023934/article/details/121242176



3. mavros安装

1) 正在连接 raw.githubusercontent.com,无法建立 SSL 连接

注意:用我的方法第一次成功了,后面想重新尝试命令时又不成功(我也不知道为啥)

用命令wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh时报了如下错误:正在连接 raw.githubusercontent.com,无法建立 SSL 连接,用了网上的方法查找raw.githubusercontent.com的ip地址再将其放入/etc/hosts里面,发现没用

我hosts里面的内容是这样的(按照教程修改后):

127.0.0.1	localhost
127.0.1.1	xw-virtual-machine
20.205.243.166   github.com
199.96.59.19   github.global.ssl.fastly.net

199.232.28.133 raw.githubusercontent.com
151.101.228.133 raw.github.com

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我把151.101.228.133 raw.github.com注释掉后,发现权限不够

--2022-03-22 20:52:46--  https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
正在解析主机 raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133
正在连接 raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度: 1244 (1.2K) [text/plain]
install_geographiclib_datasets.sh: 权限不够

无法写入 “install_geographiclib_datasets.sh” (成功)

加上sudo后又报错无法建立 SSL 连接,后面把https改成http再在最后加上--no-check-certificate后成功了

sudo wget http://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh --no-check-certificate

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值