Ubuntu20.04+MAVROS+PX4+Gazebo安装教程

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

Ubuntu20.04+MAVROS+PX4+Gazebo

安装PX4步骤

从github上clone源码

git clone https://github.com/PX4/PX4-Autopilot.git --recursive

进入PX4-Autopilot文件夹继续下载未下载完的组件

cd PX4-Autopilot/
git submodule update --init --recursive

继续执行ubuntu.sh脚本

bash ./PX4-Autopilot/Tools/setup/ubuntu.sh

中间出错的话执行指令

python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow

如果过程中有安装失败的地方可以再用

bash ./PX4-Autopilot/Tools/setup/ubuntu.sh --fix-missing

更新一下完成后重启系统

测试一下
进入你下载的PX4-Autopilot文件夹内

make px4_sitl_default gazebo

终端输入 commander takeoff 可以看到无人机起飞
终端输入 commander land 可以看到无人机降落
在这里插入图片描述

添加环境变量针对Ubuntu20.04

source ~/PX4-Autopilot/Tools/simulation/gazebo-classic/setup_gazebo.bash ~/PX4-Autopilot ~/PX4-Autopilot/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4-Autopilot
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic

安装MAVROS

sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras

运行以下命令测试

roslaunch mavros px4.launch

如果出现以下报错
在这里插入图片描述则运行

sudo /opt/ros/kinetic/lib/mavros/install_geographiclib_datasets.sh

安装QGC

参考网站https://docs.qgroundcontrol.com/master/en/getting_started/download_and_install.html

PX4仿真

添加完环境变量后可以通过以下命令进行PX4仿真

roslaunch px4 mavros_posix_sitl.launch

该launch文件会启动gazebo、mavros、px4.launch等
在这里插入图片描述
查看mavros话题

rostopic list

在这里插入图片描述

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: Ubuntu