ArduPilot飞控之ubuntu22.04-SITL安装

ArduPilot飞控之ubuntu22.04-SITL安装

  • 1. 源由
  • 2. SITL编译
    • 2.1 准备ubuntu 22.04环境
    • 2.2 更新ubuntu 22.04环境
    • 2.3 克隆最新Ardupilot代码
    • 2.4 submodule同步Ardupilot代码
    • 2.5 Ardupilot-SITL编译准备
    • 2.6 Ardupilot-SITL环境参数
    • 2.7 Ardupilot-SITL编译
  • 3. SITL运行
    • 3.1 第一次SITL运行
    • 3.2 正常启动SITL模拟器
    • 3.3 Mission Planner连接
  • 4. 参考资料

1. 源由

在没有任何硬件的情况下,SITL模拟运行Plane、Copter或Rover。提供了一个本地可执行文件(ArduCopter or ArduPlane Desktop Executable, elf),允许在没有硬件的情况下测试代码的行为。

该方法比较适合熟悉ardupilot系统,也便于研发人员验证软件算法方面的控制逻辑。

ArduPilot飞控之ubuntu22.04-SITL安装_第1张图片

2. SITL编译

2.1 准备ubuntu 22.04环境

参考ubuntu22.04@laptop安装。

$ uname -r
5.15.76-051576-generic
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

2.2 更新ubuntu 22.04环境

$ sudo apt-get update

$ sudo apt-get upgrade

$ sudo apt-get install git gitk git-gui

2.3 克隆最新Ardupilot代码

$ git clone [email protected]:ArduPilot/ardupilot.git

$ git checkout Copter-4.3

$ git log -n 1
commit c33653cd4ebec780d6961c0bcbd42a38c787fb28 (HEAD -> Copter-4.3, origin/Copter-4.3)
Author: bugobliterator <[email protected]>
Date:   Sat Mar 18 09:04:26 2023 +1100

    bootloaders: add CubeOrangePlus-bdshot bootloader

2.4 submodule同步Ardupilot代码

$ cd ardupilot

$ git submodule update --init --recursive

2.5 Ardupilot-SITL编译准备

$ Tools/environment_install/install-prereqs-ubuntu.sh -y

2.6 Ardupilot-SITL环境参数

$ pwd
/home/daniel/Work/ardupilot

$ export PATH=$PATH:<ardupilot path>/Tools/autotest
$ export PATH=/usr/lib/ccache:$PATH

$ . ~/.profile

2.7 Ardupilot-SITL编译

如果之前工程有过编译或者编译缺少组件导致失败,可以用以下命令对工程进行清理。

$ ./waf clean

配置SITL目标

$ ./waf configure --board sitl           # software-in-the-loop simulator
or
$ ./waf configure --board sitl --debug   # software-in-the-loop simulator with debug symbols

编译SITL目标

$ ./waf

3. SITL运行

3.1 第一次SITL运行

第一次运行时,应该使用-w选项擦除虚拟EEPROM,加载正确的默认参数。

$ sim_vehicle.py -w -v ArduCopter

3.2 正常启动SITL模拟器

加载默认参数后,可以正常启动模拟器。

$ sim_vehicle.py --console --map -v ArduCopter
or
$ sim_vehicle.py --console --map -v ArduCopter --custom-location=30.3051391,120.1556749,8.71000003814697,90

注: Ctrl-C停止模拟器运行。

3.3 Mission Planner连接

  1. 使用--no-mavproxy启动模拟器
$ sim_vehicle.py --console --map -v ArduCopter --custom-location=30.3051391,120.1556749,8.71000003814697,90 --no-mavproxy

  1. 使用TCP 5760端口连接



    后续Mission Planner上的操作,详见:ArduPilot飞控之Mission Planner模拟

4. 参考资料

【1】Setting up SITL on Linux
【2】ArduPilot飞控之Mission Planner模拟
【3】ubuntu22.04@laptop安装&配置wfb-ng
【4】ArduPilot飞控之Mission Planner模拟

你可能感兴趣的:(ArduPilot,git,ubuntu,bash)