[px4仿真]单独启动编译和Gazebo仿真器

This article shows how to starting Gazebo and PX4 separately
按照官方教程并没有成功。中文教程和英文教程都有错误,应该如下

cd src/Firmware
make posix_sitl_default
source ~/catkin_ws/devel/setup.bash    // (只有mavros是用源码编译的才需要)
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build_posix_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
roslaunch px4 mavros_posix_sitl.launch

如此还是有问题,运行offb offb_node会显示
MODE: Unsupported FCU
折腾了好久才解决问题
需要打开src/Firmware/launch/mavros_posix_sitl.launch(如需使用其他launch文件修改方法类似)
将这一行:

"fcu_url" default="udp://:14540@localhost:14557"/>

改成:

"fcu_url" default="udp://:[email protected]:14557"/>

参考资料:https://discuss.ardupilot.org/t/problem-calling-ros-service-for-arducopter-ros-sitl-tutorial/18992

你可能感兴趣的:([px4仿真]单独启动编译和Gazebo仿真器)