推荐使用当前版本或stable及release版本;
要clone当前最新(debug)并且下载submodules:
git clone git@github.com:PX4/PX4-Autopilot.git --recursive
更推荐的做法是,使用release的分支:
git clone --branch release/1.13 git@github.com:PX4/PX4-Autopilot.git --recursive
branch后加的分支还可以是v1.13.3等。经测试,release/1.13
可以正常运行。
之后运行配置脚本:
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
但是这个sh配置文件可能在别的版本中不在这个位置,需要查找。
之后make
make px4_sitl gazebo
成功则继续,失败则回去继续。
之后是向路径中添加
source /opt/ros/noetic/setup.bash
source ~/catkin_ws/devel/setup.bash
source ~/PX4-Autopilot/Tools/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/sitl_gazebo
根据实际情况配置;
之后再打开终端,会弹出下列消息:
GAZEBO_PLUGIN_PATH :/home/hazyparker/PX4-Autopilot/build/px4_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/hazyparker/PX4-Autopilot/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/hazyparker/catkin_ws/devel/lib:/opt/ros/noetic/lib:/opt/ros/noetic/lib/x86_64-linux-gnu:/home/hazyparker/PX4-Autopilot/build/px4_sitl_default/build_gazebo
就基本成功,这些是setup_gazebo.bash中echo
出来的,强迫症可以注释掉。