Ubuntu安装Ardupilot以及编译SITL
- 安装git
sudo apt update
sudo apt install git
- 克隆Ardupilot仓库
git clone https://github.com/ArduPilot/ardupilot.git
*其中会遇到没有权限的问题,则需要登陆github生成一个ssh key
在终端输入ssh-keygen -t rsa -C “github 邮箱地址”,在.ssh文件目录里打开id_rsa.pub复制其内容并登陆github在setting中的ssh and gpg keys添加粘贴即可
(参考:https://blog.csdn.net/W_317/article/details/106518894 )
- 安装必要依赖项
sudo apt update
sudo apt install git python-matplotlib python-serial python-wxgtk3.0 python-wxtools python-lxml(或者sudo apt install git python3-matplotlib python3-serial python3-wxgtk4.0 python3-lxml)
sudo apt-get install dropbear
sudo apt-get install samba
sudo nano /etc/samba/smb.conf(将[home]中的read only改为no)
sudo apt-get install libpcap-dev //用于wifi monitor和injection
sudo apt-get install libsodium-dev //用于数据加密
sudo apt install python3-dev python3-opencv python3-pip python3-pexpect
- 安装MAVProxy:MAVProxy是一个用于无人机通信的控制台地面站,我们将使用它来连接到ArduPilot SITL。
sudo pip install MAVProxy
- 安装SITL依赖项:进入Ardupilot目录
cd /ardupilot/Tools/environment_install
./install-prereqs-ubuntu.sh -y
- 构建SITL:运行SITL的构建脚本来编译和安装SITL模拟器(建议执行前重启一次系统,部分环境变量不一定加载上,会出现已有该文件但是执行找不到的情况)
cd ardupilot
git submodule update --init --recursive
./waf configure --board sitl
./waf copter
- 设置环境变量:为了让MAVProxy知道SITL的位置,需要将PATH环境变量添加到ArduPilot的构建目录中。假设ArduPilot存储库位于~/ardupilot,运行以下命令:
export PATH=$PATH:$HOME/ardupilot/Tools/autotest
- 启动SITL
sim_vehicle.py -v ArduCopter --console
(参考:https://blog.csdn.net/lida2003/article/details/129763315?spm=1001.2014.3001.5506
https://blog.csdn.net/lida2003/article/details/129581472
,以总结步骤为准,参考博客会出现问题,总结的步骤整合了chatgpt3.5的回答)