当前位置: 代码迷 >> 综合 >> MAVROS(1)offboard模式(手动和roslaunch启动)
  详细解决方案

MAVROS(1)offboard模式(手动和roslaunch启动)

热度:50   发布时间:2023-12-06 16:04:18.0

 官方教程:https://docs.px4.io/master/en/ros/mavros_offboard.html

 1 编写功能包 

参考:https://blog.csdn.net/weixin_44917390/article/details/106339339

一定要把可执行文件放到~/src/offboard目录下

2 测试

手动启动

1. 打开Gazebo

make px4_sitl gazebo

2. 运行MAVROS节点

roslaunch mavros px4.launch fcu_url:=udp://:14540@localhost:14557

3. 运行外部控制例程

rosrun offb_ctrl offb_ctrl_node

从launch文件启动

1. 修改.bashrc文件,添加以下内容(注意路径匹配

source ~/PX4-Autopilot/Tools/setup_gazebo.bash ~/tools/PX4-Autopilot/ ~/tools/PX4-Autopilot/build/px4_sitl_defaultexport ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/tools/PX4-Autopilot
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/tools/PX4-Autopilot/Tools/sitl_gazebo

 2. 启动launch文件

roslaunch px4 mavros_posix_sitl.launch

3. 运行外部控制例程

rosrun offb_ctrl offb_ctrl_node