前言
本教程基于 ROS2,在搭建之前,需要把 ROS2、QGC 等基础环境安装配置完成。
1. 准备
1.1 下载 PX4 源码
方式一:
从 Github 上下载。
sudo apt install git
下载并切换版本:
git clone https://github.com/PX4/PX4-Autopilot.git
mv PX4-Autopilot PX4_Firmware
cd PX4_Firmware
git checkout v1.14.0
更新子模块:
git submodule update --init --recursive
1.2 安装仿真依赖
sudo apt install ros-dev-tools
cd ~/PX4_Firmware/Tools/setup
修改文件并备份:如果觉得 python 包下载太慢,可以修改 pip 安装源。
chmod +x ubuntu.sh
./ubuntu.sh --no-nuttx --no-sim-tools
安装完成后,重启 Ubuntu
1.3 安装 Gazebo
Gazebo 是一款强大的 3D 仿真软件,主要用于机器人学的研究和开发。它提供了高度逼真的物理模拟环境,包括动力学、碰撞检测、传感器模型以及与真实世界相似的物理属性如重力、摩擦力等。Gazebo 可以模拟各种类型的机器人,从移动机器人、无人机到机械臂,甚至可以模拟整个城市环境。
根据说明,Gazebo 官方做了更新将之前的 Gazebo Ignition 命名为 Gazebo,以前的 Gazebo 现在叫 Gazebo Classic。Ubuntu 22.04 及以后的版本就支持 Gazebo (Gazebo Ignition)。
cd ~/PX4_Firmware/Tools/setup
./ubuntu.sh --no-nuttx
再运行一下 gazebo:
gz sim
成功后再重启 Ubuntu


