Ubuntu18.04 PX4编译仿真

PX4编译

make px4_fmu-v5_default
make px4_fmu-v3_default
make px4_fmu-v2_default
make px4_fmu-v2_default upload

make px4fmu-v2_default

下载
make px4_fmu-v2_default upload

仿真环境

make px4_sitl_default
make px4_sitl jmavsim
make px4_sitl gazebo
make px4_sitl_default gazebo
make px4_sitl gazebo_typhoon_h480	// 加载其他模型

make posix_sitl_default
make posix jmavsim
make posix gazebo

命令行飞机控制指令
解锁
> commander arm
起飞
> commander takeoff
降落
> commander land

编译gazebo

cd Firmware/Tools/sitl_gazebo
mkdir Build
cd Build
cmake ..
make

环境变量设置

source /opt/ros/melodic/setup.bash
source ~/mavros_ws/devel/setup.bash
export FIRMWARE_DIR=/home/zxc/Firmware
export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}:$FIRMWARE_DIR/Tools/sitl_gazebo/Build
source $FIRMWARE_DIR/Tools/setup_gazebo.bash $FIRMWARE_DIR $FIRMWARE_DIR/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$FIRMWARE_DIR
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$FIRMWARE_DIR/Tools/sitl_gazebo

仿真
编译和环境变量设置均没有问题,gazebo可以正常启动
roslaunch px4 mavros_posix_sitl.launch

建议参考
https://blog.csdn.net/qq_43414059/article/details/104643794

posted @ 2021-06-29 20:01  thomas_blog  阅读(384)  评论(0编辑  收藏  举报