概述
这里我们选择Ubuntu-22.04系统配置开发环境。
- 官方帮助文档
Setting up a Developer Environment (Toolchain) | PX4 Guide (main)
Windows Development Environment (WSL2-Based) | PX4 Guide (main)
- 如果官方网站不好打开,可以试试如下镜像网站:
https://px-4.com/v1.14/en/
安装编译工具
进入PX4项目目录后,运行官方提供的脚本进行自动化配置:
cd PX4-Autopilot
bash ./Tools/setup/ubuntu.sh
如果遇到问题:module 'em' has no attribute 'RAW_OPT',那么改变下empy的版本
$ pip uninstall empy $ pip install empy==3.3.2
启动gazebo仿真
运行如下命令启动gazebo仿真:
cd /path/to/PX4-Autopilot
make px4_sitl gz_x500
仿真支持多种机型,对应的编译命令如下:
Vehicle | Command | PX4_SYS_AUTOSTART |
---|---|---|
Quadrotor(x500) | make px4_sitl gz_x500 | 4001 |
Quadrotor(x500) with Depth Camera | make px4_sitl gz_x500_depth |