我用的飞控硬件板是pixhawk,用missionplanner刷的fight stack是apm的最新版本3.4。amp对mavros支持不是特别好,如果合适还是用px4的flight stack 比较好,没那么折腾。
在使用mavros之前,需要对飞控进行一些基本的设置,可以参考这位兄弟的文章:
http://blog.csdn.net/iracer/article/details/52718346
如果Mission Planner报 Bad gyro health,可能是usb口供电不足,接上电池就可以了。
使用mavros使用的接线示意图,连接电脑就用一个usb转串口模块接上就可以了。
接着在mission planner设置飞控的一些参数,如下:
下载mavros,并进行编译,将apm.launch里面的波特率改成921600,就可以启动了,我是将launch改了一下,添加了rviz,下面是我的apm_test.launch:
<launch>
<!-- vim: set ft=xml noet : -->
<!-- example launch script for ArduPilotMega based FCU's -->
<arg name="fcu_url" default="/dev/ttyUSB0:921600" />
<arg name="gcs_url" default="" />
<arg name="tgt_system" default="1" />
<arg name="tgt_component" default="1" />
<arg name="log_output" default="screen" />
<include file="$(find mavros)/launch/node.launch">
<arg name="pluginlists_yaml" value="$(find mavros)/launch/apm_pluginlists.yaml" />
<arg name="config_yaml" value="$(find mavros)/launch/apm_config.yaml" />
<arg name="fcu_url" value="$(arg fcu_url)" />
<arg name="gcs_url" value="$(arg gcs_url)" />
<arg name="tgt_system" value="$(arg tgt_system)" />
<arg name="tgt_component" value="$(arg tgt_component)" />
<arg name="log_output" value="$(arg log_output)" />
</include>
<node pkg="tf2_ros" type="static_transform_publisher" name="tf_world2fcu" args="0 0 0 0 0 0 fcu world" />
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find test_mavros)/launch/apm/apm_imu_test.rviz" required="True" />
</launch>
启动后,记得要用下面命令改一下飞控的广播频率,不然是收不到topic数据的。。
rosservice call /mavros/set_stream_rate 0 50 1
对于apm 固件,需要使用guided模式,因此需要有GPS信号才可以,有一些local_postion topic,是必须在有gps信号的时候才会有数据。
解锁命令:
rosrun mavros mavsafety arm
改飞控模式命令:
rosrun mavros mavsys mode -c GUIDED
记住下面的网址,有一些参考。
http://ardupilot.org/dev/docs/companion-computer-nvidia-tx1.html
https://erlerobotics.gitbooks.io/erlerobot/en/mavlink/ros/mavros.html
https://github.com/mavlink/mavros/issues/275
http://answers.ros.org/question/207097/how-to-send-velocity-to-pixhawk-with-mavros/
下面是mavros的作者,里面他回答了一些问题
http://answers.ros.org/users/10566/vooon/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)