PX4 Gazebo 安装运行教程

http://docs.px4.io/master/en/simulation/ros_interface.html

前提

此方法无论是否已经安装过ROS都适用,放心食用。

安装环境

下载脚本
wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim_ros_melodic.sh

运行脚本
bash ubuntu_sim_ros_melodic.sh

运行完之后会在目录生成一个catkin_ws工作空间,包含了mavlinkmavros,建议使用apt的方法安装这两个功能包,因此这个工作空间是多余的可以删去。

安装mavros
sudo apt install ros-melodic-mavros ros-melodic-mavros-extras

下载PX4固件

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

若克隆过慢可挂终端代理或者使用fastgit

运行仿真

cd ~/PX4/PX4-Autopilot
DONT_RUN=1 make px4_sitl_default gazebo # 这个编译需要一会
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
roslaunch px4 posix_sitl.launch

强制解锁
pxh> commander arm -f

切换offboard模式
pxh> commander mode offboard

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值